Example #1
0
        ///<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);
        }
Example #2
0
        ///<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);
            }
        }