public static void RemoveProfile(PersonalizationInfo objPersonalization, string NamingContainer, string Key) { if (objPersonalization != null) { ((Hashtable)objPersonalization.Profile).Remove(NamingContainer + ":" + Key); objPersonalization.IsModified = true; } }
public static void SetProfile(PersonalizationInfo objPersonalization, string NamingContainer, string Key, object value) { if (objPersonalization != null) { objPersonalization.Profile[NamingContainer + ":" + Key] = value; objPersonalization.IsModified = true; } }
public PersonalizationInfo LoadProfile(int UserId, int PortalId) { PersonalizationInfo objPersonalization = new PersonalizationInfo(); objPersonalization.UserId = UserId; objPersonalization.PortalId = PortalId; objPersonalization.IsModified = false; string profileData = Null.NullString; if (UserId > Null.NullInteger) { IDataReader dr = null; try { dr = DataProvider.Instance().GetProfile(UserId, PortalId); if (dr.Read()) { profileData = dr["ProfileData"].ToString(); } else { try { DataProvider.Instance().AddProfile(UserId, PortalId); } catch { } } } catch (Exception ex) { Exceptions.Exceptions.LogException(ex); } finally { CBO.CloseDataReader(dr, true); } } else { HttpContext context = HttpContext.Current; if (context != null && context.Request != null && context.Request.Cookies["Personalization"] != null) { profileData = context.Request.Cookies["Personalization"].Value; } } if (string.IsNullOrEmpty(profileData)) { objPersonalization.Profile = new Hashtable(); } else { objPersonalization.Profile = Globals.DeserializeHashTableXml(profileData); } return(objPersonalization); }
public PersonalizationInfo LoadProfile(int UserId, int PortalId) { PersonalizationInfo objPersonalization = new PersonalizationInfo(); objPersonalization.UserId = UserId; objPersonalization.PortalId = PortalId; objPersonalization.IsModified = false; string profileData = Null.NullString; if (UserId > Null.NullInteger) { IDataReader dr = null; try { dr = DataProvider.Instance().GetProfile(UserId, PortalId); if (dr.Read()) { profileData = dr["ProfileData"].ToString(); } else { try { DataProvider.Instance().AddProfile(UserId, PortalId); } catch { } } } catch (Exception ex) { Exceptions.Exceptions.LogException(ex); } finally { CBO.CloseDataReader(dr, true); } } else { HttpContext context = HttpContext.Current; if (context != null && context.Request != null && context.Request.Cookies["Personalization"] != null) { profileData = context.Request.Cookies["Personalization"].Value; } } if (string.IsNullOrEmpty(profileData)) { objPersonalization.Profile = new Hashtable(); } else { objPersonalization.Profile = Globals.DeserializeHashTableXml(profileData); } return objPersonalization; }
public static object GetProfile(PersonalizationInfo objPersonalization, string NamingContainer, string Key) { if (objPersonalization != null) { return objPersonalization.Profile[NamingContainer + ":" + Key]; } else { return ""; } }
public static object GetProfile(PersonalizationInfo objPersonalization, string NamingContainer, string Key) { if (objPersonalization != null) { return(objPersonalization.Profile[NamingContainer + ":" + Key]); } else { return(""); } }
private static PersonalizationInfo LoadProfile() { HttpContext context = HttpContext.Current; PersonalizationInfo objPersonalization = (PersonalizationInfo)context.Items["Personalization"]; if (objPersonalization == null) { PortalSettings _portalSettings = (PortalSettings)context.Items["PortalSettings"]; Entities.Users.UserInfo UserInfo = Entities.Users.UserController.GetCurrentUserInfo(); PersonalizationController objPersonalizationController = new PersonalizationController(); objPersonalization = objPersonalizationController.LoadProfile(UserInfo.UserID, _portalSettings.PortalId); context.Items.Add("Personalization", objPersonalization); } return(objPersonalization); }
public void SaveProfile(HttpContext objHTTPContext, int UserId, int PortalId) { PersonalizationInfo objPersonalization = (PersonalizationInfo)objHTTPContext.Items["Personalization"]; SaveProfile(objPersonalization, UserId, PortalId); }
public void SaveProfile(PersonalizationInfo objPersonalization) { SaveProfile(objPersonalization, objPersonalization.UserId, objPersonalization.PortalId); }
public void SaveProfile(PersonalizationInfo objPersonalization, int UserId, int PortalId) { if (objPersonalization != null) { if (objPersonalization.IsModified) { string ProfileData = Globals.SerializeHashTableXml(objPersonalization.Profile); if (UserId > Null.NullInteger) { DataProvider.Instance().UpdateProfile(UserId, PortalId, ProfileData); } else { HttpContext context = HttpContext.Current; if (context != null && context.Response != null) { HttpCookie personalizationCookie = new HttpCookie("DNNPersonalization"); personalizationCookie.Value = ProfileData; personalizationCookie.Expires = DateTime.Now.AddDays(30); context.Response.Cookies.Add(personalizationCookie); } } } } }
public void SaveProfile(PersonalizationInfo objPersonalization) { SaveProfile(objPersonalization, objPersonalization.UserId, objPersonalization.PortalId); }