Exemplo n.º 1
0
 ///<summary>Inserts one VaccineObs into the database.  Returns the new priKey.</summary>
 public static long Insert(VaccineObs vaccineObs)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         vaccineObs.VaccineObsNum = DbHelper.GetNextOracleKey("vaccineobs", "VaccineObsNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(vaccineObs, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     vaccineObs.VaccineObsNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(vaccineObs, false));
     }
 }
Exemplo n.º 2
0
        private void gridObservations_CellDoubleClick(object sender, UI.ODGridClickEventArgs e)
        {
            VaccineObs         vaccineObs = (VaccineObs)gridObservations.ListGridRows[e.Row].Tag;
            FormVaccineObsEdit form       = new FormVaccineObsEdit(vaccineObs);

            form.ShowDialog();
            if (vaccineObs.VaccinePatNum == 0)           //Was deleted
            //If the observation identifying the group is deleted, then we need to reassign a new group.
            {
                List <int> listRegroupIndicies = new List <int>();
                for (int i = 0; i < _listVaccineObservations.Count; i++)
                {
                    if (i != e.Row && _listVaccineObservationGroups[i] == _listVaccineObservationGroups[e.Row])
                    {
                        listRegroupIndicies.Add(i);
                    }
                }
                if (listRegroupIndicies.Count > 0)
                {
                    VaccineObs vaccineObsGroup = _listVaccineObservations[listRegroupIndicies[0]];
                    for (int i = 0; i < listRegroupIndicies.Count; i++)
                    {
                        _listVaccineObservationGroups[listRegroupIndicies[i]] = vaccineObsGroup;
                    }
                }
                //Delete the observation and corresponding group reference.
                _listVaccineObservations.RemoveAt(e.Row);
                _listVaccineObservationGroups.RemoveAt(e.Row);
            }
            FillObservations();
        }
Exemplo n.º 3
0
        private void butGroupObservations_Click(object sender, EventArgs e)
        {
            if (gridObservations.SelectedIndices.Length < 2)
            {
                MsgBox.Show(this, "Two or more observations must be selected.");
                return;
            }
            VaccineObs vaccineObsGroup = (VaccineObs)gridObservations.ListGridRows[gridObservations.SelectedIndices[0]].Tag;

            for (int i = 0; i < gridObservations.SelectedIndices.Length; i++)
            {
                _listVaccineObservationGroups[gridObservations.SelectedIndices[i]] = vaccineObsGroup;
            }
        }
Exemplo n.º 4
0
 ///<summary>Inserts one VaccineObs into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(VaccineObs vaccineObs)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(vaccineObs, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             vaccineObs.VaccineObsNum = DbHelper.GetNextOracleKey("vaccineobs", "VaccineObsNum");                  //Cacheless method
         }
         return(InsertNoCache(vaccineObs, true));
     }
 }
Exemplo n.º 5
0
        private void butAddObservation_Click(object sender, EventArgs e)
        {
            VaccineObs vaccineObs = new VaccineObs();

            vaccineObs.IsNew         = true;
            vaccineObs.VaccinePatNum = -1;          //Temporary dummy value (cannot be zero). Helps track new observations which have not been deleted.
            FormVaccineObsEdit form = new FormVaccineObsEdit(vaccineObs);

            if (form.ShowDialog() == DialogResult.OK)
            {
                _listVaccineObservations.Add(vaccineObs);
                _listVaccineObservationGroups.Add(vaccineObs);                //In its own group with a single item initially.
                FillObservations();
            }
        }
Exemplo n.º 6
0
        ///<summary>Updates one VaccineObs in the database.</summary>
        public static void Update(VaccineObs vaccineObs)
        {
            string command = "UPDATE vaccineobs SET "
                             + "VaccinePatNum     =  " + POut.Long(vaccineObs.VaccinePatNum) + ", "
                             + "ValType           =  " + POut.Int((int)vaccineObs.ValType) + ", "
                             + "IdentifyingCode   =  " + POut.Int((int)vaccineObs.IdentifyingCode) + ", "
                             + "ValReported       = '" + POut.String(vaccineObs.ValReported) + "', "
                             + "ValCodeSystem     =  " + POut.Int((int)vaccineObs.ValCodeSystem) + ", "
                             + "VaccineObsNumGroup=  " + POut.Long(vaccineObs.VaccineObsNumGroup) + ", "
                             + "UcumCode          = '" + POut.String(vaccineObs.UcumCode) + "', "
                             + "DateObs           =  " + POut.Date(vaccineObs.DateObs) + ", "
                             + "MethodCode        = '" + POut.String(vaccineObs.MethodCode) + "' "
                             + "WHERE VaccineObsNum = " + POut.Long(vaccineObs.VaccineObsNum);

            Db.NonQ(command);
        }
Exemplo n.º 7
0
        private void gridObservations_CellClick(object sender, UI.ODGridClickEventArgs e)
        {
            if (gridObservations.SelectedIndices.Length > 1)
            {
                return;                //Do not select group if the user has selected more than one item (otherwise it would deselect some of the rows the user clicked, which would make using the group button impossible).
            }
            //Select all observations which are in the same group.
            VaccineObs vaccineObsGroup = _listVaccineObservationGroups[e.Row];

            gridObservations.SetSelected(false);            //Deselect all.
            for (int i = 0; i < _listVaccineObservationGroups.Count; i++)
            {
                if (_listVaccineObservationGroups[i] == vaccineObsGroup)
                {
                    gridObservations.SetSelected(i, true);
                }
            }
        }
Exemplo n.º 8
0
 private void FillObservations()
 {
     gridObservations.BeginUpdate();
     gridObservations.ListGridColumns.Clear();
     gridObservations.ListGridColumns.Add(new UI.GridColumn("Question", 150));
     gridObservations.ListGridColumns.Add(new UI.GridColumn("Value", 0));
     gridObservations.EndUpdate();
     gridObservations.BeginUpdate();
     gridObservations.ListGridRows.Clear();
     for (int i = 0; i < _listVaccineObservations.Count; i++)
     {
         VaccineObs vaccineObs = _listVaccineObservations[i];
         UI.GridRow row        = new UI.GridRow();
         row.Tag = vaccineObs;
         row.Cells.Add(new UI.GridCell(vaccineObs.IdentifyingCode.ToString()));
         row.Cells.Add(new UI.GridCell(vaccineObs.ValReported));
         gridObservations.ListGridRows.Add(row);
     }
     if (_listVaccineObservationGroups == null)
     {
         _listVaccineObservationGroups = new List <VaccineObs>();
         for (int i = 0; i < _listVaccineObservations.Count; i++)
         {
             VaccineObs vaccineObs = _listVaccineObservations[i];
             if (vaccineObs.VaccineObsNumGroup == 0 || vaccineObs.VaccineObsNumGroup == vaccineObs.VaccineObsNum)
             {
                 _listVaccineObservationGroups.Add(vaccineObs);
             }
             else
             {
                 for (int j = 0; j < _listVaccineObservations.Count; j++)
                 {
                     if (j != i && _listVaccineObservations[j].VaccineObsNum == _listVaccineObservations[i].VaccineObsNumGroup)
                     {
                         _listVaccineObservationGroups.Add(_listVaccineObservations[j]);
                         break;
                     }
                 }
             }
         }
     }
     gridObservations.EndUpdate();
 }
Exemplo n.º 9
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<VaccineObs> TableToList(DataTable table){
			List<VaccineObs> retVal=new List<VaccineObs>();
			VaccineObs vaccineObs;
			for(int i=0;i<table.Rows.Count;i++) {
				vaccineObs=new VaccineObs();
				vaccineObs.VaccineObsNum     = PIn.Long  (table.Rows[i]["VaccineObsNum"].ToString());
				vaccineObs.VaccinePatNum     = PIn.Long  (table.Rows[i]["VaccinePatNum"].ToString());
				vaccineObs.ValType           = (OpenDentBusiness.VaccineObsType)PIn.Int(table.Rows[i]["ValType"].ToString());
				vaccineObs.IdentifyingCode   = (OpenDentBusiness.VaccineObsIdentifier)PIn.Int(table.Rows[i]["IdentifyingCode"].ToString());
				vaccineObs.ValReported       = PIn.String(table.Rows[i]["ValReported"].ToString());
				vaccineObs.ValCodeSystem     = (OpenDentBusiness.VaccineObsValCodeSystem)PIn.Int(table.Rows[i]["ValCodeSystem"].ToString());
				vaccineObs.VaccineObsNumGroup= PIn.Long  (table.Rows[i]["VaccineObsNumGroup"].ToString());
				vaccineObs.UcumCode          = PIn.String(table.Rows[i]["UcumCode"].ToString());
				vaccineObs.DateObs           = PIn.Date  (table.Rows[i]["DateObs"].ToString());
				vaccineObs.MethodCode        = PIn.String(table.Rows[i]["MethodCode"].ToString());
				retVal.Add(vaccineObs);
			}
			return retVal;
		}
Exemplo n.º 10
0
 ///<summary>Returns true if Update(VaccineObs,VaccineObs) 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(VaccineObs vaccineObs, VaccineObs oldVaccineObs)
 {
     if (vaccineObs.VaccinePatNum != oldVaccineObs.VaccinePatNum)
     {
         return(true);
     }
     if (vaccineObs.ValType != oldVaccineObs.ValType)
     {
         return(true);
     }
     if (vaccineObs.IdentifyingCode != oldVaccineObs.IdentifyingCode)
     {
         return(true);
     }
     if (vaccineObs.ValReported != oldVaccineObs.ValReported)
     {
         return(true);
     }
     if (vaccineObs.ValCodeSystem != oldVaccineObs.ValCodeSystem)
     {
         return(true);
     }
     if (vaccineObs.VaccineObsNumGroup != oldVaccineObs.VaccineObsNumGroup)
     {
         return(true);
     }
     if (vaccineObs.UcumCode != oldVaccineObs.UcumCode)
     {
         return(true);
     }
     if (vaccineObs.DateObs.Date != oldVaccineObs.DateObs.Date)
     {
         return(true);
     }
     if (vaccineObs.MethodCode != oldVaccineObs.MethodCode)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 11
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <VaccineObs> TableToList(DataTable table)
        {
            List <VaccineObs> retVal = new List <VaccineObs>();
            VaccineObs        vaccineObs;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                vaccineObs = new VaccineObs();
                vaccineObs.VaccineObsNum      = PIn.Long(table.Rows[i]["VaccineObsNum"].ToString());
                vaccineObs.VaccinePatNum      = PIn.Long(table.Rows[i]["VaccinePatNum"].ToString());
                vaccineObs.ValType            = (VaccineObsType)PIn.Int(table.Rows[i]["ValType"].ToString());
                vaccineObs.IdentifyingCode    = (VaccineObsIdentifier)PIn.Int(table.Rows[i]["IdentifyingCode"].ToString());
                vaccineObs.ValReported        = PIn.String(table.Rows[i]["ValReported"].ToString());
                vaccineObs.ValCodeSystem      = (VaccineObsValCodeSystem)PIn.Int(table.Rows[i]["ValCodeSystem"].ToString());
                vaccineObs.VaccineObsNumGroup = PIn.Long(table.Rows[i]["VaccineObsNumGroup"].ToString());
                vaccineObs.UcumCode           = PIn.String(table.Rows[i]["UcumCode"].ToString());
                vaccineObs.DateObs            = PIn.Date(table.Rows[i]["DateObs"].ToString());
                vaccineObs.MethodCode         = PIn.String(table.Rows[i]["MethodCode"].ToString());
                retVal.Add(vaccineObs);
            }
            return(retVal);
        }
Exemplo n.º 12
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <VaccineObs> TableToList(DataTable table)
        {
            List <VaccineObs> retVal = new List <VaccineObs>();
            VaccineObs        vaccineObs;

            foreach (DataRow row in table.Rows)
            {
                vaccineObs = new VaccineObs();
                vaccineObs.VaccineObsNum      = PIn.Long(row["VaccineObsNum"].ToString());
                vaccineObs.VaccinePatNum      = PIn.Long(row["VaccinePatNum"].ToString());
                vaccineObs.ValType            = (OpenDentBusiness.VaccineObsType)PIn.Int(row["ValType"].ToString());
                vaccineObs.IdentifyingCode    = (OpenDentBusiness.VaccineObsIdentifier)PIn.Int(row["IdentifyingCode"].ToString());
                vaccineObs.ValReported        = PIn.String(row["ValReported"].ToString());
                vaccineObs.ValCodeSystem      = (OpenDentBusiness.VaccineObsValCodeSystem)PIn.Int(row["ValCodeSystem"].ToString());
                vaccineObs.VaccineObsNumGroup = PIn.Long(row["VaccineObsNumGroup"].ToString());
                vaccineObs.UcumCode           = PIn.String(row["UcumCode"].ToString());
                vaccineObs.DateObs            = PIn.Date(row["DateObs"].ToString());
                vaccineObs.MethodCode         = PIn.String(row["MethodCode"].ToString());
                retVal.Add(vaccineObs);
            }
            return(retVal);
        }
Exemplo n.º 13
0
        ///<summary>Inserts one VaccineObs into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(VaccineObs vaccineObs, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO vaccineobs (";

            if (!useExistingPK && isRandomKeys)
            {
                vaccineObs.VaccineObsNum = ReplicationServers.GetKeyNoCache("vaccineobs", "VaccineObsNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "VaccineObsNum,";
            }
            command += "VaccinePatNum,ValType,IdentifyingCode,ValReported,ValCodeSystem,VaccineObsNumGroup,UcumCode,DateObs,MethodCode) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(vaccineObs.VaccineObsNum) + ",";
            }
            command +=
                POut.Long(vaccineObs.VaccinePatNum) + ","
                + POut.Int((int)vaccineObs.ValType) + ","
                + POut.Int((int)vaccineObs.IdentifyingCode) + ","
                + "'" + POut.String(vaccineObs.ValReported) + "',"
                + POut.Int((int)vaccineObs.ValCodeSystem) + ","
                + POut.Long(vaccineObs.VaccineObsNumGroup) + ","
                + "'" + POut.String(vaccineObs.UcumCode) + "',"
                + POut.Date(vaccineObs.DateObs) + ","
                + "'" + POut.String(vaccineObs.MethodCode) + "')";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                vaccineObs.VaccineObsNum = Db.NonQ(command, true, "VaccineObsNum", "vaccineObs");
            }
            return(vaccineObs.VaccineObsNum);
        }
Exemplo n.º 14
0
		///<summary>Inserts one VaccineObs into the database.  Returns the new priKey.</summary>
		public static long Insert(VaccineObs vaccineObs){
			if(DataConnection.DBtype==DatabaseType.Oracle) {
				vaccineObs.VaccineObsNum=DbHelper.GetNextOracleKey("vaccineobs","VaccineObsNum");
				int loopcount=0;
				while(loopcount<100){
					try {
						return Insert(vaccineObs,true);
					}
					catch(Oracle.DataAccess.Client.OracleException ex){
						if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
							vaccineObs.VaccineObsNum++;
							loopcount++;
						}
						else{
							throw ex;
						}
					}
				}
				throw new ApplicationException("Insert failed.  Could not generate primary key.");
			}
			else {
				return Insert(vaccineObs,false);
			}
		}
Exemplo n.º 15
0
        ///<summary>Updates one VaccineObs 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(VaccineObs vaccineObs, VaccineObs oldVaccineObs)
        {
            string command = "";

            if (vaccineObs.VaccinePatNum != oldVaccineObs.VaccinePatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "VaccinePatNum = " + POut.Long(vaccineObs.VaccinePatNum) + "";
            }
            if (vaccineObs.ValType != oldVaccineObs.ValType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ValType = " + POut.Int((int)vaccineObs.ValType) + "";
            }
            if (vaccineObs.IdentifyingCode != oldVaccineObs.IdentifyingCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IdentifyingCode = " + POut.Int((int)vaccineObs.IdentifyingCode) + "";
            }
            if (vaccineObs.ValReported != oldVaccineObs.ValReported)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ValReported = '" + POut.String(vaccineObs.ValReported) + "'";
            }
            if (vaccineObs.ValCodeSystem != oldVaccineObs.ValCodeSystem)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ValCodeSystem = " + POut.Int((int)vaccineObs.ValCodeSystem) + "";
            }
            if (vaccineObs.VaccineObsNumGroup != oldVaccineObs.VaccineObsNumGroup)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "VaccineObsNumGroup = " + POut.Long(vaccineObs.VaccineObsNumGroup) + "";
            }
            if (vaccineObs.UcumCode != oldVaccineObs.UcumCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UcumCode = '" + POut.String(vaccineObs.UcumCode) + "'";
            }
            if (vaccineObs.DateObs.Date != oldVaccineObs.DateObs.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateObs = " + POut.Date(vaccineObs.DateObs) + "";
            }
            if (vaccineObs.MethodCode != oldVaccineObs.MethodCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MethodCode = '" + POut.String(vaccineObs.MethodCode) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE vaccineobs SET " + command
                      + " WHERE VaccineObsNum = " + POut.Long(vaccineObs.VaccineObsNum);
            Db.NonQ(command);
            return(true);
        }
Exemplo n.º 16
0
 ///<summary>Inserts one VaccineObs into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(VaccineObs vaccineObs)
 {
     return(InsertNoCache(vaccineObs, false));
 }
Exemplo n.º 17
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textDateExpiration.errorProvider1.GetError(textDateExpiration) != "")
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }
            VaccineCompletionStatus vaccineCompletionStatus = (VaccineCompletionStatus)listCompletionStatus.SelectedIndex;

            if (comboVaccine.SelectedIndex == -1 && vaccineCompletionStatus != VaccineCompletionStatus.NotAdministered)
            {
                //When the vaccine is not administered, the CVX code is automatically assumed to be 998 and there is no manufacturer.  Therefore, no vaccine def is needed.
                MessageBox.Show(this, "Please select a vaccine.");
                return;
            }
            if (vaccineCompletionStatus == VaccineCompletionStatus.NotAdministered)
            {
                if (textNote.Text == "")
                {
                    MessageBox.Show(this, "Please enter documentation in the note.");
                    return;
                }
                VaccinePatCur.VaccineDefNum = 0;              //Written for clarity
            }
            else
            {
                VaccinePatCur.VaccineDefNum = _listVaccineDefs[comboVaccine.SelectedIndex].VaccineDefNum;
            }
            try {
                VaccinePatCur.DateTimeStart = PIn.DateT(textDateTimeStart.Text);
                VaccinePatCur.DateTimeEnd   = PIn.DateT(textDateTimeStop.Text);
            }
            catch {
                MessageBox.Show(this, "Please enter start and end times in format DD/MM/YYYY HH:mm AM/PM");
            }
            if (textAmount.Text == "")
            {
                VaccinePatCur.AdministeredAmt = 0;
            }
            else
            {
                try {
                    VaccinePatCur.AdministeredAmt = PIn.Float(textAmount.Text);
                }
                catch {
                    MessageBox.Show(this, "Please enter a valid amount.");
                }
            }
            if (comboUnits.SelectedIndex == 0)           //'none'
            {
                VaccinePatCur.DrugUnitNum = 0;
            }
            else
            {
                VaccinePatCur.DrugUnitNum = _listDrugUnits[comboUnits.SelectedIndex - 1].DrugUnitNum;
            }
            VaccinePatCur.LotNumber        = textLotNum.Text;
            VaccinePatCur.DateExpire       = PIn.Date(textDateExpiration.Text);
            VaccinePatCur.RefusalReason    = (VaccineRefusalReason)listRefusalReason.SelectedIndex;
            VaccinePatCur.CompletionStatus = (VaccineCompletionStatus)listCompletionStatus.SelectedIndex;
            VaccinePatCur.Note             = textNote.Text;
            VaccinePatCur.FilledCity       = textFilledCity.Text;
            VaccinePatCur.FilledST         = textFilledSt.Text;
            //VaccinePatCur.UserNum;//Was set when loading and cannot be edited by the user.
            VaccinePatCur.ProvNumOrdering        = _provNumSelectedOrdering;
            VaccinePatCur.ProvNumAdminister      = _provNumSelectedAdministering;
            VaccinePatCur.AdministrationRoute    = (VaccineAdministrationRoute)comboAdministrationRoute.SelectedIndex;
            VaccinePatCur.AdministrationSite     = (VaccineAdministrationSite)comboAdministrationSite.SelectedIndex;
            VaccinePatCur.AdministrationNoteCode = (VaccineAdministrationNote)listAdministrationNote.SelectedIndex;
            VaccinePatCur.ActionCode             = (VaccineAction)listAction.SelectedIndex;
            if (IsNew)
            {
                VaccinePats.Insert(VaccinePatCur);
            }
            else
            {
                VaccinePats.Update(VaccinePatCur);
            }
            //We must delete then update/insert the observations after we insert the vaccinepat record, in case the vaccinepat is new.
            VaccineObses.DeleteForVaccinePat(VaccinePatCur.VaccinePatNum);
            for (int i = 0; i < _listVaccineObservations.Count; i++)
            {
                VaccineObs vaccineObs = _listVaccineObservations[i];
                vaccineObs.VaccinePatNum = VaccinePatCur.VaccinePatNum;
                VaccineObses.Insert(vaccineObs);
            }
            //Update the vaccine observation group ids, now that the vaccine observation records have been inserted.
            for (int i = 0; i < _listVaccineObservations.Count; i++)
            {
                VaccineObs vaccineObs = _listVaccineObservations[i];
                vaccineObs.VaccineObsNumGroup = _listVaccineObservationGroups[i].VaccineObsNum;
                VaccineObses.Update(vaccineObs);
            }
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 18
0
		///<summary>Inserts one VaccineObs into the database.  Provides option to use the existing priKey.</summary>
		public static long Insert(VaccineObs vaccineObs,bool useExistingPK){
			if(!useExistingPK && PrefC.RandomKeys) {
				vaccineObs.VaccineObsNum=ReplicationServers.GetKey("vaccineobs","VaccineObsNum");
			}
			string command="INSERT INTO vaccineobs (";
			if(useExistingPK || PrefC.RandomKeys) {
				command+="VaccineObsNum,";
			}
			command+="VaccinePatNum,ValType,IdentifyingCode,ValReported,ValCodeSystem,VaccineObsNumGroup,UcumCode,DateObs,MethodCode) VALUES(";
			if(useExistingPK || PrefC.RandomKeys) {
				command+=POut.Long(vaccineObs.VaccineObsNum)+",";
			}
			command+=
				     POut.Long  (vaccineObs.VaccinePatNum)+","
				+    POut.Int   ((int)vaccineObs.ValType)+","
				+    POut.Int   ((int)vaccineObs.IdentifyingCode)+","
				+"'"+POut.String(vaccineObs.ValReported)+"',"
				+    POut.Int   ((int)vaccineObs.ValCodeSystem)+","
				+    POut.Long  (vaccineObs.VaccineObsNumGroup)+","
				+"'"+POut.String(vaccineObs.UcumCode)+"',"
				+    POut.Date  (vaccineObs.DateObs)+","
				+"'"+POut.String(vaccineObs.MethodCode)+"')";
			if(useExistingPK || PrefC.RandomKeys) {
				Db.NonQ(command);
			}
			else {
				vaccineObs.VaccineObsNum=Db.NonQ(command,true);
			}
			return vaccineObs.VaccineObsNum;
		}
Exemplo n.º 19
0
		///<summary>Updates one VaccineObs in the database.</summary>
		public static void Update(VaccineObs vaccineObs){
			string command="UPDATE vaccineobs SET "
				+"VaccinePatNum     =  "+POut.Long  (vaccineObs.VaccinePatNum)+", "
				+"ValType           =  "+POut.Int   ((int)vaccineObs.ValType)+", "
				+"IdentifyingCode   =  "+POut.Int   ((int)vaccineObs.IdentifyingCode)+", "
				+"ValReported       = '"+POut.String(vaccineObs.ValReported)+"', "
				+"ValCodeSystem     =  "+POut.Int   ((int)vaccineObs.ValCodeSystem)+", "
				+"VaccineObsNumGroup=  "+POut.Long  (vaccineObs.VaccineObsNumGroup)+", "
				+"UcumCode          = '"+POut.String(vaccineObs.UcumCode)+"', "
				+"DateObs           =  "+POut.Date  (vaccineObs.DateObs)+", "
				+"MethodCode        = '"+POut.String(vaccineObs.MethodCode)+"' "
				+"WHERE VaccineObsNum = "+POut.Long(vaccineObs.VaccineObsNum);
			Db.NonQ(command);
		}
Exemplo n.º 20
0
 public FormVaccineObsEdit(VaccineObs vaccineObs)
 {
     InitializeComponent();
     Lan.F(this);
     _vaccineObsCur = vaccineObs;
 }
Exemplo n.º 21
0
		///<summary>Updates one VaccineObs 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(VaccineObs vaccineObs,VaccineObs oldVaccineObs){
			string command="";
			if(vaccineObs.VaccinePatNum != oldVaccineObs.VaccinePatNum) {
				if(command!=""){ command+=",";}
				command+="VaccinePatNum = "+POut.Long(vaccineObs.VaccinePatNum)+"";
			}
			if(vaccineObs.ValType != oldVaccineObs.ValType) {
				if(command!=""){ command+=",";}
				command+="ValType = "+POut.Int   ((int)vaccineObs.ValType)+"";
			}
			if(vaccineObs.IdentifyingCode != oldVaccineObs.IdentifyingCode) {
				if(command!=""){ command+=",";}
				command+="IdentifyingCode = "+POut.Int   ((int)vaccineObs.IdentifyingCode)+"";
			}
			if(vaccineObs.ValReported != oldVaccineObs.ValReported) {
				if(command!=""){ command+=",";}
				command+="ValReported = '"+POut.String(vaccineObs.ValReported)+"'";
			}
			if(vaccineObs.ValCodeSystem != oldVaccineObs.ValCodeSystem) {
				if(command!=""){ command+=",";}
				command+="ValCodeSystem = "+POut.Int   ((int)vaccineObs.ValCodeSystem)+"";
			}
			if(vaccineObs.VaccineObsNumGroup != oldVaccineObs.VaccineObsNumGroup) {
				if(command!=""){ command+=",";}
				command+="VaccineObsNumGroup = "+POut.Long(vaccineObs.VaccineObsNumGroup)+"";
			}
			if(vaccineObs.UcumCode != oldVaccineObs.UcumCode) {
				if(command!=""){ command+=",";}
				command+="UcumCode = '"+POut.String(vaccineObs.UcumCode)+"'";
			}
			if(vaccineObs.DateObs != oldVaccineObs.DateObs) {
				if(command!=""){ command+=",";}
				command+="DateObs = "+POut.Date(vaccineObs.DateObs)+"";
			}
			if(vaccineObs.MethodCode != oldVaccineObs.MethodCode) {
				if(command!=""){ command+=",";}
				command+="MethodCode = '"+POut.String(vaccineObs.MethodCode)+"'";
			}
			if(command==""){
				return false;
			}
			command="UPDATE vaccineobs SET "+command
				+" WHERE VaccineObsNum = "+POut.Long(vaccineObs.VaccineObsNum);
			Db.NonQ(command);
			return true;
		}