Beispiel #1
0
        public bool SetPreferencesV2(string RegistrationKey, webforms_preference prefObj)
        {
            long DentalOfficeID = util.GetDentalOfficeID(RegistrationKey);

            try {
                ODWebServiceEntities db = new ODWebServiceEntities();
                if (DentalOfficeID == 0)
                {
                }
                var wspObj = db.webforms_preference.Where(wsp => wsp.DentalOfficeID == DentalOfficeID);
                //update preference
                if (wspObj.Count() > 0)
                {
                    wspObj.First().ColorBorder = prefObj.ColorBorder;
                    wspObj.First().CultureName = prefObj.CultureName;
                }
                // if there is no entry for that dental office make a new entry.
                if (wspObj.Count() == 0)
                {
                    prefObj.DentalOfficeID = DentalOfficeID;
                    db.AddTowebforms_preference(prefObj);
                }
                db.SaveChanges();
                Logger.Information("Preferences saved IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID);
            }
            catch (Exception ex) {
                Logger.LogError("IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID, ex);
                return(false);
            }
            return(true);
        }
Beispiel #2
0
        public bool SetPreferences(string RegistrationKey, int ColorBorder)
        {
            long DentalOfficeID = util.GetDentalOfficeID(RegistrationKey);

            try {
                webforms_preference wspNewObj = new webforms_preference();
                wspNewObj.DentalOfficeID = DentalOfficeID;
                wspNewObj.ColorBorder    = ColorBorder;
                wspNewObj.CultureName    = "";           //empty string because null is not allowed
                SetPreferencesV2(RegistrationKey, wspNewObj);
            }
            catch (Exception ex) {
                Logger.LogError("IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID, ex);
                return(false);
            }
            return(true);
        }
Beispiel #3
0
        public webforms_preference GetPreferences(string RegistrationKey)
        {
            Logger.Information("In GetPreferences IpAddress=" + HttpContext.Current.Request.UserHostAddress + " RegistrationKey=" + RegistrationKey);
            ODWebServiceEntities db     = new ODWebServiceEntities();
            webforms_preference  wspObj = null;
            int  DefaultColorBorder     = -12550016;
            long DentalOfficeID         = util.GetDentalOfficeID(RegistrationKey);

            try {
                if (DentalOfficeID == 0)
                {
                    return(wspObj);
                }
                var wspRes = db.webforms_preference.Where(wsp => wsp.DentalOfficeID == DentalOfficeID);
                if (wspRes.Count() > 0)
                {
                    wspObj = wspRes.First();
                }
                // if there is no entry for that dental office make a new entry.
                if (wspRes.Count() == 0)
                {
                    wspObj = new webforms_preference();
                    wspObj.DentalOfficeID = DentalOfficeID;
                    wspObj.ColorBorder    = DefaultColorBorder;
                    wspObj.CultureName    = "";               //empty string because null is not allowed
                    SetPreferencesV2(RegistrationKey, wspObj);
                    Logger.Information("new entry IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID);
                }
                Logger.Information("In GetPreferences IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID);
            }
            catch (Exception ex) {
                Logger.LogError("IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID, ex);
                return(wspObj);
            }
            return(wspObj);
        }