public FormInCaseOfEmergency(PatField field)
 {
     InitializeComponent();
     Lan.F(this);
     _fieldCur = field;
     _fieldOld = _fieldCur.Copy();
 }
Example #2
0
        ///<summary></summary>
        public static void Insert(PatField pf)
        {
            if (PrefB.RandomKeys)
            {
                pf.PatFieldNum = MiscData.GetKey("patfield", "PatFieldNum");
            }
            string command = "INSERT INTO patfield (";

            if (PrefB.RandomKeys)
            {
                command += "PatFieldNum,";
            }
            command += "PatNum,FieldName,FieldValue) VALUES(";
            if (PrefB.RandomKeys)
            {
                command += "'" + POut.PInt(pf.PatFieldNum) + "', ";
            }
            command +=
                "'" + POut.PInt(pf.PatNum) + "', "
                + "'" + POut.PString(pf.FieldName) + "', "
                + "'" + POut.PString(pf.FieldValue) + "')";
            if (PrefB.RandomKeys)
            {
                General.NonQ(command);
            }
            else
            {
                pf.PatFieldNum = General.NonQ(command, true);
            }
        }
Example #3
0
        ///<summary>Inserts one PatField into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(PatField patField, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                patField.PatFieldNum = ReplicationServers.GetKey("patfield", "PatFieldNum");
            }
            string command = "INSERT INTO patfield (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "PatFieldNum,";
            }
            command += "PatNum,FieldName,FieldValue) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(patField.PatFieldNum) + ",";
            }
            command +=
                POut.Long(patField.PatNum) + ","
                + "'" + POut.String(patField.FieldName) + "',"
                + "'" + POut.String(patField.FieldValue) + "')";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                patField.PatFieldNum = Db.NonQ(command, true);
            }
            return(patField.PatFieldNum);
        }
Example #4
0
 ///<summary>Inserts one PatField into the database.  Returns the new priKey.</summary>
 internal static long Insert(PatField patField)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         patField.PatFieldNum=DbHelper.GetNextOracleKey("patfield","PatFieldNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(patField,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     patField.PatFieldNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(patField,false);
     }
 }
 public FormPatFieldCurrencyEdit(PatField field)
 {
     InitializeComponent();
     Lan.F(this);
     _fieldCur = field;
     _fieldOld = _fieldCur.Copy();
 }
Example #6
0
 ///<summary>Inserts one PatField into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(PatField patField,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         patField.PatFieldNum=ReplicationServers.GetKey("patfield","PatFieldNum");
     }
     string command="INSERT INTO patfield (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="PatFieldNum,";
     }
     command+="PatNum,FieldName,FieldValue) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(patField.PatFieldNum)+",";
     }
     command+=
              POut.Long  (patField.PatNum)+","
         +"'"+POut.String(patField.FieldName)+"',"
         +"'"+POut.String(patField.FieldValue)+"')";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         patField.PatFieldNum=Db.NonQ(command,true);
     }
     return patField.PatFieldNum;
 }
Example #7
0
 ///<summary>Inserts one PatField into the database.  Returns the new priKey.</summary>
 public static long Insert(PatField patField)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         patField.PatFieldNum = DbHelper.GetNextOracleKey("patfield", "PatFieldNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(patField, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     patField.PatFieldNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(patField, false));
     }
 }
Example #8
0
        ///<summary>Adds the passed in pat fields to the grid. Adds any fields that have been renamed at the end of the grid if the preference is
        ///enabled. The tag on the row will be the PatFieldDef or the PatField if the PatFieldDef has been renamed.</summary>
        public static void AddPatFieldsToGrid(ODGrid grid, List <PatField> listPatFields, FieldLocations fieldLocation,
                                              List <FieldDefLink> listFieldDefLinks = null)
        {
            List <PatFieldDef> listPatFieldDefs = PatFieldDefs.GetDeepCopy(true);

            listFieldDefLinks = listFieldDefLinks ?? FieldDefLinks.GetForLocation(fieldLocation)
                                .FindAll(x => x.FieldDefType == FieldDefTypes.Patient);
            //Add a row for each existing PatFieldDef
            foreach (PatFieldDef patFieldDef in listPatFieldDefs)
            {
                if (listFieldDefLinks.Exists(x => x.FieldDefNum == patFieldDef.PatFieldDefNum))
                {
                    continue;
                }
                ODGridRow row   = new ODGridRow();
                PatField  field = listPatFields.FirstOrDefault(x => x.FieldName == patFieldDef.FieldName);
                if (patFieldDef.FieldType.ToString() == "InCaseOfEmergency")
                {
                    //Deprecated. Should never happen.
                    continue;
                }
                row.Cells.Add(patFieldDef.FieldName);
                if (field == null)
                {
                    row.Cells.Add("");
                }
                else
                {
                    if (patFieldDef.FieldType == PatFieldType.Checkbox)
                    {
                        row.Cells.Add("X");
                    }
                    else if (patFieldDef.FieldType == PatFieldType.Currency)
                    {
                        row.Cells.Add(PIn.Double(field.FieldValue).ToString("c"));
                    }
                    else
                    {
                        row.Cells.Add(field.FieldValue);
                    }
                }
                row.Tag = patFieldDef;
                grid.Rows.Add(row);
            }
            if (!PrefC.GetBool(PrefName.DisplayRenamedPatFields))
            {
                return;
            }
            //Now loop through the PatFields that do not have a matching PatFieldDef.
            foreach (PatField patField in listPatFields.Where(x => !listPatFieldDefs.Any(y => y.FieldName == x.FieldName)))
            {
                ODGridRow row = new ODGridRow();
                row.Cells.Add(patField.FieldName);
                row.Cells.Add(patField.FieldValue);
                row.Tag       = patField;
                row.ColorText = Color.DarkSlateGray;
                grid.Rows.Add(row);
            }
        }
Example #9
0
        private void gridPat_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            PatField field = PatFields.GetByName(PatFieldDefs.List[e.Row].FieldName, listPatientFields);

            if (field == null)
            {
                field           = new PatField();
                field.PatNum    = PatCur.PatNum;
                field.FieldName = PatFieldDefs.List[e.Row].FieldName;
                if (PatFieldDefs.List[e.Row].FieldType == PatFieldType.Text)
                {
                    FormPatFieldEdit FormPF = new FormPatFieldEdit(field);
                    FormPF.IsNew = true;
                    FormPF.ShowDialog();
                }
                if (PatFieldDefs.List[e.Row].FieldType == PatFieldType.PickList)
                {
                    FormPatFieldPickEdit FormPF = new FormPatFieldPickEdit(field);
                    FormPF.IsNew = true;
                    FormPF.ShowDialog();
                }
                if (PatFieldDefs.List[e.Row].FieldType == PatFieldType.Date)
                {
                    FormPatFieldDateEdit FormPF = new FormPatFieldDateEdit(field);
                    FormPF.IsNew = true;
                    FormPF.ShowDialog();
                }
                if (PatFieldDefs.List[e.Row].FieldType == PatFieldType.Checkbox)
                {
                    FormPatFieldCheckEdit FormPF = new FormPatFieldCheckEdit(field);
                    FormPF.IsNew = true;
                    FormPF.ShowDialog();
                }
            }
            else
            {
                if (PatFieldDefs.List[e.Row].FieldType == PatFieldType.Text)
                {
                    FormPatFieldEdit FormPF = new FormPatFieldEdit(field);
                    FormPF.ShowDialog();
                }
                if (PatFieldDefs.List[e.Row].FieldType == PatFieldType.PickList)
                {
                    FormPatFieldPickEdit FormPF = new FormPatFieldPickEdit(field);
                    FormPF.ShowDialog();
                }
                if (PatFieldDefs.List[e.Row].FieldType == PatFieldType.Date)
                {
                    FormPatFieldDateEdit FormPF = new FormPatFieldDateEdit(field);
                    FormPF.ShowDialog();
                }
                if (PatFieldDefs.List[e.Row].FieldType == PatFieldType.Checkbox)
                {
                    FormPatFieldCheckEdit FormPF = new FormPatFieldCheckEdit(field);
                    FormPF.ShowDialog();
                }
            }
            FillGridPat();
        }
 ///<summary></summary>
 public FormPatFieldEdit(PatField field)
 {
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     Lan.F(this);
     Field = field;
 }
Example #11
0
        ///<summary></summary>
        public static void Update(PatField pf)
        {
            string command = "UPDATE patfield SET "
                             + "PatNum = '" + POut.PInt(pf.PatNum) + "'"
                             + ",FieldName = '" + POut.PString(pf.FieldName) + "'"
                             + ",FieldValue = '" + POut.PString(pf.FieldValue) + "'"
                             + " WHERE PatFieldNum  ='" + POut.PInt(pf.PatFieldNum) + "'";

            General.NonQ(command);
        }
Example #12
0
        ///<summary>Updates one PatField in the database.</summary>
        public static void Update(PatField patField)
        {
            string command = "UPDATE patfield SET "
                             + "PatNum     =  " + POut.Long(patField.PatNum) + ", "
                             + "FieldName  = '" + POut.String(patField.FieldName) + "', "
                             + "FieldValue = '" + POut.String(patField.FieldValue) + "' "
                             + "WHERE PatFieldNum = " + POut.Long(patField.PatFieldNum);

            Db.NonQ(command);
        }
Example #13
0
 ///<summary></summary>
 public FormPatFieldCheckEdit(PatField field)
 {
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     Lan.F(this);
     _fieldCur = field;
     _fieldOld = _fieldCur.Copy();
 }
Example #14
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<PatField> TableToList(DataTable table){
			List<PatField> retVal=new List<PatField>();
			PatField patField;
			for(int i=0;i<table.Rows.Count;i++) {
				patField=new PatField();
				patField.PatFieldNum= PIn.Long  (table.Rows[i]["PatFieldNum"].ToString());
				patField.PatNum     = PIn.Long  (table.Rows[i]["PatNum"].ToString());
				patField.FieldName  = PIn.String(table.Rows[i]["FieldName"].ToString());
				patField.FieldValue = PIn.String(table.Rows[i]["FieldValue"].ToString());
				retVal.Add(patField);
			}
			return retVal;
		}
Example #15
0
 ///<summary>Inserts one PatField into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(PatField patField)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(patField, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             patField.PatFieldNum = DbHelper.GetNextOracleKey("patfield", "PatFieldNum");                  //Cacheless method
         }
         return(InsertNoCache(patField, true));
     }
 }
Example #16
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <PatField> TableToList(DataTable table)
        {
            List <PatField> retVal = new List <PatField>();
            PatField        patField;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                patField             = new PatField();
                patField.PatFieldNum = PIn.Long(table.Rows[i]["PatFieldNum"].ToString());
                patField.PatNum      = PIn.Long(table.Rows[i]["PatNum"].ToString());
                patField.FieldName   = PIn.String(table.Rows[i]["FieldName"].ToString());
                patField.FieldValue  = PIn.String(table.Rows[i]["FieldValue"].ToString());
                retVal.Add(patField);
            }
            return(retVal);
        }
Example #17
0
        ///<summary>Gets a list of all PatFields for a given patient.</summary>
        public static PatField[] Refresh(int patNum)
        {
            string    command = "SELECT * FROM patfield WHERE PatNum=" + POut.PInt(patNum);
            DataTable table   = General.GetTable(command);

            PatField[] List = new PatField[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]             = new PatField();
                List[i].PatFieldNum = PIn.PInt(table.Rows[i][0].ToString());
                List[i].PatNum      = PIn.PInt(table.Rows[i][1].ToString());
                List[i].FieldName   = PIn.PString(table.Rows[i][2].ToString());
                List[i].FieldValue  = PIn.PString(table.Rows[i][3].ToString());
            }
            return(List);
        }
Example #18
0
        ///<summary>Updates one PatField 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(PatField patField, PatField oldPatField)
        {
            string command = "";

            if (patField.PatNum != oldPatField.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(patField.PatNum) + "";
            }
            if (patField.FieldName != oldPatField.FieldName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FieldName = '" + POut.String(patField.FieldName) + "'";
            }
            if (patField.FieldValue != oldPatField.FieldValue)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FieldValue = " + DbHelper.ParamChar + "paramFieldValue";
            }
            //SecUserNumEntry excluded from update
            //SecDateEntry not allowed to change
            //SecDateTEdit can only be set by MySQL
            if (command == "")
            {
                return(false);
            }
            if (patField.FieldValue == null)
            {
                patField.FieldValue = "";
            }
            OdSqlParameter paramFieldValue = new OdSqlParameter("paramFieldValue", OdDbType.Text, POut.StringNote(patField.FieldValue));

            command = "UPDATE patfield SET " + command
                      + " WHERE PatFieldNum = " + POut.Long(patField.PatFieldNum);
            Db.NonQ(command, paramFieldValue);
            return(true);
        }
Example #19
0
 private void gridPat_CellDoubleClick(object sender, ODGridClickEventArgs e)
 {
     if (gridPat.Rows[e.Row].Tag is PatFieldDef)             //patfield for an existing PatFieldDef
     {
         PatFieldDef patFieldDef = (PatFieldDef)gridPat.Rows[e.Row].Tag;
         PatField    field       = PatFields.GetByName(patFieldDef.FieldName, _arrayPatientFields);
         PatFieldL.OpenPatField(field, patFieldDef, _patCur.PatNum, true);
     }
     else if (gridPat.Rows[e.Row].Tag is PatField)             //PatField for a PatFieldDef that no longer exists
     {
         PatField         field  = (PatField)gridPat.Rows[e.Row].Tag;
         FormPatFieldEdit FormPF = new FormPatFieldEdit(field);
         FormPF.IsLaunchedFromOrtho = true;
         FormPF.ShowDialog();
     }
     FillGridPat();
 }
Example #20
0
        ///<summary>Updates one PatField in the database.</summary>
        public static void Update(PatField patField)
        {
            string command = "UPDATE patfield SET "
                             + "PatNum         =  " + POut.Long(patField.PatNum) + ", "
                             + "FieldName      = '" + POut.String(patField.FieldName) + "', "
                             + "FieldValue     =  " + DbHelper.ParamChar + "paramFieldValue "
                             //SecUserNumEntry excluded from update
                             //SecDateEntry not allowed to change
                             //SecDateTEdit can only be set by MySQL
                             + "WHERE PatFieldNum = " + POut.Long(patField.PatFieldNum);

            if (patField.FieldValue == null)
            {
                patField.FieldValue = "";
            }
            OdSqlParameter paramFieldValue = new OdSqlParameter("paramFieldValue", OdDbType.Text, POut.StringNote(patField.FieldValue));

            Db.NonQ(command, paramFieldValue);
        }
Example #21
0
 ///<summary>Returns true if Update(PatField,PatField) 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(PatField patField, PatField oldPatField)
 {
     if (patField.PatNum != oldPatField.PatNum)
     {
         return(true);
     }
     if (patField.FieldName != oldPatField.FieldName)
     {
         return(true);
     }
     if (patField.FieldValue != oldPatField.FieldValue)
     {
         return(true);
     }
     //SecUserNumEntry excluded from update
     //SecDateEntry not allowed to change
     //SecDateTEdit can only be set by MySQL
     return(false);
 }
Example #22
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <PatField> TableToList(DataTable table)
        {
            List <PatField> retVal = new List <PatField>();
            PatField        patField;

            foreach (DataRow row in table.Rows)
            {
                patField                 = new PatField();
                patField.PatFieldNum     = PIn.Long(row["PatFieldNum"].ToString());
                patField.PatNum          = PIn.Long(row["PatNum"].ToString());
                patField.FieldName       = PIn.String(row["FieldName"].ToString());
                patField.FieldValue      = PIn.String(row["FieldValue"].ToString());
                patField.SecUserNumEntry = PIn.Long(row["SecUserNumEntry"].ToString());
                patField.SecDateEntry    = PIn.Date(row["SecDateEntry"].ToString());
                patField.SecDateTEdit    = PIn.DateT(row["SecDateTEdit"].ToString());
                retVal.Add(patField);
            }
            return(retVal);
        }
Example #23
0
        ///<summary>Inserts one PatField into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(PatField patField, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO patfield (";

            if (!useExistingPK && isRandomKeys)
            {
                patField.PatFieldNum = ReplicationServers.GetKeyNoCache("patfield", "PatFieldNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "PatFieldNum,";
            }
            command += "PatNum,FieldName,FieldValue,SecUserNumEntry,SecDateEntry) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(patField.PatFieldNum) + ",";
            }
            command +=
                POut.Long(patField.PatNum) + ","
                + "'" + POut.String(patField.FieldName) + "',"
                + DbHelper.ParamChar + "paramFieldValue,"
                + POut.Long(patField.SecUserNumEntry) + ","
                + DbHelper.Now() + ")";
            //SecDateTEdit can only be set by MySQL
            if (patField.FieldValue == null)
            {
                patField.FieldValue = "";
            }
            OdSqlParameter paramFieldValue = new OdSqlParameter("paramFieldValue", OdDbType.Text, POut.StringNote(patField.FieldValue));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramFieldValue);
            }
            else
            {
                patField.PatFieldNum = Db.NonQ(command, true, "PatFieldNum", "patField", paramFieldValue);
            }
            return(patField.PatFieldNum);
        }
Example #24
0
        ///<summary>Updates one PatField 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(PatField patField, PatField oldPatField)
        {
            string command = "";

            if (patField.PatNum != oldPatField.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(patField.PatNum) + "";
            }
            if (patField.FieldName != oldPatField.FieldName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FieldName = '" + POut.String(patField.FieldName) + "'";
            }
            if (patField.FieldValue != oldPatField.FieldValue)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FieldValue = '" + POut.String(patField.FieldValue) + "'";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE patfield SET " + command
                      + " WHERE PatFieldNum = " + POut.Long(patField.PatFieldNum);
            Db.NonQ(command);
        }
Example #25
0
 ///<summary>Inserts one PatField into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(PatField patField)
 {
     return(InsertNoCache(patField, false));
 }
Example #26
0
 ///<summary>Opens the appropriate form to edit the patient field. The patField argument can be null or the patFieldDef argument can be null,
 ///but they cannot both be null.</summary>
 public static void OpenPatField(PatField patField, PatFieldDef patFieldDef, long patNum, bool isForOrtho = false)
 {
     if (patFieldDef != null)
     {
         if (patField == null)
         {
             patField           = new PatField();
             patField.PatNum    = patNum;
             patField.FieldName = patFieldDef.FieldName;
             if (patFieldDef.FieldType == PatFieldType.Text)
             {
                 FormPatFieldEdit FormPF = new FormPatFieldEdit(patField);
                 FormPF.IsLaunchedFromOrtho = isForOrtho;
                 FormPF.IsNew = true;
                 FormPF.ShowDialog();
             }
             if (patFieldDef.FieldType == PatFieldType.PickList)
             {
                 FormPatFieldPickEdit FormPF = new FormPatFieldPickEdit(patField);
                 FormPF.IsNew = true;
                 FormPF.ShowDialog();
             }
             if (patFieldDef.FieldType == PatFieldType.Date)
             {
                 FormPatFieldDateEdit FormPF = new FormPatFieldDateEdit(patField);
                 FormPF.IsNew = true;
                 FormPF.ShowDialog();
             }
             if (patFieldDef.FieldType == PatFieldType.Checkbox)
             {
                 FormPatFieldCheckEdit FormPF = new FormPatFieldCheckEdit(patField);
                 FormPF.IsNew = true;
                 FormPF.ShowDialog();
             }
             if (patFieldDef.FieldType == PatFieldType.Currency)
             {
                 FormPatFieldCurrencyEdit FormPF = new FormPatFieldCurrencyEdit(patField);
                 FormPF.IsNew = true;
                 FormPF.ShowDialog();
             }
             if (patFieldDef.FieldType == PatFieldType.InCaseOfEmergency)
             {
                 //Deprecated
             }
         }
         else                  //edit existing patfield
         {
             if (patFieldDef.FieldType == PatFieldType.Text)
             {
                 FormPatFieldEdit FormPF = new FormPatFieldEdit(patField);
                 FormPF.IsLaunchedFromOrtho = isForOrtho;
                 FormPF.ShowDialog();
             }
             if (patFieldDef.FieldType == PatFieldType.PickList)
             {
                 FormPatFieldPickEdit FormPF = new FormPatFieldPickEdit(patField);
                 FormPF.ShowDialog();
             }
             if (patFieldDef.FieldType == PatFieldType.Date)
             {
                 FormPatFieldDateEdit FormPF = new FormPatFieldDateEdit(patField);
                 FormPF.ShowDialog();
             }
             if (patFieldDef.FieldType == PatFieldType.Checkbox)
             {
                 FormPatFieldCheckEdit FormPF = new FormPatFieldCheckEdit(patField);
                 FormPF.ShowDialog();
             }
             if (patFieldDef.FieldType == PatFieldType.Currency)
             {
                 FormPatFieldCurrencyEdit FormPF = new FormPatFieldCurrencyEdit(patField);
                 FormPF.ShowDialog();
             }
             if (patFieldDef.FieldType == PatFieldType.InCaseOfEmergency)
             {
                 //Deprecated
             }
         }
     }
     else if (patField != null)           //PatField for a PatFieldDef that no longer exists
     {
         FormPatFieldEdit FormPF = new FormPatFieldEdit(patField);
         FormPF.IsLaunchedFromOrtho = isForOrtho;
         FormPF.ShowDialog();
     }
 }
Example #27
0
 ///<summary>Updates one PatField 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(PatField patField,PatField oldPatField)
 {
     string command="";
     if(patField.PatNum != oldPatField.PatNum) {
         if(command!=""){ command+=",";}
         command+="PatNum = "+POut.Long(patField.PatNum)+"";
     }
     if(patField.FieldName != oldPatField.FieldName) {
         if(command!=""){ command+=",";}
         command+="FieldName = '"+POut.String(patField.FieldName)+"'";
     }
     if(patField.FieldValue != oldPatField.FieldValue) {
         if(command!=""){ command+=",";}
         command+="FieldValue = '"+POut.String(patField.FieldValue)+"'";
     }
     if(command==""){
         return;
     }
     command="UPDATE patfield SET "+command
         +" WHERE PatFieldNum = "+POut.Long(patField.PatFieldNum);
     Db.NonQ(command);
 }
Example #28
0
 ///<summary>Updates one PatField in the database.</summary>
 internal static void Update(PatField patField)
 {
     string command="UPDATE patfield SET "
         +"PatNum     =  "+POut.Long  (patField.PatNum)+", "
         +"FieldName  = '"+POut.String(patField.FieldName)+"', "
         +"FieldValue = '"+POut.String(patField.FieldValue)+"' "
         +"WHERE PatFieldNum = "+POut.Long(patField.PatFieldNum);
     Db.NonQ(command);
 }
Example #29
0
        ///<summary></summary>
        public static void Delete(PatField pf)
        {
            string command = "DELETE FROM patfield WHERE PatFieldNum =" + POut.PInt(pf.PatFieldNum);

            General.NonQ(command);
        }
 public FormPatFieldCurrencyEdit(PatField field)
 {
     InitializeComponent();
     Lan.F(this);
     Field = field;
 }