Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                IncludeCss("StoreAccessControl", "/Templates/" + TemplateName + "/css/GridView/tablesort.css", "/Templates/" + TemplateName + "/css/MessageBox/style.css");
                IncludeJs("StoreAccessControl", "/js/FormValidation/jquery.validate.js", "/js/JQueryUI/jquery-ui-1.8.10.custom.js", "/js/GridView/jquery.grid.js",
                          "/js/GridView/SagePaging.js", "/js/GridView/jquery.global.js", "/js/GridView/jquery.dateFormat.js",
                          "/js/MessageBox/jquery.easing.1.3.js", "/js/PopUp/custom.js", "/js/MessageBox/alertbox.js",
                          "/Modules/AspxCommerce/AspxStoreAccessManagement/js/StoreAccess.js");

                StoreID  = int.Parse(GetStoreID.ToString());
                PortalID = int.Parse(GetPortalID.ToString());
                LblStoreAccessValueID        = lblStoreAccessValue.ClientID;
                LblAddEditStoreAccessTitleID = lblAddEditStoreAccessTitle.ClientID;
                UserName = GetUsername;
            }
            IncludeLanguageJS();
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
Ejemplo n.º 2
0
    private List <CurrrencyRateInfo> GetCountryCodeRates()
    {
        Hashtable            hst = new Hashtable();
        StoreSettingProvider sep = new StoreSettingProvider();

        if (HttpContext.Current.Cache["AspxCurrencyRate" + GetPortalID.ToString() + GetStoreID.ToString()] != null)
        {
            hst = (Hashtable)HttpContext.Current.Cache["AspxCurrencyRate" + GetPortalID.ToString() + GetStoreID.ToString()];

            List <CurrrencyRateInfo> currencies = (List <CurrrencyRateInfo>)hst["CURRENCY"];
            return(currencies);
        }
        else
        {
            AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
            aspxCommonObj.StoreID  = GetStoreID;
            aspxCommonObj.PortalID = GetPortalID;
            List <CurrrencyRateInfo> currencyRate = AspxCurrencyController.GetCountryCodeRates(aspxCommonObj);
            if (currencyRate.Count > 0)
            {
                hst.Add("CURRENCY", currencyRate);
                HttpContext.Current.Cache.Insert("AspxCurrencyRate" + GetPortalID.ToString() + GetStoreID.ToString(), hst);
            }
            else
            {
            }
            return(currencyRate);
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                IncludeCss("CatalogPriceRule", "/Templates/" + TemplateName + "/css/GridView/tablesort.css", "/Templates/" + TemplateName + "/css/TreeView/ui.tree.css",
                           "/Templates/" + TemplateName + "/css/MessageBox/style.css", "/Templates/" + TemplateName + "/css/JQueryUI/jquery.ui.all.css",
                           "/Modules/AspxCommerce/AspxCatalogPricingRule/css/module.css");
                IncludeJs("CatalogPriceRule", "/js/FormValidation/jquery.validate.js", "/js/GridView/jquery.grid.js",
                          "/js/GridView/SagePaging.js", "/js/GridView/jquery.global.js", "/js/GridView/jquery.dateFormat.js", "/js/DateTime/date.js",
                          "/js/MessageBox/jquery.easing.1.3.js", "/js/MessageBox/alertbox.js", "/js/jquery.multipleselectbox.js", "/Modules/AspxCommerce/AspxCatalogPricingRule/js/CatalogPriceRule.js");

                PortalID    = int.Parse(GetPortalID.ToString());
                StoreID     = int.Parse(GetStoreID.ToString());
                UserName    = GetUsername;
                CultureName = GetCurrentCultureName; UserModuleId = SageUserModuleID;
            }
            IncludeLanguageJS();
            Thread catalogRunning = AspxCommerce.Core.AspxCoreController.catalogThread;
            if (catalogRunning != null && catalogRunning.IsAlive)
            {
                IsCatalogThreadRunning = true;
            }
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                IncludeJs("AttributesManage", "/js/GridView/jquery.grid.js", "/js/GridView/SagePaging.js", "/js/GridView/jquery.global.js", "/js/GridView/jquery.dateFormat.js", "/js/MessageBox/jquery.easing.1.3.js",
                          "/js/MessageBox/alertbox.js", "/Modules/AspxCommerce/AspxAttributesManagement/js/AttributesManage.js");
                IncludeCss("AttributesManage", "/Templates/" + TemplateName + "/css/GridView/tablesort.css", "/Templates/" + TemplateName + "/css/MessageBox/style.css", "/Templates/" + TemplateName + "/css/JQueryUI/jquery.ui.all.css");
                Page.ClientScript.RegisterClientScriptInclude("JQueryFormValidate", ResolveUrl("~/js/FormValidation/jquery.form-validation-and-hints.js"));
                PortalID     = int.Parse(GetPortalID.ToString());
                StoreID      = int.Parse(GetStoreID.ToString());
                UserName     = GetUsername;
                CultureName  = GetCurrentCultureName;
                UserModuleId = SageUserModuleID;
            }

            AddLanguage();
            IncludeLanguageJS();
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
Ejemplo n.º 5
0
        private void SaveProtal()
        {
            if (Int32.Parse(hdnPortalID.Value) > 0)
            {
                bool   IsParent  = ddlAvailablePortal.SelectedIndex == 0 ? true : false;
                int    ParentID  = ddlAvailablePortal.SelectedIndex == 0 ? 0 : int.Parse(ddlAvailablePortal.SelectedValue);
                string PortalURL = ddlAvailablePortal.SelectedIndex == 0 ? txtUrl.Text : txtPortalName.Text;


                PortalController.UpdatePortal(Int32.Parse(hdnPortalID.Value), txtPortalName.Text, IsParent, GetUsername, PortalURL, ParentID);
            }
            else
            {
                if (HttpRuntime.Cache["AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString()] != null)
                {
                    string newPortalname = SaveTemplate();
                    int    ParentPortal  = int.Parse(ddlAvailablePortal.SelectedValue);
                    // string PSEOName = txtUrl.Text == string.Empty ? ddlAvailablePortal.SelectedItem.ToString() : txtUrl.Text;
                    string PSEOName = string.Empty;
                    if (txtUrl.Text != string.Empty)
                    {
                        PSEOName = txtUrl.Text.Contains("http://") || txtUrl.Text.Contains("https://") ? txtUrl.Text : "http://" + txtUrl.Text;
                    }
                    else
                    {
                        PSEOName = txtPortalName.Text;
                    }
                    bool IsParent = false;
                    //PortalMgrController.AddPortal(txtPortalName.Text, false, GetUsername, newPortalname);
                    if (ddlAvailablePortal.SelectedIndex == 0)
                    {
                        IsParent = true;
                    }
                    PortalMgrController.AddStoreSubscriber(txtPortalName.Text, IsParent, GetUsername,
                                                           newPortalname, ParentPortal, PSEOName);
                }
                else
                {
                    string newPortalname = SaveTemplate();
                    int    ParentPortal  = int.Parse(ddlAvailablePortal.SelectedValue);
                    // string PSEOName = txtUrl.Text == string.Empty ? ddlAvailablePortal.SelectedItem.ToString() : txtUrl.Text;
                    string PSEOName = string.Empty;
                    if (txtUrl.Text != string.Empty)
                    {
                        PSEOName = txtUrl.Text.Contains("http://") || txtUrl.Text.Contains("https://") ? txtUrl.Text : "http://" + txtUrl.Text;
                    }
                    else
                    {
                        PSEOName = txtPortalName.Text;
                    }
                    bool IsParent = false;
                    //PortalMgrController.AddPortal(txtPortalName.Text, false, GetUsername, newPortalname);
                    if (ddlAvailablePortal.SelectedIndex == 0)
                    {
                        IsParent = true;
                    }
                    PortalMgrController.AddPortal(txtPortalName.Text, IsParent, GetUsername, newPortalname, ParentPortal, PSEOName);
                }
            }
        }
 private void SaveProtal()
 {
     if (Int32.Parse(hdnPortalID.Value) > 0)
     {
         PortalController.UpdatePortal(Int32.Parse(hdnPortalID.Value), txtPortalName.Text, false, GetUsername);
     }
     else
     {
         if (HttpRuntime.Cache["AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString()] != null)
         {
             string portalUrl;
             string portalName = txtPortalName.Text.Trim().Replace(" ", "_");
             if (IsUseFriendlyUrls)
             {
                 portalUrl = Request.ServerVariables["SERVER_NAME"] + "/portal/" + portalName + "/" + "home" + SageFrameSettingKeys.PageExtension;
             }
             else
             {
                 portalUrl = Request.ServerVariables["SERVER_NAME"] + "/portal/" + "home";
             }
             string newPortalname = SaveTemplate();
             PortalMgrController.AddStoreSubscriber(portalName, false, GetUsername,
                                                    newPortalname);
         }
         else
         {
             string newPortalname = SaveTemplate();
             PortalMgrController.AddPortal(txtPortalName.Text, false, GetUsername, newPortalname);
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                IncludeCss("AttributeSetManage", "/Templates/" + TemplateName + "/css/GridView/tablesort.css", "/Templates/" + TemplateName + "/css/TreeView/ui.tree.css", "/Templates/" + TemplateName + "/css/MessageBox/style.css", "/Templates/" + TemplateName + "/css/PopUp/style.css", "/Modules/AspxCommerce/AspxAttributesManagement/css/module.css");
                IncludeJs("AttributeSetManage", "/js/GridView/jquery.grid.js", "/js/GridView/SagePaging.js",
                          "/js/GridView/jquery.global.js", "/js/GridView/jquery.dateFormat.js", "/js/TreeView/jquery.tree.ui.core.js", "/js/TreeView/ui.tree.js",
                          "/js/TreeView/contextmenu.js", "/js/PopUp/custom.js", "/js/FormValidation/jquery.validate.js", "/js/MessageBox/jquery.easing.1.3.js", "/js/MessageBox/alertbox.js", "/Modules/AspxCommerce/AspxAttributesManagement/js/AttributesSetManage.js");

                AddImageUrls();
                PortalID    = int.Parse(GetPortalID.ToString());
                StoreID     = int.Parse(GetStoreID.ToString());
                UserName    = GetUsername;
                CultureName = GetCurrentCultureName; UserModuleId = SageUserModuleID;
            }
            AddLanguage();
            IncludeLanguageJS();
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         ddlAvailablePortal.Visible = false;
         lblAvailablePortal.Visible = false;
         lblUrl.Visible             = false;
         txtUrl.Visible             = false;
         appPath = GetApplicationName;
         if (!IsPostBack)
         {
             BindPortal();
             //BindSitePortal();
             PanelVisibility(false, true);
             imbBtnSaveChanges.Attributes.Add("onclick", "javascript:return confirm('" + GetSageMessage("PortalModules", "AreYouSureToSaveChanges") + "')");
         }
         trEmail.Visible = false;
         //test.Visible = false;
         if (HttpRuntime.Cache["AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString()] != null)
         {
             trEmail.Visible = true;
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Ejemplo n.º 9
0
    private void GetStoreSettings()
    {
        Hashtable            hst = new Hashtable();
        StoreSettingProvider sep = new StoreSettingProvider();

        if (HttpContext.Current.Cache["AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString()] != null)
        {
            hst = (Hashtable)HttpContext.Current.Cache["AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString()];
            StoreSettingConfig ssc = new StoreSettingConfig();
            decimal            timeToDeleteCartItems = decimal.Parse(ssc.GetStoreSettingsByKey(StoreSetting.TimeToDeleteAbandonedCart, GetStoreID, GetPortalID, GetCurrentCultureName));
            decimal            timeToAbandonCart     = Convert.ToDecimal(ssc.GetStoreSettingsByKey(StoreSetting.CartAbandonedTime, GetStoreID, GetPortalID, GetCurrentCultureName));
            ctl.DeleteAbandonedCartItems(GetStoreID, GetPortalID, timeToDeleteCartItems, timeToAbandonCart);
        }
        else
        {
            DataTable dt = sep.GetStoreSettings(GetStoreID, GetPortalID, GetCurrentCultureName); if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    hst.Add(dt.Rows[i]["SettingKey"].ToString(), dt.Rows[i]["SettingValue"].ToString());
                    StoreSettingConfig ssc = new StoreSettingConfig();
                    decimal            timeToDeleteCartItems = decimal.Parse(ssc.GetStoreSettingsByKey(StoreSetting.TimeToDeleteAbandonedCart, GetStoreID, GetPortalID, GetCurrentCultureName));
                    decimal            timeToAbandonCart     = Convert.ToDecimal(ssc.GetStoreSettingsByKey(StoreSetting.CartAbandonedTime, GetStoreID, GetPortalID, GetCurrentCultureName));
                    ctl.DeleteAbandonedCartItems(GetStoreID, GetPortalID, timeToDeleteCartItems, timeToAbandonCart);
                }
                HttpContext.Current.Cache.Insert("AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString(), hst);
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             IncludeCss("CouponPerSalesManage", "/Templates/" + TemplateName + "/css/GridView/tablesort.css",
                        "/Templates/" + TemplateName + "/css/MessageBox/style.css",
                        "/Templates/" + TemplateName + "/css/JQueryUI/jquery.ui.all.css");
             IncludeJs("CouponPerSalesManage", "/js/JQueryUI/jquery-ui-1.8.10.custom.js",
                       "/js/GridView/jquery.grid.js", "/js/GridView/SagePaging.js", "/js/GridView/jquery.global.js",
                       "/js/GridView/jquery.dateFormat.js", "/js/DateTime/date.js",
                       "/js/MessageBox/jquery.easing.1.3.js", "/js/ExportToCSV/table2CSV.js",
                       "/js/MessageBox/alertbox.js",
                       "/Modules/AspxCommerce/AspxCouponManagement/js/CouponPerSalesManage.js",
                       "/js/CurrencyFormat/jquery.formatCurrency-1.4.0.js",
                       "/js/CurrencyFormat/jquery.formatCurrency.all.js");
             PortalID    = int.Parse(GetPortalID.ToString());
             StoreID     = int.Parse(GetStoreID.ToString());
             UserName    = GetUsername;
             CultureName = GetCurrentCultureName;
         }
         IncludeLanguageJS();
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Ejemplo n.º 11
0
    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["StoreClosed"].ToString();
                    HttpContext.Current.Session.Remove("StoreClosed");
                    Response.Redirect(returnURL);
                }
                else
                {
                }
            }
            else
            {
                //portal no found
            }
        }
        else
        {
        }
    }
Ejemplo n.º 12
0
 public string GetStoreNotAccessPageContent()
 {
     try
     {
         List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >();
         ParaMeterCollection.Add(new KeyValuePair <string, object>("@StoreID", GetStoreID.ToString()));
         ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", GetPortalID.ToString()));
         SQLHandler sagesql = new SQLHandler();
         return(sagesql.ExecuteAsScalar <string>("dbo.usp_Aspx_CheckStoreNotAccessPageContent", ParaMeterCollection));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        private void DeletePortal(Int32 portalID)
        {
            PortalInfo objInfo = PortalController.GetPortalByPortalID(portalID, GetUsername);

            txtPortalName.Text = objInfo.Name;
            if (HttpRuntime.Cache["AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString()] != null)
            {
                PortalController.DeleteStorePortal(portalID, GetPortalID, GetUsername);
            }
            else
            {
                PortalController.DeletePortal(portalID, GetUsername);
            }

            ShowMessage("", GetSageMessage("PortalSettings", "PortalDeleteSuccessfully"), "", SageMessageType.Success);
        }
Ejemplo n.º 14
0
    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;
        SecurityPolicy            objSecurity = new SecurityPolicy();
        FormsAuthenticationTicket ticket      = objSecurity.GetUserTicket(GetPortalID);

        if (ticket != null && ticket.Name != ApplicationKeys.anonymousUser)
        {
            MembershipController member     = new MembershipController();
            UserInfo             userDetail = member.GetUserDetails(GetPortalID, 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)
        {
            string returnURL = HttpContext.Current.Session["StoreBlocked"].ToString();
            HttpContext.Current.Session.Remove("StoreBlocked");
            Response.Redirect(returnURL);
        }
        else
        {
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                IncludeCss("CartPriceRule", "/Templates/" + TemplateName + "/css/GridView/tablesort.css", "/Templates/" + TemplateName + "/css/TreeView/ui.tree.css", "/Templates/" + TemplateName + "/css/MessageBox/style.css", "/Templates/" + TemplateName + "/css/JQueryUI/jquery.ui.all.css");
                IncludeJs("CartPriceRule", "/js/JQueryUI/jquery-ui-1.8.10.custom.js", "/js/FormValidation/jquery.validate.js", "/js/GridView/jquery.grid.js",
                          "/js/GridView/SagePaging.js", "/js/GridView/jquery.global.js", "/js/GridView/jquery.dateFormat.js", "/js/DateTime/date.js",
                          "/js/DateTime/date.js", "/js/MessageBox/jquery.easing.1.3.js", "/js/MessageBox/alertbox.js", "/js/jquery.multipleselectbox.js", "/Modules/AspxCommerce/AspxCartPricingRule/js/CartPriceRule.js");

                PortalID    = int.Parse(GetPortalID.ToString());
                StoreID     = int.Parse(GetStoreID.ToString());
                UserName    = GetUsername;
                CultureName = GetCurrentCultureName;
            }
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
 public void CreateNewTemplateFolder(string TemplateName)
 {
     try
     {
         string completePath = Server.MapPath(appPath + "/Templates/" + TemplateName);
         string path         = HttpContext.Current.Server.MapPath(appPath).Replace(@"\Admin", "");
         if (HttpRuntime.Cache["AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString()] != null)
         {
             DirectoryInfo SrcDirA = new DirectoryInfo(path + "/Templates/AspxCommerce/");
             DirectoryInfo DisDirA = new DirectoryInfo(path + "/Templates/" + TemplateName);
             CopyDirectory(SrcDirA, DisDirA);
         }
         else
         {
             DirectoryInfo SrcDir = new DirectoryInfo(path + "/Core/Blank/");
             DirectoryInfo DisDir = new DirectoryInfo(path + "/Templates/" + TemplateName);
             CopyDirectory(SrcDir, DisDir);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 17
0
        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;
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            try
            {
                SageFrameConfig sfConfig = new SageFrameConfig();
                IsUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                string sageRedirectPath = string.Empty;
                if (IsUseFriendlyUrls)
                {
                    if (GetPortalID > 1)
                    {
                        sageRedirectPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx");
                        addressPath      = HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/portal/" + GetPortalSEOName + "/";
                    }
                    else
                    {
                        sageRedirectPath = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx");
                        addressPath      = HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/";
                    }
                }
                else
                {
                    sageRedirectPath = ResolveUrl("{~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage));
                }

                Image imgProgress = (Image)UpdateProgress1.FindControl("imgPrgress");
                if (imgProgress != null)
                {
                    imgProgress.ImageUrl = GetTemplateImageUrl("ajax-loader.gif", true);
                }
                hlnkHomePage.NavigateUrl = sageRedirectPath;


                OrderDetailsCollection orderdata     = new OrderDetailsCollection();
                AspxCommonInfo         aspxCommonObj = new AspxCommonInfo();
                aspxCommonObj.CustomerID  = GetCustomerID;
                aspxCommonObj.SessionCode = HttpContext.Current.Session.SessionID;
                aspxCommonObj.StoreID     = GetStoreID;
                aspxCommonObj.PortalID    = GetPortalID;
                aspxCommonObj.CultureName = GetCurrentCultureName;
                aspxCommonObj.UserName    = GetUsername;

                if (Session["OrderID"] != null)
                {
                    orderID = int.Parse(Session["OrderID"].ToString());
                    int    storeID    = int.Parse(GetStoreID.ToString());
                    int    portalID   = int.Parse(GetPortalID.ToString());
                    string userName   = GetUsername.ToString();
                    int    customerID = int.Parse(GetCustomerID.ToString());
                    transID = GetTransactionDetailById(int.Parse(Session["OrderID"].ToString()));
                    if (HttpContext.Current.Session["OrderCollection"] != null)
                    {
                        orderdata = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                        AspxGiftCardController.IssueGiftCard(orderdata.LstOrderItemsInfo, false, aspxCommonObj);
                        if (orderdata.GiftCardDetail != null && HttpContext.Current.Session["UsedGiftCard"] != null)
                        {   //updating giftcard used in chekout
                            AspxGiftCardController.UpdateGiftCardUsage(orderdata.GiftCardDetail, orderdata.ObjCommonInfo.StoreID,
                                                                       orderdata.ObjCommonInfo.PortalID, orderdata.ObjOrderDetails.OrderID, orderdata.ObjCommonInfo.AddedBy,
                                                                       orderdata.ObjCommonInfo.CultureName);
                            HttpContext.Current.Session.Remove("UsedGiftCard");
                        }
                        invoice = orderdata.ObjOrderDetails.InvoiceNumber;
                        orderdata.ObjOrderDetails.OrderStatus = "Successful";
                        EmailTemplate.SendEmailForOrder(portalID, orderdata, addressPath, TemplateName, transID);
                    }

                    lblTransaction.Text   = transID;
                    lblPaymentMethod.Text = "GoogleCheckOut";
                    lblDateTime.Text      = DateTime.Now.ToString("dddd, dd MMMM yyyy ");
                    lblInvoice.Text       = invoice;
                    ClearAllSession();
                }
                else
                {
                    Response.Redirect(sageRedirectPath, false);
                }
                IncludeLanguageJS();
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
    }
 private void SaveProtal()
 {
     if (Int32.Parse(hdnPortalID.Value) > 0)
     {
         bool   IsParent  = ddlAvailablePortal.SelectedIndex == 0 ? true : false;
         int    ParentID  = ddlAvailablePortal.SelectedIndex == 0 ? 0 : int.Parse(ddlAvailablePortal.SelectedValue);
         string PortalURL = ddlAvailablePortal.SelectedIndex == 0 ? txtUrl.Text : txtPortalName.Text;
         PortalController.UpdatePortal(Int32.Parse(hdnPortalID.Value), txtPortalName.Text, IsParent, GetUsername, PortalURL, ParentID);
     }
     else
     {
         if (HttpRuntime.Cache["AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString()] != null)
         {
             string newpassword    = GetRandomPassword(6);
             int    passowrdformat = 2;
             string password;
             int?   customerID = 0;
             string passwordsalt, portalUrl;
             string portalName = txtPortalName.Text.Trim().Replace(" ", "_");
             portalUrl = Request.ServerVariables["SERVER_NAME"] + "/portal/" + portalName + "/" + "home" + SageFrameSettingKeys.PageExtension;
             PasswordHelper.EnforcePasswordSecurity(passowrdformat, newpassword, out password,
                                                    out passwordsalt);
             string email = txtEmail.Text.Trim();
             SaveTemplate();
             customerID = PortalMgrController.AddStoreSubscriber(portalName, "", "", email, null, false, false,
                                                                 "superuser",
                                                                 password, passwordsalt, passowrdformat, false);
             try
             {
                 sendEmail(customerID, newpassword, portalName, txtEmail.Text.Trim(), "superuser", "",
                           portalUrl);
                 ShowMessage(SageMessageTitle.Information.ToString(),
                             GetSageMessage("PortalSettings", "PortalSavedAndEmailSendSuccessfully"), "",
                             SageMessageType.Success);
             }
             catch
             {
                 ShowMessage(SageMessageTitle.Notification.ToString(),
                             GetSageMessage("PortalSettings", "PortalAddEmailSendProblem"), "",
                             SageMessageType.Alert);
             }
         }
         else
         {
             string newPortalname = SaveTemplate();
             int    ParentPortal  = int.Parse(ddlAvailablePortal.SelectedValue);
             // string PSEOName = txtUrl.Text == string.Empty ? ddlAvailablePortal.SelectedItem.ToString() : txtUrl.Text;
             string PSEOName = string.Empty;
             if (txtUrl.Text != string.Empty)
             {
                 PSEOName = txtUrl.Text.Contains("http://") || txtUrl.Text.Contains("https://") ? txtUrl.Text : "http://" + txtUrl.Text;
             }
             else
             {
                 PSEOName = txtPortalName.Text;
             }
             bool IsParent = false;
             //PortalMgrController.AddPortal(txtPortalName.Text, false, GetUsername, newPortalname);
             if (ddlAvailablePortal.SelectedIndex == 0)
             {
                 IsParent = true;
             }
             PortalMgrController.AddPortal(txtPortalName.Text, IsParent, GetUsername, newPortalname, ParentPortal, PSEOName);
             ShowMessage(SageMessageTitle.Information.ToString(),
                         GetSageMessage("PortalSettings", "PortalSaveSuccessfully"), "",
                         SageMessageType.Success);
         }
     }
 }
    protected void SendConfrimMessage()
    {
        try
        {
            if (Session["OrderID"] != null)
            {
                string transID            = string.Empty; // transaction ID from Relay Response
                int    responseCode       = 1;            // response code, defaulted to Invalid
                string responsereasontext = string.Empty;
                responsereasontext = "Transaction occured Successfully";
                int    responsereasonCode         = 1;
                string purchaseorderNo            = string.Empty;
                string invoice                    = string.Empty;
                string paymentmethod              = string.Empty;
                OrderDetailsCollection orderdata2 = new OrderDetailsCollection();
                if (HttpContext.Current.Session["OrderCollection"] != null)
                {
                    orderdata2 = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                }
                invoice = orderdata2.ObjOrderDetails.InvoiceNumber.ToString();
                Random random = new Random();
                purchaseorderNo = (random.Next(0, 1000)).ToString();
                string timeStamp = ((int)(DateTime.UtcNow - new DateTime(2011, 1, 1)).TotalSeconds).ToString();
                transID               = (random.Next(99999, 111111)).ToString();
                lblTransaction.Text   = transID;
                lblInvoice.Text       = invoice;
                lblPaymentMethod.Text = "Cash On Delivery";
                lblDateTime.Text      = DateTime.Now.ToString("dddd, dd MMMM yyyy ");
                int    storeID     = int.Parse(GetStoreID.ToString());
                int    portalID    = int.Parse(GetPortalID.ToString());
                string userName    = GetUsername.ToString();
                int    customerID  = int.Parse(GetCustomerID.ToString());
                string sessionCode = HttpContext.Current.Session.SessionID.ToString();
                string result      = CashOnDelivery.Parse(transID, invoice, purchaseorderNo, responseCode, responsereasonCode, responsereasontext, storeID, portalID, userName, customerID, sessionCode);
                lblerror.Text = result.ToString();
                lblerror.Text = GetSageMessage("Payment", "PaymentProcessed");
                TransactionLogInfo tinfo = new TransactionLogInfo();
                TransactionLog     Tlog  = new TransactionLog();

                tinfo.TransactionID      = transID;
                tinfo.AuthCode           = "";
                tinfo.TotalAmount        = decimal.Parse(orderdata2.ObjOrderDetails.GrandTotal.ToString());
                tinfo.ResponseCode       = responseCode.ToString();
                tinfo.ResponseReasonText = responsereasontext;
                tinfo.OrderID            = orderdata2.ObjOrderDetails.OrderID;
                tinfo.StoreID            = orderdata2.ObjCommonInfo.StoreID;
                tinfo.PortalID           = orderdata2.ObjCommonInfo.PortalID;
                tinfo.AddedBy            = orderdata2.ObjCommonInfo.AddedBy;
                tinfo.CustomerID         = orderdata2.ObjOrderDetails.CustomerID;
                tinfo.SessionCode        = orderdata2.ObjOrderDetails.SessionCode;
                tinfo.PaymentGatewayID   = orderdata2.ObjOrderDetails.PaymentGatewayTypeID;
                tinfo.PaymentStatus      = "Processed";
                tinfo.CreditCard         = "";
                Tlog.SaveTransactionLog(tinfo);

                AspxCommerceWebService clSes = new AspxCommerceWebService();
                if (Session["IsFreeShipping"] != null)
                {
                    HttpContext.Current.Session.Remove("IsFreeShipping");
                }
                if (Session["DiscountAmount"] != null)
                {
                    HttpContext.Current.Session.Remove("DiscountAmount");
                }
                if (Session["CouponCode"] != null)
                {
                    HttpContext.Current.Session.Remove("CouponCode");
                }
                if (Session["CouponApplied"] != null)
                {
                    HttpContext.Current.Session.Remove("CouponApplied");
                }
                if (Session["DiscountAll"] != null)
                {
                    HttpContext.Current.Session.Remove("DiscountAll");
                }
                if (Session["TaxAll"] != null)
                {
                    HttpContext.Current.Session.Remove("TaxAll");
                }
                if (Session["ShippingCostAll"] != null)
                {
                    HttpContext.Current.Session.Remove("ShippingCostAll");
                }
                if (Session["GrandTotalAll"] != null)
                {
                    HttpContext.Current.Session.Remove("GrandTotalAll");
                }
                if (Session["Gateway"] != null)
                {
                    HttpContext.Current.Session.Remove("Gateway");
                }

                //invoice  transID

                if (Session["OrderCollection"] != null)
                {
                    OrderDetailsCollection orderdata = new OrderDetailsCollection();
                    orderdata = (OrderDetailsCollection)Session["OrderCollection"];
                    try
                    {
                        EmailTemplate.SendEmailForOrder(GetPortalID, orderdata, addressPath, TemplateName, transID);
                    }
                    catch
                    {
                        lblerror.Text = "";
                        lblerror.Text = GetSageMessage("Payment", "EmailSendOrderProblem");
                    }
                    clSes.ClearSessionVariable("OrderCollection");
                }
            }
            else
            {
                Response.Redirect(sageRedirectPath, false);
            }
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
Ejemplo n.º 21
0
    private void CheckStoreAccessible()
    {
        SageFrameConfig sfConfig  = new SageFrameConfig();
        string          loginPage = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage);

        PageExtension = SageFrameSettingKeys.PageExtension;

        if (!Request.Url.AbsoluteUri.Contains(loginPage))
        {
            StoreAccessDetailsInfo storeAccessTracker = new StoreAccessDetailsInfo();
            storeAccessTracker.PortalID = GetPortalID.ToString();
            storeAccessTracker.StoreID  = GetStoreID.ToString();
            storeAccessTracker.Username = GetUsername;

            MembershipController member = new MembershipController();
            UserInfo             user   = member.GetUserDetails(GetPortalID, GetUsername);

            if (!string.IsNullOrEmpty(user.UserName))
            {
                storeAccessTracker.UserEmail = user.Email;
            }
            else
            {
                storeAccessTracker.UserEmail = "";
            }
            StoreAccessResultInfo saResults = (StoreAccessResultInfo)GetStoreAccessByCurrentData(storeAccessTracker);
            bool storeClosed     = (bool)saResults.StoreClosed;
            bool storeAccessible = (bool)saResults.IsAccess;
            if (!storeClosed)
            {
                if (storeAccessible)
                {
                }
                else
                {
                    string blockedPortalUrl = string.Empty;
                    if (!IsParent)
                    {
                        if (IsUseFriendlyUrls)
                        {
                            blockedPortalUrl =
                                ResolveUrl(GetParentURL + "/portal/" + GetPortalSEOName + "/" +
                                           sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) +
                                           PageExtension);
                        }
                        else
                        {
                            blockedPortalUrl =
                                ResolveUrl(GetParentURL + "/portal/" + GetPortalSEOName + "/" +
                                           sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage));
                        }
                    }
                    else
                    {
                        if (IsUseFriendlyUrls)
                        {
                            blockedPortalUrl =
                                ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) +
                                           PageExtension);
                        }
                        else
                        {
                            blockedPortalUrl =
                                ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage));
                        }
                    }
                    Session["StoreBlocked"] = blockedPortalUrl;
                    HttpContext.Current.Response.Redirect(
                        ResolveUrl("~/Modules/AspxCommerce/Store-Not-Accessed" + PageExtension));
                }
            }
            else
            {
                string closePortalUrl = string.Empty;
                if (!IsParent)
                {
                    if (IsUseFriendlyUrls)
                    {
                        closePortalUrl =
                            ResolveUrl(GetParentURL + "/portal/" + GetPortalSEOName + "/" +
                                       sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + PageExtension);
                    }
                    else
                    {
                        closePortalUrl =
                            ResolveUrl(GetParentURL + "/portal/" + GetPortalSEOName + "/" +
                                       sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage));
                    }
                }
                else
                {
                    if (IsUseFriendlyUrls)
                    {
                        closePortalUrl =
                            ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) +
                                       PageExtension);
                    }
                    else
                    {
                        closePortalUrl =
                            ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage));
                    }
                }
                Session["StoreClosed"] = closePortalUrl;
                HttpContext.Current.Response.Redirect(ResolveUrl("~/Modules/AspxCommerce/Store-Closed" + PageExtension));
            }
        }
    }
        public int Step1CheckLogic(string tempUnzippedPath, PaymentGateWayModuleInfo module)
        {
            if (CheckFormanifestFile(tempUnzippedPath, module) != "")
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(tempUnzippedPath + '\\' + module.ManifestFile);
                XmlElement root = doc.DocumentElement;
                if (CheckValidManifestFile(root, module))
                {
                    XmlNodeList xnList = doc.SelectNodes("sageframe/folders/folder");
                    foreach (XmlNode xn in xnList)
                    {
                        module.PaymentGatewayTypeName = xn["paymentgatewayname"].InnerXml.ToString();
                        module.FolderName             = xn["foldername"].InnerXml.ToString();
                        module.FriendlyName           = xn["friendlyname"].InnerXml.ToString();
                        module.Description            = xn["description"].InnerXml.ToString();
                        module.Version     = xn["version"].InnerXml.ToString();
                        module.Name        = xn["name"].InnerXml.ToString();
                        module.StoreID     = GetStoreID;  //int.Parse(xn["storeid"].InnerXml.ToString());
                        module.PortalID    = GetPortalID; //int.Parse(xn["portalid"].InnerXml.ToString());
                        module.CultureName = xn["culturename"].InnerXml.ToString();

                        if (!String.IsNullOrEmpty(module.PaymentGatewayTypeName) && IsModuleExist(module.PaymentGatewayTypeName.ToLower(), module.FolderName.ToString(), module.FriendlyName.ToString(), int.Parse(GetStoreID.ToString()), int.Parse(GetPortalID.ToString())))
                        {
                            string path       = HttpContext.Current.Server.MapPath("~/");
                            string targetPath = path + SageFrame.Core.RegisterModule.Common.ModuleFolder + '\\' + module.FolderName;
                            module.InstalledFolderPath = targetPath;
                            // DeleteTempDirectory(tempUnzippedPath);
                            return(1);//Already exist
                        }
                        else
                        {
                            return(2);//Not Exists
                        }
                    }
                }
                else
                {
                    return(-1);//Invalid Manifest file
                }
            }
            return(0);//No manifest file
        }
Ejemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            try
            {
                SageFrameConfig sfConfig = new SageFrameConfig();
                IsUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                string sageRedirectPath = string.Empty;
                if (IsUseFriendlyUrls)
                {
                    if (GetPortalID > 1)
                    {
                        sageRedirectPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx");
                        addressPath      = HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/portal/" + GetPortalSEOName + "/";
                    }
                    else
                    {
                        sageRedirectPath = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx");
                        addressPath      = HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/";
                    }
                }
                else
                {
                    sageRedirectPath = ResolveUrl("{~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage));
                }

                Image imgProgress = (Image)UpdateProgress1.FindControl("imgPrgress");
                if (imgProgress != null)
                {
                    imgProgress.ImageUrl = GetTemplateImageUrl("ajax-loader.gif", true);
                }
                hlnkHomePage.NavigateUrl = sageRedirectPath;

                if (Session["OrderID"] != null)
                {
                    int    storeID    = int.Parse(GetStoreID.ToString());
                    int    portalID   = int.Parse(GetPortalID.ToString());
                    string userName   = GetUsername.ToString();
                    int    customerID = int.Parse(GetCustomerID.ToString());
                    OrderDetailsCollection   orderdata = new OrderDetailsCollection();
                    List <PayPalSettingInfo> setting;
                    if (HttpContext.Current.Session["OrderCollection"] != null)
                    {
                        orderdata = (OrderDetailsCollection)HttpContext.Current.Session["OrderCollection"];
                        invoice   = orderdata.ObjOrderDetails.InvoiceNumber.ToString();
                        PayPalWCFService pw = new PayPalWCFService();
                        int i = int.Parse(orderdata.ObjOrderDetails.PaymentGatewayTypeID.ToString());
                        setting   = pw.GetAllPayPalSetting(i, storeID, portalID);
                        authToken = setting[0].AuthToken.ToString();
                    }

                    // authToken = "QMtOC54_YHYUkoggkMZ81ivNWSxPXduIqS5oMynafeUGRL1Rv5OTtUd4rvq";

                    //read in txn token from querystring
                    txToken = Request.QueryString.Get("tx");
                    query   = string.Format("cmd=_notify-synch&tx={0}&at={1}", txToken, authToken);
                    // Create the request back
                    // string url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
                    string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/webscr";
                    string strLive    = "https://www.paypal.com/cgi-bin/webscr";
                    string test       = string.Empty;
                    if (Session["IsTestPayPal"] != null)
                    {
                        if (bool.Parse(Session["IsTestPayPal"].ToString()))
                        {
                            test = strSandbox;
                        }
                        else
                        {
                            test = strLive;
                        }
                    }
                    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(test);

                    // Set values for the request back
                    req.Method        = "POST";
                    req.ContentType   = "application/x-www-form-urlencoded";
                    req.ContentLength = query.Length;

                    // Write the request back IPN strings
                    StreamWriter stOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
                    stOut.Write(query);
                    stOut.Close();

                    // Do the request to PayPal and get the response
                    StreamReader stIn = new StreamReader(req.GetResponse().GetResponseStream());
                    strResponse = stIn.ReadToEnd();
                    stIn.Close();

                    // If response was SUCCESS, parse response string and output details
                    if (strResponse.StartsWith("SUCCESS"))
                    {
                        string sessionCode = HttpContext.Current.Session.SessionID.ToString();
                        //for localhost
                        // PayPalHandler pdt = PayPalHandler.Parse(strResponse, storeID, portalID, userName, customerID, sessionCode);
                        //for live site
                        try
                        {
                            PayPalHandler pdtt = PayPalHandler.ParseAfterIPN(strResponse, storeID, portalID, userName, customerID, sessionCode, TemplateName, addressPath);
                        }
                        catch (Exception)
                        {
                            lblerror.Text = GetSageMessage("Payment", "PaymentParsingIPNError");
                        }
                        AspxCommerceWebService clSes = new AspxCommerceWebService();

                        String   sKey, sValue;
                        String[] StringArray = strResponse.Split('\n');
                        int      i;
                        string   status = string.Empty;
                        for (i = 1; i < StringArray.Length - 1; i++)
                        {
                            String[] StringArray1 = StringArray[i].Split('=');

                            sKey   = StringArray1[0];
                            sValue = HttpUtility.UrlDecode(StringArray1[1]);

                            // set string vars to hold variable names using a switch
                            switch (sKey)
                            {
                            case "txn_id":
                                transID = Convert.ToString(sValue);
                                break;

                            case "payment_status":
                                status = Convert.ToString(sValue);
                                break;
                            }
                        }

                        lblTransaction.Text   = transID;
                        lblInvoice.Text       = invoice;
                        lblPaymentMethod.Text = "Paypal";
                        lblDateTime.Text      = DateTime.Now.ToString("dddd, dd MMMM yyyy ");
                        if (status.ToLower().Trim() == "completed")
                        {
                            lblerror.Text = GetSageMessage("Payment", "PaymentProcessed");
                        }
                        else if (status.ToLower().Trim() == "pending")
                        {
                            lblerror.Text = GetSageMessage("Payment", "PaymentPending");
                        }

                        if (Session["IsFreeShipping"] != null)
                        {
                            clSes.ClearSessionVariable("IsFreeShipping");
                        }
                        if (Session["DiscountAmount"] != null)
                        {
                            clSes.ClearSessionVariable("DiscountAmount");
                        }
                        if (Session["CouponCode"] != null)
                        {
                            clSes.ClearSessionVariable("CouponCode");
                        }
                        if (Session["CouponApplied"] != null)
                        {
                            HttpContext.Current.Session.Remove("CouponApplied");
                        }
                        Session.Remove("IsTestPayPal");
                        if (Session["DiscountAll"] != null)
                        {
                            HttpContext.Current.Session.Remove("DiscountAll");
                        }
                        if (Session["TaxAll"] != null)
                        {
                            HttpContext.Current.Session.Remove("TaxAll");
                        }
                        if (Session["ShippingCostAll"] != null)
                        {
                            HttpContext.Current.Session.Remove("ShippingCostAll");
                        }
                        if (Session["GrandTotalAll"] != null)
                        {
                            HttpContext.Current.Session.Remove("GrandTotalAll");
                        }
                        if (Session["Gateway"] != null)
                        {
                            HttpContext.Current.Session.Remove("Gateway");
                        }
                    }
                    else
                    {
                        lblerror.Text = GetSageMessage("Payment", "PaymentError");
                    }
                }
                else
                {
                    Response.Redirect(sageRedirectPath, false);
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
    }
Ejemplo n.º 24
0
        private void GetStoreSettings()
        {
            Hashtable            hst = new Hashtable();
            StoreSettingProvider sep = new StoreSettingProvider();

            if (HttpContext.Current.Cache["AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString()] != null)
            {
                hst = (Hashtable)HttpContext.Current.Cache["AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString()];
            }
            else
            {
                DataTable dt = sep.GetStoreSettings(GetStoreID, GetPortalID, GetCurrentCultureName); //GetSettingsByPortal();
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        hst.Add(dt.Rows[i]["SettingKey"].ToString(), dt.Rows[i]["SettingValue"].ToString());
                    }
                }
            }
            HttpContext.Current.Cache.Insert("AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString(), hst);
        }