コード例 #1
0
ファイル: RxAlertCrud.cs プロジェクト: nampn/ODental
 ///<summary>Inserts one RxAlert into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(RxAlert rxAlert,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         rxAlert.RxAlertNum=ReplicationServers.GetKey("rxalert","RxAlertNum");
     }
     string command="INSERT INTO rxalert (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="RxAlertNum,";
     }
     command+="RxDefNum,DiseaseDefNum,AllergyDefNum,MedicationNum,NotificationMsg) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(rxAlert.RxAlertNum)+",";
     }
     command+=
              POut.Long  (rxAlert.RxDefNum)+","
         +    POut.Long  (rxAlert.DiseaseDefNum)+","
         +    POut.Long  (rxAlert.AllergyDefNum)+","
         +    POut.Long  (rxAlert.MedicationNum)+","
         +"'"+POut.String(rxAlert.NotificationMsg)+"')";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         rxAlert.RxAlertNum=Db.NonQ(command,true);
     }
     return rxAlert.RxAlertNum;
 }
コード例 #2
0
ファイル: RxAlertCrud.cs プロジェクト: nampn/ODental
        ///<summary>Inserts one RxAlert into the database.  Provides option to use the existing priKey.</summary>
        internal static long Insert(RxAlert rxAlert, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                rxAlert.RxAlertNum = ReplicationServers.GetKey("rxalert", "RxAlertNum");
            }
            string command = "INSERT INTO rxalert (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "RxAlertNum,";
            }
            command += "RxDefNum,DiseaseDefNum,AllergyDefNum,MedicationNum,NotificationMsg) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(rxAlert.RxAlertNum) + ",";
            }
            command +=
                POut.Long(rxAlert.RxDefNum) + ","
                + POut.Long(rxAlert.DiseaseDefNum) + ","
                + POut.Long(rxAlert.AllergyDefNum) + ","
                + POut.Long(rxAlert.MedicationNum) + ","
                + "'" + POut.String(rxAlert.NotificationMsg) + "')";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                rxAlert.RxAlertNum = Db.NonQ(command, true);
            }
            return(rxAlert.RxAlertNum);
        }
コード例 #3
0
ファイル: FormRxAlertEdit.cs プロジェクト: kjb7749/testImport
 public FormRxAlertEdit(RxAlert rxAlertCur, RxDef rxDefCur)
 {
     InitializeComponent();
     Lan.F(this);
     RxAlertCur = rxAlertCur;
     RxDefCur   = rxDefCur;
 }
コード例 #4
0
ファイル: RxAlertCrud.cs プロジェクト: nampn/ODental
 ///<summary>Inserts one RxAlert into the database.  Returns the new priKey.</summary>
 internal static long Insert(RxAlert rxAlert)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         rxAlert.RxAlertNum = DbHelper.GetNextOracleKey("rxalert", "RxAlertNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(rxAlert, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     rxAlert.RxAlertNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(rxAlert, false));
     }
 }
コード例 #5
0
ファイル: RxAlertCrud.cs プロジェクト: royedwards/DRDNet
 ///<summary>Returns true if Update(RxAlert,RxAlert) 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(RxAlert rxAlert, RxAlert oldRxAlert)
 {
     if (rxAlert.RxDefNum != oldRxAlert.RxDefNum)
     {
         return(true);
     }
     if (rxAlert.DiseaseDefNum != oldRxAlert.DiseaseDefNum)
     {
         return(true);
     }
     if (rxAlert.AllergyDefNum != oldRxAlert.AllergyDefNum)
     {
         return(true);
     }
     if (rxAlert.MedicationNum != oldRxAlert.MedicationNum)
     {
         return(true);
     }
     if (rxAlert.NotificationMsg != oldRxAlert.NotificationMsg)
     {
         return(true);
     }
     if (rxAlert.IsHighSignificance != oldRxAlert.IsHighSignificance)
     {
         return(true);
     }
     return(false);
 }
コード例 #6
0
ファイル: RxAlertCrud.cs プロジェクト: royedwards/DRDNet
        ///<summary>Inserts one RxAlert into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(RxAlert rxAlert, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO rxalert (";

            if (!useExistingPK && isRandomKeys)
            {
                rxAlert.RxAlertNum = ReplicationServers.GetKeyNoCache("rxalert", "RxAlertNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "RxAlertNum,";
            }
            command += "RxDefNum,DiseaseDefNum,AllergyDefNum,MedicationNum,NotificationMsg,IsHighSignificance) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(rxAlert.RxAlertNum) + ",";
            }
            command +=
                POut.Long(rxAlert.RxDefNum) + ","
                + POut.Long(rxAlert.DiseaseDefNum) + ","
                + POut.Long(rxAlert.AllergyDefNum) + ","
                + POut.Long(rxAlert.MedicationNum) + ","
                + "'" + POut.String(rxAlert.NotificationMsg) + "',"
                + POut.Bool(rxAlert.IsHighSignificance) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                rxAlert.RxAlertNum = Db.NonQ(command, true, "RxAlertNum", "rxAlert");
            }
            return(rxAlert.RxAlertNum);
        }
コード例 #7
0
ファイル: RxAlertCrud.cs プロジェクト: nampn/ODental
 ///<summary>Inserts one RxAlert into the database.  Returns the new priKey.</summary>
 internal static long Insert(RxAlert rxAlert)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         rxAlert.RxAlertNum=DbHelper.GetNextOracleKey("rxalert","RxAlertNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(rxAlert,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     rxAlert.RxAlertNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(rxAlert,false);
     }
 }
コード例 #8
0
        ///<summary>Updates one RxAlert 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(RxAlert rxAlert, RxAlert oldRxAlert)
        {
            string command = "";

            if (rxAlert.RxDefNum != oldRxAlert.RxDefNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RxDefNum = " + POut.Long(rxAlert.RxDefNum) + "";
            }
            if (rxAlert.DiseaseDefNum != oldRxAlert.DiseaseDefNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DiseaseDefNum = " + POut.Long(rxAlert.DiseaseDefNum) + "";
            }
            if (rxAlert.AllergyDefNum != oldRxAlert.AllergyDefNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AllergyDefNum = " + POut.Long(rxAlert.AllergyDefNum) + "";
            }
            if (rxAlert.MedicationNum != oldRxAlert.MedicationNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MedicationNum = " + POut.Long(rxAlert.MedicationNum) + "";
            }
            if (rxAlert.NotificationMsg != oldRxAlert.NotificationMsg)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "NotificationMsg = '" + POut.String(rxAlert.NotificationMsg) + "'";
            }
            if (rxAlert.IsHighSignificance != oldRxAlert.IsHighSignificance)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHighSignificance = " + POut.Bool(rxAlert.IsHighSignificance) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE rxalert SET " + command
                      + " WHERE RxAlertNum = " + POut.Long(rxAlert.RxAlertNum);
            Db.NonQ(command);
        }
コード例 #9
0
ファイル: RxAlerts.cs プロジェクト: luisurbinanet/apolloniax
        ///<summary></summary>
        public static void Insert(RxAlert alert)
        {
            string command = "INSERT INTO rxalert (RxDefNum,DiseaseDefNum) VALUES("
                             + "'" + POut.PInt(alert.RxDefNum) + "', "
                             + "'" + POut.PInt(alert.DiseaseDefNum) + "')";

            alert.RxAlertNum = General.NonQ(command, true);
        }
コード例 #10
0
ファイル: RxAlerts.cs プロジェクト: luisurbinanet/apolloniax
        ///<summary></summary>
        public static void Update(RxAlert alert)
        {
            string command = "UPDATE rxalert SET "
                             + "RxDefNum = '" + POut.PInt(alert.RxDefNum) + "'"
                             + ",DiseaseDefNum = '" + POut.PInt(alert.DiseaseDefNum) + "'"
                             + " WHERE RxAlertNum  ='" + POut.PInt(alert.RxAlertNum) + "'";

            General.NonQ(command);
        }
コード例 #11
0
ファイル: FormRxAlertEdit.cs プロジェクト: nampn/ODental
 public FormRxAlertEdit(RxAlert rxAlertCur, RxDef rxDefCur)
 {
     InitializeComponent();
     Lan.F(this);
     RxAlertCur = rxAlertCur;
     RxDefCur   = rxDefCur;
     if (!PrefC.GetBool(PrefName.ShowFeatureEhr))
     {
         textRxNorm.Visible  = false;
         labelRxNorm.Visible = false;
     }
 }
コード例 #12
0
ファイル: RxAlertCrud.cs プロジェクト: nampn/ODental
        ///<summary>Updates one RxAlert in the database.</summary>
        internal static void Update(RxAlert rxAlert)
        {
            string command = "UPDATE rxalert SET "
                             + "RxDefNum       =  " + POut.Long(rxAlert.RxDefNum) + ", "
                             + "DiseaseDefNum  =  " + POut.Long(rxAlert.DiseaseDefNum) + ", "
                             + "AllergyDefNum  =  " + POut.Long(rxAlert.AllergyDefNum) + ", "
                             + "MedicationNum  =  " + POut.Long(rxAlert.MedicationNum) + ", "
                             + "NotificationMsg= '" + POut.String(rxAlert.NotificationMsg) + "' "
                             + "WHERE RxAlertNum = " + POut.Long(rxAlert.RxAlertNum);

            Db.NonQ(command);
        }
コード例 #13
0
ファイル: RxAlertCrud.cs プロジェクト: royedwards/DRDNet
        ///<summary>Updates one RxAlert in the database.</summary>
        public static void Update(RxAlert rxAlert)
        {
            string command = "UPDATE rxalert SET "
                             + "RxDefNum          =  " + POut.Long(rxAlert.RxDefNum) + ", "
                             + "DiseaseDefNum     =  " + POut.Long(rxAlert.DiseaseDefNum) + ", "
                             + "AllergyDefNum     =  " + POut.Long(rxAlert.AllergyDefNum) + ", "
                             + "MedicationNum     =  " + POut.Long(rxAlert.MedicationNum) + ", "
                             + "NotificationMsg   = '" + POut.String(rxAlert.NotificationMsg) + "', "
                             + "IsHighSignificance=  " + POut.Bool(rxAlert.IsHighSignificance) + " "
                             + "WHERE RxAlertNum = " + POut.Long(rxAlert.RxAlertNum);

            Db.NonQ(command);
        }
コード例 #14
0
ファイル: RxAlerts.cs プロジェクト: luisurbinanet/apolloniax
        ///<summary>Gets a list of all RxAlerts for one RxDef.</summary>
        public static RxAlert[] Refresh(int rxDefNum)
        {
            string    command = "SELECT * FROM rxalert WHERE RxDefNum=" + POut.PInt(rxDefNum);
            DataTable table   = General.GetTable(command);

            RxAlert[] List = new RxAlert[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]               = new RxAlert();
                List[i].RxAlertNum    = PIn.PInt(table.Rows[i][0].ToString());
                List[i].RxDefNum      = PIn.PInt(table.Rows[i][1].ToString());
                List[i].DiseaseDefNum = PIn.PInt(table.Rows[i][2].ToString());
            }
            return(List);
        }
コード例 #15
0
ファイル: RxAlertCrud.cs プロジェクト: royedwards/DRDNet
 ///<summary>Inserts one RxAlert into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(RxAlert rxAlert)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(rxAlert, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             rxAlert.RxAlertNum = DbHelper.GetNextOracleKey("rxalert", "RxAlertNum");                  //Cacheless method
         }
         return(InsertNoCache(rxAlert, true));
     }
 }
コード例 #16
0
ファイル: RxAlertCrud.cs プロジェクト: mnisl/OD
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<RxAlert> TableToList(DataTable table){
			List<RxAlert> retVal=new List<RxAlert>();
			RxAlert rxAlert;
			for(int i=0;i<table.Rows.Count;i++) {
				rxAlert=new RxAlert();
				rxAlert.RxAlertNum        = PIn.Long  (table.Rows[i]["RxAlertNum"].ToString());
				rxAlert.RxDefNum          = PIn.Long  (table.Rows[i]["RxDefNum"].ToString());
				rxAlert.DiseaseDefNum     = PIn.Long  (table.Rows[i]["DiseaseDefNum"].ToString());
				rxAlert.AllergyDefNum     = PIn.Long  (table.Rows[i]["AllergyDefNum"].ToString());
				rxAlert.MedicationNum     = PIn.Long  (table.Rows[i]["MedicationNum"].ToString());
				rxAlert.NotificationMsg   = PIn.String(table.Rows[i]["NotificationMsg"].ToString());
				rxAlert.IsHighSignificance= PIn.Bool  (table.Rows[i]["IsHighSignificance"].ToString());
				retVal.Add(rxAlert);
			}
			return retVal;
		}
コード例 #17
0
        private void butAddAllergy_Click(object sender, EventArgs e)
        {
            FormAllergySetup FormAS = new FormAllergySetup();

            FormAS.IsSelectionMode = true;
            FormAS.ShowDialog();
            if (FormAS.DialogResult != DialogResult.OK)
            {
                return;
            }
            RxAlert alert = new RxAlert();

            alert.AllergyDefNum = FormAS.SelectedAllergyDefNum;
            alert.RxDefNum      = RxDefCur.RxDefNum;
            RxAlerts.Insert(alert);
            FillAlerts();
        }
コード例 #18
0
        private void butAddProblem_Click(object sender, EventArgs e)
        {
            FormDiseaseDefs FormD = new FormDiseaseDefs();

            FormD.IsSelectionMode = true;
            FormD.ShowDialog();
            if (FormD.DialogResult != DialogResult.OK)
            {
                return;
            }
            RxAlert alert = new RxAlert();

            alert.DiseaseDefNum = FormD.SelectedDiseaseDefNum;
            alert.RxDefNum      = RxDefCur.RxDefNum;
            RxAlerts.Insert(alert);
            FillAlerts();
        }
コード例 #19
0
        private void butAddMedication_Click(object sender, EventArgs e)
        {
            FormMedications FormMED = new FormMedications();

            FormMED.IsSelectionMode = true;
            FormMED.ShowDialog();
            if (FormMED.DialogResult != DialogResult.OK)
            {
                return;
            }
            RxAlert alert = new RxAlert();

            alert.MedicationNum = FormMED.SelectedMedicationNum;
            alert.RxDefNum      = RxDefCur.RxDefNum;
            RxAlerts.Insert(alert);
            FillAlerts();
        }
コード例 #20
0
ファイル: RxAlertCrud.cs プロジェクト: nampn/ODental
        ///<summary>Converts a DataTable to a list of objects.</summary>
        internal static List <RxAlert> TableToList(DataTable table)
        {
            List <RxAlert> retVal = new List <RxAlert>();
            RxAlert        rxAlert;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                rxAlert                 = new RxAlert();
                rxAlert.RxAlertNum      = PIn.Long(table.Rows[i]["RxAlertNum"].ToString());
                rxAlert.RxDefNum        = PIn.Long(table.Rows[i]["RxDefNum"].ToString());
                rxAlert.DiseaseDefNum   = PIn.Long(table.Rows[i]["DiseaseDefNum"].ToString());
                rxAlert.AllergyDefNum   = PIn.Long(table.Rows[i]["AllergyDefNum"].ToString());
                rxAlert.MedicationNum   = PIn.Long(table.Rows[i]["MedicationNum"].ToString());
                rxAlert.NotificationMsg = PIn.String(table.Rows[i]["NotificationMsg"].ToString());
                retVal.Add(rxAlert);
            }
            return(retVal);
        }
コード例 #21
0
ファイル: RxAlertCrud.cs プロジェクト: royedwards/DRDNet
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <RxAlert> TableToList(DataTable table)
        {
            List <RxAlert> retVal = new List <RxAlert>();
            RxAlert        rxAlert;

            foreach (DataRow row in table.Rows)
            {
                rxAlert                    = new RxAlert();
                rxAlert.RxAlertNum         = PIn.Long(row["RxAlertNum"].ToString());
                rxAlert.RxDefNum           = PIn.Long(row["RxDefNum"].ToString());
                rxAlert.DiseaseDefNum      = PIn.Long(row["DiseaseDefNum"].ToString());
                rxAlert.AllergyDefNum      = PIn.Long(row["AllergyDefNum"].ToString());
                rxAlert.MedicationNum      = PIn.Long(row["MedicationNum"].ToString());
                rxAlert.NotificationMsg    = PIn.String(row["NotificationMsg"].ToString());
                rxAlert.IsHighSignificance = PIn.Bool(row["IsHighSignificance"].ToString());
                retVal.Add(rxAlert);
            }
            return(retVal);
        }
コード例 #22
0
        private void butAddProblem_Click(object sender, EventArgs e)
        {
            FormDiseaseDefs FormD = new FormDiseaseDefs();

            FormD.IsSelectionMode = true;
            FormD.IsMultiSelect   = true;
            FormD.ShowDialog();
            if (FormD.DialogResult != DialogResult.OK)
            {
                return;
            }
            for (int i = 0; i < FormD.ListSelectedDiseaseDefs.Count; i++)
            {
                RxAlert alert = new RxAlert();
                alert.DiseaseDefNum = FormD.ListSelectedDiseaseDefs[i].DiseaseDefNum;
                alert.RxDefNum      = RxDefCur.RxDefNum;
                RxAlerts.Insert(alert);
            }
            FillAlerts();
        }
コード例 #23
0
ファイル: RxAlerts.cs プロジェクト: luisurbinanet/apolloniax
        ///<summary></summary>
        public static void Delete(RxAlert alert)
        {
            string command = "DELETE FROM rxalert WHERE RxAlertNum =" + POut.PInt(alert.RxAlertNum);

            General.NonQ(command);
        }
コード例 #24
0
 ///<summary>Inserts one RxAlert into the database.  Returns the new priKey.</summary>
 public static long Insert(RxAlert rxAlert)
 {
     return(Insert(rxAlert, false));
 }
コード例 #25
0
 ///<summary>Inserts one RxAlert into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(RxAlert rxAlert)
 {
     return(InsertNoCache(rxAlert, false));
 }
コード例 #26
0
ファイル: RxAlertCrud.cs プロジェクト: mnisl/OD
		///<summary>Updates one RxAlert 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(RxAlert rxAlert,RxAlert oldRxAlert){
			string command="";
			if(rxAlert.RxDefNum != oldRxAlert.RxDefNum) {
				if(command!=""){ command+=",";}
				command+="RxDefNum = "+POut.Long(rxAlert.RxDefNum)+"";
			}
			if(rxAlert.DiseaseDefNum != oldRxAlert.DiseaseDefNum) {
				if(command!=""){ command+=",";}
				command+="DiseaseDefNum = "+POut.Long(rxAlert.DiseaseDefNum)+"";
			}
			if(rxAlert.AllergyDefNum != oldRxAlert.AllergyDefNum) {
				if(command!=""){ command+=",";}
				command+="AllergyDefNum = "+POut.Long(rxAlert.AllergyDefNum)+"";
			}
			if(rxAlert.MedicationNum != oldRxAlert.MedicationNum) {
				if(command!=""){ command+=",";}
				command+="MedicationNum = "+POut.Long(rxAlert.MedicationNum)+"";
			}
			if(rxAlert.NotificationMsg != oldRxAlert.NotificationMsg) {
				if(command!=""){ command+=",";}
				command+="NotificationMsg = '"+POut.String(rxAlert.NotificationMsg)+"'";
			}
			if(rxAlert.IsHighSignificance != oldRxAlert.IsHighSignificance) {
				if(command!=""){ command+=",";}
				command+="IsHighSignificance = "+POut.Bool(rxAlert.IsHighSignificance)+"";
			}
			if(command==""){
				return false;
			}
			command="UPDATE rxalert SET "+command
				+" WHERE RxAlertNum = "+POut.Long(rxAlert.RxAlertNum);
			Db.NonQ(command);
			return true;
		}
コード例 #27
0
ファイル: RxAlertCrud.cs プロジェクト: mnisl/OD
		///<summary>Updates one RxAlert in the database.</summary>
		public static void Update(RxAlert rxAlert){
			string command="UPDATE rxalert SET "
				+"RxDefNum          =  "+POut.Long  (rxAlert.RxDefNum)+", "
				+"DiseaseDefNum     =  "+POut.Long  (rxAlert.DiseaseDefNum)+", "
				+"AllergyDefNum     =  "+POut.Long  (rxAlert.AllergyDefNum)+", "
				+"MedicationNum     =  "+POut.Long  (rxAlert.MedicationNum)+", "
				+"NotificationMsg   = '"+POut.String(rxAlert.NotificationMsg)+"', "
				+"IsHighSignificance=  "+POut.Bool  (rxAlert.IsHighSignificance)+" "
				+"WHERE RxAlertNum = "+POut.Long(rxAlert.RxAlertNum);
			Db.NonQ(command);
		}
コード例 #28
0
ファイル: RxAlertCrud.cs プロジェクト: nampn/ODental
 ///<summary>Updates one RxAlert in the database.</summary>
 internal static void Update(RxAlert rxAlert)
 {
     string command="UPDATE rxalert SET "
         +"RxDefNum       =  "+POut.Long  (rxAlert.RxDefNum)+", "
         +"DiseaseDefNum  =  "+POut.Long  (rxAlert.DiseaseDefNum)+", "
         +"AllergyDefNum  =  "+POut.Long  (rxAlert.AllergyDefNum)+", "
         +"MedicationNum  =  "+POut.Long  (rxAlert.MedicationNum)+", "
         +"NotificationMsg= '"+POut.String(rxAlert.NotificationMsg)+"' "
         +"WHERE RxAlertNum = "+POut.Long(rxAlert.RxAlertNum);
     Db.NonQ(command);
 }
コード例 #29
0
ファイル: RxAlertCrud.cs プロジェクト: nampn/ODental
 ///<summary>Updates one RxAlert 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>
 internal static void Update(RxAlert rxAlert,RxAlert oldRxAlert)
 {
     string command="";
     if(rxAlert.RxDefNum != oldRxAlert.RxDefNum) {
         if(command!=""){ command+=",";}
         command+="RxDefNum = "+POut.Long(rxAlert.RxDefNum)+"";
     }
     if(rxAlert.DiseaseDefNum != oldRxAlert.DiseaseDefNum) {
         if(command!=""){ command+=",";}
         command+="DiseaseDefNum = "+POut.Long(rxAlert.DiseaseDefNum)+"";
     }
     if(rxAlert.AllergyDefNum != oldRxAlert.AllergyDefNum) {
         if(command!=""){ command+=",";}
         command+="AllergyDefNum = "+POut.Long(rxAlert.AllergyDefNum)+"";
     }
     if(rxAlert.MedicationNum != oldRxAlert.MedicationNum) {
         if(command!=""){ command+=",";}
         command+="MedicationNum = "+POut.Long(rxAlert.MedicationNum)+"";
     }
     if(rxAlert.NotificationMsg != oldRxAlert.NotificationMsg) {
         if(command!=""){ command+=",";}
         command+="NotificationMsg = '"+POut.String(rxAlert.NotificationMsg)+"'";
     }
     if(command==""){
         return;
     }
     command="UPDATE rxalert SET "+command
         +" WHERE RxAlertNum = "+POut.Long(rxAlert.RxAlertNum);
     Db.NonQ(command);
 }