private static void DetermineResolvedChecks(List <Check> checks, string disposition, List <Check> researchChecks) { int i = 0; int checkCount = checks.Count; foreach (Check check in checks) { List <Check> matchedChecks = researchChecks.FindAll(c => c.Num == check.Num || c.Num == -check.Num); // Normally, matchedChecks.Count() == 0 or matchedChecks.Count == 1 // But in the case of a birth certificate, a single check number may cover // multiple children. In this case matchedChecks.Count() > 1. // The foreach loop below creates a new resolved check for each matched check. // This means that if one check number is used by a parent and his/her children, // then there will be a resolved check for the parent and each child. if (matchedChecks.Count() != 0) { foreach (Check matchedCheck in matchedChecks) { bool protectedCheck = IsProtectedCheck(matchedCheck.Disposition); // string disposition = (type.Equals("ImportMe") ? check.Disposition : type); if (!protectedCheck) { DataManager.NewResolvedCheck(matchedCheck, disposition); } /* Operation Recovery code * if (type.Equals("ImportMe")) * { * // DataManager.RecoverLostChecks(check, researchChecks); * } */ } } // Slow down the merging a little bit so we can see the progress bar Thread.Sleep(100); i += 1; ProgressHub.SendProgress("Merge in progress...", i, checkCount); /* * else // PLB 1/11/2019 * { * // Operation Recovery indavertently erased some level 2 checks (LBVD2, TID2, etc.) * // This code restores the lost check numbers and adds the erased checks as nameless * // checks in the Research Table. The lost checks are entered through the Operation Recovery - Dec 2018 * // entry on the Merge screen. * DataManager.AppendResearchCheck(check); * DataManager.NewResolvedCheck(check, check.Disposition); * } */ } }
private static void RestoreRChecksTable(List <CheckViewModel> rChecks) { using (OpidDB opidcontext = new OpidDB()) { var checks = opidcontext.RChecks; int checkCount = rChecks.Count; int i = 0; if (checks.Count() == 0) // Is the table empty for rebuild? { foreach (CheckViewModel rc in rChecks) { checks.Add(new RCheck { RecordID = rc.RecordID, sRecordID = rc.sRecordID, InterviewRecordID = rc.InterviewRecordID, sInterviewRecordID = rc.sInterviewRecordID, Num = rc.Num, sNum = rc.sNum, Name = rc.Name, Date = Convert.ToDateTime(rc.Date), sDate = Convert.ToDateTime(rc.Date).ToString("MM/dd/yyyy"), Service = rc.Service, Disposition = rc.Disposition }); i += 1; ProgressHub.SendProgress("Restore in progress...", i, checkCount); } opidcontext.SaveChanges(); return; } } }
private static List <Check> DetermineResearchChecks(List <DispositionRow> researchRows) { int i = 0; int checkCount = researchRows.Count; foreach (DispositionRow row in researchRows) { if (row.LBVDCheckNum != 0) { NewResearchCheck(row, "LBVD", row.LBVDCheckDisposition); } if (row.LBVDCheckNum2 != 0) { NewResearchCheck(row, "LBVD2", row.LBVDCheck2Disposition); } if (row.LBVDCheckNum3 != 0) { NewResearchCheck(row, "LBVD3", row.LBVDCheck3Disposition); } if (row.TIDCheckNum != 0) { NewResearchCheck(row, "TID", row.TIDCheckDisposition); } if (row.TIDCheckNum2 != 0) { NewResearchCheck(row, "TID2", row.TIDCheck2Disposition); } if (row.TIDCheckNum3 != 0) { NewResearchCheck(row, "TID3", row.TIDCheck3Disposition); } if (row.TDLCheckNum != 0) { NewResearchCheck(row, "TDL", row.TDLCheckDisposition); } if (row.TDLCheckNum2 != 0) { NewResearchCheck(row, "TDL2", row.TDLCheck2Disposition); } if (row.TDLCheckNum3 != 0) { NewResearchCheck(row, "TDL3", row.TDLCheck3Disposition); } if (row.MBVDCheckNum != 0) { NewResearchCheck(row, "MBVD", row.MBVDCheckDisposition); } if (row.MBVDCheckNum2 != 0) { NewResearchCheck(row, "MBVD2", row.MBVDCheck2Disposition); } if (row.MBVDCheckNum3 != 0) { NewResearchCheck(row, "MBVD3", row.MBVDCheck3Disposition); } if (row.SDCheckNum != 0) { NewResearchCheck(row, "SD", row.SDCheckDisposition); } // Slow down adding of checks to the Research Table a little bit so we can see the progress bar Thread.Sleep(100); i += 1; ProgressHub.SendProgress("Adding checks to Research Table...", i, checkCount); } return(newResearchChecks); }