///<summary></summary> public static RecallType CreateRecallType(string description = "Cleaning", string procedures = "D1110,D0150", string timePattern = "///X///", Interval defaultInterval = default(Interval)) { RecallType recallType = new RecallType(); if (defaultInterval == default(Interval)) { recallType.DefaultInterval = new Interval(1, 0, 6, 0); } else { recallType.DefaultInterval = defaultInterval; } recallType.Description = description; recallType.Procedures = procedures; recallType.TimePattern = timePattern; RecallTypes.Insert(recallType); RecallTypes.RefreshCache(); foreach (string procStr in procedures.Split(',')) { RecallTriggers.Insert(new RecallTrigger { CodeNum = ProcedureCodes.GetOne(procStr).CodeNum, RecallTypeNum = recallType.RecallTypeNum }); } return(recallType); }
///<summary>Returns a procedure code object that utilizes the procCode passed in. ///Either returns the pre-existing code from the cache or creates a new one. Throws an exception if procCode is longer than 15 chars.</summary> public static ProcedureCode CreateProcCode(string procCode, bool isCanadianLab = false) { //The ProcCode column on the procedurecode table is a VARCHAR(15). MySQL will not throw an exception but will instead truncate the ProcCode. //Engineers might not be expecting this and might write an invalid unit test assuming that this method did what they told it to do. if (procCode.Length > 15) { throw new ODException("Invalid procCode passed into ProcedureCodeT.CreateProcCode(); Must be less than 15 characters."); } AddIfNotPresent(procCode, isCanadianLab); return(ProcedureCodes.GetOne(procCode)); }
public void ProcedureCodes_GetProcCodesByTreatmentArea_MouthCodes() { string suffix = MethodBase.GetCurrentMethod().Name; List <ProcedureCode> listMouthProcCodesOld = ProcedureCodes.GetProcCodesByTreatmentArea(false, TreatmentArea.Mouth); int i = 0; do { i++; //Add a nonexisting proc code. }while(!ProcedureCodeT.AddIfNotPresent("D" + i.ToString().PadLeft(4, '0')) && i < 10000); ProcedureCode newProc = ProcedureCodes.GetOne("D" + i.ToString().PadLeft(4, '0')); newProc.TreatArea = TreatmentArea.Mouth; newProc.Descript = suffix; ProcedureCodeT.Update(newProc); List <ProcedureCode> listMouthProcCodesNew = ProcedureCodes.GetProcCodesByTreatmentArea(false, TreatmentArea.Mouth); Assert.IsFalse(listMouthProcCodesNew.Any(x => x.TreatArea != TreatmentArea.Mouth)); Assert.IsTrue((listMouthProcCodesOld.Count + 1) == listMouthProcCodesNew.Count); Assert.IsTrue(listMouthProcCodesNew.Exists(x => x.CodeNum == newProc.CodeNum)); }