How do I make my GetCasesButton_Click work?
-
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 -
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._loggedInUserNo 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.
-
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.
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.