///<summary></summary> public static void SetOrder(int mySelNum, int myItemOrder, Def[] list) { //No need to check RemotingRole; no call to db. Def def = list[mySelNum]; def.ItemOrder = myItemOrder; //Cur=temp; Defs.Update(def); }
///<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(); } } }
///<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(); } } }
///<summary></summary> public static void HideDef(Def def) { //No need to check RemotingRole; no call to db. def.IsHidden = true; Defs.Update(def); }