Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How do I make my GetCasesButton_Click work?

How do I make my GetCasesButton_Click work?

Scheduled Pinned Locked Moved ASP.NET
questionhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 11369001
    wrote on last edited by
    #1

    The code below is from a desktop app that uses forms. I was asked to create a new web app to replace old desktop client app. How can I change the following code to work in web app which does not have forms instead has aspx? Please help.

    private async void GetCasesButton_Click(object sender, EventArgs e)
    {
    if (CaseNumbersTextBox.Text.Length < 1)
    {
    MessageBox.Show("Casenumber textbox cannot be empty.", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    return;
    }
    ComboboxItem requestorItem = new ComboboxItem();
    requestorItem = (ComboboxItem)RequestorComboBox.SelectedItem;
    ComboboxItem reasonItem = new ComboboxItem();
    reasonItem = (ComboboxItem)ReasonComboBox.SelectedItem;
    if (requestorItem.Value < 1)
    {
    MessageBox.Show("Please select a Requestor.", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    return;
    }
    if (reasonItem.Value < 1)
    {
    MessageBox.Show("Please select a Reason.", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    return;
    }
    string userEnteredCaseNumbers = CaseNumbersTextBox.Text;
    userEnteredCaseNumbers = userEnteredCaseNumbers.Replace("\r", ",");
    userEnteredCaseNumbers = userEnteredCaseNumbers.Replace("\n", ",");
    while (userEnteredCaseNumbers.Contains(",,"))
    userEnteredCaseNumbers = userEnteredCaseNumbers.Replace(",,", ",");
    List userEnteredCaseNumberList = new List();
    userEnteredCaseNumberList = userEnteredCaseNumbers.Split(',').Where(x => x.Length > 0).ToList();
    userEnteredCaseNumberList = userEnteredCaseNumberList.Select(s => s.Trim()).ToList();
    try
    {
    int newBatchNumber = await CandidateCaseController.GetNextBatchNumber();
    foreach (string caseNumber in userEnteredCaseNumberList)
    {
    EditCandidateCaseModel newCandidate = new EditCandidateCaseModel();
    newCandidate.CaseNbr = caseNumber;
    newCandidate.RequestorInfoID = requestorItem.Value;
    newCandidate.ReasonID = reasonItem.Value;
    newCandidate.BatchNumber = newBatchNumber;
    newCandidate.EntryStaffUserName = this._loggedInUser

    Z 1 Reply Last reply
    0
    • U User 11369001

      The code below is from a desktop app that uses forms. I was asked to create a new web app to replace old desktop client app. How can I change the following code to work in web app which does not have forms instead has aspx? Please help.

      private async void GetCasesButton_Click(object sender, EventArgs e)
      {
      if (CaseNumbersTextBox.Text.Length < 1)
      {
      MessageBox.Show("Casenumber textbox cannot be empty.", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
      return;
      }
      ComboboxItem requestorItem = new ComboboxItem();
      requestorItem = (ComboboxItem)RequestorComboBox.SelectedItem;
      ComboboxItem reasonItem = new ComboboxItem();
      reasonItem = (ComboboxItem)ReasonComboBox.SelectedItem;
      if (requestorItem.Value < 1)
      {
      MessageBox.Show("Please select a Requestor.", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
      return;
      }
      if (reasonItem.Value < 1)
      {
      MessageBox.Show("Please select a Reason.", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
      return;
      }
      string userEnteredCaseNumbers = CaseNumbersTextBox.Text;
      userEnteredCaseNumbers = userEnteredCaseNumbers.Replace("\r", ",");
      userEnteredCaseNumbers = userEnteredCaseNumbers.Replace("\n", ",");
      while (userEnteredCaseNumbers.Contains(",,"))
      userEnteredCaseNumbers = userEnteredCaseNumbers.Replace(",,", ",");
      List userEnteredCaseNumberList = new List();
      userEnteredCaseNumberList = userEnteredCaseNumbers.Split(',').Where(x => x.Length > 0).ToList();
      userEnteredCaseNumberList = userEnteredCaseNumberList.Select(s => s.Trim()).ToList();
      try
      {
      int newBatchNumber = await CandidateCaseController.GetNextBatchNumber();
      foreach (string caseNumber in userEnteredCaseNumberList)
      {
      EditCandidateCaseModel newCandidate = new EditCandidateCaseModel();
      newCandidate.CaseNbr = caseNumber;
      newCandidate.RequestorInfoID = requestorItem.Value;
      newCandidate.ReasonID = reasonItem.Value;
      newCandidate.BatchNumber = newBatchNumber;
      newCandidate.EntryStaffUserName = this._loggedInUser

      Z Offline
      Z Offline
      ZurdoDev
      wrote on last edited by
      #2

      No one is going to rewrite all of your code for you and quite frankly, it's very rude for you to ask us to. Converting desktop app to web app is not a trivial task. Step 1. Learn the basics of web development. How and where code runs can be very different than desktop development. Step 2. Rewrite the code. Figure out what the code does and then rewrite it for the web.

      Social Media - A platform that makes it easier for the crazies to find each other. Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

      U 1 Reply Last reply
      0
      • Z ZurdoDev

        No one is going to rewrite all of your code for you and quite frankly, it's very rude for you to ask us to. Converting desktop app to web app is not a trivial task. Step 1. Learn the basics of web development. How and where code runs can be very different than desktop development. Step 2. Rewrite the code. Figure out what the code does and then rewrite it for the web.

        Social Media - A platform that makes it easier for the crazies to find each other. Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

        U Offline
        U Offline
        User 11369001
        wrote on last edited by
        #3

        ZurdoDev, I was not asking you or anyone to wrote the code for me. Maybe my question could have been rewritten to make more sense. I am working on the app and I will be asking simpler questions as I get stuck. I made a mistake and seems you are offended. That was not my intention to offend you and other or to be rude. Moving forward, I will post better questions. Everyone makes mistakes. I am sure you might agree with me. Accept my sincere apology.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups