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); } }
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); } }
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 { 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(); 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); } } }
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.PlortalLoginpage) + ".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); } } }
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 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(); 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.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")); } } }
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); } List<string> moduleDefIDList = new List<string>(); // 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); LoadControl(phdPlaceHolder, ControlSrc, paneName, UserModuleID, "", "", false, new HtmlGenericControl("div"), new HtmlGenericControl("span"), false); //if (!status) //{ // LoadModuleInfo(phdPlaceHolder, int.Parse(UserModuleID), 1); //} moduleDefIDList.Add(dtPageModule.Rows[i]["ModuleDefID"].ToString()); } } } SetModuleDefList(moduleDefIDList); } #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.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 (!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(redirecPath.ToString()); } } }
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);// 1 is default parent PortalID } 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] = portalID; Session[SessionKeys.SageFrame_AdminTheme] = ThemeHelper.GetAdminTheme(GetPortalID, GetUsername); Globals.sysHst[ApplicationKeys.ActiveTemplate + "_" + portalID] = TemplateController.GetActiveTemplate(GetPortalID).TemplateSeoName; Globals.sysHst[ApplicationKeys.ActivePagePreset + "_" + portalID] = PresetHelper.LoadActivePagePreset(GetActiveTemplate, GetPageSEOName(Request.Url.ToString())); suc.SetPortalID(portalID); SetPortalID(portalID); #region "Set user credentials for modules" SecurityPolicy objSecurity = new SecurityPolicy(); if (objSecurity.GetUser(GetPortalID) != string.Empty) { SettingProvider objSP = new SettingProvider(); SageFrameConfig sfConfig = new SageFrameConfig(); string strRoles = string.Empty; List<SageUserRole> sageUserRolles = objSP.RoleListGetByUsername(objSecurity.GetUser(GetPortalID), 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); } } #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(); suc.PagePath = PagePath; if (Request.QueryString["pgnm"] != null) { PageSEOName = Request.QueryString["pgnm"].ToString(); } else { PageSEOName ="ManagePages"; } PageSEOName = "ManagePages"; 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) { //checking IsPageAccessible true or false 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 strUserModuleID = 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, strUserModuleID); } // 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 + "/" + 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 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 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]; 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) { 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); } } } } } else { if (IsUseFriendlyUrls) { 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); } } else { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.GetApplicationName); redirecPath.Append("/Default"); redirecPath.Append(Extension); redirecPath.Append("?ptlid="); redirecPath.Append(GetPortalID); redirecPath.Append("&ptSEO="); redirecPath.Append(GetPortalSEOName); redirecPath.Append("&pgnm="); redirecPath.Append(sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage)); } 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 (IsUseFriendlyUrls) { 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); } } else { redirecPath.Append(url.Scheme); redirecPath.Append("://"); redirecPath.Append(url.Authority); redirecPath.Append(PortalAPI.GetApplicationName); redirecPath.Append("/Default"); redirecPath.Append(Extension); redirecPath.Append("?ptlid="); redirecPath.Append(GetPortalID); redirecPath.Append("&ptSEO="); redirecPath.Append(GetPortalSEOName); redirecPath.Append("&pgnm="); redirecPath.Append(sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound)); } Response.Redirect(ResolveUrl(redirecPath.ToString())); } } }
private void SetCustomerID() { SageUserControl suc = new SageUserControl(); int customerID = 0; SecurityPolicy objSecurity = new SecurityPolicy(); FormsAuthenticationTicket ticket = objSecurity.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); } }