Esempio n. 1
0
        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 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 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();
            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);
        }