Exemple #1
0
        public void LoadPageFooter()
        {
            string SiteFoot = " ";

            Classes.cLogin SiteFooter = new Classes.cLogin();
            SiteFooter.SetPageFooter();
            SiteFoot = SiteFooter.SiteFooter;
            Session["PageFooter"] = SiteFoot;
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            //if (Request.Url.Host.ToUpper().Contains("BETA."))
            //{
            //    lblMessage.Text = "Beta Site";
            //    SqlConnectionStringBuilder ConnPieces = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["LARPortal"].ConnectionString);
            //    if (ConnPieces != null)
            //        lblMessage.Text += "  Database: " + ConnPieces.InitialCatalog;
            //}
            //else if (Request.Url.Host.ToUpper().Contains("LOCALHOST"))
            //{
            //    lblMessage.Text = "Local Host";
            //    SqlConnectionStringBuilder ConnPieces = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["LARPortal"].ConnectionString);
            //    if (ConnPieces != null)
            //        lblMessage.Text += "  Database: " + ConnPieces.InitialCatalog;
            //}

            if (Session["CompileDate"] is null)
            {
                DateTime dtCompileTime = Classes.cCompileDate.GetLinkerDateTime(Assembly.GetExecutingAssembly());
                string   sCompileTime  = "Compiled: " + dtCompileTime.ToString("g", CultureInfo.CreateSpecificCulture("en-US"));
                Session["CompileDate"] = sCompileTime;
            }
            SqlConnectionStringBuilder ConnPieces = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["LARPortal"].ConnectionString);

            if (ConnPieces != null)
            {
                lblMessage.Text = Session["CompileDate"].ToString() + "   Database: " + ConnPieces.InitialCatalog;
            }

            lblMessage.ForeColor = System.Drawing.Color.Transparent;

            if ((Session["SuperUser"] != null) ||
                (Request.Url.Host.ToUpper().Contains("BETA.")) ||
                (Request.Url.Host.ToUpper().Contains("LOCALHOST")))
            {
                lblMessage.ForeColor = System.Drawing.Color.White;
            }

            Classes.cLogin SiteFooter = new Classes.cLogin();
            SiteFooter.SetPageFooter();
            lblFooter.Text = SiteFooter.SiteFooter;

            if ((!IsPostBack) || (Session["ReloadCampaigns"] != null))
            {
                if (Session["ReloadCampaigns"] != null)
                {
                    Session.Remove("CampaignID");
                    Session.Remove("CampaignName");
                    Session.Remove("CampaignList");
                    Session.Remove("RoleString");
                }

                Session.Remove("ReloadCampaigns");
                if (Session["Guest"] != null)
                {
                    mvMenuArea.SetActiveView(vwGuest);
                    lblUserName.Text = "Guest";
                    return;
                }
                mvMenuArea.SetActiveView(vwFullMenu);
                lblUserName.Text = Session["UserName"].ToString();
                if (!DisplayAllOptions)
                {
                    if (Session["CampaignID"] != null)
                    {
                        int iCampaignID;
                        if (int.TryParse(Session["CampaignID"].ToString(), out iCampaignID))
                        {
                            if (iCampaignID < 0)
                            {
                                Session.Remove("CampaignID");
                            }
                        }
                    }
                }
                LoadData();
            }
            Classes.cPlayerRoles Roles = new Classes.cPlayerRoles();
            Roles.Load(UserID, 0, CampaignID, DateTime.Today);
            Classes.cURLPermission permissions = new Classes.cURLPermission();
            bool   PagePermission         = true;
            string DefaultUnauthorizedURL = "";
            string CurrentPage            = Request.RawUrl;

            if (CurrentPage.ToUpper().EndsWith(".ASPX"))
            {
                CurrentPage = CurrentPage.Substring(0, CurrentPage.Length - 5);
            }

            permissions.GetURLPermissions(CurrentPage, UserName, Roles.PlayerRoleString);
            PagePermission         = permissions.PagePermission;
            DefaultUnauthorizedURL = permissions.DefaultUnauthorizedURL;
            if (!PagePermission)
            {
                Response.Redirect(DefaultUnauthorizedURL);
            }

            // Save current page to database so when person logs back in it can go to last page.
            string PageName = Request.Url.AbsolutePath;

            Classes.cLogin LastLoggedIn = new Classes.cLogin();
            LastLoggedIn.LogLastPage(UserID, PageName);
        }