///<summary>Only called from ContrChart.listProcButtons_Click. Called once for each tooth selected and for each autocode item attached to the button.</summary> public static string GetADA(int autoCodeNum, string toothNum, string surf, bool isAdditional, int patNum, int age) { bool allCondsMet; GetListForCode(autoCodeNum); if (ListForCode.Length == 0) { return(""); } bool willBeMissing = Procedures.WillBeMissing(toothNum, patNum); for (int i = 0; i < ListForCode.Length; i++) { AutoCodeConds.GetListForItem(ListForCode[i].AutoCodeItemNum); allCondsMet = true; for (int j = 0; j < AutoCodeConds.ListForItem.Length; j++) { if (!AutoCodeConds.ConditionIsMet (AutoCodeConds.ListForItem[j].Cond, toothNum, surf, isAdditional, willBeMissing, age)) { allCondsMet = false; } } if (allCondsMet) { return(ListForCode[i].ADACode); } } return(ListForCode[0].ADACode); //if couldn't find a better match }
///<summary>Only called when closing the procedure edit window. Usually returns the supplied adaCode, unless a better match is found.</summary> public static string VerifyCode(string ADACode, string toothNum, string surf, bool isAdditional, int patNum, int age, out AutoCode AutoCodeCur) { bool allCondsMet; AutoCodeCur = null; if (!HList.ContainsKey(ADACode)) { return(ADACode); } if (!AutoCodes.HList.ContainsKey((int)HList[ADACode])) { return(ADACode); //just in case. } AutoCodeCur = (AutoCode)AutoCodes.HList[(int)HList[ADACode]]; if (AutoCodeCur.LessIntrusive) { return(ADACode); } bool willBeMissing = Procedures.WillBeMissing(toothNum, patNum); //AutoCode verAutoCode=(AutoCode)HList[ADACode]; GetListForCode((int)HList[ADACode]); for (int i = 0; i < ListForCode.Length; i++) { AutoCodeConds.GetListForItem(ListForCode[i].AutoCodeItemNum); allCondsMet = true; for (int j = 0; j < AutoCodeConds.ListForItem.Length; j++) { if (!AutoCodeConds.ConditionIsMet (AutoCodeConds.ListForItem[j].Cond, toothNum, surf, isAdditional, willBeMissing, age)) { allCondsMet = false; } } if (allCondsMet) { return(ListForCode[i].ADACode); } } return(ADACode); //if couldn't find a better match }