Exemplo n.º 1
0
        //public static PageServices GetUserControlPageService(UserControl control)
        //{
        //    var pageParent = (control.Page as BasePage);
        //    if (pageParent == null)
        //        return new PageServices(control.Page);
        //    return pageParent.PageService;
        //}

        private void basePagePreInit(object sender, EventArgs e)
        {
            try {
                MasterPage = (BaseSRPMaster)Master;
                MasterPage.InitResFile();
            } catch //(Exception ex)
            {
            }
        }
        //public void LoadPageInfo()
        //{

        //    if (!string.IsNullOrEmpty(srpPageName))
        //    {
        //        //int cmsPageID = CMSPageHelper.FindPageId(srpPageName);

        //        //pageInfo = CMSPageHelper.SelectPageInfo(cmsPageID);
        //        //pageContent = CMSPageHelper.SelectPageContent(cmsPageID);
        //        //pageWidgetSettings = CMSPageHelper.SelectPageWidgetSettings(cmsPageID);
        //    }
        //}

        public void TranslateStrings(Control ctl)
        {
            MasterPage = (BaseSRPMaster)Master;
            MasterPage.InitResFile();

            LoadLabels(ctl);
            LoadValidators(ctl);
            LoadRadioButtonLists(ctl);
            LoadDropDownListLists(ctl);
            LoadButtons(ctl);
        }
        //public static PageServices GetUserControlPageService(UserControl control)
        //{
        //    var pageParent = (control.Page as BasePage);
        //    if (pageParent == null)
        //        return new PageServices(control.Page);
        //    return pageParent.PageService;
        //}

        private void basePagePreInit(object sender, EventArgs e)
        {
            try
            {
                MasterPage = (BaseSRPMaster)Master;
                MasterPage.InitResFile();
            }
            catch //(Exception ex)
            {
            }
            if ("y".Equals(Request.QueryString["print"]))
            {
                MasterPageFile = "~/master/Print.master";
            }
        }
Exemplo n.º 4
0
        //public static PageServices GetUserControlPageService(UserControl control)
        //{
        //    var pageParent = (control.Page as BasePage);
        //    if (pageParent == null)
        //        return new PageServices(control.Page);
        //    return pageParent.PageService;
        //}

        private void basePagePreInit(object sender, EventArgs e)
        {
            try {
                var secretCode = this.Context.Request.QueryString["secretcode"];
                if (!string.IsNullOrWhiteSpace(secretCode))
                {
                    Session[SessionKey.SecretCode] = secretCode.Length > 50
                        ? secretCode.Substring(0, 50).Trim()
                        : secretCode.Trim();
                    Session[SessionKey.RequestedPath] = "~/Dashboard.aspx";
                }

                MasterPage = (BaseSRPMaster)Master;
                MasterPage.InitResFile();
            } catch //(Exception ex)
            {
            }
        }
        //{
        //    get
        //    {

        //    }
        //}

        protected override void OnPreLoad(EventArgs e)
        {
            MasterPage = (BaseSRPMaster)Master;

            IsLoggedIn = false;
            if (Session["PatronLoggedIn"] != null && (bool)Session["PatronLoggedIn"])
            {
                IsLoggedIn = true;
                // Load the Patron  -- SRPUser = (SRPUser)Session[SessionData.UserProfile.ToString()];
                // PatronID =  patron.PK
                // ProgramID = patron.programid
            }
            if (IsSecure && !IsLoggedIn)
            {
                Response.Redirect("~/Login.aspx");
            }


            base.OnPreLoad(e);
        }
Exemplo n.º 6
0
        //public void LoadPageInfo()
        //{

        //    if (!string.IsNullOrEmpty(srpPageName))
        //    {
        //        //int cmsPageID = CMSPageHelper.FindPageId(srpPageName);

        //        //pageInfo = CMSPageHelper.SelectPageInfo(cmsPageID);
        //        //pageContent = CMSPageHelper.SelectPageContent(cmsPageID);
        //        //pageWidgetSettings = CMSPageHelper.SelectPageWidgetSettings(cmsPageID);
        //    }
        //}

        public void TranslateStrings(Control ctl)
        {
            MasterPage = (BaseSRPMaster)Master;
            MasterPage.InitResFile();

            LoadLabels(ctl);
            LoadValidators(ctl);
            LoadRadioButtonLists(ctl);
            LoadDropDownListLists(ctl);
            LoadButtons(ctl);
            string systemName = GetResourceString("system-name");

            if (string.IsNullOrEmpty(Page.Title) || Page.Title == "Home Page")
            {
                if (systemName != "system-name")
                {
                    string title  = systemName;
                    string slogan = GetResourceString("slogan");
                    if (slogan != "slogan")
                    {
                        title = string.Format("{0} - {1}",
                                              title,
                                              slogan);
                    }
                    Page.Title = title.Trim();
                }
            }
            else
            {
                if (systemName != "system-name")
                {
                    Page.Title = string.Format("{0} - {1}",
                                               Page.Title,
                                               systemName).Trim();
                }
            }
        }
Exemplo n.º 7
0
        //{
        //    get
        //    {

        //    }
        //}

        protected override void OnPreLoad(EventArgs e)
        {
            MasterPage = (BaseSRPMaster)Master;
            var tenantVs = ViewState["TenantID"];

            // Tenant not selected ...
            if (Session["TenantID"] == null || Session["TenantID"].ToString() == "")
            {
                if (tenantVs != null &&
                    !string.IsNullOrEmpty(tenantVs.ToString()))
                {
                    Session["TenantID"] = ViewState["TenantID"];
                }
                else
                {
                    // Direct program ID hit
                    if (!String.IsNullOrEmpty(Request["PID"]))
                    {
                        // we can get the get the Tenant ID from the Program
                        // Set the tenant
                        var tenID = Tenant.GetTenantByProgram(Request["PID"].SafeToInt());

                        if (tenID < 0)
                        {
                            Response.Redirect("~/Select.aspx", true);
                        }
                        Session["TenantID"] = tenID;
                    }
                    else
                    {
                        // Check domain name and see if we can get the tenant from there
                        // Set then tenant
                        var dom  = Request.ServerVariables["HTTP_HOST"];
                        var port = Request.ServerVariables["SERVER_PORT"];
                        if (port == "80")
                        {
                            port = "";
                        }
                        else
                        {
                            port = ":" + port;
                        }
                        if (dom.Contains(":"))
                        {
                            dom = dom.Substring(0, dom.IndexOf(":")) + port;
                        }
                        var tenID = -1;
                        try {
                            tenID = Tenant.GetTenantByDomainName(dom);
                        } catch {
                            Response.Redirect("~/ControlRoom/Configure.aspx");
                        }
                        // else go to tenant selection page ..
                        if (tenID < 0)
                        {
                            // we don't have a tenant, let's see what's going on
                            var ds = Tenant.GetAllActive();
                            if (ds.Tables.Count == 1)
                            {
                                // table tenant fetched
                                if (ds.Tables[0].Rows.Count == 0)
                                {
                                    // no tenants in the tenant table, we'll assume master
                                    tenID = Tenant.GetMasterID();
                                }
                                else if (ds.Tables[0].Rows.Count == 1)
                                {
                                    // one tenant in the tenant talbe, we'll assume it
                                    var row            = ds.Tables[0].Rows[0];
                                    var potentalTenant = row["TenId"] as int?;
                                    if (potentalTenant != null)
                                    {
                                        tenID = (int)potentalTenant;
                                    }
                                }
                            }
                            if (tenID < 0)
                            {
                                Response.Redirect("~/Select.aspx", true);
                            }
                        }
                        Session["TenantID"] = tenID;
                    }
                }
            }

            if (tenantVs == null ||
                string.IsNullOrEmpty(tenantVs.ToString()))
            {
                ViewState["TenantID"] = Session["TenantID"];
            }

            IsLoggedIn = false;
            object patron = Session[SessionKey.Patron];

            if (patron != null)
            {
                IsLoggedIn = true;
            }
            if (IsSecure && !IsLoggedIn)
            {
                if (Session[SessionKey.RequestedPath] == null)
                {
                    Session[SessionKey.RequestedPath] = Request.Path;
                }
                Response.Redirect("~");
            }

            base.OnPreLoad(e);
        }
        //{
        //    get
        //    {

        //    }
        //}

        protected override void OnPreLoad(EventArgs e) {
            MasterPage = (BaseSRPMaster)Master;
            var tenantVs = ViewState["TenantID"];

            // Tenant not selected ...  
            if (Session["TenantID"] == null || Session["TenantID"].ToString() == "") {
                if(tenantVs != null
                   && !string.IsNullOrEmpty(tenantVs.ToString())) {
                    Session["TenantID"] = ViewState["TenantID"];
                } else {
                    // Direct program ID hit
                    if(!String.IsNullOrEmpty(Request["PID"])) {
                        // we can get the get the Tenant ID from the Program 
                        // Set the tenant
                        var tenID = Tenant.GetTenantByProgram(Request["PID"].SafeToInt());

                        if(tenID < 0) {
                            Response.Redirect("~/Select.aspx", true);
                        }
                        Session["TenantID"] = tenID;
                    } else {
                        // Check domain name and see if we can get the tenant from there
                        // Set then tenant
                        var dom = Request.ServerVariables["HTTP_HOST"];
                        var port = Request.ServerVariables["SERVER_PORT"];
                        if(port == "80")
                            port = "";
                        else
                            port = ":" + port;
                        if(dom.Contains(":")) {
                            dom = dom.Substring(0, dom.IndexOf(":")) + port;
                        }
                        var tenID = -1;
                        try {
                            tenID = Tenant.GetTenantByDomainName(dom);
                        } catch {
                            Response.Redirect("~/ControlRoom/Configure.aspx");
                        }
                        // else go to tenant selection page ..
                        if(tenID < 0) {
                            // we don't have a tenant, let's see what's going on
                            var ds = Tenant.GetAllActive();
                            if(ds.Tables.Count == 1) {
                                // table tenant fetched
                                if(ds.Tables[0].Rows.Count == 0) {
                                    // no tenants in the tenant table, we'll assume master
                                    tenID = Tenant.GetMasterID();
                                } else if(ds.Tables[0].Rows.Count == 1) {
                                    // one tenant in the tenant talbe, we'll assume it
                                    var row = ds.Tables[0].Rows[0];
                                    var potentalTenant = row["TenId"] as int?;
                                    if(potentalTenant != null) {
                                        tenID = (int)potentalTenant;
                                    }
                                }

                            }
                            if(tenID < 0) {
                                Response.Redirect("~/Select.aspx", true);
                            }
                        }
                        Session["TenantID"] = tenID;
                    }
                }
            }

            if(tenantVs == null
                    || string.IsNullOrEmpty(tenantVs.ToString())) {
                ViewState["TenantID"] = Session["TenantID"];
            }

            IsLoggedIn = false;
            object patron = Session[SessionKey.Patron];
            if(patron != null) {
                IsLoggedIn = true;
            }
            if(IsSecure && !IsLoggedIn) {
                if(Session[SessionKey.RequestedPath] == null) {
                    Session[SessionKey.RequestedPath] = Request.Path;
                }
                Response.Redirect("~");
            }

            base.OnPreLoad(e);
        }
        //public static PageServices GetUserControlPageService(UserControl control)
        //{
        //    var pageParent = (control.Page as BasePage);
        //    if (pageParent == null)
        //        return new PageServices(control.Page);
        //    return pageParent.PageService;
        //}

        private void basePagePreInit(object sender, EventArgs e) {
            try {
                var secretCode = this.Context.Request.QueryString["secretcode"];
                if (!string.IsNullOrWhiteSpace(secretCode))
                {
                    Session[SessionKey.SecretCode] = secretCode.Length > 50
                        ? secretCode.Substring(0, 50).Trim()
                        : secretCode.Trim();
                    Session[SessionKey.RequestedPath] = "~/Dashboard.aspx";
                }

                MasterPage = (BaseSRPMaster)Master;
                MasterPage.InitResFile();
            } catch //(Exception ex)
              {
            }
        }
        //public void LoadPageInfo()
        //{

        //    if (!string.IsNullOrEmpty(srpPageName))
        //    {
        //        //int cmsPageID = CMSPageHelper.FindPageId(srpPageName);

        //        //pageInfo = CMSPageHelper.SelectPageInfo(cmsPageID);
        //        //pageContent = CMSPageHelper.SelectPageContent(cmsPageID);
        //        //pageWidgetSettings = CMSPageHelper.SelectPageWidgetSettings(cmsPageID);
        //    }
        //}

        public void TranslateStrings(Control ctl) {
            MasterPage = (BaseSRPMaster)Master;
            MasterPage.InitResFile();

            LoadLabels(ctl);
            LoadValidators(ctl);
            LoadRadioButtonLists(ctl);
            LoadDropDownListLists(ctl);
            LoadButtons(ctl);
            string systemName = GetResourceString("system-name");
            if(string.IsNullOrEmpty(Page.Title) || Page.Title == "Home Page") {
                if(systemName != "system-name") {
                    string title = systemName;
                    string slogan = GetResourceString("slogan");
                    if(slogan != "slogan") {
                        title = string.Format("{0} - {1}",
                                              title,
                                              slogan);
                    }
                    Page.Title = title.Trim();
                }
            } else {
                if(systemName != "system-name") {
                    Page.Title = string.Format("{0} - {1}",
                                               Page.Title,
                                               systemName).Trim();
                }
            }
        }
Exemplo n.º 11
0
 //public static PageServices GetUserControlPageService(UserControl control)
 //{
 //    var pageParent = (control.Page as BasePage);
 //    if (pageParent == null)
 //        return new PageServices(control.Page);
 //    return pageParent.PageService;
 //}
 private void basePagePreInit(object sender, EventArgs e)
 {
     try {
         MasterPage = (BaseSRPMaster)Master;
         MasterPage.InitResFile();
     } catch //(Exception ex)
       {
     }
 }