public void ProcedureLogic_SortProcedures_CanadianLabs_ProcStatusMismatch() { CultureInfo oldCulture = SetCulture(new CultureInfo("en-CA")); Patient pat = PatientT.CreatePatient("Test"); List <Procedure> listProcs = new List <Procedure>(); //Parent and Lab match on all fields except ProcStatus Procedure parentProc = ProcedureT.CreateProcedure(pat, "D1120", ProcStat.C, "4", 200.00, procDate: DateTime.Now, priority: 0, 0, 0, 0, 0, "", 0); listProcs.Add(parentProc); Procedure parentProc2 = ProcedureT.CreateProcedure(pat, "D1420", ProcStat.C, "6", 200.00, procDate: DateTime.Now, priority: 0, 0, 0, 0, 0, "", 0); listProcs.Add(parentProc2); listProcs.AddRange(CreateAssortedProcs(pat)); Procedure labProc = ProcedureT.CreateProcedure(pat, "99333", ProcStat.TP, "4", 200.00, parentProc.ProcDate, priority: 0, 0, 0, 0, 0, "", parentProc.ProcNum); listProcs.Add(labProc); Procedure labProc2 = ProcedureT.CreateProcedure(pat, "99222", ProcStat.TP, "6", 120.00, parentProc2.ProcDate, priority: 0, 0, 0, 0, 0, "", parentProc2.ProcNum); listProcs.Add(labProc2); ProcedureLogic.SortProcedures(ref listProcs); int parentProcIndex = listProcs.FindIndex(x => x == parentProc); int labProcIndex = listProcs.FindIndex(x => x == labProc); int parentProc2Index = listProcs.FindIndex(x => x == parentProc2); int labProc2Index = listProcs.FindIndex(x => x == labProc2); Assert.AreEqual(parentProcIndex + 1, labProcIndex); //A lab should be directly after its parent Assert.AreEqual(parentProc2Index + 1, labProc2Index); //A lab should be directly after its parent SetCulture(oldCulture); }
public void ProcedureLogic_SortProcedures_CanadianLabs_MultipleLabs() { string suffix = MethodBase.GetCurrentMethod().Name; CultureInfo oldCulture = SetCulture(new CultureInfo("en-CA")); Patient pat = PatientT.CreatePatient(suffix); List <Procedure> listProcs = new List <Procedure>(); //Parent and Lab match on all fields except ProcStatus Procedure parentProc = ProcedureT.CreateProcedure(pat, "04711", ProcStat.TP, "", 91.00); listProcs.Add(parentProc); Procedure parentProc2 = ProcedureT.CreateProcedure(pat, "04712", ProcStat.TP, "", 182.00); listProcs.Add(parentProc2); listProcs.AddRange(CreateAssortedProcs(pat)); Procedure labProc = ProcedureT.CreateProcedure(pat, "99111", ProcStat.TP, "", 89.00, parentProc.ProcDate, procNumLab: parentProc.ProcNum); listProcs.Add(labProc); Procedure labProc2A = ProcedureT.CreateProcedure(pat, "99111", ProcStat.TP, "", 23.00, parentProc2.ProcDate, procNumLab: parentProc2.ProcNum); listProcs.Add(labProc2A); Procedure labProc2B = ProcedureT.CreateProcedure(pat, "99111", ProcStat.TP, "", 15.00, parentProc2.ProcDate, procNumLab: parentProc2.ProcNum); listProcs.Add(labProc2B); Procedure randomProcedure = ProcedureT.CreateProcedure(pat, "01101", ProcStat.TP, "", 105.00); ProcedureLogic.SortProcedures(ref listProcs); //Get the indexes of all of the parent procedures and their corresponding labs. int parentProcIndex = listProcs.FindIndex(x => x == parentProc); int labProcIndex = listProcs.FindIndex(x => x == labProc); int parentProc2Index = listProcs.FindIndex(x => x == parentProc2); int labProc2AIndex = listProcs.FindIndex(x => x == labProc2A); int labProc2BIndex = listProcs.FindIndex(x => x == labProc2B); //Labs should always be directly after their parent procedure. Assert.AreEqual(parentProcIndex + 1, labProcIndex); Assert.IsTrue(labProc2AIndex.In(parentProc2Index + 1, parentProc2Index + 2)); Assert.IsTrue(labProc2BIndex.In(parentProc2Index + 1, parentProc2Index + 2)); SetCulture(oldCulture); }
private void FormTreatPlanCurEdit_Load(object sender, EventArgs e) { if (TreatPlanCur == null || (TreatPlanCur.TPStatus != TreatPlanStatus.Active && TreatPlanCur.TPStatus != TreatPlanStatus.Inactive)) { throw new Exception("No treatment plan loaded."); } _treatPlanUnassigned = TreatPlans.GetUnassigned(TreatPlanCur.PatNum); this.Text = TreatPlanCur.Heading + " - {" + Lans.g(this, TreatPlanCur.TPStatus.ToString()) + "}"; _listTpAttachesAll = TreatPlanAttaches.GetAllForPatNum(TreatPlanCur.PatNum); _listTpAttachesCur = _listTpAttachesAll.FindAll(x => x.TreatPlanNum == TreatPlanCur.TreatPlanNum); _listTpProcsAll = Procedures.GetProcsByStatusForPat(TreatPlanCur.PatNum, new[] { ProcStat.TP, ProcStat.TPi }); ProcedureLogic.SortProcedures(ref _listTpProcsAll); _listTpProcsCur = _listTpProcsAll.FindAll(x => _listTpAttachesCur.Any(y => x.ProcNum == y.ProcNum) || (TreatPlanCur.TPStatus == TreatPlanStatus.Active && (x.AptNum > 0 || x.PlannedAptNum > 0))); _listAppointments = Appointments.GetMultApts(_listTpProcsAll.SelectMany(x => new[] { x.AptNum, x.PlannedAptNum }).Distinct().Where(x => x > 0).ToList()); textHeading.Text = TreatPlanCur.Heading; textNote.Text = TreatPlanCur.Note; FillGrids(); if (TreatPlanCur.TPStatus == TreatPlanStatus.Inactive && TreatPlanCur.Heading == Lan.g("TreatPlan", "Unassigned")) { gridTP.Title = Lan.g("TreatPlan", "Unassigned Procedures"); labelHeading.Visible = false; textHeading.Visible = false; labelNote.Visible = false; textNote.Visible = false; gridAll.Visible = false; butLeft.Visible = false; butRight.Visible = false; butOK.Enabled = false; butDelete.Visible = false; } if (TreatPlanCur.TPStatus == TreatPlanStatus.Active) { butMakeActive.Enabled = false; butDelete.Enabled = false; } comboPlanType.Items.AddRange(Enum.GetNames(typeof(TreatPlanType))); comboPlanType.SelectedIndex = (int)TreatPlanCur.TPType; }