private void DashBoardView() { try { string PageSEOName = string.Empty; if (Request.QueryString["pgnm"] != null) { PageSEOName = Request.QueryString["pgnm"].ToString(); } else { PageBase pb = new PageBase(); SageUserControl SageUser = new SageUserControl(); PageSEOName = pb.GetPageSEOName(SageUser.PagePath); } DashboardController objController = new DashboardController(); List <DashboardInfo> lstDashboard = objController.DashBoardView(PageSEOName, GetUsername, GetPortalID); lstDashboard.ForEach( delegate(DashboardInfo obj) { obj.IconFile = string.Format("{0}/PageImages/{1}", Request.ApplicationPath == "/" ? "" : Request.ApplicationPath, obj.IconFile); obj.Url = obj.Url + Extension; } ); rptDashBoard.DataSource = lstDashboard; rptDashBoard.DataBind(); } catch (Exception ex) { ProcessException(ex); } }
protected void Page_Load(object sender, EventArgs e) { PageExtension = SageFrameSettingKeys.PageExtension; SageUserControl suc = new SageUserControl(); SageFrameConfig sfConfig = new SageFrameConfig(); StartupPage = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage); ActiveTemplateName = TemplateName; InitializeCssJs(); appPath = Request.ApplicationPath != "/" ? Request.ApplicationPath : ""; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "SageMenuAdminGlobal1", " var ServicePath='" + appPath + "';", true); if (!IsPostBack) { BuildAccessControlledSelection(); AddImageUrls(); UserModuleID = int.Parse(SageUserModuleID); PortalID = GetPortalID; UserName = GetUsername; CultureCode = GetCurrentCulture(); PageName = Path.GetFileNameWithoutExtension(PagePath); string modulePath = ResolveUrl(this.AppRelativeTemplateSourceDirectory); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "SageMenuGlobal", " var Path='" + ResolveUrl(modulePath) + "';", true); string pagePath = Request.ApplicationPath != "/" ? Request.ApplicationPath : ""; pagePath = GetPortalID == 1 ? pagePath : pagePath + "/portal/" + GetPortalSEOName; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "SageMenuGlobal1", " var PagePath='" + pagePath + "';", true); } }
private void DashBoardView() { try { DashBoardDataContext db = new DashBoardDataContext(SystemSetting.SageFrameConnectionString); string PageSEOName = string.Empty; if (Request.QueryString["pgnm"] != null) { PageSEOName = Request.QueryString["pgnm"].ToString(); } else { PageBase pb = new PageBase(); SageUserControl SageUser = new SageUserControl(); PageSEOName = pb.GetPageSEOName(SageUser.PagePath); } var LINQDashBoardView = db.sp_DashBoardView(PageSEOName, GetUsername, GetPortalID); rptDashBoard.DataSource = LINQDashBoardView; rptDashBoard.DataBind(); } catch (Exception ex) { ProcessException(ex); } }
private void LoadControl(PlaceHolder ContainerControl, string controlSource, string UserModuleID) { SageUserControl ctl = this.Page.LoadControl(controlSource) as SageUserControl; ctl.EnableViewState = true; ctl.SageUserModuleID = UserModuleID; ContainerControl.Controls.Add(ctl); }
protected void Page_Init(object sender, EventArgs e) { try { StoreID = GetStoreID; PortalID = GetPortalID; UserName = GetUsername; CustomerID = GetCustomerID; CultureName = GetCurrentCultureName; string pageExtension = SageFrameSettingKeys.PageExtension; SageFrameRoute parentPage = (SageFrameRoute)this.Page; StoreSettingConfig ssc = new StoreSettingConfig(); if (parentPage.ControlMode.Equals("search")) { SageUserControl itemDetails = (SageUserControl)LoadControl("~/Modules/AspxCommerce/DetailsBrowse/ItemLists.ascx"); itemDetails.EnableViewState = true; itemDetails.SageUserModuleID = SageUserModuleID; phdetailBrowseholder.Controls.Add(itemDetails); } else if (parentPage.ControlMode.Equals("option")) { SageUserControl itemDetails = (SageUserControl)LoadControl("~/Modules/AspxCommerce/DetailsBrowse/ItemsListByIds.ascx"); itemDetails.EnableViewState = true; itemDetails.SageUserModuleID = SageUserModuleID; phdetailBrowseholder.Controls.Add(itemDetails); } else if (parentPage.ControlMode.Equals("coupons")) { SageUserControl itemDetails = (SageUserControl)LoadControl("~/Modules/AspxCommerce/DetailsBrowse/AllCoupons.ascx"); itemDetails.EnableViewState = true; itemDetails.SageUserModuleID = SageUserModuleID; phdetailBrowseholder.Controls.Add(itemDetails); } else if (parentPage.ControlMode.Equals("brand")) { SageUserControl itemDetails = (SageUserControl)LoadControl("~/Modules/AspxCommerce/DetailsBrowse/ItemsListByBrand.ascx"); itemDetails.EnableViewState = true; itemDetails.SageUserModuleID = SageUserModuleID; phdetailBrowseholder.Controls.Add(itemDetails); } IncludeLanguageJS(); } catch (Exception ex) { ProcessException(ex); } }
private void DashBoardView() { try { string PageSEOName = string.Empty; if (Request.QueryString["pgnm"] != null) { PageSEOName = Request.QueryString["pgnm"].ToString(); } else { PageBase pb = new PageBase(); SageUserControl SageUser = new SageUserControl(); PageSEOName = pb.GetPageSEOName(SageUser.PagePath); } DashboardController objController = new DashboardController(); List <DashboardInfo> lstDashboard = objController.DashBoardView(PageSEOName, GetUsername, GetPortalID); GroupItemInfo objbnInfo = new GroupItemInfo(); //objbnInfo.PortalID = portalID; List <GroupItemInfo> objGroupItem = objController.GroupGetAll(GetPortalID, PageSEOName, GetUsername); if (objGroupItem.Count > 0) { BindGroups(objGroupItem); } StringBuilder html = new StringBuilder(); html.Append("<ul class='" + dragClass + " storePages clearfix' data-groupid='0'>"); foreach (DashboardInfo objDashboard in lstDashboard) { html.Append("<li class='page' data-pageID='" + objDashboard.PageID + "' data-itemid='0'>"); objDashboard.IconFile = "<i class='icon-" + objDashboard.PageName.Replace(" ", "-").ToLower() + "'></i>"; objDashboard.Url = objDashboard.Url + Extension; html.Append("<a href=" + objDashboard.Url + "><span class='sfModuleicon'>"); html.Append(objDashboard.IconFile); html.Append("</span>"); html.Append("<span class='sfModulename'>" + objDashboard.PageName + "</span>"); html.Append("</a>"); html.Append("</li>"); } html.Append("</ul>"); ltradminPageList.Text = html.ToString(); } catch (Exception ex) { ProcessException(ex); } }
public static string Results(string controlName) { try { Page page = new Page(); SageUserControl userControl = (SageUserControl)page.LoadControl(controlName); page.Controls.Add(userControl); StringWriter textWriter = new StringWriter(); HttpContext.Current.Server.Execute(page, textWriter, false); return(textWriter.ToString()); } catch (Exception ex) { return(ex.ToString()); } }
public override void ShowMessage(string MessageTitle, string Message, string CompleteMessage, bool isSageAsyncPostBack, SageMessageType MessageType) { string strCssClass = GetMessageCssClass(MessageType); int Cont = this.Page.Controls.Count; ControlCollection lstControls = Page.FindControl("form1").Controls; PlaceHolder phd = Page.FindControl("message") as PlaceHolder; if (phd != null) { foreach (Control c in phd.Controls) { if (c.GetType().FullName.ToLower() == "ASP.Controls_message_ascx".ToLower()) { SageUserControl tt = (SageUserControl)c; tt.Modules_Message_ShowMessage(tt, MessageTitle, Message, CompleteMessage, isSageAsyncPostBack, MessageType, strCssClass); } } } }
protected void Page_Load(object sender, EventArgs e) { PageExtension = SageFrameSettingKeys.PageExtension; SageUserControl suc = new SageUserControl(); SageFrameConfig sfConfig = new SageFrameConfig(); StartupPage = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage); ActiveTemplateName = TemplateName; InitializeCssJs(); appPath = Request.ApplicationPath != "/" ? Request.ApplicationPath : ""; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "SageMenuAdminGlobal1", " var ServicePath='" + appPath + "';", true); //module manager IncludeJs("ModuleManager", false, "/js/jquery.floatobject-1.0.js", "/js/cookie.js"); IncludeCss("ModuleManager", "/Modules/Pages/css/widget.css", "/Modules/Pages/css/module.css"); IncludeJs("ModuleManager", false, "/js/jquery.pagination.js"); IncludeJs("ModuleManager", false, "/js/jquery.validate.js"); ActiveTemplate = TemplateName; PortalName = GetPortalSEOName; bool ShowSideBar = sfConfig.GetSettingBoolValueByIndividualKey(SageFrameSettingKeys.ShowSideBar); IsSideBarVisible = ShowSideBar ? 1 : 0; //end UserModuleID = int.Parse(SageUserModuleID); PortalID = GetPortalID; UserName = GetUsername; GetURL = Page.Request.Url.Scheme + "://" + Request.Url.Authority + GetApplicationName; if (!IsPostBack) { BuildAccessControlledSelection(); AddImageUrls(); CultureCode = GetCurrentCulture(); PageName = Path.GetFileNameWithoutExtension(PagePath); BindLayout(); } string pagePath = Request.ApplicationPath != "/" ? Request.ApplicationPath : ""; pagePath = GetPortalID == 1 ? pagePath : pagePath + "/portal/" + GetPortalSEOName; string modulePath = ResolveUrl(this.AppRelativeTemplateSourceDirectory); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "SageMenuGlobal", " var Path='" + ResolveUrl(modulePath) + "';", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "SageMenuGlobal1", " var PagePath='" + pagePath + "';", true); }
private void DashBoardView() { try { string PageSEOName = string.Empty; if (Request.QueryString["pgnm"] != null) { PageSEOName = Request.QueryString["pgnm"].ToString(); } else { PageBase pb = new PageBase(); SageUserControl SageUser = new SageUserControl(); PageSEOName = pb.GetPageSEOName(SageUser.PagePath); } DashboardController objController = new DashboardController(); List <DashboardInfo> lstDashboard = objController.DashBoardView(PageSEOName, GetUsername, GetPortalID); lstDashboard.ForEach( delegate(DashboardInfo obj) { if (obj.IconFile != null && obj.IconFile != string.Empty) { string iconFile = string.Empty; iconFile = string.Format("{0}/PageImages/{1}", Request.ApplicationPath == "/" ? "" : Request.ApplicationPath, obj.IconFile); iconFile = "<img align='middle' style='border-width:0px;' src='" + iconFile + "' class='sfImageheight' id='ctl17_rptDashBoard_ctl17_imgDisplayImage'>"; obj.IconFile = iconFile; } else { obj.IconFile = "<i class='icon-" + obj.PageName.Replace(" ", "-").ToLower() + "'></i>"; } obj.Url = obj.Url + Extension; } ); rptDashBoard.DataSource = lstDashboard; rptDashBoard.DataBind(); } catch (Exception ex) { ProcessException(ex); } }
private void SetPortalCofig() { Hashtable hstPortals = GetPortals(); SageUserControl suc = new SageUserControl(); int portalID = 1; if (string.IsNullOrEmpty(Request.QueryString["ptSEO"])) { if (string.IsNullOrEmpty(PortalSEOName)) { PortalSEOName = "default"; } else if (!hstPortals.ContainsKey(PortalSEOName.ToLower().Trim())) { PortalSEOName = "default"; } else { portalID = int.Parse(hstPortals[PortalSEOName.ToLower().Trim()].ToString()); } } else { PortalSEOName = Request.QueryString["ptSEO"].ToString().ToLower().Trim(); portalID = Int32.Parse(Request.QueryString["ptlid"].ToString()); } suc.SetPortalSEOName(PortalSEOName.ToLower().Trim()); Session["SiteMapProvider"] = PortalSEOName.ToLower().Trim() + "SiteMapProvider"; Session["SiteMapProviderAdmin"] = PortalSEOName.ToLower().Trim() + "SiteMapProviderAdmin"; Session["SiteMapProviderFooter"] = PortalSEOName.ToLower().Trim() + "SiteMapProviderFooter"; Session["SageFrame.PortalSEOName"] = PortalSEOName.ToLower().Trim(); Session["SageFrame.PortalID"] = portalID; suc.SetPortalID(portalID); SetPortalID(portalID); int storeID = portalID; //TODO:: set StoreID According the URL HERE Session["SageFrame.StoreID"] = storeID; suc.SetStoreID(storeID); SetStoreID(storeID); }
private void SetCustomerID() { SageUserControl suc = new SageUserControl(); int customerID = 0; FormsAuthenticationTicket ticket = SecurityPolicy.GetUserTicket(GetPortalID); if (ticket != null) { CustomerGeneralInfo sageUserCust = CustomerGeneralInfoController.CustomerIDGetByUsername(ticket.Name, GetPortalID, GetStoreID); if (sageUserCust != null) { customerID = sageUserCust.CustomerID; } Session[SessionKeys.SageFrame_CustomerID] = customerID; suc.SetCustomerID(customerID); SetCustomerID(customerID); } }
public static string Results(string controlName) { try { //For setting culture SageFrameConfig sfConf = new SageFrameConfig(); string portalCulture = sfConf.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultLanguage); if (HttpContext.Current.Session[SessionKeys.SageUICulture] != null) { Thread.CurrentThread.CurrentUICulture = (CultureInfo)HttpContext.Current.Session[SessionKeys.SageUICulture]; } else { CultureInfo newUICultureInfo = new CultureInfo(portalCulture); Thread.CurrentThread.CurrentUICulture = newUICultureInfo; HttpContext.Current.Session[SessionKeys.SageUICulture] = newUICultureInfo; } if (HttpContext.Current.Session[SessionKeys.SageUICulture] != null) { Thread.CurrentThread.CurrentCulture = (CultureInfo)HttpContext.Current.Session[SessionKeys.SageUICulture]; } else { CultureInfo newCultureInfo = new CultureInfo(portalCulture); Thread.CurrentThread.CurrentCulture = newCultureInfo; HttpContext.Current.Session[SessionKeys.SageUICulture] = newCultureInfo; } //end for setting culture Page page = new Page(); SageUserControl userControl = (SageUserControl)page.LoadControl(controlName); page.Controls.Add(userControl); StringWriter textWriter = new StringWriter(); HttpContext.Current.Server.Execute(page, textWriter, false); return(textWriter.ToString()); } catch (Exception ex) { return(ex.ToString()); } }
public override void ShowMessage(string MessageTitle, string Message, string CompleteMessage, bool isSageAsyncPostBack, SageMessageType MessageType) { string strCssClass = GetMessageCsssClass(MessageType); int Cont = this.Page.Controls.Count; List <SageFrameStringKeyValue> lst = SageFrameLists.ModulePanes(); for (int i = 0; i < lst.Count; i++) { string strName = lst[i].Key; PlaceHolder phd = this.Page.FindControl(strName) as PlaceHolder; if (phd != null) { foreach (Control ctl in phd.Controls) { if (ctl.GetType().FullName.ToLower() == "ASP.modules_message_message_ascx".ToLower()) { SageUserControl tt = (SageUserControl)ctl; tt.Modules_Message_ShowMessage(tt, MessageTitle, Message, CompleteMessage, isSageAsyncPostBack, MessageType, strCssClass); } } } } }
private void BindModuleControls() { string preFix = string.Empty; string paneName = string.Empty; string ControlSrc = string.Empty; string phdContainer = string.Empty; string PageSEOName = string.Empty; SageUserControl suc = new SageUserControl(); SageFrameConfig sfConfig = new SageFrameConfig(); string portalDefaultPage = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage); if (PagePath != null) { suc.PagePath = PagePath; } else { suc.PagePath = portalDefaultPage; } if (PagePath != null) { PageSEOName = GetPageSEOName(PagePath); } else { PageSEOName = GetPageSEOName(portalDefaultPage); } PageSEOName = PageSEOName.Replace(" ", "-"); //:TODO: Need to get controlType and pageID from the selected page from routing path //string controlType = "0"; //string pageID = "2"; StringBuilder redirecPath = new StringBuilder(); if (PageSEOName != string.Empty) { RoleController _role = new RoleController(); bool isDashboardAccessible = _role.IsDashboardAccesible(GetUsername, GetPortalID); string SEOName = portalDefaultPage.Replace(" ", "-"); List <UserModuleInfo> lstUserModules = new List <UserModuleInfo>(); bool SuperRole = false; string previewCode = "none"; bool isPreview = false; if (Request.QueryString["preview"] != null) { previewCode = Request.QueryString["preview"].ToString(); isPreview = true; } if (Session[SessionKeys.SageRoles] != null && Session[SessionKeys.SageRoles].ToString() != string.Empty) { string[] objRole = Session[SessionKeys.SageRoles].ToString().Split(','); foreach (string role in objRole) { if (role.Replace(" ", string.Empty).ToLower().Equals(ApplicationKeys.Super_User.ToLower().Replace("-", string.Empty))) { SuperRole = true; } } } if (GetUsername.Equals(ApplicationKeys.anonymousUser)) { lstUserModules = sfConfig.GetPageModules_Anonymous("1", PageSEOName, GetUsername, GetCurrentCulture()); } else if (SuperRole) { lstUserModules = sfConfig.GetPageModules_Superuser("1", PageSEOName, GetUsername, GetCurrentCulture(), isPreview, previewCode); } else { lstUserModules = sfConfig.GetPageModules("1", PageSEOName, GetUsername, GetCurrentCulture(), isPreview, previewCode); } Uri url = HttpContext.Current.Request.Url; if (lstUserModules[0].IsPageAvailable) { if (lstUserModules[0].IsPageAccessible) { #region "Load Controls" AddMetaTag(lstUserModules[0].MetaTag); if (lstUserModules.Count > 0) { OverridePageInfo(lstUserModules[0]); bool isUserLoggedIn = IsUserLoggedIn(); List <string> moduleDefIDList = new List <string>(); if (isUserLoggedIn) { SecurityPolicy objSecurity = new SecurityPolicy(); objSecurity.UpdateExpireTime(GetUsername, GetPortalID); moduleDefIDList.Add("-1,"); } bool isHandheld = IsHandheld(); //bool gotExtraModule = false; //int count = 0; foreach (UserModuleInfo usermodule in lstUserModules) { bool handheld_status = bool.Parse(usermodule.IsHandHeld.ToString()); if (isHandheld == handheld_status) { int pageID = lstUserModules[0].PageID; paneName = usermodule.PaneName; paneName = "pch_" + paneName; if (string.IsNullOrEmpty(paneName)) { paneName = "ContentPane"; } string UserModuleTitle = usermodule.UserModuleTitle != string.Empty ? usermodule.UserModuleTitle.ToString() : string.Empty; ControlSrc = usermodule.ControlSrc; string SupportsPartialRendering = usermodule.SupportsPartialRendering.ToString(); string SuffixClass = usermodule.SuffixClass.ToString(); string HeaderText = usermodule.ShowHeaderText ? usermodule.HeaderText : ""; bool ContainsEdit = usermodule.IsEdit; int ControlCount = usermodule.ControlsCount; UserControl uc = pchWhole.FindControl("lytA") as UserControl; PlaceHolder phdPlaceHolder = uc.FindControl(paneName) as PlaceHolder; SuffixClass = isUserLoggedIn && ContainsEdit?string.Format("sfLogged sfModule{0}", SuffixClass) : string.Format("sfModule{0}", SuffixClass); Page page = this.Page; //if (phdPlaceHolder == null && isUserLoggedIn && isDashboardAccessible) //{ // HtmlGenericControl divWrapper = new HtmlGenericControl("div"); // divWrapper.Attributes.Add("data-usemoduleid", usermodule.UserModuleID.ToString()); // divWrapper.Attributes.Add("data-pageid", pageID.ToString()); // divWrapper.Attributes.Add("data-moduledefid", usermodule.ModuleDefID.ToString()); // divWrapper.Attributes.Add("class", "extramodule"); // phdPlaceHolder = pchAddedControl.FindControl(paneName) as PlaceHolder; // if (phdPlaceHolder != null) // { // count++; // paneName = paneName + count; // } // PlaceHolder ph = new PlaceHolder(); // ph.ID = paneName; // divWrapper.Controls.Add(ph); // pchAddedControl.Controls.Add(divWrapper); // phdPlaceHolder = ph; // gotExtraModule = true; //} if (phdPlaceHolder != null) { string TemplateControls = Server.MapPath(string.Format("~/Templates/{0}/modules/{1}", activeTemplate, ControlSrc.Substring(ControlSrc.IndexOf('/'), ControlSrc.Length - ControlSrc.IndexOf('/')))); ControlSrc = File.Exists(TemplateControls) ? string.Format("/Templates/{0}/modules/{1}", activeTemplate, ControlSrc.Substring(ControlSrc.IndexOf('/'), ControlSrc.Length - ControlSrc.IndexOf('/'))) : string.Format("/{0}", ControlSrc); LoadControl(phdPlaceHolder, ControlSrc, paneName, usermodule.UserModuleID.ToString(), SuffixClass, HeaderText, isUserLoggedIn, GetModuleControls(usermodule.UserModuleID, ContainsEdit, ControlCount, usermodule.ModuleDefID, pageID), GetPaneNameContainer(UserModuleTitle), ContainsEdit, ParamCollection); //changecss 1 take module list here take usermodulename moduleDefIDList.Add(usermodule.ModuleDefID.ToString()); } } } SetModuleDefList(moduleDefIDList); //if (gotExtraModule) //{ // ExtraModuleMessage(PageSEOName); //} } #endregion else { if (!IsParent) { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.GetApplicationName); redirecPath.Append("/portal/"); redirecPath.Append(GetPortalSEOName); redirecPath.Append("/"); redirecPath.Append(PortalAPI.PageNotFoundPageWithExtension); } else { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.LoginURL); } Response.Redirect(redirecPath.ToString()); } } else { if (!IsParent) { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.GetApplicationName); redirecPath.Append("/portal/"); redirecPath.Append(GetPortalSEOName); redirecPath.Append("/"); redirecPath.Append(PortalAPI.PageNotAccessiblePageWithExtension); } else { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.LoginURL); } Response.Redirect(redirecPath.ToString()); } } else { //page is not found if (!IsParent) { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.GetApplicationName); redirecPath.Append("/portal/"); redirecPath.Append(GetPortalSEOName); redirecPath.Append("/"); redirecPath.Append(PortalAPI.PageNotFoundPageWithExtension); } else { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.LoginURL); } Response.Redirect(redirecPath.ToString()); } } SetScreenWidth(GetUsername); }
//private string GetUpgraderUrl() //{ // string upgradeLink = string.Empty; // if (GetPortalID > 1) // { // upgradeLink = "~/portal/" + GetPortalSEOName + "/Admin/sfUpgrader" + Extension; // } // else // { // upgradeLink = "~/Admin/sfUpgrader" + Extension; // } // return upgradeLink; //} private void SetPortalCofig() { Hashtable hstPortals = GetPortals(); SageUserControl suc = new SageUserControl(); suc.PagePath = PagePath; int portalID = 1; #region "Get Portal SEO Name and PortalID" if (string.IsNullOrEmpty(Request.QueryString["ptSEO"])) { if (string.IsNullOrEmpty(PortalSEOName)) { PortalSEOName = GetDefaultPortalName(hstPortals, 1); } else if (!hstPortals.ContainsKey(PortalSEOName.ToLower().Trim())) { PortalSEOName = GetDefaultPortalName(hstPortals, 1); } else { portalID = int.Parse(hstPortals[PortalSEOName.ToLower().Trim()].ToString()); } } else { PortalSEOName = Request.QueryString["ptSEO"].ToString().ToLower().Trim(); portalID = Int32.Parse(Request.QueryString["ptlid"].ToString()); } #endregion suc.SetPortalSEOName(PortalSEOName.ToLower().Trim()); Session[SessionKeys.SageFrame_PortalSEOName] = PortalSEOName.ToLower().Trim(); Session[SessionKeys.SageFrame_PortalID] = 1; Session[SessionKeys.SageFrame_AdminTheme] = ThemeHelper.GetAdminTheme(1, GetUsername); Globals.sysHst[ApplicationKeys.ActiveTemplate + "_" + 1] = TemplateController.GetActiveTemplate(1).TemplateSeoName; Globals.sysHst[ApplicationKeys.ActivePagePreset + "_" + 1] = PresetHelper.LoadActivePagePreset(GetActiveTemplate, GetPageSEOName(Request.Url.ToString())); suc.SetPortalID(1); SetPortalID(1); #region "Set user credentials for modules" //SecurityPolicy objSecurity = new SecurityPolicy(); //if (objSecurity.GetUser(1) != string.Empty) //{ // SettingProvider objSP = new SettingProvider(); // SageFrameConfig sfConfig = new SageFrameConfig(); // string strRoles = string.Empty; // List<SageUserRole> sageUserRolles = objSP.RoleListGetByUsername(objSecurity.GetUser(1), 1); // if (sageUserRolles != null) // { // foreach (SageUserRole userRole in sageUserRolles) // { // strRoles += userRole.RoleId + ","; // } // } // if (strRoles.Length > 1) // { // strRoles = strRoles.Substring(0, strRoles.Length - 1); // } // if (strRoles.Length > 0) // { // SetUserRoles(strRoles); // } //} #endregion }
private void BindModuleControls() { string preFix = string.Empty; string paneName = string.Empty; string ControlSrc = string.Empty; string phdContainer = string.Empty; string PageSEOName = string.Empty; SageUserControl suc = new SageUserControl(); string PageName = PagePath; if (PagePath == null) { string PageUrl = Request.RawUrl; PageName = Path.GetFileNameWithoutExtension(PageUrl); } else { PageName = PagePath; } suc.PagePath = PageName; if (Request.QueryString["pgnm"] != null) { PageSEOName = Request.QueryString["pgnm"].ToString(); } else { PageSEOName = GetPageSEOName(PageName); } //:TODO: Need to get controlType and pageID from the selected page from routing path //string controlType = "0"; //string pageID = "2"; string redirecPath = string.Empty; if (PageSEOName != string.Empty) { DataSet dsPageSettings = new DataSet(); SageFrameConfig sfConfig = new SageFrameConfig(); dsPageSettings = sfConfig.GetPageSettingsByPageSEONameForAdmin("1", PageSEOName, GetUsername); if (bool.Parse(dsPageSettings.Tables[0].Rows[0][0].ToString()) == true) { if (bool.Parse(dsPageSettings.Tables[0].Rows[0][1].ToString()) == true) { // Get ModuleControls data table DataTable dtPages = dsPageSettings.Tables[1]; if (dtPages != null && dtPages.Rows.Count > 0) { OverridePageInfo(dtPages); } // Get ModuleDefinitions data table DataTable dtPageModule = dsPageSettings.Tables[2]; if (dtPageModule != null && dtPageModule.Rows.Count > 0) { for (int i = 0; i < dtPageModule.Rows.Count; i++) { paneName = dtPageModule.Rows[i]["PaneName"].ToString(); if (string.IsNullOrEmpty(paneName)) { paneName = "ContentPane"; } string UserModuleID = dtPageModule.Rows[i]["UserModuleID"].ToString(); ControlSrc = "/" + dtPageModule.Rows[i]["ControlSrc"].ToString(); string SupportsPartialRendering = dtPageModule.Rows[i]["SupportsPartialRendering"].ToString(); PlaceHolder phdPlaceHolder = (PlaceHolder)this.FindControl(paneName); if (phdPlaceHolder != null) { phdPlaceHolder = LoadControl(i.ToString(), bool.Parse(SupportsPartialRendering), phdPlaceHolder, ControlSrc, paneName, UserModuleID); } // AddModuleCssToPage(ControlSrc, false); } } } else { if (IsUseFriendlyUrls) { if (GetPortalID > 1) { redirecPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey( SageFrameSettingKeys.PortalPageNotAccessible) + ".aspx"); } else { redirecPath = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx"); } } else { redirecPath = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotAccessible)); } Response.Redirect(redirecPath); } } else { if (IsUseFriendlyUrls) { if (GetPortalID > 1) { redirecPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound) + ".aspx"); } else { redirecPath = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound) + ".aspx"); } } else { redirecPath = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound)); } Response.Redirect(redirecPath); } } HttpContext.Current.Session["ModuleCss"] = null; HttpContext.Current.Session["ModuleJs"] = null; }
private void BindModuleControls() { string preFix = string.Empty; string paneName = string.Empty; string ControlSrc = string.Empty; string phdContainer = string.Empty; string PageSEOName = string.Empty; SageUserControl suc = new SageUserControl(); string PageName = PagePath; if (PagePath == null) { PageName = PagePath; } else { PageName = PagePath; } suc.PagePath = PageName; if (PagePath != null) { PageSEOName = GetPageSEOName(PagePath); } else { SageFrameConfig sfConfig = new SageFrameConfig(); PageSEOName = GetPageSEOName(sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)); } //:TODO: Need to get controlType and pageID from the selected page from routing path //string controlType = "0"; //string pageID = "2"; StringBuilder redirecPath = new StringBuilder(); Uri url = HttpContext.Current.Request.Url; if (PageSEOName != string.Empty) { DataSet dsPageSettings = new DataSet(); SageFrameConfig sfConfig = new SageFrameConfig(); dsPageSettings = sfConfig.GetPageSettingsByPageSEONameForAdmin("1", PageSEOName, GetUsername); if (bool.Parse(dsPageSettings.Tables[0].Rows[0][0].ToString()) == true) // Is Page Exists { if (bool.Parse(dsPageSettings.Tables[0].Rows[0][1].ToString()) == true) // Is Page Aceessable { // Get ModuleControls data table DataTable dtPages = dsPageSettings.Tables[1]; if (dtPages != null && dtPages.Rows.Count > 0) { OverridePageInfo(dtPages); } // Get ModuleDefinitions data table DataTable dtPageModule = dsPageSettings.Tables[2]; List <string> moduleDefIDList = new List <string>(); if (dtPageModule != null && dtPageModule.Rows.Count > 0) { for (int i = 0; i < dtPageModule.Rows.Count; i++) { paneName = dtPageModule.Rows[i]["PaneName"].ToString(); if (string.IsNullOrEmpty(paneName)) { paneName = "ContentPane"; } string UserModuleID = dtPageModule.Rows[i]["UserModuleID"].ToString(); ControlSrc = "/" + dtPageModule.Rows[i]["ControlSrc"].ToString(); string SupportsPartialRendering = dtPageModule.Rows[i]["SupportsPartialRendering"].ToString(); PlaceHolder phdPlaceHolder = (PlaceHolder)this.FindControl(paneName); if (paneName.ToLower().Equals("navigation")) { divNavigation.Attributes.Add("style", "display:block"); } if (paneName.ToLower().Equals("middlemaincurrent")) { divRight.Attributes.Add("style", "display:block"); } if (paneName.ToLower().Equals("cpanel")) { divBottompanel.Attributes.Add("style", "display:block"); } if (paneName.ToLower().Equals("lefta")) { divLeft.Attributes.Add("style", "display:block"); } if (phdPlaceHolder != null) { LoadControl(phdPlaceHolder, ControlSrc, paneName, UserModuleID, "", "", false, new HtmlGenericControl("div"), new HtmlGenericControl("span"), false); moduleDefIDList.Add(dtPageModule.Rows[i]["ModuleDefID"].ToString()); } } } SetModuleDefList(moduleDefIDList); } else { if (!IsParent) { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.GetApplicationName); redirecPath.Append("/portal/"); redirecPath.Append(GetPortalSEOName); redirecPath.Append("/"); redirecPath.Append(PortalAPI.LoginPageWithExtension); } else { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.LoginURL); } string strCurrentURL = Request.Url.ToString(); if (redirecPath.ToString().Contains("?")) { redirecPath.Append("&ReturnUrl="); redirecPath.Append(strCurrentURL); } else { redirecPath.Append("?ReturnUrl="); redirecPath.Append(strCurrentURL); } HttpContext.Current.Response.Redirect(redirecPath.ToString()); } } else { if (!IsParent) { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.GetApplicationName); redirecPath.Append("/portal/"); redirecPath.Append(GetPortalSEOName); redirecPath.Append("/"); redirecPath.Append(PortalAPI.PageNotFoundPageWithExtension); } else { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.PageNotFoundURL); } Response.Redirect(ResolveUrl(redirecPath.ToString())); } } }
private void BindModuleControls() { string preFix = string.Empty; string paneName = string.Empty; string ControlSrc = string.Empty; string phdContainer = string.Empty; string PageSEOName = string.Empty; SageUserControl suc = new SageUserControl(); if (PagePath != null) { suc.PagePath = PagePath; } else { SageFrameConfig sfConfig = new SageFrameConfig(); suc.PagePath = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx"; } if (Request.QueryString["pgnm"] != null) { PageSEOName = Request.QueryString["pgnm"].ToString(); } else { PageSEOName = GetPageSEOName(PagePath); } //:TODO: Need to get controlType and pageID from the selected page from routing path //string controlType = "0"; //string pageID = "2"; string redirecPath = string.Empty; if (PageSEOName != string.Empty) { SageFrameConfig sfConfig = new SageFrameConfig(); string SEOName = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage); if (SEOName.ToLower() == PageSEOName.ToLower()) { divTopWrapper.Attributes.Add("class", " cssClassTopWrapper cssClassIndexPage"); } //TODO:: check store access control here Based on @IPAddress, @Domain, @CustomerName, @email, @StoreID, @PortalID StoreAccessDetailsInfo storeAccessTracker = new StoreAccessDetailsInfo(); storeAccessTracker.PortalID = GetPortalID.ToString(); storeAccessTracker.StoreID = GetStoreID.ToString(); storeAccessTracker.Username = GetUsername; if (Membership.GetUser() != null) { MembershipUser userDetail = Membership.GetUser(GetUsername); storeAccessTracker.UserEmail = userDetail.Email; } else { storeAccessTracker.UserEmail = ""; } StoreAccessResultInfo saResults = (StoreAccessResultInfo)GetStoreAccessByCurrentData(storeAccessTracker); bool storeClosed = (bool)saResults.StoreClosed; bool storeAccessible = (bool)saResults.IsAccess; if (!storeClosed) { if (storeAccessible) { DataSet dsPageSettings = new DataSet(); dsPageSettings = sfConfig.GetPageSettingsByPageSEOName("1", PageSEOName, GetUsername); if (bool.Parse(dsPageSettings.Tables[0].Rows[0][0].ToString()) == true) { //if (bool.Parse(dsPageSettings.Tables[0].Rows[0][2].ToString()) != true) //{ if (bool.Parse(dsPageSettings.Tables[0].Rows[0][1].ToString()) == true) { // Get ModuleControls data table DataTable dtPages = dsPageSettings.Tables[1]; if (dtPages != null && dtPages.Rows.Count > 0) { OverridePageInfo(dtPages); } // Get ModuleDefinitions data table DataTable dtPageModule = dsPageSettings.Tables[2]; if (dtPageModule != null && dtPageModule.Rows.Count > 0) { for (int i = 0; i < dtPageModule.Rows.Count; i++) { paneName = dtPageModule.Rows[i]["PaneName"].ToString(); if (string.IsNullOrEmpty(paneName)) { paneName = "ContentPane"; } string UserModuleID = dtPageModule.Rows[i]["UserModuleID"].ToString(); ControlSrc = "/" + dtPageModule.Rows[i]["ControlSrc"].ToString(); var SupportsPartialRendering = dtPageModule.Rows[i]["SupportsPartialRendering"].ToString(); PlaceHolder phdPlaceHolder = (PlaceHolder)this.FindControl(paneName); if (phdPlaceHolder != null) { phdPlaceHolder = LoadControl(i.ToString(), bool.Parse(SupportsPartialRendering), phdPlaceHolder, ControlSrc, paneName, UserModuleID); } //AddModuleCssToPage(ControlSrc, false); } } } else { if (IsUseFriendlyUrls) { if (GetPortalID > 1) { redirecPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotAccessible) + ".aspx"); } else { redirecPath = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotAccessible) + ".aspx"); } } else { redirecPath = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotAccessible)); } Response.Redirect(redirecPath); } //} //else //{ // if (IsUseFriendlyUrls) // { // if (GetPortalID > 1) // { // redirecPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + PageSEOName + ".aspx"); // } // else // { // redirecPath = ResolveUrl("~/" + PageSEOName + ".aspx"); // } // } // else // { // redirecPath = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + PageSEOName); // } // CommonHelper.EnsureSSL(true, redirecPath); //} } else { if (IsUseFriendlyUrls) { if (GetPortalID > 1) { redirecPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound) + ".aspx"); } else { redirecPath = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound) + ".aspx"); } } else { redirecPath = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound)); } Response.Redirect(redirecPath); } } else { //Store NOT Accessed Page string blockedPortalUrl = string.Empty; if (GetPortalID > 1) { if (IsUseFriendlyUrls) { blockedPortalUrl = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx"); } else { blockedPortalUrl = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)); } } else { if (IsUseFriendlyUrls) { blockedPortalUrl = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx"); } else { blockedPortalUrl = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)); } } Session["StoreBlocked"] = blockedPortalUrl; HttpContext.Current.Response.Redirect(ResolveUrl("~/Modules/AspxCommerce/Store-Not-Accessed.aspx")); } } else { //Store Closed Page string closePortalUrl = string.Empty; if (GetPortalID > 1) { if (IsUseFriendlyUrls) { closePortalUrl = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx"); } else { closePortalUrl = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)); } } else { if (IsUseFriendlyUrls) { closePortalUrl = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx"); } else { closePortalUrl = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)); } } Session["StoreClosed"] = closePortalUrl; HttpContext.Current.Response.Redirect(ResolveUrl("~/Modules/AspxCommerce/Store-Closed.aspx")); } } HttpContext.Current.Session["ModuleCss"] = null; HttpContext.Current.Session["ModuleJs"] = null; }
private void BindModuleControls() { string preFix = string.Empty; string paneName = string.Empty; string ControlSrc = string.Empty; string phdContainer = string.Empty; string PageSEOName = string.Empty; SageUserControl suc = new SageUserControl(); string PageName = PagePath; if (PagePath == null) { string PageUrl = Request.RawUrl; PageName = Path.GetFileNameWithoutExtension(PageUrl); } else { PageName = PagePath; } suc.PagePath = PageName; if (Request.QueryString["pgnm"] != null) { PageSEOName = Request.QueryString["pgnm"].ToString(); } else { PageSEOName = GetPageSEOName(PageName); } //:TODO: Need to get controlType and pageID from the selected page from routing path //string controlType = "0"; //string pageID = "2"; StringBuilder redirecPath = new StringBuilder(); Uri url = HttpContext.Current.Request.Url; if (PageSEOName != string.Empty) { DataSet dsPageSettings = new DataSet(); SageFrameConfig sfConfig = new SageFrameConfig(); dsPageSettings = sfConfig.GetPageSettingsByPageSEONameForAdmin("1", PageSEOName, GetUsername); if (bool.Parse(dsPageSettings.Tables[0].Rows[0][0].ToString()) == true) { #region "Control Load Part" if (bool.Parse(dsPageSettings.Tables[0].Rows[0][1].ToString()) == true) { // Get ModuleControls data table DataTable dtPages = dsPageSettings.Tables[1]; if (dtPages != null && dtPages.Rows.Count > 0) { OverridePageInfo(dtPages); } // Get ModuleDefinitions data table DataTable dtPageModule = dsPageSettings.Tables[2]; if (dtPageModule != null && dtPageModule.Rows.Count > 0) { for (int i = 0; i < dtPageModule.Rows.Count; i++) { paneName = dtPageModule.Rows[i]["PaneName"].ToString(); if (string.IsNullOrEmpty(paneName)) { paneName = "ContentPane"; } string UserModuleID = dtPageModule.Rows[i]["UserModuleID"].ToString(); ControlSrc = "/" + dtPageModule.Rows[i]["ControlSrc"].ToString(); string SupportsPartialRendering = dtPageModule.Rows[i]["SupportsPartialRendering"].ToString(); PlaceHolder phdPlaceHolder = (PlaceHolder)this.FindControl(paneName); if (paneName.Equals("navigation")) { divNavigation.Attributes.Add("style", "display:block"); } if (phdPlaceHolder != null) { bool status = LoadModuleInfo(phdPlaceHolder, int.Parse(UserModuleID), 0); phdPlaceHolder = LoadControl(i.ToString(), bool.Parse(SupportsPartialRendering), phdPlaceHolder, ControlSrc, paneName, UserModuleID, "", "", false, new HtmlGenericControl("div"), new HtmlGenericControl("span"), false); if (!status) { LoadModuleInfo(phdPlaceHolder, int.Parse(UserModuleID), 1); } } } } } #endregion else { if (GetPortalID > 1) { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.GetApplicationName); redirecPath.Append("/portal/"); redirecPath.Append(GetPortalSEOName); redirecPath.Append("/"); redirecPath.Append(PortalAPI.LoginPageWithExtension); } else { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.LoginURL); } string strCurrentURL = Request.Url.ToString(); if (redirecPath.ToString().Contains("?")) { redirecPath.Append("&ReturnUrl="); redirecPath.Append(strCurrentURL); } else { redirecPath.Append("?ReturnUrl="); redirecPath.Append(strCurrentURL); } Response.Redirect(redirecPath.ToString()); } } else { if (GetPortalID > 1) { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.GetApplicationName); redirecPath.Append("/portal/"); redirecPath.Append(GetPortalSEOName); redirecPath.Append("/"); redirecPath.Append(PortalAPI.PageNotFoundPageWithExtension); } else { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.PageNotFoundURL); } Response.Redirect(redirecPath.ToString()); } } }
private void BindModuleControls() { string preFix = string.Empty; string paneName = string.Empty; string ControlSrc = string.Empty; string phdContainer = string.Empty; string PageSEOName = string.Empty; SageUserControl suc = new SageUserControl(); if (PagePath != null) { suc.PagePath = PagePath; } else { SageFrameConfig sfConfig = new SageFrameConfig(); suc.PagePath = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage); } if (PagePath != null) { PageSEOName = GetPageSEOName(PagePath); } else { SageFrameConfig sfConfig = new SageFrameConfig(); PageSEOName = GetPageSEOName(sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)); } PageSEOName = PageSEOName.Replace("-and-", "&").Replace(" ", "-"); //:TODO: Need to get controlType and pageID from the selected page from routing path //string controlType = "0"; //string pageID = "2"; StringBuilder redirecPath = new StringBuilder(); if (PageSEOName != string.Empty) { SageFrameConfig sfConfig = new SageFrameConfig(); string SEOName = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-"); List <UserModuleInfo> lstUserModules = new List <UserModuleInfo>(); bool SuperRole = false; if (Session[SessionKeys.SageRoles] != string.Empty && Session[SessionKeys.SageRoles] != null) { string[] objRole = Session[SessionKeys.SageRoles].ToString().Split(','); foreach (string role in objRole) { if (role.Replace(" ", string.Empty).ToLower().Equals(ApplicationKeys.Super_User.ToLower().Replace("-", string.Empty))) { SuperRole = true; } } } if (GetUsername.Equals(ApplicationKeys.anonymousUser)) { lstUserModules = sfConfig.GetPageModules_Anonymous("1", PageSEOName, GetUsername, GetCurrentCulture()); } else if (SuperRole) { lstUserModules = sfConfig.GetPageModules_Superuser("1", PageSEOName, GetUsername, GetCurrentCulture()); } else { lstUserModules = sfConfig.GetPageModules("1", PageSEOName, GetUsername, GetCurrentCulture()); } Uri url = HttpContext.Current.Request.Url; if (lstUserModules[0].IsPageAvailable) { if (lstUserModules[0].IsPageAccessible) { #region "Load Controls" if (lstUserModules.Count > 0) { OverridePageInfo(lstUserModules[0]); int i = 0; foreach (UserModuleInfo usermodule in lstUserModules) { bool handheld_status = bool.Parse(usermodule.IsHandHeld.ToString()); if (IsHandheld() == handheld_status) { paneName = usermodule.PaneName; paneName = "pch_" + paneName; if (string.IsNullOrEmpty(paneName)) { paneName = "ContentPane"; } string UserModuleTitle = usermodule.UserModuleTitle != string.Empty ? usermodule.UserModuleTitle.ToString() : string.Empty; ControlSrc = usermodule.ControlSrc; string SupportsPartialRendering = usermodule.SupportsPartialRendering.ToString(); string SuffixClass = usermodule.SuffixClass.ToString(); string HeaderText = usermodule.ShowHeaderText ? usermodule.HeaderText : ""; bool ContainsEdit = usermodule.IsEdit; int ControlCount = usermodule.ControlsCount; UserControl uc = pchWhole.FindControl("lytA") as UserControl; PlaceHolder phdPlaceHolder = uc.FindControl(paneName) as PlaceHolder; SuffixClass = IsUserLoggedIn() && ContainsEdit?string.Format("sfLogged sfModule{0}", SuffixClass) : string.Format("sfModule{0}", SuffixClass); if (phdPlaceHolder != null) { string TemplateControls = Server.MapPath(string.Format("~/Templates/{0}/modules/{1}", activeTemplate, ControlSrc.Substring(ControlSrc.IndexOf('/'), ControlSrc.Length - ControlSrc.IndexOf('/')))); ControlSrc = File.Exists(TemplateControls) ? string.Format("/Templates/{0}/modules/{1}", activeTemplate, ControlSrc.Substring(ControlSrc.IndexOf('/'), ControlSrc.Length - ControlSrc.IndexOf('/'))) : string.Format("/{0}", ControlSrc); phdPlaceHolder = LoadControl(i.ToString(), bool.Parse(SupportsPartialRendering), phdPlaceHolder, ControlSrc, paneName, usermodule.UserModuleID.ToString(), SuffixClass, HeaderText, IsUserLoggedIn(), GetModuleControls(usermodule.UserModuleID, ContainsEdit, ControlCount), GetPaneNameContainer(UserModuleTitle), ContainsEdit); } i++; } } } #endregion else { if (currentportalID > 1) { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.GetApplicationName); redirecPath.Append("/portal/"); redirecPath.Append(GetPortalSEOName); redirecPath.Append("/"); redirecPath.Append(PortalAPI.PageNotFoundPageWithExtension); } else { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.PageNotFoundURL); } Response.Redirect(redirecPath.ToString()); } } else { if (currentportalID > 1) { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.GetApplicationName); redirecPath.Append("/portal/"); redirecPath.Append(GetPortalSEOName); redirecPath.Append("/"); redirecPath.Append(PortalAPI.PageNotAccessiblePageWithExtension); } else { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.PageNotAccessibleURL); } Response.Redirect(redirecPath.ToString()); } } else { //page is not found if (currentportalID > 1) { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.GetApplicationName); redirecPath.Append("/portal/"); redirecPath.Append(GetPortalSEOName); redirecPath.Append("/"); redirecPath.Append(PortalAPI.PageNotFoundPageWithExtension); } else { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.PageNotFoundURL); } Response.Redirect(redirecPath.ToString()); } } SetScreenWidth(); }
private void SetPortalCofig() { Hashtable hstPortals = GetPortals(); SageUserControl suc = new SageUserControl(); int portalID = 1; #region "Get Portal SEO Name and PortalID" if (string.IsNullOrEmpty(Request.QueryString["ptSEO"])) { if (string.IsNullOrEmpty(PortalSEOName)) { PortalSEOName = GetDefaultPortalName(hstPortals, 1);// 1 is for Default Portal } else if (!hstPortals.ContainsKey(PortalSEOName.ToLower().Trim())) { PortalSEOName = GetDefaultPortalName(hstPortals, 1);// 1 is for Default Portal } else { portalID = int.Parse(hstPortals[PortalSEOName.ToLower().Trim()].ToString()); } } else { PortalSEOName = Request.QueryString["ptSEO"].ToString().ToLower().Trim(); portalID = Int32.Parse(Request.QueryString["ptlid"].ToString()); } #endregion suc.SetPortalSEOName(PortalSEOName.ToLower().Trim()); Session[SessionKeys.SageFrame_PortalSEOName] = PortalSEOName.ToLower().Trim(); Session[SessionKeys.SageFrame_PortalID] = portalID; string tempName = /*activeTemplate;// */ TemplateController.GetActiveTemplate(currentportalID).TemplateSeoName; string tempPath = Decide.IsTemplateDefault(tempName) ? Utils.GetTemplatePath_Default(tempName) : Utils.GetTemplatePath(tempName); if (!Directory.Exists(tempPath)) { tempName = "default"; } Globals.sysHst[ApplicationKeys.ActiveTemplate + "_" + currentportalID] = tempName; //Globals.sysHst[ApplicationKeys.ActivePagePreset + "_" + currentportalID] = LoadActivePagePreset() || PresetHelper.LoadActivePagePreset(tempName, GetPageSEOName(Request.Url.ToString())); LoadActivePagePreset(); suc.SetPortalID(portalID); SetPortalID(portalID); #region "Set user credentials for modules" if (SecurityPolicy.GetUser(GetPortalID) != string.Empty) { SettingProvider objSP = new SettingProvider(); SageFrameConfig sfConfig = new SageFrameConfig(); if (SecurityPolicy.GetUser(GetPortalID) != string.Empty) { string strRoles = string.Empty; List <SageUserRole> sageUserRolles = objSP.RoleListGetByUsername(SecurityPolicy.GetUser(GetPortalID), currentportalID); if (sageUserRolles != null) { foreach (SageUserRole userRole in sageUserRolles) { strRoles += userRole.RoleId + ","; } } if (strRoles.Length > 1) { strRoles = strRoles.Substring(0, strRoles.Length - 1); } if (strRoles.Length > 0) { SetUserRoles(strRoles); } } } #endregion }
private void SetPortalCofig() { Hashtable hstPortals = GetPortals(); SageUserControl suc = new SageUserControl(); suc.PagePath = PagePath; int portalID = 1; //ptlid=-9&ptSEO=contruction&pgnm=faqs if (string.IsNullOrEmpty(Request.QueryString["ptSEO"])) { if (string.IsNullOrEmpty(PortalSEOName)) { PortalSEOName = "default"; } else if (!hstPortals.ContainsKey(PortalSEOName.ToLower().Trim())) { PortalSEOName = "default"; } else { portalID = int.Parse(hstPortals[PortalSEOName.ToLower().Trim()].ToString()); } } else { PortalSEOName = Request.QueryString["ptSEO"].ToString().ToLower().Trim(); portalID = Int32.Parse(Request.QueryString["ptlid"].ToString()); } suc.SetPortalSEOName(PortalSEOName.ToLower().Trim()); Session["SageFrame.PortalSEOName"] = PortalSEOName.ToLower().Trim(); Session["SageFrame.PortalID"] = portalID; suc.SetPortalID(portalID); SetPortalID(portalID); int storeID = portalID; //TODO:: set StoreID According the URL HERE Session["SageFrame.StoreID"] = storeID; suc.SetStoreID(storeID); SetStoreID(storeID); if (HttpContext.Current.User != null) { SettingProvider objSP = new SettingProvider(); int customerID = 0; if (Membership.GetUser() != null) { string strRoles = string.Empty; //RolesManagementDataContext dbRole = new RolesManagementDataContext(SystemSetting.SageFrameConnectionString); //var userRoles = dbRole.sp_RoleGetByUsername(HttpContext.Current.User.Identity.Name, GetPortalID).ToList(); //foreach (var userRole in userRoles) //{ // strRoles += userRole.RoleId + ","; //} List <SageUserRole> sageUserRolles = objSP.RoleListGetByUsername(HttpContext.Current.User.Identity.Name, GetPortalID); if (sageUserRolles != null) { foreach (SageUserRole userRole in sageUserRolles) { strRoles += userRole.RoleId + ","; } } if (strRoles.Length > 1) { strRoles = strRoles.Substring(0, strRoles.Length - 1); } if (strRoles.Length > 0) { SetUserRoles(strRoles); } //TO Get Customer Details CustomerGeneralInfo sageUserCust = objSP.CustomerIDGetByUsername(HttpContext.Current.User.Identity.Name, GetPortalID, GetStoreID); if (sageUserCust != null) { customerID = sageUserCust.CustomerID; } Session["SageFrame.CustomerID"] = customerID; suc.SetCustomerID(customerID); SetCustomerID(customerID); } else { //TO Get Customer Details CustomerGeneralInfo sageUserCust = objSP.CustomerIDGetByUsername("anonymoususer", GetPortalID, GetStoreID); if (sageUserCust != null) { customerID = sageUserCust.CustomerID; } Session["SageFrame.CustomerID"] = customerID; suc.SetCustomerID(customerID); SetCustomerID(customerID); } } }
protected void ComponentAdminControl(string ControlName, string UserModuleID) { bool IsSortable = true; string ctrlSrc = GetAppPath() + "/Modules/WBComponentAdmin/" + ControlName; if (Directory.Exists(Server.MapPath(ctrlSrc))) { List <ModuleControlInfo> lstModCtls = new List <ModuleControlInfo>(); string[] files = Directory.GetFiles(Server.MapPath(ctrlSrc)).Select(file => Path.GetFileName(file)).ToArray(); ctrlSrc = ctrlSrc + "/"; string[] ControlTitle; TabContainerManagePages.Visible = false; foreach (string fileName in files) { string NameOnly = Path.GetFileNameWithoutExtension(fileName); if (Path.GetExtension(fileName) == ".ascx") { ControlTitle = NameOnly.Split('-'); int len = ControlTitle.Length; if (len > 1) { NameOnly = String.Join("-", ControlTitle.Take(len - 1));//name can have dash. try { lstModCtls.Add(new ModuleControlInfo { ControlTitle = NameOnly, ControlSrc = ctrlSrc + fileName, DisplayOrder = Int32.Parse(ControlTitle.Last()) }); } catch { // having dash but not number in last IsSortable = false; lstModCtls.Add(new ModuleControlInfo { ControlTitle = NameOnly, ControlSrc = ctrlSrc + fileName }); } } else //with out dash { lstModCtls.Add(new ModuleControlInfo { ControlTitle = ControlTitle[0], ControlSrc = ctrlSrc + fileName }); IsSortable = false; } } } if (IsSortable) { lstModCtls = lstModCtls.OrderBy(o => o.DisplayOrder).ToList(); } foreach (ModuleControlInfo CtrlInfo in lstModCtls) { TabPanel tp = new TabPanel(); tp.HeaderText = CtrlInfo.ControlTitle; SageUserControl ctl = this.Page.LoadControl(CtrlInfo.ControlSrc) as SageUserControl; ctl.EnableViewState = true; ctl.SageUserModuleID = UserModuleID; tp.Controls.Add(ctl); TabContainerManagePages.Tabs.Add(tp); } TabContainerManagePages.Visible = true; } else { TabContainerManagePages.Visible = false; StringBuilder redirecPath = new StringBuilder(); redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.PageNotAccessibleURL); HttpContext.Current.Response.Redirect(redirecPath.ToString()); } }
protected void Page_Init(object sender, EventArgs e) { try { SageFrameRoute parentPage = (SageFrameRoute)this.Page; if (parentPage.ControlMode.Equals("category")) { SageUserControl itemDetails = (SageUserControl)LoadControl("~/Modules/Admin/DetailsBrowse/CategoryDetails.ascx"); itemDetails.EnableViewState = true; itemDetails.SageUserModuleID = SageUserModuleID; phdetailBrowseholder.Controls.Add(itemDetails); } else if (parentPage.ControlMode.Equals("item")) { SageUserControl itemDetails = (SageUserControl)LoadControl("~/Modules/Admin/DetailsBrowse/ItemDetails.ascx"); itemDetails.EnableViewState = true; itemDetails.SageUserModuleID = SageUserModuleID; phdetailBrowseholder.Controls.Add(itemDetails); } else if (parentPage.ControlMode.Equals("tags")) { SageUserControl itemDetails = (SageUserControl)LoadControl("~/Modules/Admin/DetailsBrowse/AllTags.ascx"); itemDetails.EnableViewState = true; itemDetails.SageUserModuleID = SageUserModuleID; phdetailBrowseholder.Controls.Add(itemDetails); } else if (parentPage.ControlMode.Equals("tagsitems")) { SageUserControl itemDetails = (SageUserControl)LoadControl("~/Modules/Admin/DetailsBrowse/ViewTagsItems.ascx"); itemDetails.EnableViewState = true; itemDetails.SageUserModuleID = SageUserModuleID; phdetailBrowseholder.Controls.Add(itemDetails); } else if (parentPage.ControlMode.Equals("search")) { SageUserControl itemDetails = (SageUserControl)LoadControl("~/Modules/Admin/DetailsBrowse/ItemLists.ascx"); itemDetails.EnableViewState = true; itemDetails.SageUserModuleID = SageUserModuleID; phdetailBrowseholder.Controls.Add(itemDetails); } else if (parentPage.ControlMode.Equals("option")) { SageUserControl itemDetails = (SageUserControl)LoadControl("~/Modules/Admin/DetailsBrowse/ItemsListByIds.ascx"); itemDetails.EnableViewState = true; itemDetails.SageUserModuleID = SageUserModuleID; phdetailBrowseholder.Controls.Add(itemDetails); } else if (parentPage.ControlMode.Equals("coupons")) { SageUserControl itemDetails = (SageUserControl)LoadControl("~/Modules/Admin/DetailsBrowse/AllCoupons.ascx"); itemDetails.EnableViewState = true; itemDetails.SageUserModuleID = SageUserModuleID; phdetailBrowseholder.Controls.Add(itemDetails); } } catch (Exception ex) { ProcessException(ex); } }