Пример #1
0
 ///<summary>Inserts one EhrTrigger into the database.  Returns the new priKey.</summary>
 public static long Insert(EhrTrigger ehrTrigger)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         ehrTrigger.EhrTriggerNum = DbHelper.GetNextOracleKey("ehrtrigger", "EhrTriggerNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(ehrTrigger, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     ehrTrigger.EhrTriggerNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(ehrTrigger, false));
     }
 }
Пример #2
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<EhrTrigger> TableToList(DataTable table){
			List<EhrTrigger> retVal=new List<EhrTrigger>();
			EhrTrigger ehrTrigger;
			for(int i=0;i<table.Rows.Count;i++) {
				ehrTrigger=new EhrTrigger();
				ehrTrigger.EhrTriggerNum    = PIn.Long  (table.Rows[i]["EhrTriggerNum"].ToString());
				ehrTrigger.Description      = PIn.String(table.Rows[i]["Description"].ToString());
				ehrTrigger.ProblemSnomedList= PIn.String(table.Rows[i]["ProblemSnomedList"].ToString());
				ehrTrigger.ProblemIcd9List  = PIn.String(table.Rows[i]["ProblemIcd9List"].ToString());
				ehrTrigger.ProblemIcd10List = PIn.String(table.Rows[i]["ProblemIcd10List"].ToString());
				ehrTrigger.ProblemDefNumList= PIn.String(table.Rows[i]["ProblemDefNumList"].ToString());
				ehrTrigger.MedicationNumList= PIn.String(table.Rows[i]["MedicationNumList"].ToString());
				ehrTrigger.RxCuiList        = PIn.String(table.Rows[i]["RxCuiList"].ToString());
				ehrTrigger.CvxList          = PIn.String(table.Rows[i]["CvxList"].ToString());
				ehrTrigger.AllergyDefNumList= PIn.String(table.Rows[i]["AllergyDefNumList"].ToString());
				ehrTrigger.DemographicsList = PIn.String(table.Rows[i]["DemographicsList"].ToString());
				ehrTrigger.LabLoincList     = PIn.String(table.Rows[i]["LabLoincList"].ToString());
				ehrTrigger.VitalLoincList   = PIn.String(table.Rows[i]["VitalLoincList"].ToString());
				ehrTrigger.Instructions     = PIn.String(table.Rows[i]["Instructions"].ToString());
				ehrTrigger.Bibliography     = PIn.String(table.Rows[i]["Bibliography"].ToString());
				ehrTrigger.Cardinality      = (MatchCardinality)PIn.Int(table.Rows[i]["Cardinality"].ToString());
				retVal.Add(ehrTrigger);
			}
			return retVal;
		}
Пример #3
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <EhrTrigger> TableToList(DataTable table)
        {
            List <EhrTrigger> retVal = new List <EhrTrigger>();
            EhrTrigger        ehrTrigger;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                ehrTrigger = new EhrTrigger();
                ehrTrigger.EhrTriggerNum     = PIn.Long(table.Rows[i]["EhrTriggerNum"].ToString());
                ehrTrigger.Description       = PIn.String(table.Rows[i]["Description"].ToString());
                ehrTrigger.ProblemSnomedList = PIn.String(table.Rows[i]["ProblemSnomedList"].ToString());
                ehrTrigger.ProblemIcd9List   = PIn.String(table.Rows[i]["ProblemIcd9List"].ToString());
                ehrTrigger.ProblemIcd10List  = PIn.String(table.Rows[i]["ProblemIcd10List"].ToString());
                ehrTrigger.ProblemDefNumList = PIn.String(table.Rows[i]["ProblemDefNumList"].ToString());
                ehrTrigger.MedicationNumList = PIn.String(table.Rows[i]["MedicationNumList"].ToString());
                ehrTrigger.RxCuiList         = PIn.String(table.Rows[i]["RxCuiList"].ToString());
                ehrTrigger.CvxList           = PIn.String(table.Rows[i]["CvxList"].ToString());
                ehrTrigger.AllergyDefNumList = PIn.String(table.Rows[i]["AllergyDefNumList"].ToString());
                ehrTrigger.DemographicsList  = PIn.String(table.Rows[i]["DemographicsList"].ToString());
                ehrTrigger.LabLoincList      = PIn.String(table.Rows[i]["LabLoincList"].ToString());
                ehrTrigger.VitalLoincList    = PIn.String(table.Rows[i]["VitalLoincList"].ToString());
                ehrTrigger.Instructions      = PIn.String(table.Rows[i]["Instructions"].ToString());
                ehrTrigger.Bibliography      = PIn.String(table.Rows[i]["Bibliography"].ToString());
                ehrTrigger.Cardinality       = (MatchCardinality)PIn.Int(table.Rows[i]["Cardinality"].ToString());
                retVal.Add(ehrTrigger);
            }
            return(retVal);
        }
Пример #4
0
 ///<summary>Inserts one EhrTrigger into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(EhrTrigger ehrTrigger)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(ehrTrigger, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             ehrTrigger.EhrTriggerNum = DbHelper.GetNextOracleKey("ehrtrigger", "EhrTriggerNum");                  //Cacheless method
         }
         return(InsertNoCache(ehrTrigger, true));
     }
 }
Пример #5
0
        ///<summary>Inserts one EhrTrigger into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(EhrTrigger ehrTrigger, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                ehrTrigger.EhrTriggerNum = ReplicationServers.GetKey("ehrtrigger", "EhrTriggerNum");
            }
            string command = "INSERT INTO ehrtrigger (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "EhrTriggerNum,";
            }
            command += "Description,ProblemSnomedList,ProblemIcd9List,ProblemIcd10List,ProblemDefNumList,MedicationNumList,RxCuiList,CvxList,AllergyDefNumList,DemographicsList,LabLoincList,VitalLoincList,Instructions,Bibliography,Cardinality) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(ehrTrigger.EhrTriggerNum) + ",";
            }
            command +=
                "'" + POut.String(ehrTrigger.Description) + "',"
                + "'" + POut.String(ehrTrigger.ProblemSnomedList) + "',"
                + "'" + POut.String(ehrTrigger.ProblemIcd9List) + "',"
                + "'" + POut.String(ehrTrigger.ProblemIcd10List) + "',"
                + "'" + POut.String(ehrTrigger.ProblemDefNumList) + "',"
                + "'" + POut.String(ehrTrigger.MedicationNumList) + "',"
                + "'" + POut.String(ehrTrigger.RxCuiList) + "',"
                + "'" + POut.String(ehrTrigger.CvxList) + "',"
                + "'" + POut.String(ehrTrigger.AllergyDefNumList) + "',"
                + "'" + POut.String(ehrTrigger.DemographicsList) + "',"
                + "'" + POut.String(ehrTrigger.LabLoincList) + "',"
                + "'" + POut.String(ehrTrigger.VitalLoincList) + "',"
                + "'" + POut.String(ehrTrigger.Instructions) + "',"
                + "'" + POut.String(ehrTrigger.Bibliography) + "',"
                + POut.Int((int)ehrTrigger.Cardinality) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                ehrTrigger.EhrTriggerNum = Db.NonQ(command, true);
            }
            return(ehrTrigger.EhrTriggerNum);
        }
Пример #6
0
        ///<summary>Updates one EhrTrigger in the database.</summary>
        public static void Update(EhrTrigger ehrTrigger)
        {
            string command = "UPDATE ehrtrigger SET "
                             + "Description      = '" + POut.String(ehrTrigger.Description) + "', "
                             + "ProblemSnomedList= '" + POut.String(ehrTrigger.ProblemSnomedList) + "', "
                             + "ProblemIcd9List  = '" + POut.String(ehrTrigger.ProblemIcd9List) + "', "
                             + "ProblemIcd10List = '" + POut.String(ehrTrigger.ProblemIcd10List) + "', "
                             + "ProblemDefNumList= '" + POut.String(ehrTrigger.ProblemDefNumList) + "', "
                             + "MedicationNumList= '" + POut.String(ehrTrigger.MedicationNumList) + "', "
                             + "RxCuiList        = '" + POut.String(ehrTrigger.RxCuiList) + "', "
                             + "CvxList          = '" + POut.String(ehrTrigger.CvxList) + "', "
                             + "AllergyDefNumList= '" + POut.String(ehrTrigger.AllergyDefNumList) + "', "
                             + "DemographicsList = '" + POut.String(ehrTrigger.DemographicsList) + "', "
                             + "LabLoincList     = '" + POut.String(ehrTrigger.LabLoincList) + "', "
                             + "VitalLoincList   = '" + POut.String(ehrTrigger.VitalLoincList) + "', "
                             + "Instructions     = '" + POut.String(ehrTrigger.Instructions) + "', "
                             + "Bibliography     = '" + POut.String(ehrTrigger.Bibliography) + "', "
                             + "Cardinality      =  " + POut.Int((int)ehrTrigger.Cardinality) + " "
                             + "WHERE EhrTriggerNum = " + POut.Long(ehrTrigger.EhrTriggerNum);

            Db.NonQ(command);
        }
Пример #7
0
		///<summary>Inserts one EhrTrigger into the database.  Returns the new priKey.</summary>
		public static long Insert(EhrTrigger ehrTrigger){
			if(DataConnection.DBtype==DatabaseType.Oracle) {
				ehrTrigger.EhrTriggerNum=DbHelper.GetNextOracleKey("ehrtrigger","EhrTriggerNum");
				int loopcount=0;
				while(loopcount<100){
					try {
						return Insert(ehrTrigger,true);
					}
					catch(Oracle.DataAccess.Client.OracleException ex){
						if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
							ehrTrigger.EhrTriggerNum++;
							loopcount++;
						}
						else{
							throw ex;
						}
					}
				}
				throw new ApplicationException("Insert failed.  Could not generate primary key.");
			}
			else {
				return Insert(ehrTrigger,false);
			}
		}
Пример #8
0
        ///<summary>Updates one EhrTrigger in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
        public static void Update(EhrTrigger ehrTrigger, EhrTrigger oldEhrTrigger)
        {
            string command = "";

            if (ehrTrigger.Description != oldEhrTrigger.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(ehrTrigger.Description) + "'";
            }
            if (ehrTrigger.ProblemSnomedList != oldEhrTrigger.ProblemSnomedList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProblemSnomedList = '" + POut.String(ehrTrigger.ProblemSnomedList) + "'";
            }
            if (ehrTrigger.ProblemIcd9List != oldEhrTrigger.ProblemIcd9List)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProblemIcd9List = '" + POut.String(ehrTrigger.ProblemIcd9List) + "'";
            }
            if (ehrTrigger.ProblemIcd10List != oldEhrTrigger.ProblemIcd10List)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProblemIcd10List = '" + POut.String(ehrTrigger.ProblemIcd10List) + "'";
            }
            if (ehrTrigger.ProblemDefNumList != oldEhrTrigger.ProblemDefNumList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProblemDefNumList = '" + POut.String(ehrTrigger.ProblemDefNumList) + "'";
            }
            if (ehrTrigger.MedicationNumList != oldEhrTrigger.MedicationNumList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MedicationNumList = '" + POut.String(ehrTrigger.MedicationNumList) + "'";
            }
            if (ehrTrigger.RxCuiList != oldEhrTrigger.RxCuiList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RxCuiList = '" + POut.String(ehrTrigger.RxCuiList) + "'";
            }
            if (ehrTrigger.CvxList != oldEhrTrigger.CvxList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CvxList = '" + POut.String(ehrTrigger.CvxList) + "'";
            }
            if (ehrTrigger.AllergyDefNumList != oldEhrTrigger.AllergyDefNumList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AllergyDefNumList = '" + POut.String(ehrTrigger.AllergyDefNumList) + "'";
            }
            if (ehrTrigger.DemographicsList != oldEhrTrigger.DemographicsList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DemographicsList = '" + POut.String(ehrTrigger.DemographicsList) + "'";
            }
            if (ehrTrigger.LabLoincList != oldEhrTrigger.LabLoincList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "LabLoincList = '" + POut.String(ehrTrigger.LabLoincList) + "'";
            }
            if (ehrTrigger.VitalLoincList != oldEhrTrigger.VitalLoincList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "VitalLoincList = '" + POut.String(ehrTrigger.VitalLoincList) + "'";
            }
            if (ehrTrigger.Instructions != oldEhrTrigger.Instructions)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Instructions = '" + POut.String(ehrTrigger.Instructions) + "'";
            }
            if (ehrTrigger.Bibliography != oldEhrTrigger.Bibliography)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Bibliography = '" + POut.String(ehrTrigger.Bibliography) + "'";
            }
            if (ehrTrigger.Cardinality != oldEhrTrigger.Cardinality)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Cardinality = " + POut.Int((int)ehrTrigger.Cardinality) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE ehrtrigger SET " + command
                      + " WHERE EhrTriggerNum = " + POut.Long(ehrTrigger.EhrTriggerNum);
            Db.NonQ(command);
        }
Пример #9
0
 ///<summary>Returns true if Update(EhrTrigger,EhrTrigger) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(EhrTrigger ehrTrigger, EhrTrigger oldEhrTrigger)
 {
     if (ehrTrigger.Description != oldEhrTrigger.Description)
     {
         return(true);
     }
     if (ehrTrigger.ProblemSnomedList != oldEhrTrigger.ProblemSnomedList)
     {
         return(true);
     }
     if (ehrTrigger.ProblemIcd9List != oldEhrTrigger.ProblemIcd9List)
     {
         return(true);
     }
     if (ehrTrigger.ProblemIcd10List != oldEhrTrigger.ProblemIcd10List)
     {
         return(true);
     }
     if (ehrTrigger.ProblemDefNumList != oldEhrTrigger.ProblemDefNumList)
     {
         return(true);
     }
     if (ehrTrigger.MedicationNumList != oldEhrTrigger.MedicationNumList)
     {
         return(true);
     }
     if (ehrTrigger.RxCuiList != oldEhrTrigger.RxCuiList)
     {
         return(true);
     }
     if (ehrTrigger.CvxList != oldEhrTrigger.CvxList)
     {
         return(true);
     }
     if (ehrTrigger.AllergyDefNumList != oldEhrTrigger.AllergyDefNumList)
     {
         return(true);
     }
     if (ehrTrigger.DemographicsList != oldEhrTrigger.DemographicsList)
     {
         return(true);
     }
     if (ehrTrigger.LabLoincList != oldEhrTrigger.LabLoincList)
     {
         return(true);
     }
     if (ehrTrigger.VitalLoincList != oldEhrTrigger.VitalLoincList)
     {
         return(true);
     }
     if (ehrTrigger.Instructions != oldEhrTrigger.Instructions)
     {
         return(true);
     }
     if (ehrTrigger.Bibliography != oldEhrTrigger.Bibliography)
     {
         return(true);
     }
     if (ehrTrigger.Cardinality != oldEhrTrigger.Cardinality)
     {
         return(true);
     }
     return(false);
 }
Пример #10
0
        ///<summary>Updates one EhrTrigger in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
        public static bool Update(EhrTrigger ehrTrigger, EhrTrigger oldEhrTrigger)
        {
            string command = "";

            if (ehrTrigger.Description != oldEhrTrigger.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(ehrTrigger.Description) + "'";
            }
            if (ehrTrigger.ProblemSnomedList != oldEhrTrigger.ProblemSnomedList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProblemSnomedList = " + DbHelper.ParamChar + "paramProblemSnomedList";
            }
            if (ehrTrigger.ProblemIcd9List != oldEhrTrigger.ProblemIcd9List)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProblemIcd9List = " + DbHelper.ParamChar + "paramProblemIcd9List";
            }
            if (ehrTrigger.ProblemIcd10List != oldEhrTrigger.ProblemIcd10List)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProblemIcd10List = " + DbHelper.ParamChar + "paramProblemIcd10List";
            }
            if (ehrTrigger.ProblemDefNumList != oldEhrTrigger.ProblemDefNumList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProblemDefNumList = " + DbHelper.ParamChar + "paramProblemDefNumList";
            }
            if (ehrTrigger.MedicationNumList != oldEhrTrigger.MedicationNumList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MedicationNumList = " + DbHelper.ParamChar + "paramMedicationNumList";
            }
            if (ehrTrigger.RxCuiList != oldEhrTrigger.RxCuiList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RxCuiList = " + DbHelper.ParamChar + "paramRxCuiList";
            }
            if (ehrTrigger.CvxList != oldEhrTrigger.CvxList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CvxList = " + DbHelper.ParamChar + "paramCvxList";
            }
            if (ehrTrigger.AllergyDefNumList != oldEhrTrigger.AllergyDefNumList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AllergyDefNumList = " + DbHelper.ParamChar + "paramAllergyDefNumList";
            }
            if (ehrTrigger.DemographicsList != oldEhrTrigger.DemographicsList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DemographicsList = " + DbHelper.ParamChar + "paramDemographicsList";
            }
            if (ehrTrigger.LabLoincList != oldEhrTrigger.LabLoincList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "LabLoincList = " + DbHelper.ParamChar + "paramLabLoincList";
            }
            if (ehrTrigger.VitalLoincList != oldEhrTrigger.VitalLoincList)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "VitalLoincList = " + DbHelper.ParamChar + "paramVitalLoincList";
            }
            if (ehrTrigger.Instructions != oldEhrTrigger.Instructions)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Instructions = " + DbHelper.ParamChar + "paramInstructions";
            }
            if (ehrTrigger.Bibliography != oldEhrTrigger.Bibliography)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Bibliography = " + DbHelper.ParamChar + "paramBibliography";
            }
            if (ehrTrigger.Cardinality != oldEhrTrigger.Cardinality)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Cardinality = " + POut.Int((int)ehrTrigger.Cardinality) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (ehrTrigger.ProblemSnomedList == null)
            {
                ehrTrigger.ProblemSnomedList = "";
            }
            OdSqlParameter paramProblemSnomedList = new OdSqlParameter("paramProblemSnomedList", OdDbType.Text, POut.StringParam(ehrTrigger.ProblemSnomedList));

            if (ehrTrigger.ProblemIcd9List == null)
            {
                ehrTrigger.ProblemIcd9List = "";
            }
            OdSqlParameter paramProblemIcd9List = new OdSqlParameter("paramProblemIcd9List", OdDbType.Text, POut.StringParam(ehrTrigger.ProblemIcd9List));

            if (ehrTrigger.ProblemIcd10List == null)
            {
                ehrTrigger.ProblemIcd10List = "";
            }
            OdSqlParameter paramProblemIcd10List = new OdSqlParameter("paramProblemIcd10List", OdDbType.Text, POut.StringParam(ehrTrigger.ProblemIcd10List));

            if (ehrTrigger.ProblemDefNumList == null)
            {
                ehrTrigger.ProblemDefNumList = "";
            }
            OdSqlParameter paramProblemDefNumList = new OdSqlParameter("paramProblemDefNumList", OdDbType.Text, POut.StringParam(ehrTrigger.ProblemDefNumList));

            if (ehrTrigger.MedicationNumList == null)
            {
                ehrTrigger.MedicationNumList = "";
            }
            OdSqlParameter paramMedicationNumList = new OdSqlParameter("paramMedicationNumList", OdDbType.Text, POut.StringParam(ehrTrigger.MedicationNumList));

            if (ehrTrigger.RxCuiList == null)
            {
                ehrTrigger.RxCuiList = "";
            }
            OdSqlParameter paramRxCuiList = new OdSqlParameter("paramRxCuiList", OdDbType.Text, POut.StringParam(ehrTrigger.RxCuiList));

            if (ehrTrigger.CvxList == null)
            {
                ehrTrigger.CvxList = "";
            }
            OdSqlParameter paramCvxList = new OdSqlParameter("paramCvxList", OdDbType.Text, POut.StringParam(ehrTrigger.CvxList));

            if (ehrTrigger.AllergyDefNumList == null)
            {
                ehrTrigger.AllergyDefNumList = "";
            }
            OdSqlParameter paramAllergyDefNumList = new OdSqlParameter("paramAllergyDefNumList", OdDbType.Text, POut.StringParam(ehrTrigger.AllergyDefNumList));

            if (ehrTrigger.DemographicsList == null)
            {
                ehrTrigger.DemographicsList = "";
            }
            OdSqlParameter paramDemographicsList = new OdSqlParameter("paramDemographicsList", OdDbType.Text, POut.StringParam(ehrTrigger.DemographicsList));

            if (ehrTrigger.LabLoincList == null)
            {
                ehrTrigger.LabLoincList = "";
            }
            OdSqlParameter paramLabLoincList = new OdSqlParameter("paramLabLoincList", OdDbType.Text, POut.StringParam(ehrTrigger.LabLoincList));

            if (ehrTrigger.VitalLoincList == null)
            {
                ehrTrigger.VitalLoincList = "";
            }
            OdSqlParameter paramVitalLoincList = new OdSqlParameter("paramVitalLoincList", OdDbType.Text, POut.StringParam(ehrTrigger.VitalLoincList));

            if (ehrTrigger.Instructions == null)
            {
                ehrTrigger.Instructions = "";
            }
            OdSqlParameter paramInstructions = new OdSqlParameter("paramInstructions", OdDbType.Text, POut.StringParam(ehrTrigger.Instructions));

            if (ehrTrigger.Bibliography == null)
            {
                ehrTrigger.Bibliography = "";
            }
            OdSqlParameter paramBibliography = new OdSqlParameter("paramBibliography", OdDbType.Text, POut.StringParam(ehrTrigger.Bibliography));

            command = "UPDATE ehrtrigger SET " + command
                      + " WHERE EhrTriggerNum = " + POut.Long(ehrTrigger.EhrTriggerNum);
            Db.NonQ(command, paramProblemSnomedList, paramProblemIcd9List, paramProblemIcd10List, paramProblemDefNumList, paramMedicationNumList, paramRxCuiList, paramCvxList, paramAllergyDefNumList, paramDemographicsList, paramLabLoincList, paramVitalLoincList, paramInstructions, paramBibliography);
            return(true);
        }
Пример #11
0
        ///<summary>Updates one EhrTrigger in the database.</summary>
        public static void Update(EhrTrigger ehrTrigger)
        {
            string command = "UPDATE ehrtrigger SET "
                             + "Description      = '" + POut.String(ehrTrigger.Description) + "', "
                             + "ProblemSnomedList=  " + DbHelper.ParamChar + "paramProblemSnomedList, "
                             + "ProblemIcd9List  =  " + DbHelper.ParamChar + "paramProblemIcd9List, "
                             + "ProblemIcd10List =  " + DbHelper.ParamChar + "paramProblemIcd10List, "
                             + "ProblemDefNumList=  " + DbHelper.ParamChar + "paramProblemDefNumList, "
                             + "MedicationNumList=  " + DbHelper.ParamChar + "paramMedicationNumList, "
                             + "RxCuiList        =  " + DbHelper.ParamChar + "paramRxCuiList, "
                             + "CvxList          =  " + DbHelper.ParamChar + "paramCvxList, "
                             + "AllergyDefNumList=  " + DbHelper.ParamChar + "paramAllergyDefNumList, "
                             + "DemographicsList =  " + DbHelper.ParamChar + "paramDemographicsList, "
                             + "LabLoincList     =  " + DbHelper.ParamChar + "paramLabLoincList, "
                             + "VitalLoincList   =  " + DbHelper.ParamChar + "paramVitalLoincList, "
                             + "Instructions     =  " + DbHelper.ParamChar + "paramInstructions, "
                             + "Bibliography     =  " + DbHelper.ParamChar + "paramBibliography, "
                             + "Cardinality      =  " + POut.Int((int)ehrTrigger.Cardinality) + " "
                             + "WHERE EhrTriggerNum = " + POut.Long(ehrTrigger.EhrTriggerNum);

            if (ehrTrigger.ProblemSnomedList == null)
            {
                ehrTrigger.ProblemSnomedList = "";
            }
            OdSqlParameter paramProblemSnomedList = new OdSqlParameter("paramProblemSnomedList", OdDbType.Text, POut.StringParam(ehrTrigger.ProblemSnomedList));

            if (ehrTrigger.ProblemIcd9List == null)
            {
                ehrTrigger.ProblemIcd9List = "";
            }
            OdSqlParameter paramProblemIcd9List = new OdSqlParameter("paramProblemIcd9List", OdDbType.Text, POut.StringParam(ehrTrigger.ProblemIcd9List));

            if (ehrTrigger.ProblemIcd10List == null)
            {
                ehrTrigger.ProblemIcd10List = "";
            }
            OdSqlParameter paramProblemIcd10List = new OdSqlParameter("paramProblemIcd10List", OdDbType.Text, POut.StringParam(ehrTrigger.ProblemIcd10List));

            if (ehrTrigger.ProblemDefNumList == null)
            {
                ehrTrigger.ProblemDefNumList = "";
            }
            OdSqlParameter paramProblemDefNumList = new OdSqlParameter("paramProblemDefNumList", OdDbType.Text, POut.StringParam(ehrTrigger.ProblemDefNumList));

            if (ehrTrigger.MedicationNumList == null)
            {
                ehrTrigger.MedicationNumList = "";
            }
            OdSqlParameter paramMedicationNumList = new OdSqlParameter("paramMedicationNumList", OdDbType.Text, POut.StringParam(ehrTrigger.MedicationNumList));

            if (ehrTrigger.RxCuiList == null)
            {
                ehrTrigger.RxCuiList = "";
            }
            OdSqlParameter paramRxCuiList = new OdSqlParameter("paramRxCuiList", OdDbType.Text, POut.StringParam(ehrTrigger.RxCuiList));

            if (ehrTrigger.CvxList == null)
            {
                ehrTrigger.CvxList = "";
            }
            OdSqlParameter paramCvxList = new OdSqlParameter("paramCvxList", OdDbType.Text, POut.StringParam(ehrTrigger.CvxList));

            if (ehrTrigger.AllergyDefNumList == null)
            {
                ehrTrigger.AllergyDefNumList = "";
            }
            OdSqlParameter paramAllergyDefNumList = new OdSqlParameter("paramAllergyDefNumList", OdDbType.Text, POut.StringParam(ehrTrigger.AllergyDefNumList));

            if (ehrTrigger.DemographicsList == null)
            {
                ehrTrigger.DemographicsList = "";
            }
            OdSqlParameter paramDemographicsList = new OdSqlParameter("paramDemographicsList", OdDbType.Text, POut.StringParam(ehrTrigger.DemographicsList));

            if (ehrTrigger.LabLoincList == null)
            {
                ehrTrigger.LabLoincList = "";
            }
            OdSqlParameter paramLabLoincList = new OdSqlParameter("paramLabLoincList", OdDbType.Text, POut.StringParam(ehrTrigger.LabLoincList));

            if (ehrTrigger.VitalLoincList == null)
            {
                ehrTrigger.VitalLoincList = "";
            }
            OdSqlParameter paramVitalLoincList = new OdSqlParameter("paramVitalLoincList", OdDbType.Text, POut.StringParam(ehrTrigger.VitalLoincList));

            if (ehrTrigger.Instructions == null)
            {
                ehrTrigger.Instructions = "";
            }
            OdSqlParameter paramInstructions = new OdSqlParameter("paramInstructions", OdDbType.Text, POut.StringParam(ehrTrigger.Instructions));

            if (ehrTrigger.Bibliography == null)
            {
                ehrTrigger.Bibliography = "";
            }
            OdSqlParameter paramBibliography = new OdSqlParameter("paramBibliography", OdDbType.Text, POut.StringParam(ehrTrigger.Bibliography));

            Db.NonQ(command, paramProblemSnomedList, paramProblemIcd9List, paramProblemIcd10List, paramProblemDefNumList, paramMedicationNumList, paramRxCuiList, paramCvxList, paramAllergyDefNumList, paramDemographicsList, paramLabLoincList, paramVitalLoincList, paramInstructions, paramBibliography);
        }
Пример #12
0
        ///<summary>Inserts one EhrTrigger into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(EhrTrigger ehrTrigger, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO ehrtrigger (";

            if (!useExistingPK && isRandomKeys)
            {
                ehrTrigger.EhrTriggerNum = ReplicationServers.GetKeyNoCache("ehrtrigger", "EhrTriggerNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "EhrTriggerNum,";
            }
            command += "Description,ProblemSnomedList,ProblemIcd9List,ProblemIcd10List,ProblemDefNumList,MedicationNumList,RxCuiList,CvxList,AllergyDefNumList,DemographicsList,LabLoincList,VitalLoincList,Instructions,Bibliography,Cardinality) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(ehrTrigger.EhrTriggerNum) + ",";
            }
            command +=
                "'" + POut.String(ehrTrigger.Description) + "',"
                + DbHelper.ParamChar + "paramProblemSnomedList,"
                + DbHelper.ParamChar + "paramProblemIcd9List,"
                + DbHelper.ParamChar + "paramProblemIcd10List,"
                + DbHelper.ParamChar + "paramProblemDefNumList,"
                + DbHelper.ParamChar + "paramMedicationNumList,"
                + DbHelper.ParamChar + "paramRxCuiList,"
                + DbHelper.ParamChar + "paramCvxList,"
                + DbHelper.ParamChar + "paramAllergyDefNumList,"
                + DbHelper.ParamChar + "paramDemographicsList,"
                + DbHelper.ParamChar + "paramLabLoincList,"
                + DbHelper.ParamChar + "paramVitalLoincList,"
                + DbHelper.ParamChar + "paramInstructions,"
                + DbHelper.ParamChar + "paramBibliography,"
                + POut.Int((int)ehrTrigger.Cardinality) + ")";
            if (ehrTrigger.ProblemSnomedList == null)
            {
                ehrTrigger.ProblemSnomedList = "";
            }
            OdSqlParameter paramProblemSnomedList = new OdSqlParameter("paramProblemSnomedList", OdDbType.Text, POut.StringParam(ehrTrigger.ProblemSnomedList));

            if (ehrTrigger.ProblemIcd9List == null)
            {
                ehrTrigger.ProblemIcd9List = "";
            }
            OdSqlParameter paramProblemIcd9List = new OdSqlParameter("paramProblemIcd9List", OdDbType.Text, POut.StringParam(ehrTrigger.ProblemIcd9List));

            if (ehrTrigger.ProblemIcd10List == null)
            {
                ehrTrigger.ProblemIcd10List = "";
            }
            OdSqlParameter paramProblemIcd10List = new OdSqlParameter("paramProblemIcd10List", OdDbType.Text, POut.StringParam(ehrTrigger.ProblemIcd10List));

            if (ehrTrigger.ProblemDefNumList == null)
            {
                ehrTrigger.ProblemDefNumList = "";
            }
            OdSqlParameter paramProblemDefNumList = new OdSqlParameter("paramProblemDefNumList", OdDbType.Text, POut.StringParam(ehrTrigger.ProblemDefNumList));

            if (ehrTrigger.MedicationNumList == null)
            {
                ehrTrigger.MedicationNumList = "";
            }
            OdSqlParameter paramMedicationNumList = new OdSqlParameter("paramMedicationNumList", OdDbType.Text, POut.StringParam(ehrTrigger.MedicationNumList));

            if (ehrTrigger.RxCuiList == null)
            {
                ehrTrigger.RxCuiList = "";
            }
            OdSqlParameter paramRxCuiList = new OdSqlParameter("paramRxCuiList", OdDbType.Text, POut.StringParam(ehrTrigger.RxCuiList));

            if (ehrTrigger.CvxList == null)
            {
                ehrTrigger.CvxList = "";
            }
            OdSqlParameter paramCvxList = new OdSqlParameter("paramCvxList", OdDbType.Text, POut.StringParam(ehrTrigger.CvxList));

            if (ehrTrigger.AllergyDefNumList == null)
            {
                ehrTrigger.AllergyDefNumList = "";
            }
            OdSqlParameter paramAllergyDefNumList = new OdSqlParameter("paramAllergyDefNumList", OdDbType.Text, POut.StringParam(ehrTrigger.AllergyDefNumList));

            if (ehrTrigger.DemographicsList == null)
            {
                ehrTrigger.DemographicsList = "";
            }
            OdSqlParameter paramDemographicsList = new OdSqlParameter("paramDemographicsList", OdDbType.Text, POut.StringParam(ehrTrigger.DemographicsList));

            if (ehrTrigger.LabLoincList == null)
            {
                ehrTrigger.LabLoincList = "";
            }
            OdSqlParameter paramLabLoincList = new OdSqlParameter("paramLabLoincList", OdDbType.Text, POut.StringParam(ehrTrigger.LabLoincList));

            if (ehrTrigger.VitalLoincList == null)
            {
                ehrTrigger.VitalLoincList = "";
            }
            OdSqlParameter paramVitalLoincList = new OdSqlParameter("paramVitalLoincList", OdDbType.Text, POut.StringParam(ehrTrigger.VitalLoincList));

            if (ehrTrigger.Instructions == null)
            {
                ehrTrigger.Instructions = "";
            }
            OdSqlParameter paramInstructions = new OdSqlParameter("paramInstructions", OdDbType.Text, POut.StringParam(ehrTrigger.Instructions));

            if (ehrTrigger.Bibliography == null)
            {
                ehrTrigger.Bibliography = "";
            }
            OdSqlParameter paramBibliography = new OdSqlParameter("paramBibliography", OdDbType.Text, POut.StringParam(ehrTrigger.Bibliography));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramProblemSnomedList, paramProblemIcd9List, paramProblemIcd10List, paramProblemDefNumList, paramMedicationNumList, paramRxCuiList, paramCvxList, paramAllergyDefNumList, paramDemographicsList, paramLabLoincList, paramVitalLoincList, paramInstructions, paramBibliography);
            }
            else
            {
                ehrTrigger.EhrTriggerNum = Db.NonQ(command, true, "EhrTriggerNum", "ehrTrigger", paramProblemSnomedList, paramProblemIcd9List, paramProblemIcd10List, paramProblemDefNumList, paramMedicationNumList, paramRxCuiList, paramCvxList, paramAllergyDefNumList, paramDemographicsList, paramLabLoincList, paramVitalLoincList, paramInstructions, paramBibliography);
            }
            return(ehrTrigger.EhrTriggerNum);
        }
Пример #13
0
		///<summary>Inserts one EhrTrigger into the database.  Provides option to use the existing priKey.</summary>
		public static long Insert(EhrTrigger ehrTrigger,bool useExistingPK){
			if(!useExistingPK && PrefC.RandomKeys) {
				ehrTrigger.EhrTriggerNum=ReplicationServers.GetKey("ehrtrigger","EhrTriggerNum");
			}
			string command="INSERT INTO ehrtrigger (";
			if(useExistingPK || PrefC.RandomKeys) {
				command+="EhrTriggerNum,";
			}
			command+="Description,ProblemSnomedList,ProblemIcd9List,ProblemIcd10List,ProblemDefNumList,MedicationNumList,RxCuiList,CvxList,AllergyDefNumList,DemographicsList,LabLoincList,VitalLoincList,Instructions,Bibliography,Cardinality) VALUES(";
			if(useExistingPK || PrefC.RandomKeys) {
				command+=POut.Long(ehrTrigger.EhrTriggerNum)+",";
			}
			command+=
				 "'"+POut.String(ehrTrigger.Description)+"',"
				+"'"+POut.String(ehrTrigger.ProblemSnomedList)+"',"
				+"'"+POut.String(ehrTrigger.ProblemIcd9List)+"',"
				+"'"+POut.String(ehrTrigger.ProblemIcd10List)+"',"
				+"'"+POut.String(ehrTrigger.ProblemDefNumList)+"',"
				+"'"+POut.String(ehrTrigger.MedicationNumList)+"',"
				+"'"+POut.String(ehrTrigger.RxCuiList)+"',"
				+"'"+POut.String(ehrTrigger.CvxList)+"',"
				+"'"+POut.String(ehrTrigger.AllergyDefNumList)+"',"
				+"'"+POut.String(ehrTrigger.DemographicsList)+"',"
				+"'"+POut.String(ehrTrigger.LabLoincList)+"',"
				+"'"+POut.String(ehrTrigger.VitalLoincList)+"',"
				+"'"+POut.String(ehrTrigger.Instructions)+"',"
				+"'"+POut.String(ehrTrigger.Bibliography)+"',"
				+    POut.Int   ((int)ehrTrigger.Cardinality)+")";
			if(useExistingPK || PrefC.RandomKeys) {
				Db.NonQ(command);
			}
			else {
				ehrTrigger.EhrTriggerNum=Db.NonQ(command,true);
			}
			return ehrTrigger.EhrTriggerNum;
		}
Пример #14
0
		///<summary>Updates one EhrTrigger in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
		public static void Update(EhrTrigger ehrTrigger,EhrTrigger oldEhrTrigger){
			string command="";
			if(ehrTrigger.Description != oldEhrTrigger.Description) {
				if(command!=""){ command+=",";}
				command+="Description = '"+POut.String(ehrTrigger.Description)+"'";
			}
			if(ehrTrigger.ProblemSnomedList != oldEhrTrigger.ProblemSnomedList) {
				if(command!=""){ command+=",";}
				command+="ProblemSnomedList = '"+POut.String(ehrTrigger.ProblemSnomedList)+"'";
			}
			if(ehrTrigger.ProblemIcd9List != oldEhrTrigger.ProblemIcd9List) {
				if(command!=""){ command+=",";}
				command+="ProblemIcd9List = '"+POut.String(ehrTrigger.ProblemIcd9List)+"'";
			}
			if(ehrTrigger.ProblemIcd10List != oldEhrTrigger.ProblemIcd10List) {
				if(command!=""){ command+=",";}
				command+="ProblemIcd10List = '"+POut.String(ehrTrigger.ProblemIcd10List)+"'";
			}
			if(ehrTrigger.ProblemDefNumList != oldEhrTrigger.ProblemDefNumList) {
				if(command!=""){ command+=",";}
				command+="ProblemDefNumList = '"+POut.String(ehrTrigger.ProblemDefNumList)+"'";
			}
			if(ehrTrigger.MedicationNumList != oldEhrTrigger.MedicationNumList) {
				if(command!=""){ command+=",";}
				command+="MedicationNumList = '"+POut.String(ehrTrigger.MedicationNumList)+"'";
			}
			if(ehrTrigger.RxCuiList != oldEhrTrigger.RxCuiList) {
				if(command!=""){ command+=",";}
				command+="RxCuiList = '"+POut.String(ehrTrigger.RxCuiList)+"'";
			}
			if(ehrTrigger.CvxList != oldEhrTrigger.CvxList) {
				if(command!=""){ command+=",";}
				command+="CvxList = '"+POut.String(ehrTrigger.CvxList)+"'";
			}
			if(ehrTrigger.AllergyDefNumList != oldEhrTrigger.AllergyDefNumList) {
				if(command!=""){ command+=",";}
				command+="AllergyDefNumList = '"+POut.String(ehrTrigger.AllergyDefNumList)+"'";
			}
			if(ehrTrigger.DemographicsList != oldEhrTrigger.DemographicsList) {
				if(command!=""){ command+=",";}
				command+="DemographicsList = '"+POut.String(ehrTrigger.DemographicsList)+"'";
			}
			if(ehrTrigger.LabLoincList != oldEhrTrigger.LabLoincList) {
				if(command!=""){ command+=",";}
				command+="LabLoincList = '"+POut.String(ehrTrigger.LabLoincList)+"'";
			}
			if(ehrTrigger.VitalLoincList != oldEhrTrigger.VitalLoincList) {
				if(command!=""){ command+=",";}
				command+="VitalLoincList = '"+POut.String(ehrTrigger.VitalLoincList)+"'";
			}
			if(ehrTrigger.Instructions != oldEhrTrigger.Instructions) {
				if(command!=""){ command+=",";}
				command+="Instructions = '"+POut.String(ehrTrigger.Instructions)+"'";
			}
			if(ehrTrigger.Bibliography != oldEhrTrigger.Bibliography) {
				if(command!=""){ command+=",";}
				command+="Bibliography = '"+POut.String(ehrTrigger.Bibliography)+"'";
			}
			if(ehrTrigger.Cardinality != oldEhrTrigger.Cardinality) {
				if(command!=""){ command+=",";}
				command+="Cardinality = "+POut.Int   ((int)ehrTrigger.Cardinality)+"";
			}
			if(command==""){
				return;
			}
			command="UPDATE ehrtrigger SET "+command
				+" WHERE EhrTriggerNum = "+POut.Long(ehrTrigger.EhrTriggerNum);
			Db.NonQ(command);
		}
Пример #15
0
		///<summary>Updates one EhrTrigger in the database.</summary>
		public static void Update(EhrTrigger ehrTrigger){
			string command="UPDATE ehrtrigger SET "
				+"Description      = '"+POut.String(ehrTrigger.Description)+"', "
				+"ProblemSnomedList= '"+POut.String(ehrTrigger.ProblemSnomedList)+"', "
				+"ProblemIcd9List  = '"+POut.String(ehrTrigger.ProblemIcd9List)+"', "
				+"ProblemIcd10List = '"+POut.String(ehrTrigger.ProblemIcd10List)+"', "
				+"ProblemDefNumList= '"+POut.String(ehrTrigger.ProblemDefNumList)+"', "
				+"MedicationNumList= '"+POut.String(ehrTrigger.MedicationNumList)+"', "
				+"RxCuiList        = '"+POut.String(ehrTrigger.RxCuiList)+"', "
				+"CvxList          = '"+POut.String(ehrTrigger.CvxList)+"', "
				+"AllergyDefNumList= '"+POut.String(ehrTrigger.AllergyDefNumList)+"', "
				+"DemographicsList = '"+POut.String(ehrTrigger.DemographicsList)+"', "
				+"LabLoincList     = '"+POut.String(ehrTrigger.LabLoincList)+"', "
				+"VitalLoincList   = '"+POut.String(ehrTrigger.VitalLoincList)+"', "
				+"Instructions     = '"+POut.String(ehrTrigger.Instructions)+"', "
				+"Bibliography     = '"+POut.String(ehrTrigger.Bibliography)+"', "
				+"Cardinality      =  "+POut.Int   ((int)ehrTrigger.Cardinality)+" "
				+"WHERE EhrTriggerNum = "+POut.Long(ehrTrigger.EhrTriggerNum);
			Db.NonQ(command);
		}
Пример #16
0
 ///<summary>Inserts one EhrTrigger into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(EhrTrigger ehrTrigger)
 {
     return(InsertNoCache(ehrTrigger, false));
 }