private void createListsBTN_Click(object sender, EventArgs e) { disableUI(); List <State> missingListChecks = new List <State>() { State.FILE_PATH_EMPTY, State.FILE_PATH_NOT_FOUND }; List <State> logFileChecks = new List <State>() { State.FILE_PATH_EMPTY, State.FILE_PATH_NOT_FOUND }; List <State> folderChecks = new List <State>() { State.FOLDER_PATH_EMPTY, State.FOLDER_PATH_NOT_FOUND, State.FOLDER_HAS_NO_PDFS, State.BAD_FILE_NAME }; State missingListState = StateChecks.performStateChecks(missingListChecks, missingListPathField.Text); State logFileState = StateChecks.performStateChecks(logFileChecks, logFilePathField.Text); State folderState = StateChecks.performStateChecks(folderChecks, folderPathField.Text); if (missingListState != State.READY) { StateChecks.showErrorMessage(missingListState, missingListPathField.Text); } else if (logFileState != State.READY) { StateChecks.showErrorMessage(logFileState, logFilePathField.Text); } else if (folderState != State.READY) { StateChecks.showErrorMessage(folderState, folderPathField.Text); } else { List <Dictionary <string, string> > tdnnList = new List <Dictionary <string, string> >(); List <Dictionary <string, string> > vdList = new List <Dictionary <string, string> >(); string dos_mmddyyyy = null; LogReportOnDemand.ParseLogReportOnDemand(ref tdnnList, ref vdList, ref dos_mmddyyyy, "CT", logFilePathField.Text, folderPathField.Text); // load each missing list section into a sublist struct // subListIDs here should be only log codes we want to send to coding List <string> subListIDs = new List <string>() { "ME", "NN", "PM", "SG", "TD", "WR" }; List <SubList> subLists = MissingList.createSubLists(subListIDs, missingListPathField.Text); // loop through all files in folder and handle stragglers and BAD files List <Dictionary <string, string> > stragglerList = new List <Dictionary <string, string> >(); List <string> nnList = new List <string>(); foreach (string absolute_file_path in Directory.EnumerateFiles(folderPathField.Text, "*.pdf")) { string fileName = Path.GetFileNameWithoutExtension(absolute_file_path); if (fileName.Contains("BAD")) { string dest = DONT_NEEDS + fileName + ".pdf"; copyToDontNeeds(absolute_file_path, dest); string sanitizedName = getSanitizedName(fileName); nnList.Add(sanitizedName); } else { // go through each sub list // if it is found, add patient info struct to straggler list foreach (SubList subList in subLists) { if (subList.patientInfo.ContainsKey(fileName)) { stragglerList.Add(subList.patientInfo[fileName]); } } } } List <Dictionary <string, string> > sortedStragglerList = stragglerList.OrderBy(x => x["chartNum"]) .ThenBy(x => Convert.ToDateTime(x["date"])) .ToList <Dictionary <string, string> >(); bool accountability_list_created = AccountabilityLists.CreateAccountabilityLists(tdnnList, vdList, stragglerList, "CT", dos_mmddyyyy, folderPathField.Text); if (accountability_list_created) { missingTotalLabel.Text = "Missing Total: " + tdnnList.Count; int voidedChartsNotMissing = 0; foreach (var patientInfo in vdList) { if (patientInfo["missing"] != "-") { voidedChartsNotMissing++; } } voidedTotalLabel.Text = "Voided Total: " + vdList.Count + " (" + voidedChartsNotMissing + ")"; stragglersTotalLabel.Text = "Straggler Total: " + stragglerList.Count; } else { MessageBox.Show("The accountability list could not be created.\n\n" + "Either try again or create this list manually."); } removeNNFromMissingList(tdnnList, nnList); createUIPathList(tdnnList, stragglerList, nnList); MessageBox.Show("Lists created!!"); } enableUI(); }
private void createListsBTN_Click(object sender, EventArgs e) { disableUI(); List <State> missingListChecks = new List <State>() { State.FILE_PATH_EMPTY, State.FILE_PATH_NOT_FOUND }; List <State> logFileChecks = new List <State>() { State.FILE_PATH_EMPTY, State.FILE_PATH_NOT_FOUND }; List <State> folderChecks = new List <State>() { State.FOLDER_PATH_EMPTY, State.FOLDER_PATH_NOT_FOUND }; State missingListState = StateChecks.performStateChecks(missingListChecks, missingListPathField.Text); State logFileState = StateChecks.performStateChecks(logFileChecks, logFilePathField.Text); State folderState = StateChecks.performStateChecks(folderChecks, saveFileToPathField.Text); if (missingListState != State.READY) { StateChecks.showErrorMessage(missingListState, missingListPathField.Text); } else if (logFileState != State.READY) { StateChecks.showErrorMessage(logFileState, logFilePathField.Text); } else if (folderState != State.READY) { StateChecks.showErrorMessage(folderState, saveFileToPathField.Text); } else { List <Dictionary <string, string> > tdList = new List <Dictionary <string, string> >(); List <Dictionary <string, string> > vdList = new List <Dictionary <string, string> >(); string dos_mmddyyyy = null; LogReportOnDemand.ParseLogReportOnDemand(ref tdList, ref vdList, ref dos_mmddyyyy, "GV", logFilePathField.Text, null); List <string> subListIDs = new List <string>() { "ME", "PM", "SG", "TD", "WR" }; List <SubList> subLists = MissingList.createSubLists(subListIDs, missingListPathField.Text); List <Dictionary <string, string> > stragglerList = createStragglerList(subLists); bool accountability_list_created = AccountabilityLists.CreateAccountabilityLists(tdList, vdList, stragglerList, "GV", dos_mmddyyyy, saveFileToPathField.Text); if (accountability_list_created) { // missing list file to be used in UiPath if (stragglerList.Count > 0) { createTextFile(stragglerList); } // output number on each list missingTotalLabel.Text = "Missing Total: " + tdList.Count; voidedTotalLabel.Text = "Voided Total: " + vdList.Count; stragglersTotalLabel.Text = "Straggler Total: " + stragglerList.Count; MessageBox.Show("Lists created!!"); } else { MessageBox.Show("An error occurred so the lists were not created and the missing list was not updated. Try again."); } } enableUI(); }