/// <summary>
        /// ExtendCookie
        /// </summary>
        /// <param name="portalSettings">The portal settings.</param>
        /// <param name="minuteAdd">The minute add.</param>
        public static void ExtendCookie(PortalSettings portalSettings, int minuteAdd)
        {
            DateTime time = DateTime.Now;
            TimeSpan span = new TimeSpan(0, 0, minuteAdd, 0, 0);

            HttpContext.Current.Response.Cookies["Appleseed_" + portalSettings.PortalAlias].Expires = time.Add(span);

            return;
        }
Ejemplo n.º 2
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "XslHelper" /> class.
        /// </summary>
        public XslHelper()
        {
            if (HttpContext.Current != null)
            {
                this.PortalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];

                var users = new UsersDB();
                this.user = users.GetSingleUser(HttpContext.Current.User.Identity.Name, this.PortalSettings.PortalAlias);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Loads the control.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void LoadControl(object sender, EventArgs e)
        {
            // Obtain PortalSettings from Current Context
            PortalSettings = (PortalSettings) HttpContext.Current.Items["PortalSettings"];

            PortalPagesXml = PortalSettings.PortalPagesXml;

            //base.DataBind();
        }
 /// <summary>
 /// ExtendCookie
 /// </summary>
 /// <param name="portalSettings">The portal settings.</param>
 public static void ExtendCookie(PortalSettings portalSettings)
 {
     int minuteAdd = Config.CookieExpire;
     ExtendCookie(portalSettings, minuteAdd);
     return;
 }
Ejemplo n.º 5
0
 private static void AddToCache(string key, PortalSettings portalSettings)
 {
     var cache = HttpRuntime.Cache;
     int time;
     try
     {
         time = int.Parse(ConfigurationManager.AppSettings["PortalSettingsCacheTime"]);
     }
     catch (Exception)
     {
         time = 0;
     }
     if (time > 0 && cache.Get(key) == null )
     {
         cache.Add(key, portalSettings, null, DateTime.Now.AddMinutes(time), TimeSpan.Zero, CacheItemPriority.Normal, null);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PortalSettings"/> class.
        ///   The PortalSettings Constructor encapsulates all of the logic
        ///   necessary to obtain configuration settings necessary to render
        ///   a Portal Page view for a given request.<br/>
        ///   These Portal Settings are stored within a SQL database, and are
        ///   fetched below by calling the "GetPortalSettings" stored procedure.<br/>
        ///   This stored procedure returns values as SPROC output parameters,
        ///   and using three result sets.
        /// </summary>
        /// <param name="pageId">
        /// The page id.
        /// </param>
        /// <param name="portalAlias">
        /// The portal alias.
        /// </param>
        /// <remarks>
        /// </remarks>
        public static PortalSettings GetPortalSettings(int pageId, string portalAlias)
        {
            ProcessCurrentLanguage(portalAlias);
            var key = GetPortalSettingsCacheKey(pageId, portalAlias, Thread.CurrentThread.CurrentUICulture.Name);
            var cache = HttpRuntime.Cache;
            if(cache.Get(key) != null)
            {
                return (PortalSettings) cache.Get(key);
            }
            var portalSettings = new PortalSettings(pageId, portalAlias);
            AddToCache(key, portalSettings);

            return portalSettings;
        }
Ejemplo n.º 7
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "CssHelper" /> class.
 /// </summary>
 public CssHelper()
 {
     if (HttpContext.Current != null)
     {
         this.PortalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];
     }
 }