示例#1
0
 ///<summary>Used every time user enters toothNum in procedure box. Must be followed with FromInternat. These are the *ONLY* methods that are designed to accept user input.  Can also handle international toothnum</summary>
 public static bool IsValidEntry(string toothNum)
 {
     //international
     if (PrefB.GetBool("UseInternationalToothNumbers"))
     {
         if (toothNum == null || toothNum == "")
         {
             return(false);
         }
         Regex regex = new Regex("^[1-4][1-8]$");              //perm teeth: matches firt digit 1-4 and second digit 1-8,9 would be supernumerary?
         if (regex.IsMatch(toothNum))
         {
             return(true);
         }
         regex = new Regex("^[5-8][1-5]$");              //pri teeth: matches firt digit 5-8 and second digit 1-5
         if (regex.IsMatch(toothNum))
         {
             return(true);
         }
         return(false);
     }
     else             //american
                      //tooth numbers validated the same as they are in db.
     {
         return(IsValidDB(toothNum));
     }
 }
示例#2
0
        ///<summary>Sometimes validated by IsValidDB before coming here, otherwise an invalid toothnum .  This should be run on all displayed tooth numbers. It will handle checking for whether user is using international tooth numbers.  All tooth numbers are passed in american values until the very last moment.  Just before display, the string is converted using this method.</summary>
        public static string ToInternat(string toothNum)
        {
            //if not using international tooth numbers, no change.
            if (!PrefB.GetBool("UseInternationalToothNumbers"))
            {
                //((Pref)PrefB.HList[]).ValueString=="0"){
                return(toothNum);
            }
            if (toothNum == null || toothNum == "")
            {
                return("");
            }
            int intToothI = 0;          //the international tooth number we will find
            int intTooth  = 0;

            try{
                intTooth = ToInt(toothNum);              //this gives us the american 1-32. Primary are 4-13,20-29
            }
            catch {
                return("");               //for situations where no validation was performed
            }
            if (IsPrimary(toothNum))
            {
                if (intTooth >= 4 && intTooth <= 8)            //UR= 51-55
                {
                    intToothI = 59 - intTooth;
                }
                else if (intTooth >= 9 && intTooth <= 13)            //UL= 61-65
                {
                    intToothI = 52 + intTooth;
                }
                else if (intTooth >= 20 && intTooth <= 24)            //LL= 71-75
                {
                    intToothI = 95 - intTooth;
                }
                else if (intTooth >= 25 && intTooth <= 29)            //LR= 81-85
                {
                    intToothI = 56 + intTooth;
                }
            }
            else                                    //adult toothnum
            {
                if (intTooth >= 1 && intTooth <= 8) //UR= 11-18
                {
                    intToothI = 19 - intTooth;
                }
                else if (intTooth >= 9 && intTooth <= 16)            //UL= 21-28
                {
                    intToothI = 12 + intTooth;
                }
                else if (intTooth >= 17 && intTooth <= 24)            //LL= 31-38
                {
                    intToothI = 55 - intTooth;
                }
                else if (intTooth >= 25 && intTooth <= 32)            //LR= 41-48
                {
                    intToothI = 16 + intTooth;
                }
            }
            return(intToothI.ToString());
        }