protected void Page_Load(object sender, EventArgs e)
    {
        int StoreID, PortalID;
        int CustomerID;
        string UserName, CultureName, SessionCode;
        SetCustomerID();
        GetPortalCommonInfo(out StoreID, out PortalID, out CustomerID, out UserName, 
            out CultureName, out SessionCode);
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo(StoreID, PortalID, UserName, 
            CultureName, CustomerID, SessionCode);

        StoreSettingConfig ssc = new StoreSettingConfig();
        string timeToDeleteCartItems, timeToAbandonCart;
        ssc.GetStoreSettingParamTwo(StoreSetting.TimeToDeleteAbandonedCart, StoreSetting.CartAbandonedTime,
            out timeToDeleteCartItems, out timeToAbandonCart,
            StoreID, PortalID, CultureName);

        ctl.DeleteAbandonedCartItems(StoreID, PortalID, decimal.Parse(timeToDeleteCartItems), 
            decimal.Parse(timeToAbandonCart));

        StoreAccessDetailsInfo storeAccessTracker = new StoreAccessDetailsInfo();
        storeAccessTracker.PortalID = PortalID;
        storeAccessTracker.StoreID =StoreID;
        storeAccessTracker.Username = UserName;

        StartUpInfoCollection objStartInfo = new StartUpInfoCollection();
        AspxCommonController objCommonCont = new AspxCommonController();
        objStartInfo = objCommonCont.GetStartUpInformation("AspxKPI", "AspxABTesting", storeAccessTracker);

        CheckStoreAccessible(aspxCommonObj, objStartInfo.IsStoreAccess,objStartInfo.IsStoreClosed);
        CreateGlobalVariables(aspxCommonObj,objStartInfo.IsKPIInstalled,objStartInfo.IsABTestInstalled);
        IncludeCoreLanguageJS();
        IncludeTemplateLanguageJS();
        IncludeRssFeedLanguageJS();
        if (HttpContext.Current.Session["IsLoginClick" + UserName] != null)
        {
            if (bool.Parse(HttpContext.Current.Session["IsLoginClick" + UserName].ToString()))
            {

                objCommonCont.UpdateCartAnonymoususertoRegistered(StoreID, PortalID, CustomerID, SessionCode);
                HttpContext.Current.Session["IsLoginClick" + UserName] = false;
            }
        }

        List<CurrrencyRateInfo> ratelist = GetCountryCodeRates(aspxCommonObj);
        JavaScriptSerializer json_serializer = new JavaScriptSerializer();
        string jsonRates = json_serializer.Serialize(ratelist);
        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ratelist", " var currencyRate='" + jsonRates + "';", true);

    }
    public void CheckAccess()
    {
        string preFix = string.Empty;
        string paneName = string.Empty;
        string ControlSrc = string.Empty;
        string phdContainer = string.Empty;
        string PageSEOName = string.Empty;
        string redirecPath = string.Empty;
        SageFrameConfig sfConfig = new SageFrameConfig();
        IsUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
        StoreAccessDetailsInfo storeAccessTracker = new StoreAccessDetailsInfo();
        storeAccessTracker.PortalID = GetPortalID;
        storeAccessTracker.StoreID = GetStoreID;
        storeAccessTracker.Username = GetUsername;
        SecurityPolicy objSecurity = new SecurityPolicy();
        FormsAuthenticationTicket ticket = objSecurity.GetUserTicket(GetPortalID);
        StoreAccessResultInfo saResults = (StoreAccessResultInfo) GetStoreAccessByCurrentData(storeAccessTracker);
        bool storeClosed = (bool) saResults.StoreClosed;
        bool storeAccessible = (bool) saResults.IsAccess;

        if (storeAccessible)
        {

                       string returnURL = HttpContext.Current.Session["StoreClosed"].ToString();
            HttpContext.Current.Session.Remove("StoreClosed");
            Response.Redirect(returnURL);

        }
        else
        {
        }

    }
    public StoreAccessResultInfo GetStoreAccessByCurrentData(StoreAccessDetailsInfo storeAccessTracker)
    {
        try
        {
            List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();

            ParaMeterCollection.Add(new KeyValuePair<string, object>("@IPAddress", storeAccessTracker.UserIPAddress));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@Domain", storeAccessTracker.UserDomainURL));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@CustomerName", storeAccessTracker.Username));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", storeAccessTracker.PortalID));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@StoreID", storeAccessTracker.StoreID));
            SQLHandler sagesql = new SQLHandler();
            StoreAccessResultInfo obj = sagesql.ExecuteAsObject<StoreAccessResultInfo>("dbo.usp_Aspx_CheckStoreAccess", ParaMeterCollection);
            return obj;
        }
        catch (Exception e)
        {
            throw e;
        }
    }
Beispiel #4
0
 public StartUpInfoCollection GetStartUpInformation(string moduleFriendlyName1, string moduleFriendlyName2, StoreAccessDetailsInfo objStoreAccess)
 {
     try
     {
         SQLHandler sqlH = new SQLHandler();
         List <KeyValuePair <string, object> > parameterCollection = new List <KeyValuePair <string, object> >();
         parameterCollection.Add(new KeyValuePair <string, object>("@ModuleFriendlyName1", moduleFriendlyName1));
         parameterCollection.Add(new KeyValuePair <string, object>("@ModuleFriendlyName2", moduleFriendlyName2));
         parameterCollection.Add(new KeyValuePair <string, object>("@IPAddress", objStoreAccess.UserIPAddress));
         parameterCollection.Add(new KeyValuePair <string, object>("@Domain", objStoreAccess.UserDomainURL));
         parameterCollection.Add(new KeyValuePair <string, object>("@CustomerName", objStoreAccess.Username));
         parameterCollection.Add(new KeyValuePair <string, object>("@StoreID", objStoreAccess.StoreID));
         parameterCollection.Add(new KeyValuePair <string, object>("@PortalID", objStoreAccess.PortalID));
         StartUpInfoCollection objStartUp = new StartUpInfoCollection();
         objStartUp = sqlH.ExecuteAsObject <StartUpInfoCollection>("[usp_Aspx_GetStartUpInformation]", parameterCollection);
         return(objStartUp);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        public StartUpInfoCollection GetStartUpInformation(string moduleFriendlyName1, string moduleFriendlyName2, StoreAccessDetailsInfo objStoreAccess)
        {
            try
            {

                AspxCommonProvider objCommonProvider = new AspxCommonProvider();
                return objCommonProvider.GetStartUpInformation(moduleFriendlyName1, moduleFriendlyName2, objStoreAccess);
                
            }
            catch (Exception e)
            {
                throw e;
            }
        }
    public void CheckAccess()
    {
        string preFix = string.Empty;
        string paneName = string.Empty;
        string ControlSrc = string.Empty;
        string phdContainer = string.Empty;
        string PageSEOName = string.Empty;
        string redirecPath = string.Empty;
        SageFrameConfig sfConfig = new SageFrameConfig();
        IsUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
        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 (storeAccessible)
        {
            DataSet dsPageSettings = new DataSet();

            dsPageSettings = sfConfig.GetPageSettingsByPageSEOName("1", "Home", 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)
                {
                    //from session previous url will retrive and redirect to id
                    string returnURL = HttpContext.Current.Session["StoreBlocked"].ToString();
                    HttpContext.Current.Session.Remove("StoreBlocked");
                    Response.Redirect(returnURL);
                }
                else
                {

                }

            }
            else
            {
                //portal no found
            }
        }
        else
        {
        }
    
       
    }
Beispiel #7
0
 public StartUpInfoCollection GetStartUpInformation(string moduleFriendlyName1, string moduleFriendlyName2, StoreAccessDetailsInfo objStoreAccess)
 {
     try
     {
         AspxCommonProvider objCommonProvider = new AspxCommonProvider();
         return(objCommonProvider.GetStartUpInformation(moduleFriendlyName1, moduleFriendlyName2, objStoreAccess));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        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;
        }
 public StartUpInfoCollection GetStartUpInformation(string moduleFriendlyName1, string moduleFriendlyName2, StoreAccessDetailsInfo objStoreAccess)
 {
     try
     {
         SQLHandler sqlH = new SQLHandler();
         List<KeyValuePair<string, object>> parameterCollection = new List<KeyValuePair<string, object>>();
         parameterCollection.Add(new KeyValuePair<string, object>("@ModuleFriendlyName1", moduleFriendlyName1));
         parameterCollection.Add(new KeyValuePair<string, object>("@ModuleFriendlyName2", moduleFriendlyName2));
         parameterCollection.Add(new KeyValuePair<string, object>("@IPAddress", objStoreAccess.UserIPAddress));
         parameterCollection.Add(new KeyValuePair<string, object>("@Domain", objStoreAccess.UserDomainURL));
         parameterCollection.Add(new KeyValuePair<string, object>("@CustomerName", objStoreAccess.Username));
         parameterCollection.Add(new KeyValuePair<string, object>("@StoreID", objStoreAccess.StoreID));
         parameterCollection.Add(new KeyValuePair<string, object>("@PortalID", objStoreAccess.PortalID));
         StartUpInfoCollection objStartUp = new StartUpInfoCollection();
         objStartUp = sqlH.ExecuteAsObject<StartUpInfoCollection>("[usp_Aspx_GetStartUpInformation]", parameterCollection);
         return objStartUp;
     }
     catch (Exception e)
     {
         throw e;
     }
 }