Exemplo n.º 1
0
 ///<summary>Inserts one ClinicPref into the database.  Returns the new priKey.</summary>
 public static long Insert(ClinicPref clinicPref)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         clinicPref.ClinicPrefNum = DbHelper.GetNextOracleKey("clinicpref", "ClinicPrefNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(clinicPref, true));
             }
             catch (Oracle.ManagedDataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     clinicPref.ClinicPrefNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(clinicPref, false));
     }
 }
Exemplo n.º 2
0
        ///<summary>Save template changes made in WebSchedVerify.</summary>
        private void SaveTabWebSchedVerify()
        {
            List <long> listClinics = Clinics.GetForUserod(Security.CurUser).Select(x => x.ClinicNum).ToList();

            foreach (PrefName prefName in _listWebSchedVerifyPrefNames)
            {
                foreach (long clinicNum in listClinics)
                {
                    ClinicPref newClinicPref = _listWebSchedVerifyClinicPrefs.FirstOrDefault(x => x.PrefName == prefName && x.ClinicNum == clinicNum);
                    ClinicPref oldClinicPref = _listWebSchedVerifyClinicPrefs_Old.FirstOrDefault(x => x.PrefName == prefName && x.ClinicNum == clinicNum);
                    if (oldClinicPref == null && newClinicPref == null)                  //skip items not in either list
                    {
                        continue;
                    }
                    else if (oldClinicPref == null && newClinicPref != null)                  //insert items in the new list and not the old list
                    {
                        ClinicPrefs.Insert(newClinicPref);
                    }
                    else if (oldClinicPref != null && newClinicPref == null)                  //delete items in the old list and not the new list
                    {
                        ClinicPrefs.Delete(oldClinicPref.ClinicPrefNum);
                    }
                    else                       //update items that have changed
                    {
                        ClinicPrefs.Update(newClinicPref, oldClinicPref);
                    }
                }
                ClinicPref newPref = _listWebSchedVerifyClinicPrefs.FirstOrDefault(x => x.PrefName == prefName && x.ClinicNum == CLINIC_NUM_DEFAULT);
                if (newPref != null)
                {
                    Prefs.UpdateString(prefName, newPref.ValueString);
                }
            }
        }
Exemplo n.º 3
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <ClinicPref> TableToList(DataTable table)
        {
            List <ClinicPref> retVal = new List <ClinicPref>();
            ClinicPref        clinicPref;

            foreach (DataRow row in table.Rows)
            {
                clinicPref = new ClinicPref();
                clinicPref.ClinicPrefNum = PIn.Long(row["ClinicPrefNum"].ToString());
                clinicPref.ClinicNum     = PIn.Long(row["ClinicNum"].ToString());
                string prefName = row["PrefName"].ToString();
                if (prefName == "")
                {
                    clinicPref.PrefName = (PrefName)0;
                }
                else
                {
                    try{
                        clinicPref.PrefName = (PrefName)Enum.Parse(typeof(PrefName), prefName);
                    }
                    catch {
                        clinicPref.PrefName = (PrefName)0;
                    }
                }
                clinicPref.ValueString = PIn.String(row["ValueString"].ToString());
                retVal.Add(clinicPref);
            }
            return(retVal);
        }
Exemplo n.º 4
0
        ///<summary>Essentially a "sync" method although it doesn't save to the db. Takes the list of new clinic preference values
        ///and compares it to the database. Returns a list of clinics that have had their preference values changed.</summary>
        public List <long> GetClinicsWithChanges(PrefName prefName)
        {
            List <ClinicPref> listClinicPrefsThisPrefName = _listClinicPrefs.FindAll(x => x.PrefName == prefName);
            List <long>       listRet = new List <long>();
            List <ClinicPref> listDb  = ClinicPrefs.GetPrefAllClinics(prefName, includeDefault: true);

            listRet.AddRange(listClinicPrefsThisPrefName.Where(x =>
                             //Get the items from the new list that aren't in the old list
                                                               !listDb.Select(y => y.ClinicNum).Contains(x.ClinicNum)
                             //AND that aren't using the default preference value
                                                               && x.ValueString != PrefC.GetString(prefName))
                             //Add the clinic nums
                             .Select(x => x.ClinicNum));
            //Add any items that have been deleted or updated.
            foreach (ClinicPref oldCp in listDb)
            {
                ClinicPref newCp = listClinicPrefsThisPrefName.FirstOrDefault(x => x.ClinicNum == oldCp.ClinicNum);
                if (newCp == null)                //Item was in db and now is not.
                {
                    listRet.Add(oldCp.ClinicNum);
                    continue;
                }
                if (newCp.ValueString != oldCp.ValueString)                //Item has changed.
                {
                    listRet.Add(oldCp.ClinicNum);
                }
            }
            return(listRet.Distinct().ToList());
        }
        private void checkUseDefaultProvRule_Click(object sender, EventArgs e)
        {
            listBoxWebSchedProviderPref.Enabled = (!checkUseDefaultProvRule.Checked);
            ClinicPref prefProviderRule = ClinicPrefs.GetPref(PrefName.WebSchedProviderRule, comboClinicProvRule.SelectedClinicNum, isDefaultIncluded: true);

            if (checkUseDefaultProvRule.Checked)
            {
                if (ClinicPrefs.DeletePrefs(comboClinicProvRule.SelectedClinicNum, new List <PrefName>()
                {
                    PrefName.WebSchedProviderRule
                }) > 0)
                {
                    DataValid.SetInvalid(InvalidType.ClinicPrefs);                    //Checking "Use Defaults", delete ClinicPref is exists.
                }
            }
            else if (!comboClinicProvRule.IsUnassignedSelected)
            {
                //Unchecking "Use Defaults" and on a clinic that doesn't have a ClinicPref yet, create new ClinicPref with default value
                if (prefProviderRule != null)
                {
                    ClinicPrefs.DeletePrefs(comboClinicProvRule.SelectedClinicNum, new List <PrefName>()
                    {
                        PrefName.WebSchedProviderRule
                    });
                }
                ClinicPrefs.InsertPref(PrefName.WebSchedProviderRule, comboClinicProvRule.SelectedClinicNum
                                       , POut.Int(PrefC.GetInt(PrefName.WebSchedProviderRule)));
                DataValid.SetInvalid(InvalidType.ClinicPrefs);
            }
            prefProviderRule = ClinicPrefs.GetPref(PrefName.WebSchedProviderRule, comboClinicProvRule.SelectedClinicNum, isDefaultIncluded: true);
            SetListBoxWebSchedProviderPref(prefProviderRule);
        }
Exemplo n.º 6
0
        ///<summary>Creates a row for the passed in template type. Unchecks checkUseDefaults if a clinic-level template is in use.</summary>
        private ODGridRow BuildRowForTemplate(PrefName prefName, string templateName, string availableVars)
        {
            string templateText;
            bool   doShowDefault = false;

            if (_selectedClinicNum == 0)
            {
                templateText             = PrefC.GetString(prefName);
                checkUseDefaults.Checked = false;
            }
            else
            {
                ClinicPref clinicPref = ClinicPrefs.GetPref(prefName, _selectedClinicNum);
                if (clinicPref == null || clinicPref.ValueString == null)
                {
                    templateText  = PrefC.GetString(prefName);
                    doShowDefault = true;
                }
                else
                {
                    templateText             = clinicPref.ValueString;
                    checkUseDefaults.Checked = false;
                }
            }
            ODGridRow row = new ODGridRow();

            row.Cells.Add(Lan.g(this, templateName) + (doShowDefault ? " " + Lan.g(this, "(Default)") : ""));
            row.Cells.Add(availableVars);
            row.Cells.Add(templateText);
            row.Tag = prefName;
            return(row);
        }
        private void FillWebSchedProviderRule()
        {
            ClinicPref prefProviderRule = ClinicPrefs.GetPref(PrefName.WebSchedProviderRule, comboClinicProvRule.SelectedClinicNum, isDefaultIncluded: true);

            checkUseDefaultProvRule.Visible = (!comboClinicProvRule.IsUnassignedSelected); //"Use Defaults" checkbox visible when actual clinic is selected.
            checkUseDefaultProvRule.Checked = (prefProviderRule == null);
            SetListBoxWebSchedProviderPref(prefProviderRule);                              //Select ClincPref's value, or default if no ClinicPref.
        }
Exemplo n.º 8
0
        ///<summary>Returns the clinic pref value for the currently selected clinic and provided PrefName, or the default pref if there is none.</summary>
        private string WebSchedVerify_GetTemplateVal(PrefName prefName)
        {
            ClinicPref clinicPref  = _listWebSchedVerifyClinicPrefs.FirstOrDefault(x => x.ClinicNum == comboClinicVerify.SelectedClinicNum && x.PrefName == prefName);
            ClinicPref defaultPref = _listWebSchedVerifyClinicPrefs.FirstOrDefault(x => x.ClinicNum == CLINIC_NUM_DEFAULT && x.PrefName == prefName);

            //ClinicPref won't be available if it has not been created previously.
            return(clinicPref != null ? clinicPref.ValueString : defaultPref.ValueString);
        }
Exemplo n.º 9
0
        private void AddClinicPrefToList(PrefName prefName, long clinicNum)
        {
            ClinicPref clinicPref = ClinicPrefs.GetPref(prefName, clinicNum);

            if (clinicPref != null)
            {
                _listClinicPrefsWebSchedNewPats.Add(clinicPref);
            }
        }
Exemplo n.º 10
0
        /// <summary>Tries to get the original clinic pref that was loaded in when the form first opened, and reload it into the in-memory clinic pref
        /// list. If there is no old pref, this loads the default pref value for that clinic into the in-memory list.</summary>
        private void WebSchedVerify_TryRestoreClinicPrefOld(PrefName prefName)
        {
            ClinicPref pref = _listWebSchedVerifyClinicPrefs_Old.FindAll(x => x.ClinicNum == comboClinicVerify.SelectedClinicNum && x.PrefName == prefName).FirstOrDefault();

            if (pref == null)
            {
                pref = _listWebSchedVerifyClinicPrefs.FindAll(x => x.ClinicNum == CLINIC_NUM_DEFAULT && x.PrefName == prefName).First();
            }
            WebSchedVerify_UpdateClinicPref(prefName, pref.ValueString);
        }
 private void SetListBoxWebSchedProviderPref(ClinicPref pref)
 {
     if (pref == null)           //Using defaults.
     {
         listBoxWebSchedProviderPref.SelectedIndex = PrefC.GetInt(PrefName.WebSchedProviderRule);
     }
     else
     {
         listBoxWebSchedProviderPref.SelectedIndex = PIn.Int(pref.ValueString);
     }
 }
Exemplo n.º 12
0
        private ClinicPref GetClinicPrefToSave(long clinicNum, PrefName prefName, string value)
        {
            ClinicPref clinicPref = _listClinicPrefsWebSchedNewPats.FirstOrDefault(x => x.ClinicNum == clinicNum && x.PrefName == prefName)?.Clone();

            if (clinicPref == null)
            {
                return(new ClinicPref(clinicNum, prefName, value));
            }
            clinicPref.ValueString = value;
            return(clinicPref);
        }
Exemplo n.º 13
0
 ///<summary>Inserts one ClinicPref into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ClinicPref clinicPref)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(clinicPref, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             clinicPref.ClinicPrefNum = DbHelper.GetNextOracleKey("clinicpref", "ClinicPrefNum");                  //Cacheless method
         }
         return(InsertNoCache(clinicPref, true));
     }
 }
Exemplo n.º 14
0
        ///<summary>Updates the in-memory clinic pref list with the given valueString for the provided prefName and currently selected clinic.</summary>
        private void WebSchedVerify_UpdateClinicPref(PrefName prefName, string valueString)
        {
            ClinicPref clinicPref = _listWebSchedVerifyClinicPrefs.FirstOrDefault(x => x.ClinicNum == comboClinicVerify.SelectedClinicNum && x.PrefName == prefName);

            if (clinicPref == null)
            {
                _listWebSchedVerifyClinicPrefs.Add(new ClinicPref()
                {
                    PrefName = prefName, ClinicNum = comboClinicVerify.SelectedClinicNum, ValueString = valueString
                });
            }
            else
            {
                clinicPref.ValueString = valueString;
            }
        }
Exemplo n.º 15
0
 ///<summary>Returns true if Update(ClinicPref,ClinicPref) 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(ClinicPref clinicPref, ClinicPref oldClinicPref)
 {
     if (clinicPref.ClinicNum != oldClinicPref.ClinicNum)
     {
         return(true);
     }
     if (clinicPref.PrefName != oldClinicPref.PrefName)
     {
         return(true);
     }
     if (clinicPref.ValueString != oldClinicPref.ValueString)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 16
0
        ///<summary>Updates one ClinicPref in the database.</summary>
        public static void Update(ClinicPref clinicPref)
        {
            string command = "UPDATE clinicpref SET "
                             + "ClinicNum    =  " + POut.Long(clinicPref.ClinicNum) + ", "
                             + "PrefName     = '" + POut.String(clinicPref.PrefName.ToString()) + "', "
                             + "ValueString  =  " + DbHelper.ParamChar + "paramValueString "
                             + "WHERE ClinicPrefNum = " + POut.Long(clinicPref.ClinicPrefNum);

            if (clinicPref.ValueString == null)
            {
                clinicPref.ValueString = "";
            }
            OdSqlParameter paramValueString = new OdSqlParameter("paramValueString", OdDbType.Text, POut.StringParam(clinicPref.ValueString));

            Db.NonQ(command, paramValueString);
        }
Exemplo n.º 17
0
        private void FillPrefs()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn(Lan.g(this, "Type"), 100);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, ""), 250);        //Random tidbits regarding the template
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Template"), 500);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            checkUseDefaults.Checked = true;
            string    baseVars = Lan.g(this, "Available variables:") + " [NameF], [Date], [Time], [OfficeName], [OfficePhone]";
            ODGridRow row;

            row = BuildRowForTemplate(PrefName.ASAPTextTemplate, "Text manual", baseVars);
            gridMain.Rows.Add(row);
            row = BuildRowForTemplate(PrefName.WebSchedAsapTextTemplate, "Web Sched Text", baseVars + ", [AsapURL]");
            gridMain.Rows.Add(row);
            row = BuildRowForTemplate(PrefName.WebSchedAsapEmailTemplate, "Web Sched Email Body", baseVars + ", [AsapURL]");
            gridMain.Rows.Add(row);
            row = BuildRowForTemplate(PrefName.WebSchedAsapEmailSubj, "Web Sched Email Subject", baseVars);
            gridMain.Rows.Add(row);
            gridMain.EndUpdate();
            if (_selectedClinicNum == 0)
            {
                textWebSchedPerDay.Text  = PrefC.GetString(PrefName.WebSchedAsapTextLimit);
                checkUseDefaults.Checked = false;
            }
            else
            {
                ClinicPref clinicPref = ClinicPrefs.GetPref(PrefName.WebSchedAsapTextLimit, _selectedClinicNum);
                if (clinicPref == null || clinicPref.ValueString == null)
                {
                    textWebSchedPerDay.Text = PrefC.GetString(PrefName.WebSchedAsapTextLimit);
                }
                else
                {
                    textWebSchedPerDay.Text  = clinicPref.ValueString;
                    checkUseDefaults.Checked = false;
                }
            }
        }
Exemplo n.º 18
0
        ///<summary>Updates one ClinicPref 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(ClinicPref clinicPref, ClinicPref oldClinicPref)
        {
            string command = "";

            if (clinicPref.ClinicNum != oldClinicPref.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(clinicPref.ClinicNum) + "";
            }
            if (clinicPref.PrefName != oldClinicPref.PrefName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PrefName = '" + POut.String(clinicPref.PrefName.ToString()) + "'";
            }
            if (clinicPref.ValueString != oldClinicPref.ValueString)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ValueString = " + DbHelper.ParamChar + "paramValueString";
            }
            if (command == "")
            {
                return(false);
            }
            if (clinicPref.ValueString == null)
            {
                clinicPref.ValueString = "";
            }
            OdSqlParameter paramValueString = new OdSqlParameter("paramValueString", OdDbType.Text, POut.StringParam(clinicPref.ValueString));

            command = "UPDATE clinicpref SET " + command
                      + " WHERE ClinicPrefNum = " + POut.Long(clinicPref.ClinicPrefNum);
            Db.NonQ(command, paramValueString);
            return(true);
        }
Exemplo n.º 19
0
        private void FillGrid()
        {
            gridOptions.BeginUpdate();
            //Columns
            gridOptions.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g(this, "Allow Children"), 85, HorizontalAlignment.Center);

            gridOptions.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Show Pre-Screen Questions"), 175, HorizontalAlignment.Center);
            gridOptions.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "E-mail Verify"), 80, HorizontalAlignment.Center);
            gridOptions.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Text Verify"), 80, HorizontalAlignment.Center);
            gridOptions.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Launch WebForm on Complete"), 175, HorizontalAlignment.Center);
            gridOptions.Columns.Add(col);
            //Rows
            gridOptions.Rows.Clear();
            ODGridRow row = new ODGridRow();

            row.Cells.Add(ToGridStr(ClinicPrefs.GetBool(PrefName.WebSchedNewPatAllowChildren, Signup.ClinicNum)));
            row.Cells.Add(ToGridStr(ClinicPrefs.GetBool(PrefName.WebSchedNewPatVerifyInfo, Signup.ClinicNum)));
            row.Cells.Add(ToGridStr(ClinicPrefs.GetBool(PrefName.WebSchedNewPatDoAuthEmail, Signup.ClinicNum)));
            row.Cells.Add(ToGridStr(ClinicPrefs.GetBool(PrefName.WebSchedNewPatDoAuthText, Signup.ClinicNum)));
            string url = "";

            if (Signup.ClinicNum == 0)            //HQ always uses pref.
            {
                url = PrefC.GetString(PrefName.WebSchedNewPatWebFormsURL);
            }
            else               //Clinic should not default back to HQ version of URL. This is unlike typical ClinicPref behavior.
            {
                ClinicPref pref = ClinicPrefs.GetPref(PrefName.WebSchedNewPatWebFormsURL, Signup.ClinicNum);
                if (pref != null)
                {
                    url = pref.ValueString;
                }
            }
            row.Cells.Add(ToGridStr(!string.IsNullOrWhiteSpace(url)));
            gridOptions.Rows.Add(row);
            gridOptions.EndUpdate();
            SetFormToLaunch(url);
        }
Exemplo n.º 20
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            PrefName prefName           = (PrefName)gridMain.Rows[e.Row].Tag;
            FormRecallMessageEdit FormR = new FormRecallMessageEdit(prefName);

            if (_selectedClinicNum == 0)
            {
                FormR.MessageVal = PrefC.GetString(prefName);
            }
            else
            {
                ClinicPref clinicPref = ClinicPrefs.GetPref(prefName, _selectedClinicNum);
                if (clinicPref == null || string.IsNullOrEmpty(clinicPref.ValueString))
                {
                    FormR.MessageVal = PrefC.GetString(prefName);
                }
                else
                {
                    FormR.MessageVal = clinicPref.ValueString;
                }
            }
            FormR.ShowDialog();
            if (FormR.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (_selectedClinicNum == 0)
            {
                if (Prefs.UpdateString(prefName, FormR.MessageVal))
                {
                    DataValid.SetInvalid(InvalidType.Prefs);
                }
            }
            else
            {
                if (ClinicPrefs.Upsert(prefName, _selectedClinicNum, FormR.MessageVal))
                {
                    DataValid.SetInvalid(InvalidType.ClinicPrefs);
                }
            }
            FillPrefs();
        }
Exemplo n.º 21
0
        ///<summary>For all types, so pass in string val.  This changes the value in the clinicpref that we have in memory.  It will be synched later.</summary>
        public void ValChangedByUser(PrefName prefName, long clinicNum, string newVal)
        {
            if (clinicNum < 0)            //Shouldn't happen...
            {
                return;
            }
            //Update the current value for the pref that we are storing in the list
            ClinicPref clinicPref = _listClinicPrefs.FirstOrDefault(x => x.ClinicNum == clinicNum && x.PrefName == prefName);

            if (clinicPref == null)            //Doesn't exist so create one
            {
                clinicPref = new ClinicPref()
                {
                    PrefName  = prefName,
                    ClinicNum = clinicNum
                };
                _listClinicPrefs.Add(clinicPref);
            }
            clinicPref.ValueString = newVal;
        }
Exemplo n.º 22
0
        ///<summary>Inserts one ClinicPref into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ClinicPref clinicPref, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO clinicpref (";

            if (!useExistingPK && isRandomKeys)
            {
                clinicPref.ClinicPrefNum = ReplicationServers.GetKeyNoCache("clinicpref", "ClinicPrefNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ClinicPrefNum,";
            }
            command += "ClinicNum,PrefName,ValueString) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(clinicPref.ClinicPrefNum) + ",";
            }
            command +=
                POut.Long(clinicPref.ClinicNum) + ","
                + "'" + POut.String(clinicPref.PrefName.ToString()) + "',"
                + DbHelper.ParamChar + "paramValueString)";
            if (clinicPref.ValueString == null)
            {
                clinicPref.ValueString = "";
            }
            OdSqlParameter paramValueString = new OdSqlParameter("paramValueString", OdDbType.Text, POut.StringParam(clinicPref.ValueString));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramValueString);
            }
            else
            {
                clinicPref.ClinicPrefNum = Db.NonQ(command, true, "ClinicPrefNum", "clinicPref", paramValueString);
            }
            return(clinicPref.ClinicPrefNum);
        }
Exemplo n.º 23
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            PrefName prefName = (PrefName)gridMain.ListGridRows[e.Row].Tag;
            string   curPrefValue;

            if (_selectedClinicNum == 0)
            {
                curPrefValue = PrefC.GetString(prefName);
            }
            else
            {
                ClinicPref clinicPref = ClinicPrefs.GetPref(prefName, _selectedClinicNum);
                if (clinicPref == null || string.IsNullOrEmpty(clinicPref.ValueString))
                {
                    curPrefValue = PrefC.GetString(prefName);
                }
                else
                {
                    curPrefValue = clinicPref.ValueString;
                }
            }
            string newPrefValue;
            bool   isHtmlTemplate = prefName == PrefName.WebSchedAsapEmailTemplate;

            if (isHtmlTemplate)
            {
                FormEmailEdit formEmailEdit = new FormEmailEdit {
                    MarkupText           = curPrefValue,
                    DoCheckForDisclaimer = true,
                    IsRawAllowed         = false,
                };
                formEmailEdit.ShowDialog();
                if (formEmailEdit.DialogResult != DialogResult.OK)
                {
                    return;
                }
                newPrefValue = formEmailEdit.MarkupText;
            }
            else
            {
                FormRecallMessageEdit FormR = new FormRecallMessageEdit(prefName);
                FormR.MessageVal = curPrefValue;
                FormR.ShowDialog();
                if (FormR.DialogResult != DialogResult.OK)
                {
                    return;
                }
                newPrefValue = FormR.MessageVal;
            }
            if (_selectedClinicNum == 0)
            {
                if (Prefs.UpdateString(prefName, newPrefValue))
                {
                    DataValid.SetInvalid(InvalidType.Prefs);
                }
            }
            else
            {
                if (ClinicPrefs.Upsert(prefName, _selectedClinicNum, newPrefValue))
                {
                    DataValid.SetInvalid(InvalidType.ClinicPrefs);
                }
            }
            FillPrefs();
        }
Exemplo n.º 24
0
 ///<summary>Inserts one ClinicPref into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ClinicPref clinicPref)
 {
     return(InsertNoCache(clinicPref, false));
 }