public static int CompareByToothNum(CanadianExtract x1, CanadianExtract x2) { string t1 = x1.ToothNum; string t2 = x2.ToothNum; if (t1 == null || t1 == "" || t2 == null || t2 == "") { return(0); //should never happen } if (!Tooth.IsValidDB(t1) || !Tooth.IsValidDB(t2)) { return(0); } if (Tooth.IsPrimary(t1) && !Tooth.IsPrimary(t2)) { return(-1); } if (!Tooth.IsPrimary(t1) && Tooth.IsPrimary(t2)) { return(1); } //so either both are primary or both are permanent. return(Tooth.ToInt(t1).CompareTo(Tooth.ToInt(t2))); }
///<summary>Both grid s should be filled with the same columns. This method prevents the need for two nearly identical fill grid patterns.</summary> private void FillGrid(ref ODGrid grid) { grid.BeginUpdate(); grid.Columns.Clear(); grid.Columns.Add(new ODGridColumn(Lan.g(this, "Status"), 40)); grid.Columns.Add(new ODGridColumn(Lan.g(this, "Tth"), 30)); grid.Columns.Add(new ODGridColumn(Lan.g(this, "Surf"), 40)); grid.Columns.Add(new ODGridColumn(Lan.g(this, "Code"), 40)); grid.Columns.Add(new ODGridColumn(Lan.g(this, "Description"), 195)); grid.Columns.Add(new ODGridColumn(Lan.g(this, "TPs"), 35)); grid.Columns.Add(new ODGridColumn(Lan.g(this, "Apt"), 40)); grid.Rows.Clear(); ODGridRow row; List <Procedure> listProcs; if (grid == gridAll) { listProcs = _listTpProcsAll.FindAll(x => _listTpProcsCur.All(y => x.ProcNum != y.ProcNum)).OrderBy(x => Tooth.ToInt(x.ToothNum)).ToList(); } else { listProcs = _listTpProcsCur.OrderBy(x => Tooth.ToInt(x.ToothNum)).ToList(); } foreach (Procedure proc in listProcs) { row = new ODGridRow(); ProcedureCode proccode = ProcedureCodes.GetProcCode(proc.CodeNum); row.Cells.Add(proc.ProcStatus.ToString()); row.Cells.Add(Tooth.ToInternat(proc.ToothNum)); row.Cells.Add(proc.Surf); row.Cells.Add(proccode.ProcCode); row.Cells.Add(ProcedureCodes.GetLaymanTerm(proc.CodeNum)); row.Cells.Add(_listTpAttachesAll.FindAll(x => x.ProcNum == proc.ProcNum && x.TreatPlanNum != _treatPlanUnassigned.TreatPlanNum).Count.ToString()); string aptStatus = ""; foreach (long aptNum in new[] { proc.AptNum, proc.PlannedAptNum }.Where(x => x > 0)) { Appointment apt = _listAppointments.FirstOrDefault(x => x.AptNum == aptNum); if (apt != null) { switch (apt.AptStatus) { case ApptStatus.UnschedList: aptStatus += "U"; break; case ApptStatus.Scheduled: aptStatus += "S"; break; case ApptStatus.Complete: aptStatus += "C"; break; case ApptStatus.Broken: aptStatus += "B"; break; case ApptStatus.Planned: aptStatus += "P"; break; case ApptStatus.PtNote: case ApptStatus.PtNoteCompleted: case ApptStatus.None: default: aptStatus += "!"; //should never happen break; } } } row.Cells.Add(aptStatus); row.Tag = proc; grid.Rows.Add(row); } grid.EndUpdate(); }
///<summary>This is, of course, called when module refreshed. But it's also called when user sets missing teeth or tooth movements. In that case, the Progress notes are not refreshed, so it's a little faster. This also fills in the movement amounts.</summary> private void FillToothChart() { Cursor = Cursors.WaitCursor; toothChart.SuspendLayout(); toothChart.UseInternational = PrefB.GetBool("UseInternationalToothNumbers"); toothChart.ColorBackground = DefB.Long[(int)DefCat.ChartGraphicColors][10].ItemColor; toothChart.ColorText = DefB.Long[(int)DefCat.ChartGraphicColors][11].ItemColor; toothChart.ColorTextHighlight = DefB.Long[(int)DefCat.ChartGraphicColors][12].ItemColor; toothChart.ColorBackHighlight = DefB.Long[(int)DefCat.ChartGraphicColors][13].ItemColor; //remember which teeth were selected ArrayList selectedTeeth = new ArrayList(); //integers 1-32 for (int i = 0; i < toothChart.SelectedTeeth.Length; i++) { selectedTeeth.Add(Tooth.ToInt(toothChart.SelectedTeeth[i])); } toothChart.ResetTeeth(); /*if(PatCur==null) { * toothChart.ResumeLayout(); * FillMovementsAndHidden(); * Cursor=Cursors.Default; * return; * }*/ if (ShowBySelectedTeeth) { for (int i = 0; i < selectedTeeth.Count; i++) { toothChart.SetSelected((int)selectedTeeth[i], true); } } //first, primary. That way, you can still set a primary tooth missing afterwards. for (int i = 0; i < ToothInitialList.Length; i++) { if (ToothInitialList[i].InitialType == ToothInitialType.Primary) { toothChart.SetToPrimary(ToothInitialList[i].ToothNum); } } for (int i = 0; i < ToothInitialList.Length; i++) { switch (ToothInitialList[i].InitialType) { case ToothInitialType.Missing: toothChart.SetInvisible(ToothInitialList[i].ToothNum); break; case ToothInitialType.Hidden: toothChart.HideTooth(ToothInitialList[i].ToothNum); break; //case ToothInitialType.Primary: // break; case ToothInitialType.Rotate: toothChart.MoveTooth(ToothInitialList[i].ToothNum, ToothInitialList[i].Movement, 0, 0, 0, 0, 0); break; case ToothInitialType.TipM: toothChart.MoveTooth(ToothInitialList[i].ToothNum, 0, ToothInitialList[i].Movement, 0, 0, 0, 0); break; case ToothInitialType.TipB: toothChart.MoveTooth(ToothInitialList[i].ToothNum, 0, 0, ToothInitialList[i].Movement, 0, 0, 0); break; case ToothInitialType.ShiftM: toothChart.MoveTooth(ToothInitialList[i].ToothNum, 0, 0, 0, ToothInitialList[i].Movement, 0, 0); break; case ToothInitialType.ShiftO: toothChart.MoveTooth(ToothInitialList[i].ToothNum, 0, 0, 0, 0, ToothInitialList[i].Movement, 0); break; case ToothInitialType.ShiftB: toothChart.MoveTooth(ToothInitialList[i].ToothNum, 0, 0, 0, 0, 0, ToothInitialList[i].Movement); break; } } DrawProcsOfStatus(ProcStat.EO); DrawProcsOfStatus(ProcStat.EC); DrawProcsOfStatus(ProcStat.C); DrawProcsOfStatus(ProcStat.R); DrawProcsOfStatus(ProcStat.TP); toothChart.ResumeLayout(); //FillMovementsAndHidden(); Cursor = Cursors.Default; }