コード例 #1
0
ファイル: Prefs.cs プロジェクト: nampn/ODental
        ///<summary>Updates a pref of type long.  Returns true if a change was required, or false if no change needed.</summary>
        public static bool UpdateLong(PrefName prefName, long newValue)
        {
            //Very unusual.  Involves cache, so Meth is used further down instead of here at the top.
            if (!PrefC.Dict.ContainsKey(prefName.ToString()))
            {
                throw new ApplicationException(prefName + " is an invalid pref name.");
            }
            if (PrefC.GetLong(prefName) == newValue)
            {
                return(false);               //no change needed
            }
            string command = "UPDATE preference SET "
                             + "ValueString = '" + POut.Long(newValue) + "' "
                             + "WHERE PrefName = '" + POut.String(prefName.ToString()) + "'";
            bool retVal = true;

            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                retVal = Meth.GetBool(MethodBase.GetCurrentMethod(), prefName, newValue);
            }
            else
            {
                Db.NonQ(command);
            }
            Pref pref = new Pref();

            pref.PrefName    = prefName.ToString();
            pref.ValueString = newValue.ToString();
            PrefC.Dict[prefName.ToString()] = pref;          //in some cases, we just want to change the pref in local memory instead of doing a refresh afterwards.
            return(retVal);
        }
コード例 #2
0
ファイル: Prefs.cs プロジェクト: ChemBrain/OpenDental
        ///<summary>Returns true if a change was required, or false if no change needed.</summary>
        public static bool UpdateDateT(PrefName prefName, DateTime newValue)
        {
            //Very unusual.  Involves cache, so Meth is used further down instead of here at the top.
            DateTime curValue = PrefC.GetDateT(prefName);

            if (curValue == newValue)
            {
                return(false);               //no change needed
            }
            string command = "UPDATE preference SET "
                             + "ValueString = '" + POut.DateT(newValue, false) + "' "
                             + "WHERE PrefName = '" + POut.String(prefName.ToString()) + "'";
            bool retVal = true;

            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                retVal = Meth.GetBool(MethodBase.GetCurrentMethod(), prefName, newValue);
            }
            else
            {
                Db.NonQ(command);
            }
            Pref pref = new Pref();

            pref.PrefName    = prefName.ToString();
            pref.ValueString = POut.DateT(newValue, false);
            Prefs.UpdateValueForKey(pref);
            return(retVal);
        }
コード例 #3
0
ファイル: Prefs.cs プロジェクト: nampn/ODental
        ///<summary>Returns true if a change was required, or false if no change needed.</summary>
        public static bool UpdateBool(PrefName prefName, bool newValue, bool isForced)
        {
            //Very unusual.  Involves cache, so Meth is used further down instead of here at the top.
            if (!PrefC.Dict.ContainsKey(prefName.ToString()))
            {
                throw new ApplicationException(prefName + " is an invalid pref name.");
            }
            if (!isForced && PrefC.GetBool(prefName) == newValue)
            {
                return(false);               //no change needed
            }
            string command = "UPDATE preference SET "
                             + "ValueString = '" + POut.Bool(newValue) + "' "
                             + "WHERE PrefName = '" + POut.String(prefName.ToString()) + "'";
            bool retVal = true;

            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                retVal = Meth.GetBool(MethodBase.GetCurrentMethod(), prefName, newValue, isForced);
            }
            else
            {
                Db.NonQ(command);
            }
            Pref pref = new Pref();

            pref.PrefName    = prefName.ToString();
            pref.ValueString = POut.Bool(newValue);
            PrefC.Dict[prefName.ToString()] = pref;
            return(retVal);
        }
コード例 #4
0
ファイル: PrefC.cs プロジェクト: mnisl/OD
		///<summary>Gets a pref of type double.</summary>
		public static double GetDouble(PrefName prefName) {
			Dictionary<string,Pref> dictPrefs=GetDict();
			if(!dictPrefs.ContainsKey(prefName.ToString())) {
				throw new Exception(prefName+" is an invalid pref name.");
			}
			return PIn.Double(dictPrefs[prefName.ToString()].ValueString);
		}
コード例 #5
0
ファイル: PrefC.cs プロジェクト: romeroyonatan/opendental
		///<Summary>Gets a pref of type bool, but will not throw an exception if null or not found.  Indicate whether the silent default is true or false.</Summary>
		public static bool GetBoolSilent(PrefName prefName,bool silentDefault) {
			if(Dict==null) {
				return silentDefault;
			}
			if(!Dict.ContainsKey(prefName.ToString())) {
				return silentDefault;
			}
			return PIn.Bool(Dict[prefName.ToString()].ValueString);
		}
コード例 #6
0
ファイル: PrefC.cs プロジェクト: romeroyonatan/opendental
		///<summary>Gets a pref of type bool.</summary>
		public static bool GetBool(PrefName prefName) {
			if(Dict==null) {
				Prefs.RefreshCache();
			}
			if(!Dict.ContainsKey(prefName.ToString())) {
				throw new Exception(prefName+" is an invalid pref name.");
			}
			return PIn.Bool(Dict[prefName.ToString()].ValueString);
		}
コード例 #7
0
 ///<summary>Gets a pref of type string.  Will not throw an exception if null or not found.</summary>
 public static string GetStringSilent(PrefName prefName)
 {
     if (Dict == null)
     {
         return("");
     }
     if (!Dict.ContainsKey(prefName.ToString()))
     {
         return("");
     }
     return(Dict[prefName.ToString()].ValueString);
 }
コード例 #8
0
 ///<summary>Gets a color from an int32 pref.</summary>
 public static Color GetColor(PrefName prefName)
 {
     if (Dict == null)
     {
         Prefs.RefreshCache();
     }
     if (!Dict.ContainsKey(prefName.ToString()))
     {
         throw new Exception(prefName + " is an invalid pref name.");
     }
     return(Color.FromArgb(PIn.Int(Dict[prefName.ToString()].ValueString)));
 }
コード例 #9
0
 ///<Summary>Gets a pref of type bool, but will not throw an exception if null or not found.  Indicate whether the silent default is true or false.</Summary>
 public static bool GetBoolSilent(PrefName prefName, bool silentDefault)
 {
     if (Dict == null)
     {
         return(silentDefault);
     }
     if (!Dict.ContainsKey(prefName.ToString()))
     {
         return(silentDefault);
     }
     return(PIn.Bool(Dict[prefName.ToString()].ValueString));
 }
コード例 #10
0
 ///<summary>Gets a pref of type string.</summary>
 public static string GetString(PrefName prefName)
 {
     if (Dict == null)
     {
         Prefs.RefreshCache();
     }
     if (!Dict.ContainsKey(prefName.ToString()))
     {
         throw new Exception(prefName + " is an invalid pref name.");
     }
     return(Dict[prefName.ToString()].ValueString);
 }
コード例 #11
0
ファイル: ClinicPrefs.cs プロジェクト: kjb7749/testImport
        ///<summary>Updates a pref of type long for the specified clinic.  Returns true if a change was required, or false if no change needed.</summary>
        public static bool UpdateLong(PrefName prefName, long clinicNum, long newValue)
        {
            //Very unusual.  Involves cache, so Meth is used further down instead of here at the top.
            ClinicPref clinicPref = GetFirstOrDefault(x => x.ClinicNum == clinicNum && x.PrefName == prefName);

            if (clinicPref == null)
            {
                throw new ApplicationException("The PrefName " + prefName + " does not exist for ClinicNum: " + clinicNum);
            }
            if (PIn.Long(clinicPref.ValueString) == newValue)
            {
                return(false);               //no change needed
            }
            string command = "UPDATE clinicpref SET ValueString='" + POut.Long(newValue) + "' "
                             + "WHERE PrefName='" + POut.String(prefName.ToString()) + "' "
                             + "AND ClinicNum='" + POut.Long(clinicNum) + "'";
            bool retVal = true;

            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                retVal = Meth.GetBool(MethodBase.GetCurrentMethod(), prefName, newValue);
            }
            else
            {
                Db.NonQ(command);
            }
            //Update local cache even though we should be invalidating the cache outside of this method.
            ClinicPref cachedClinicPref = clinicPref;

            cachedClinicPref.PrefName    = prefName;
            cachedClinicPref.ValueString = newValue.ToString();
            cachedClinicPref.ClinicNum   = clinicNum;
            return(retVal);
        }
コード例 #12
0
ファイル: Prefs.cs プロジェクト: mnisl/OD
		///<summary>Updates a pref of type long.  Returns true if a change was required, or false if no change needed.</summary>
		public static bool UpdateLong(PrefName prefName,long newValue) {
			//Very unusual.  Involves cache, so Meth is used further down instead of here at the top.
			Dictionary<string,Pref> dictPrefs=PrefC.GetDict();
			if(!dictPrefs.ContainsKey(prefName.ToString())) {
				throw new ApplicationException(prefName+" is an invalid pref name.");
			}
			if(PrefC.GetLong(prefName)==newValue) {
				return false;//no change needed
			}
			string command= "UPDATE preference SET "
				+"ValueString = '"+POut.Long(newValue)+"' "
				+"WHERE PrefName = '"+POut.String(prefName.ToString())+"'";
			bool retVal=true;
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				retVal=Meth.GetBool(MethodBase.GetCurrentMethod(),prefName,newValue);
			}
			else{
				Db.NonQ(command);
			}
			Pref pref=new Pref();
			pref.PrefName=prefName.ToString();
			pref.ValueString=newValue.ToString();
			Dictionary<string,Pref> dictPrefsUpdated=PrefC.GetDict();
			dictPrefsUpdated[prefName.ToString()]=pref;//in some cases, we just want to change the pref in local memory instead of doing a refresh afterwards.
			PrefC.Dict=dictPrefsUpdated;
			return retVal;
		}
コード例 #13
0
ファイル: PrefT.cs プロジェクト: kjb7749/testImport
        private static void AddToDict(PrefName prefName, string newValue)
        {
            string oldValue = Prefs.GetPref(prefName.ToString()).ValueString;

            if (oldValue == newValue || _dictPrefsOrig.ContainsKey(prefName))
            {
                return;
            }
            _dictPrefsOrig[prefName] = oldValue;
        }
コード例 #14
0
 ///<summary>Uploads Preferences to the Patient Portal /Mobile Web.</summary>
 public static void UploadPreference(PrefName prefname)
 {
     try {
         if (TestWebServiceExists())
         {
             Prefm prefm = Prefms.GetPrefm(prefname.ToString());
             mb.SetPreference(PrefC.GetString(PrefName.RegistrationKey), prefm);
         }
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);                //may not show if called from a thread but that does not matter - the failing of this method should not stop the  the code from proceeding.
     }
 }
コード例 #15
0
ファイル: FormMobile.cs プロジェクト: steev90/opendental
 ///<summary>Uploads Preferences to the Patient Portal /Mobile Web.</summary>
 public static void UploadPreference(PrefName prefname)
 {
     if (PrefC.GetString(PrefName.RegistrationKey) == "")
     {
         return;                //Prevents a bug when using the trial version with no registration key.  Practice edit, OK, was giving error.
     }
     try {
         if (TestWebServiceExists())
         {
             Prefm prefm = Prefms.GetPrefm(prefname.ToString());
             mb.SetPreference(PrefC.GetString(PrefName.RegistrationKey), prefm);
         }
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);                //may not show if called from a thread but that does not matter - the failing of this method should not stop the  the code from proceeding.
     }
 }
コード例 #16
0
ファイル: Prefs.cs プロジェクト: ChemBrain/OpenDental
 ///<summary>Returns a deep copy of the corresponding preference by name from the cache.
 ///Throws an exception indicating that the prefName passed in is invalid if it cannot be found in the cache (old behavior).</summary>
 public static Pref GetOne(PrefName prefName)
 {
     return(GetOne(prefName.ToString()));
 }
コード例 #17
0
ファイル: Prefs.cs プロジェクト: ChemBrain/OpenDental
        ///<summary>Gets a pref of type bool without using the cache.</summary>
        public static bool GetBoolNoCache(PrefName prefName)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetBool(MethodBase.GetCurrentMethod(), prefName));
            }
            string command = "SELECT ValueString FROM preference WHERE PrefName = '" + POut.String(prefName.ToString()) + "'";

            return(PIn.Bool(Db.GetScalar(command)));
        }
コード例 #18
0
ファイル: Prefs.cs プロジェクト: ChemBrain/OpenDental
        ///<summary>Updates a pref string without using the cache classes.  Useful for multithreaded connections.</summary>
        public static void UpdateStringNoCache(PrefName prefName, string newValue)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), prefName, newValue);
                return;
            }
            string command = "UPDATE preference SET ValueString='" + POut.String(newValue) + "' WHERE PrefName='" + POut.String(prefName.ToString()) + "'";

            Db.NonQ(command);
        }
コード例 #19
0
		///<summary>Uploads Preferences to the Patient Portal /Mobile Web.</summary>
		public static void UploadPreference(PrefName prefname) {
			if(PrefC.GetString(PrefName.RegistrationKey)=="") {
				return;//Prevents a bug when using the trial version with no registration key.  Practice edit, OK, was giving error.
			}
			try {
				if(TestWebServiceExists()) {
					Prefm prefm = Prefms.GetPrefm(prefname.ToString());
					mb.SetPreference(PrefC.GetString(PrefName.RegistrationKey),prefm);
				}
			}
			catch(Exception ex) {
				MessageBox.Show(ex.Message);//may not show if called from a thread but that does not matter - the failing of this method should not stop the  the code from proceeding.
			}
		}
コード例 #20
0
ファイル: PrefC.cs プロジェクト: romeroyonatan/opendental
		///<summary>Gets a color from an int32 pref.</summary>
		public static Color GetColor(PrefName prefName) {
			if(Dict==null) {
				Prefs.RefreshCache();
			}
			if(!Dict.ContainsKey(prefName.ToString())) {
				throw new Exception(prefName+" is an invalid pref name.");
			}
			return Color.FromArgb(PIn.Int(Dict[prefName.ToString()].ValueString));
		}
コード例 #21
0
ファイル: PrefC.cs プロジェクト: romeroyonatan/opendental
		///<summary>Gets a pref of type string.  Will not throw an exception if null or not found.</summary>
		public static string GetStringSilent(PrefName prefName) {
			if(Dict==null) {
				return "";
			}
			if(!Dict.ContainsKey(prefName.ToString())) {
				return "";
			}
			return Dict[prefName.ToString()].ValueString;
		}
コード例 #22
0
ファイル: PrefC.cs プロジェクト: mnisl/OD
		///<Summary>Gets a pref of type bool, but will not throw an exception if null or not found.  Indicate whether the silent default is true or false.</Summary>
		public static bool GetBoolSilent(PrefName prefName,bool silentDefault) {
			if(HListIsNull()) {
				return silentDefault;
			}
			Dictionary<string,Pref> dictPrefs=GetDict();
			if(!dictPrefs.ContainsKey(prefName.ToString())) {
				return silentDefault;
			}
			return PIn.Bool(dictPrefs[prefName.ToString()].ValueString);
		}
コード例 #23
0
ファイル: PrefC.cs プロジェクト: mnisl/OD
		///<summary>Gets a pref of type string.  Will not throw an exception if null or not found.</summary>
		public static string GetStringSilent(PrefName prefName) {
			if(HListIsNull()) {
				return "";
			}
			Dictionary<string,Pref> dictPrefs=GetDict();
			if(!dictPrefs.ContainsKey(prefName.ToString())) {
				return "";
			}
			return dictPrefs[prefName.ToString()].ValueString;
		}
コード例 #24
0
ファイル: PrefC.cs プロジェクト: mnisl/OD
		///<summary>Gets a color from an int32 pref.</summary>
		public static Color GetColor(PrefName prefName) {
			Dictionary<string,Pref> dictPrefs=GetDict();
			if(!dictPrefs.ContainsKey(prefName.ToString())) {
				throw new Exception(prefName+" is an invalid pref name.");
			}
			return Color.FromArgb(PIn.Int(dictPrefs[prefName.ToString()].ValueString));
		}
コード例 #25
0
ファイル: PrefT.cs プロジェクト: ChemBrain/OpenDental
 ///<summary>Updates a pref of type long.  Returns true if a change was required, or false if no change needed.</summary>
 public static bool UpdateLong(PrefName prefName, long newValue)
 {
     return(UpdateLong(prefName.ToString(), newValue));
 }
コード例 #26
0
ファイル: PrefT.cs プロジェクト: ChemBrain/OpenDental
 ///<summary>Updates a pref of type int.  Returns true if a change was required, or false if no change needed.</summary>
 public static bool UpdateInt(PrefName prefName, int newValue)
 {
     return(UpdateInt(prefName.ToString(), newValue));
 }
コード例 #27
0
ファイル: PrefT.cs プロジェクト: ChemBrain/OpenDental
 private static void AddToDict(PrefName prefName, string newValue)
 {
     AddToDict(prefName.ToString(), newValue);
 }
コード例 #28
0
ファイル: FormMobile.cs プロジェクト: nampn/ODental
 ///<summary>Uploads Preferences to the Patient Portal /Mobile Web.</summary>
 public static void UploadPreference(PrefName prefname)
 {
     try {
         if(TestWebServiceExists()) {
             Prefm prefm = Prefms.GetPrefm(prefname.ToString());
             mb.SetPreference(PrefC.GetString(PrefName.RegistrationKey),prefm);
         }
     }
     catch(Exception ex) {
         MessageBox.Show(ex.Message);//may not show if called from a thread but that does not matter - the failing of this method should not stop the  the code from proceeding.
     }
 }
コード例 #29
0
ファイル: Prefs.cs プロジェクト: romeroyonatan/opendental
		///<summary>Updates a pref of type double.  Returns true if a change was required, or false if no change needed.</summary>
		public static bool UpdateDouble(PrefName prefName,double newValue) {
			//Very unusual.  Involves cache, so Meth is used further down instead of here at the top.
			if(!PrefC.Dict.ContainsKey(prefName.ToString())) {
				throw new ApplicationException(prefName+" is an invalid pref name.");
			}
			if(PrefC.GetDouble(prefName)==newValue) {
				return false;//no change needed
			}
			string command = "UPDATE preference SET "
				+"ValueString = '"+POut.Double(newValue)+"' "
				+"WHERE PrefName = '"+POut.String(prefName.ToString())+"'";
			bool retVal=true;
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				retVal=Meth.GetBool(MethodBase.GetCurrentMethod(),prefName,newValue);
			}
			else{
				Db.NonQ(command);
			}
			return retVal;
		}