Click here to Skip to main content
15,886,801 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How do you have a DropDownList populated without default selected item? Pin
ZurdoDev9-Jan-20 7:59
professionalZurdoDev9-Jan-20 7:59 
GeneralRe: How do you have a DropDownList populated without default selected item? Pin
Mycroft Holmes9-Jan-20 10:14
professionalMycroft Holmes9-Jan-20 10:14 
QuestionHow to I make EmailButton_Click work? Pin
Member 114033048-Jan-20 4:59
Member 114033048-Jan-20 4:59 
AnswerRe: How to I make EmailButton_Click work? Pin
ZurdoDev8-Jan-20 5:21
professionalZurdoDev8-Jan-20 5:21 
AnswerRe: How to I make EmailButton_Click work? Pin
F-ES Sitecore8-Jan-20 5:45
professionalF-ES Sitecore8-Jan-20 5:45 
GeneralRe: How to I make EmailButton_Click work? Pin
Member 114033048-Jan-20 11:16
Member 114033048-Jan-20 11:16 
GeneralRe: How to I make EmailButton_Click work? Pin
F-ES Sitecore8-Jan-20 22:11
professionalF-ES Sitecore8-Jan-20 22:11 
QuestionHow do I make my GetCasesButton_Click work? Pin
Member 114033048-Jan-20 4:46
Member 114033048-Jan-20 4:46 
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<string> userEnteredCaseNumberList = new List<string>();
           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._loggedInUserName;
                   await CandidateCaseController.PostCandidate(newCandidate);
               }
               List<GetCandidateCaseModel> candidateList = await CandidateCaseController.GetAllCandidates();
               candidateList = candidateList.Where(x => x.BatchNumber == newBatchNumber).ToList();
               string candidateCasesString = string.Empty;
               Regex rgxDash = new Regex("[^a-zA-Z0-9 ,]");
               candidateCasesString = string.Join(",", candidateList.Select(p => p.CaseNbr.ToString()));
               candidateCasesString = rgxDash.Replace(candidateCasesString, "").ToString();
               //Get MNCIS info on cases candidateCasesString
               List<string> smallEnoughStrings = new List<string>();
               while (candidateCasesString.Length > 0)
               {
                   int sendLength = 200;
                   bool isLastString = false;
                   if (candidateCasesString.Length < sendLength)
                   {
                       sendLength = candidateCasesString.Length;
                       isLastString = true;
                   }
                   string smallChunk = candidateCasesString.Substring(0, sendLength);
                   if (!isLastString)
                   {
                       int lastComma = smallChunk.LastIndexOf(',');
                       smallChunk = smallChunk.Substring(0, lastComma);
                       candidateCasesString = candidateCasesString.Remove(0, lastComma);
                       if (candidateCasesString[0] == ',')
                           candidateCasesString = candidateCasesString.Remove(0, 1);
                   }
                   else
                       candidateCasesString = candidateCasesString.Remove(0, sendLength);
                   smallEnoughStrings.Add(smallChunk);
               }
               List<AcceptCaseNumbersModel> mncisDetailList = new List<AcceptCaseNumbersModel>();
               List<AcceptCaseNumbersModel> smallEnoughMncisDetailList = new List<AcceptCaseNumbersModel>();
               foreach (string smallEnoughString in smallEnoughStrings)
               {
                   smallEnoughMncisDetailList = await FTACaseReset.Controllers.JusticeController.GetAllAcceptCaseNumbers(smallEnoughString);
                   mncisDetailList.AddRange(smallEnoughMncisDetailList);
               }
               //Parse data from MNCIS and add it to Candidate table
               //use candidateList to pull records out of mncisDetailList then update CandidateCase table
               foreach (GetCandidateCaseModel candidateCase in candidateList)
               {
                   string caseNbrWODash = rgxDash.Replace(candidateCase.CaseNbr, "").ToString();
                   AcceptCaseNumbersModel mncisDetail = mncisDetailList.Where(x => x.CaseNbrSrch.ToLower() == caseNbrWODash.ToLower()).FirstOrDefault();
                   if (mncisDetail != null)
                   {
                       //if it found a mncis record then edit Candidate details with MNCIS data
                       candidateCase.FirstPenalty = mncisDetail.FirstPenaltyFlag == 1 ? true : false;
                       candidateCase.SecondPenalty = mncisDetail.SecondPenaltyFlag == 1 ? true : false;
                       if (candidateCase.CaseNbr.ToLower().Contains("vb") == false)
                           candidateCase.RejectionReason = await FTACaseReset.Controllers.RejectionController.GetRejectionByDescription(Enumerations.Rejections.No_Records_To_Reset.ToString().Replace("_", " "));
                       else if (candidateCase.FirstPenalty == false && candidateCase.SecondPenalty == false)
                           candidateCase.RejectionReason = await FTACaseReset.Controllers.RejectionController.GetRejectionByDescription(Enumerations.Rejections.No_Records_To_Reset.ToString().Replace("_", " "));
                       if (candidateCase.RejectionReason == null)
                           candidateCase.RejectionReason = await FTACaseReset.Controllers.RejectionController.GetRejectionByDescription(Enumerations.Rejections.Valid.ToString());
                       candidateCase.Title = mncisDetail.Style;
                       await FTACaseReset.Controllers.CandidateCaseController.PutCandidate(candidateCase);
                   }
                   else
                   {
                       //if it didn't find a mncis record then change the rejection code on the Candidate
                       candidateCase.RejectionReason = await FTACaseReset.Controllers.RejectionController.GetRejectionByDescription(Enumerations.Rejections.Invalid_Case_Number.ToString().Replace("_", " "));
                       await FTACaseReset.Controllers.CandidateCaseController.PutCandidate(candidateCase);
                   }
               }
               GetCasesProgressBar.PerformStep();
               this.ClearForm();
               //Populate Results
               ValidTabPage.Controls.Clear();
               InvalidTabPage.Controls.Clear();
               ValidTabPage.Text = "Valid Cases";
               InvalidTabPage.Text = "Invalid Cases";
               //Repopulate Batch ComboBox
               this.PopulateBatchComboBox();
               List<GetCandidateCaseModel> thisBatchCasesList = new List<GetCandidateCaseModel>();
               thisBatchCasesList = await Controllers.CandidateCaseController.GetCandidateByBatchID(newBatchNumber);
               if (thisBatchCasesList.Count > 0)
                   this.EmailButton.Enabled = true;
               else
               {
                   this.EmailButton.Enabled = false;
                   return;
               }
               this.PopulateTabs(thisBatchCasesList, true);
               this.GetCasesPanel.Visible = false;
               this.UpdateExistingPanel.Visible = true;
               ComboboxItem batchItem = new ComboboxItem(thisBatchCasesList[0].BatchNumber);
               SelectBatch(batchItem);
               ComboboxItem requestorUpdateItem = new ComboboxItem(thisBatchCasesList[0].RequestorInfo);
               SelectRequestorUpdate(requestorUpdateItem);
               ComboboxItem reasonUpdateItem = new ComboboxItem(thisBatchCasesList[0].Reason);
               SelectReasonUpdate(reasonUpdateItem);
           }
           catch (Exception ex)
           {
               string errorMsg = string.Format("An error has occured in {0}. \nException:\n{1}", "GetCasesButton_Click()", ex.Message);
               MessageBox.Show(errorMsg, "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
           }
       }

AnswerRe: How do I make my GetCasesButton_Click work? Pin
ZurdoDev8-Jan-20 5:19
professionalZurdoDev8-Jan-20 5:19 
GeneralRe: How do I make my GetCasesButton_Click work? Pin
Member 114033048-Jan-20 7:56
Member 114033048-Jan-20 7:56 
QuestionHow do I make my GetCasesButton_Click work? Pin
Member 114033048-Jan-20 4:33
Member 114033048-Jan-20 4:33 
AnswerRe: How do I make my GetCasesButton_Click work? Pin
ZurdoDev8-Jan-20 5:18
professionalZurdoDev8-Jan-20 5:18 
QuestionText with Audio Pin
Member 104440587-Jan-20 21:19
Member 104440587-Jan-20 21:19 
AnswerRe: Text with Audio Pin
ZurdoDev8-Jan-20 0:57
professionalZurdoDev8-Jan-20 0:57 
GeneralRe: Text with Audio Pin
Member 104440588-Jan-20 19:47
Member 104440588-Jan-20 19:47 
QuestionName of the software that can package websites to install on smartphones: android and iphone ? Pin
Member 24584677-Jan-20 17:34
Member 24584677-Jan-20 17:34 
GeneralRe: Name of the software that can package websites to install on smartphones: android and iphone ? Pin
Richard MacCutchan7-Jan-20 21:21
mveRichard MacCutchan7-Jan-20 21:21 
GeneralRe: Name of the software that can package websites to install on smartphones: android and iphone ? Pin
Member 24584679-Jan-20 19:44
Member 24584679-Jan-20 19:44 
GeneralRe: Name of the software that can package websites to install on smartphones: android and iphone ? Pin
Richard MacCutchan9-Jan-20 23:08
mveRichard MacCutchan9-Jan-20 23:08 
QuestionScrape with htmlagilityapck question Pin
Member 17532506-Jan-20 12:10
Member 17532506-Jan-20 12:10 
SuggestionRe: Scrape with htmlagilityapck question Pin
ZurdoDev7-Jan-20 9:04
professionalZurdoDev7-Jan-20 9:04 
GeneralRe: Scrape with htmlagilityapck question Pin
Member 17532507-Jan-20 9:57
Member 17532507-Jan-20 9:57 
QuestionRe: Scrape with htmlagilityapck question Pin
ZurdoDev11-Jan-20 8:55
professionalZurdoDev11-Jan-20 8:55 
AnswerRe: Scrape with htmlagilityapck question Pin
Member 175325011-Jan-20 9:36
Member 175325011-Jan-20 9:36 
QuestionAssigning data from sql database to a chart C# and entity framework Pin
Member 146959565-Jan-20 22:07
Member 146959565-Jan-20 22:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.