Click here to Skip to main content
14,451,737 members
   

ASP.NET

 
GeneralRe: How do you have a DropDownList populated without default selected item? Pin
ZurdoDev9-Jan-20 8:59
mveZurdoDev9-Jan-20 8:59 
GeneralRe: How do you have a DropDownList populated without default selected item? Pin
Mycroft Holmes9-Jan-20 11:14
MemberMycroft Holmes9-Jan-20 11:14 
QuestionHow to I make EmailButton_Click work? Pin
Member 114033048-Jan-20 5:59
MemberMember 114033048-Jan-20 5:59 
AnswerRe: How to I make EmailButton_Click work? Pin
ZurdoDev8-Jan-20 6:21
mveZurdoDev8-Jan-20 6:21 
AnswerRe: How to I make EmailButton_Click work? Pin
F-ES Sitecore8-Jan-20 6:45
mveF-ES Sitecore8-Jan-20 6:45 
GeneralRe: How to I make EmailButton_Click work? Pin
Member 114033048-Jan-20 12:16
MemberMember 114033048-Jan-20 12:16 
GeneralRe: How to I make EmailButton_Click work? Pin
F-ES Sitecore8-Jan-20 23:11
mveF-ES Sitecore8-Jan-20 23:11 
QuestionHow do I make my GetCasesButton_Click work? Pin
Member 114033048-Jan-20 5:46
MemberMember 114033048-Jan-20 5: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 6:19
mveZurdoDev8-Jan-20 6:19 
GeneralRe: How do I make my GetCasesButton_Click work? Pin
Member 114033048-Jan-20 8:56
MemberMember 114033048-Jan-20 8:56 
QuestionHow do I make my GetCasesButton_Click work? Pin
Member 114033048-Jan-20 5:33
MemberMember 114033048-Jan-20 5:33 
AnswerRe: How do I make my GetCasesButton_Click work? Pin
ZurdoDev8-Jan-20 6:18
mveZurdoDev8-Jan-20 6:18 
QuestionText with Audio Pin
Member 104440587-Jan-20 22:19
MemberMember 104440587-Jan-20 22:19 
AnswerRe: Text with Audio Pin
ZurdoDev8-Jan-20 1:57
mveZurdoDev8-Jan-20 1:57 
GeneralRe: Text with Audio Pin
Member 104440588-Jan-20 20:47
MemberMember 104440588-Jan-20 20:47 
QuestionName of the software that can package websites to install on smartphones: android and iphone ? Pin
Member 24584677-Jan-20 18:34
MemberMember 24584677-Jan-20 18:34 
GeneralRe: Name of the software that can package websites to install on smartphones: android and iphone ? Pin
Richard MacCutchan7-Jan-20 22:21
communityengineerRichard MacCutchan7-Jan-20 22:21 
GeneralRe: Name of the software that can package websites to install on smartphones: android and iphone ? Pin
Member 24584679-Jan-20 20:44
MemberMember 24584679-Jan-20 20:44 
GeneralRe: Name of the software that can package websites to install on smartphones: android and iphone ? Pin
Richard MacCutchan10-Jan-20 0:08
communityengineerRichard MacCutchan10-Jan-20 0:08 
QuestionScrape with htmlagilityapck question Pin
Member 17532506-Jan-20 13:10
MemberMember 17532506-Jan-20 13:10 
SuggestionRe: Scrape with htmlagilityapck question Pin
ZurdoDev7-Jan-20 10:04
mveZurdoDev7-Jan-20 10:04 
GeneralRe: Scrape with htmlagilityapck question Pin
Member 17532507-Jan-20 10:57
MemberMember 17532507-Jan-20 10:57 
QuestionRe: Scrape with htmlagilityapck question Pin
ZurdoDev11-Jan-20 9:55
mveZurdoDev11-Jan-20 9:55 
AnswerRe: Scrape with htmlagilityapck question Pin
Member 175325011-Jan-20 10:36
MemberMember 175325011-Jan-20 10:36 
QuestionAssigning data from sql database to a chart C# and entity framework Pin
Member 146959565-Jan-20 23:07
MemberMember 146959565-Jan-20 23: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.