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; }
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; }
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; }
/// <summary> /// Create a new webforms_preference object. /// </summary> /// <param name="colorBorder">Initial value of the ColorBorder property.</param> /// <param name="dentalOfficeID">Initial value of the DentalOfficeID property.</param> /// <param name="cultureName">Initial value of the CultureName property.</param> public static webforms_preference Createwebforms_preference(global::System.Int32 colorBorder, global::System.Int64 dentalOfficeID, global::System.String cultureName) { webforms_preference webforms_preference = new webforms_preference(); webforms_preference.ColorBorder = colorBorder; webforms_preference.DentalOfficeID = dentalOfficeID; webforms_preference.CultureName = cultureName; return webforms_preference; }
/// <summary> /// Deprecated Method for adding a new object to the webforms_preference EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTowebforms_preference(webforms_preference webforms_preference) { base.AddObject("webforms_preference", webforms_preference); }