///<summary>If a substitute exists for the given proc code, then it will give the CodeNum of that code. Otherwise, it will return the codeNum for the given procCode.</summary> public static long GetSubstituteCodeNum(string procCode, string toothNum) { //No need to check RemotingRole; no call to db. if (procCode == null || procCode == "") { return(0); } if (!ProcedureCodeC.HList.Contains(procCode)) { return(0); } ProcedureCode proc = (ProcedureCode)ProcedureCodeC.HList[procCode]; if (proc.SubstitutionCode != "" && ProcedureCodeC.HList.Contains(proc.SubstitutionCode)) { if (proc.SubstOnlyIf == SubstitutionCondition.Always) { return(((ProcedureCode)ProcedureCodeC.HList[proc.SubstitutionCode]).CodeNum); } if (proc.SubstOnlyIf == SubstitutionCondition.Molar && Tooth.IsMolar(toothNum)) { return(((ProcedureCode)ProcedureCodeC.HList[proc.SubstitutionCode]).CodeNum); } if (proc.SubstOnlyIf == SubstitutionCondition.SecondMolar && Tooth.IsSecondMolar(toothNum)) { return(((ProcedureCode)ProcedureCodeC.HList[proc.SubstitutionCode]).CodeNum); } } return(proc.CodeNum); }
///<summary>If a substitute exists for the given proc code, then it will give the CodeNum of that code. ///Otherwise, it will return the codeNum for the given procCode.</summary> public static long GetSubstituteCodeNum(string procCode, string toothNum) { //No need to check RemotingRole; no call to db. long codeNum = 0; if (string.IsNullOrEmpty(procCode)) { return(codeNum); } ODException.SwallowAnyException(() => { ProcedureCode procedureCode = _procedureCodeCache.GetOne(procCode); codeNum = procedureCode.CodeNum; if (!string.IsNullOrEmpty(procedureCode.SubstitutionCode)) { //Swallow any following exceptions because the old code would first check and make sure the key was in the dictionary. ODException.SwallowAnyException(() => { if (procedureCode.SubstOnlyIf == SubstitutionCondition.Always) { codeNum = _procedureCodeCache.GetOne(procedureCode.SubstitutionCode).CodeNum; } else if (procedureCode.SubstOnlyIf == SubstitutionCondition.Molar && Tooth.IsMolar(toothNum)) { codeNum = _procedureCodeCache.GetOne(procedureCode.SubstitutionCode).CodeNum; } else if (procedureCode.SubstOnlyIf == SubstitutionCondition.SecondMolar && Tooth.IsSecondMolar(toothNum)) { codeNum = _procedureCodeCache.GetOne(procedureCode.SubstitutionCode).CodeNum; } }); } }); return(codeNum); }