コード例 #1
0
ファイル: RecallTypes.cs プロジェクト: royedwards/DRDNet
        ///<summary>Gets a list of all active recall types.  Those without triggers are excluded.  Perio and Prophy are both included.  One of them should later be removed from the collection.</summary>
        public static List <RecallType> GetActive()
        {
            //No need to check RemotingRole; no call to db.
            List <RecallType>    retVal = new List <RecallType>();
            List <RecallTrigger> triggers;
            List <RecallType>    listRecallTypes = RecallTypes.GetDeepCopy();

            for (int i = 0; i < listRecallTypes.Count; i++)
            {
                triggers = RecallTriggers.GetForType(listRecallTypes[i].RecallTypeNum);
                if (triggers.Count > 0)
                {
                    retVal.Add(listRecallTypes[i].Copy());
                }
            }
            return(retVal);
        }
コード例 #2
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();
                }
            }
        }