예제 #1
0
        //-----

        ///<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 long GetCodeNum(long autoCodeNum, string toothNum, string surf, bool isAdditional, long patNum, int age)
        {
            //No need to check RemotingRole; no call to db.
            bool allCondsMet;
            List <AutoCodeItem> listForCode = AutoCodeItems.GetListForCode(autoCodeNum);

            if (listForCode.Count == 0)
            {
                return(0);
            }
            bool willBeMissing = Procedures.WillBeMissing(toothNum, patNum);
            List <AutoCodeCond> condList;

            for (int i = 0; i < listForCode.Count; i++)
            {
                condList    = AutoCodeConds.GetListForItem(listForCode[i].AutoCodeItemNum);
                allCondsMet = true;
                for (int j = 0; j < condList.Count; j++)
                {
                    if (!AutoCodeConds.ConditionIsMet(condList[j].Cond, toothNum, surf, isAdditional, willBeMissing, age))
                    {
                        allCondsMet = false;
                    }
                }
                if (allCondsMet)
                {
                    return(listForCode[i].CodeNum);
                }
            }
            return(listForCode[0].CodeNum);           //if couldn't find a better match
        }
예제 #2
0
        ///<summary>Only called when closing the procedure edit window. Usually returns the supplied CodeNum, unless a better match is found.</summary>
        public static long VerifyCode(long codeNum, string toothNum, string surf, bool isAdditional, long patNum, int age,
                                      out AutoCode AutoCodeCur)
        {
            //No need to check RemotingRole; no call to db.
            bool allCondsMet;

            AutoCodeCur = null;
            if (!GetContainsKey(codeNum))
            {
                return(codeNum);
            }
            if (!AutoCodes.GetContainsKey(GetOne(codeNum).AutoCodeNum))
            {
                return(codeNum);               //just in case.
            }
            AutoCodeCur = AutoCodes.GetOne(GetOne(codeNum).AutoCodeNum);
            if (AutoCodeCur.LessIntrusive)
            {
                return(codeNum);
            }
            bool willBeMissing = Procedures.WillBeMissing(toothNum, patNum);
            List <AutoCodeItem> listForCode = AutoCodeItems.GetListForCode(GetOne(codeNum).AutoCodeNum);
            List <AutoCodeCond> condList;

            for (int i = 0; i < listForCode.Count; i++)
            {
                condList    = AutoCodeConds.GetListForItem(listForCode[i].AutoCodeItemNum);
                allCondsMet = true;
                for (int j = 0; j < condList.Count; j++)
                {
                    if (!AutoCodeConds.ConditionIsMet(condList[j].Cond, toothNum, surf, isAdditional, willBeMissing, age))
                    {
                        allCondsMet = false;
                    }
                }
                if (allCondsMet)
                {
                    return(listForCode[i].CodeNum);
                }
            }
            return(codeNum);           //if couldn't find a better match
        }