예제 #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);
                }
            }
        }
예제 #2
0
        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);
        }