示例#1
0
        ///<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);
        }