///<summary>Only used for incremental tooth movements. Automatically adds a movement to any existing movement. Supply a list of all toothInitials for the patient.</summary> public static void AddMovement(List <ToothInitial> initialList, long patNum, string tooth_id, ToothInitialType initialType, float moveAmt) { //No need to check RemotingRole; no call to db. ToothInitial ti = null; for (int i = 0; i < initialList.Count; i++) { if (initialList[i].ToothNum == tooth_id && initialList[i].InitialType == initialType) { ti = initialList[i].Copy(); } } if (ti == null) { ti = new ToothInitial(); ti.PatNum = patNum; ti.ToothNum = tooth_id; ti.InitialType = initialType; ti.Movement = moveAmt; ToothInitials.Insert(ti); return; } ti.Movement += moveAmt; ToothInitials.Update(ti); }
///<summary>Only used for incremental tooth movements. Automatically adds a movement to any existing movement. Supply a list of all toothInitials for the patient.</summary> public static void AddMovement(List <ToothInitial> initialList, long patNum, string tooth_id, ToothInitialType initialType, float moveAmt) { //No need to check RemotingRole; no call to db. if (moveAmt == 0) { return; } ToothInitial ti = initialList.Find(x => x.ToothNum == tooth_id && x.InitialType == initialType)?.Copy(); if (ti == null) { ti = new ToothInitial(); ti.PatNum = patNum; ti.ToothNum = tooth_id; ti.InitialType = initialType; ti.Movement = moveAmt; ToothInitials.Insert(ti); return; } ti.Movement += moveAmt; if (ti.Movement == 0) { ClearValue(patNum, tooth_id, initialType); } else { ToothInitials.Update(ti); } }
///<summary>Same as SetValue, but does not clear any values first. Only use this if you have first run ClearAllValuesForType.</summary> public static void SetValueQuick(long patNum, string tooth_id, ToothInitialType initialType, float moveAmt) { //No need to check RemotingRole; no call to db. ToothInitial ti = new ToothInitial(); ti.PatNum = patNum; ti.ToothNum = tooth_id; ti.InitialType = initialType; ti.Movement = moveAmt; ToothInitials.Insert(ti); }
///<summary>Same as SetValue, but does not clear any values first. Only use this if you have first run ClearAllValuesForType.</summary> public static void SetValueQuick(long patNum, string tooth_id, ToothInitialType initialType, float moveAmt) { //No need to check RemotingRole; no call to db. //if initialType is a movement and the movement amt is 0, then don't add a row, just return; if (moveAmt == 0 && initialType.In(ToothInitialType.ShiftM, ToothInitialType.ShiftO, ToothInitialType.ShiftB, ToothInitialType.Rotate, ToothInitialType.TipM, ToothInitialType.TipB)) { return; } ToothInitial ti = new ToothInitial(); ti.PatNum = patNum; ti.ToothNum = tooth_id; ti.InitialType = initialType; ti.Movement = moveAmt; ToothInitials.Insert(ti); }