コード例 #1
0
ファイル: Defs.cs プロジェクト: azzedinerise/OpenDental
        ///<summary>Returns the named def.  If it can't find the name, then it returns the first def in the category.</summary>
        public static long GetByExactNameNeverZero(DefCat myCat, string itemName)
        {
            //No need to check RemotingRole; no call to db.
            List <Def> listDefs = Defs.GetDefsForCategory(myCat);
            Def        def;

            //We have been getting bug submissions from customers where listDefs will be null (e.g. DefCat.ProviderSpecialties cat itemName "General")
            //Therefore, we should check for null or and entirely empty category first before looking for a match.
            if (listDefs == null || listDefs.Count == 0)
            {
                //There are no defs for the category passed in, create one because this method should never return zero.
                def           = new Def();
                def.Category  = myCat;
                def.ItemOrder = 0;
                def.ItemName  = itemName;
                Defs.Insert(def);
                Defs.RefreshCache();
                return(def.DefNum);
            }
            //From this point on, we know our list of definitions contains at least one def.
            def = listDefs.FirstOrDefault(x => x.ItemName == itemName);
            if (def != null)
            {
                return(def.DefNum);
            }
            //Couldn't find a match so return the first definition from our list as a last resort.
            return(listDefs[0].DefNum);
        }
コード例 #2
0
 ///<summary>Returns the named def.  If it can't find the name, then it returns the first def in the category.</summary>
 public static long GetByExactNameNeverZero(DefCat myCat, string itemName)
 {
     if (itemName == "")
     {
         return(DefC.Long[(int)myCat][0].DefNum);               //return the first one in the list
     }
     for (int i = 0; i < DefC.Long[(int)myCat].GetLength(0); i++)
     {
         if (DefC.Long[(int)myCat][i].ItemName == itemName)
         {
             return(DefC.Long[(int)myCat][i].DefNum);
         }
     }
     if (DefC.Long[(int)myCat].Length == 0)
     {
         Def def = new Def();
         def.Category  = myCat;
         def.ItemOrder = 0;
         def.ItemName  = itemName;
         Defs.Insert(def);
         Defs.RefreshCache();
     }
     return(DefC.Long[(int)myCat][0].DefNum);           //return the first one in the list
 }
コード例 #3
0
ファイル: ProcedureCodes.cs プロジェクト: nampn/ODental
        public static void ResetApptProcsQuickAdd()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod());
                return;
            }
            string command = "DELETE FROM definition WHERE Category=3";

            Db.NonQ(command);
            string[] array = new string[] {
                "CompEx-4BW-Pano-Pro-Flo", "D0150,D0274,D0330,D1110,D1204",
                "CompEx-2BW-Pano-ChPro-Flo", "D0150,D0272,D0330,D1120,D1203",
                "PerEx-4BW-Pro-Flo", "D0120,D0274,D1110,D1204",
                "LimEx-PA", "D0140,D0220",
                "PerEx-4BW-Pro-Flo", "D0120,D0274,D1110,D1204",
                "PerEx-2BW-ChildPro-Flo", "D0120,D0272,D1120,D1203",
                "Comp Exam", "D0150",
                "Per Exam", "D0120",
                "Lim Exam", "D0140",
                "1 PA", "D0220",
                "2BW", "D0272",
                "4BW", "D0274",
                "Pano", "D0330",
                "Pro Adult", "D1110",
                "Fluor Adult", "D1204",
                "Pro Child", "D1120",
                "Fuor Child", "D1203",
                "PostOp", "N4101",
                "DentAdj", "N4102",
                "Consult", "D9310"
            };
            Def def;

            string[] codelist;
            bool     allvalid;
            int      itemorder = 0;

            for (int i = 0; i < array.Length; i += 2)
            {
                //first, test all procedures for valid
                codelist = array[i + 1].Split(',');
                allvalid = true;
                for (int c = 0; c < codelist.Length; c++)
                {
                    if (!ProcedureCodes.IsValidCode(codelist[c]))
                    {
                        allvalid = false;
                    }
                }
                if (!allvalid)
                {
                    continue;
                }
                def           = new Def();
                def.Category  = DefCat.ApptProcsQuickAdd;
                def.ItemOrder = itemorder;
                def.ItemName  = array[i];
                def.ItemValue = array[i + 1];
                Defs.Insert(def);
                itemorder++;
            }
        }
コード例 #4
0
ファイル: ProcedureCodes.cs プロジェクト: nampn/ODental
        ///<summary>Used to check whether codes starting with T exist and are in a visible category.  If so, it moves them to the Obsolete category.  If the T code has never been used, then it deletes it.</summary>
        public static void TcodesClear()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod());
                return;
            }
            //first delete any unused T codes
            string    command = @"SELECT CodeNum,ProcCode FROM procedurecode
				WHERE NOT EXISTS(SELECT * FROM procedurelog WHERE procedurelog.CodeNum=procedurecode.CodeNum)
				AND ProcCode LIKE 'T%'"                ;
            DataTable table   = Db.GetTable(command);
            long      codenum;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                codenum = PIn.Long(table.Rows[i]["CodeNum"].ToString());
                command = "DELETE FROM fee WHERE CodeNum=" + POut.Long(codenum);
                Db.NonQ(command);
                command = "DELETE FROM procedurecode WHERE CodeNum=" + POut.Long(codenum);
                Db.NonQ(command);
            }
            //then, move any other T codes to obsolete category
            command = @"SELECT DISTINCT ProcCat FROM procedurecode,definition 
				WHERE procedurecode.ProcCode LIKE 'T%'
				AND definition.IsHidden=0
				AND procedurecode.ProcCat=definition.DefNum"                ;
            table   = Db.GetTable(command);
            long catNum = DefC.GetByExactName(DefCat.ProcCodeCats, "Obsolete");         //check to make sure an Obsolete category exists.
            Def  def;

            if (catNum != 0)           //if a category exists with that name
            {
                def = DefC.GetDef(DefCat.ProcCodeCats, catNum);
                if (!def.IsHidden)
                {
                    def.IsHidden = true;
                    Defs.Update(def);
                    Defs.RefreshCache();
                }
            }
            if (catNum == 0)
            {
                def           = new Def();
                def.Category  = DefCat.ProcCodeCats;
                def.ItemName  = "Obsolete";
                def.ItemOrder = DefC.Long[(int)DefCat.ProcCodeCats].Length;
                def.IsHidden  = true;
                Defs.Insert(def);
                Defs.RefreshCache();
                catNum = def.DefNum;
            }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                command = "UPDATE procedurecode SET ProcCat=" + POut.Long(catNum)
                          + " WHERE ProcCat=" + table.Rows[i][0].ToString()
                          + " AND procedurecode.ProcCode LIKE 'T%'";
                Db.NonQ(command);
            }
            //finally, set Never Used category to be hidden.  This isn't really part of clearing Tcodes, but is required
            //because many customers won't have that category hidden
            catNum = DefC.GetByExactName(DefCat.ProcCodeCats, "Never Used");
            if (catNum != 0)           //if a category exists with that name
            {
                def = DefC.GetDef(DefCat.ProcCodeCats, catNum);
                if (!def.IsHidden)
                {
                    def.IsHidden = true;
                    Defs.Update(def);
                    Defs.RefreshCache();
                }
            }
        }
コード例 #5
0
ファイル: ProcedureCodes.cs プロジェクト: royedwards/DRDNet
        ///<summary>Used to check whether codes starting with T exist and are in a visible category.  If so, it moves them to the Obsolete category.  If the T code has never been used, then it deletes it.</summary>
        public static void TcodesClear()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod());
                return;
            }
            //first delete any unused T codes
            string        command         = @"SELECT CodeNum,ProcCode FROM procedurecode
				WHERE CodeNum NOT IN(SELECT CodeNum FROM procedurelog)
				AND CodeNum NOT IN(SELECT CodeNum FROM autocodeitem)
				AND CodeNum NOT IN(SELECT CodeNum FROM procbuttonitem)
				AND CodeNum NOT IN(SELECT CodeNum FROM recalltrigger)
				AND CodeNum NOT IN(SELECT CodeNum FROM benefit)
				AND ProcCode NOT IN(SELECT CodeValue FROM encounter WHERE CodeSystem='CDT')
				AND ProcCode LIKE 'T%'"                ;
            DataTable     table           = Db.GetTable(command);
            List <long>   listCodeNums    = new List <long>();
            List <string> listRecallCodes = RecallTypes.GetDeepCopy()
                                            .SelectMany(x => x.Procedures.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                                            .ToList();

            for (int i = 0; i < table.Rows.Count; i++)
            {
                if (!listRecallCodes.Contains(PIn.String(table.Rows[i]["ProcCode"].ToString())))                 //The ProcCode is not attached to a recall type.
                {
                    listCodeNums.Add(PIn.Long(table.Rows[i]["CodeNum"].ToString()));
                }
            }
            if (listCodeNums.Count > 0)
            {
                ProcedureCodes.ClearFkey(listCodeNums);                //Zero securitylog FKey column for rows to be deleted.
                command = "SELECT FeeNum FROM fee WHERE CodeNum IN(" + String.Join(",", listCodeNums) + ")";
                List <long> listFeeNums = Db.GetListLong(command);
                Fees.DeleteMany(listFeeNums);
                command = "DELETE FROM proccodenote WHERE CodeNum IN(" + String.Join(",", listCodeNums) + ")";
                Db.NonQ(command);
                command = "DELETE FROM procedurecode WHERE CodeNum IN(" + String.Join(",", listCodeNums) + ")";
                Db.NonQ(command);
            }
            //then, move any other T codes to obsolete category
            command = @"SELECT DISTINCT ProcCat FROM procedurecode,definition 
				WHERE procedurecode.ProcCode LIKE 'T%'
				AND definition.IsHidden=0
				AND procedurecode.ProcCat=definition.DefNum"                ;
            table   = Db.GetTable(command);
            long catNum = Defs.GetByExactName(DefCat.ProcCodeCats, "Obsolete");         //check to make sure an Obsolete category exists.
            Def  def;

            if (catNum != 0)           //if a category exists with that name
            {
                def = Defs.GetDef(DefCat.ProcCodeCats, catNum);
                if (!def.IsHidden)
                {
                    def.IsHidden = true;
                    Defs.Update(def);
                    Defs.RefreshCache();
                }
            }
            if (catNum == 0)
            {
                List <Def> listDefs = Defs.GetDefsForCategory(DefCat.ProcCodeCats);
                def           = new Def();
                def.Category  = DefCat.ProcCodeCats;
                def.ItemName  = "Obsolete";
                def.ItemOrder = listDefs.Count;
                def.IsHidden  = true;
                Defs.Insert(def);
                Defs.RefreshCache();
                catNum = def.DefNum;
            }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                command = "UPDATE procedurecode SET ProcCat=" + POut.Long(catNum)
                          + " WHERE ProcCat=" + table.Rows[i][0].ToString()
                          + " AND procedurecode.ProcCode LIKE 'T%'";
                Db.NonQ(command);
            }
            //finally, set Never Used category to be hidden.  This isn't really part of clearing Tcodes, but is required
            //because many customers won't have that category hidden
            catNum = Defs.GetByExactName(DefCat.ProcCodeCats, "Never Used");
            if (catNum != 0)           //if a category exists with that name
            {
                def = Defs.GetDef(DefCat.ProcCodeCats, catNum);
                if (!def.IsHidden)
                {
                    def.IsHidden = true;
                    Defs.Update(def);
                    Defs.RefreshCache();
                }
            }
        }