예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        configuredSite = SiteInfoProvider.GetSiteInfo(ConfiguredSiteID);

        // Check permissions for CMS Desk -> Ecommerce
        if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Ecommerce", "Configuration.Settings.CheckoutProcess"))
        {
            RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "Configuration.Settings.CheckoutProcess");
        }

        // Set up header
        CurrentMaster.HeaderActions.Actions          = GetHeaderActions();
        CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;

        // Modify page content css class
        Panel pnl = CurrentMaster.PanelBody.FindControl("pnlContent") as Panel;

        if (pnl != null)
        {
            pnl.CssClass = "";
        }

        // Hide buttons - this page has custom header action
        ucCheckoutProcess.ShowActions    = false;
        ucCheckoutProcess.OnModeChanged += new CMSModules_Ecommerce_FormControls_CheckoutProcess.ModeChangedHandler(ucCheckoutProcess_OnModeChanged);

        // Register javascript to confirm generate default checkout process
        string script = "function ConfirmGlobalProcess() {return confirm(" + ScriptHelper.GetString(GetString("CheckoutProcess.ConfirmGlobalProcess")) + ");}";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ConfirmGlobalProcess", ScriptHelper.GetScript(script));

        ucCheckoutProcess.OnCheckoutProcessDefinitionUpdate += new OnCheckoutProcessDefinitionUpdateEventHandler(ucCheckoutProcess_OnCheckoutProcessDefinitionUpdate);

        // Load data
        if (!RequestHelper.IsPostBack())
        {
            if (configuredSite != null)
            {
                ucCheckoutProcess.Value = ECommerceSettings.CheckoutProcess(configuredSite.SiteName);
            }
            else
            {
                ucCheckoutProcess.Value = ECommerceSettings.CheckoutProcess(null);
            }

            ucCheckoutProcess.EnableDefaultCheckoutProcessTypes = true;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        configuredSite = SiteInfoProvider.GetSiteInfo(ConfiguredSiteID);

        // Check UI element
        var elementName = IsMultiStoreConfiguration ? "Tools.Ecommerce.ChackoutSettings" : "Configuration.Settings.CheckoutProcess";

        CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, elementName);

        // Set up header
        InitHeaderActions();

        // Modify page content css class
        Panel pnl = CurrentMaster.PanelBody.FindControl("pnlContent") as Panel;

        if (pnl != null)
        {
            pnl.CssClass = "";
        }

        ucCheckoutProcess.OnModeChanged += ucCheckoutProcess_OnModeChanged;

        // Register javascript to confirm generate default checkout process
        string script = "function ConfirmGlobalProcess() {return confirm(" + ScriptHelper.GetString(GetString("CheckoutProcess.ConfirmGlobalProcess")) + ");}";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ConfirmGlobalProcess", ScriptHelper.GetScript(script));

        ucCheckoutProcess.OnCheckoutProcessDefinitionUpdate += ucCheckoutProcess_OnCheckoutProcessDefinitionUpdate;

        // Load data
        if (!RequestHelper.IsPostBack())
        {
            if (configuredSite != null)
            {
                ucCheckoutProcess.Value = ECommerceSettings.CheckoutProcess(configuredSite.SiteName);
            }
            else
            {
                ucCheckoutProcess.Value = ECommerceSettings.CheckoutProcess(null);
            }

            ucCheckoutProcess.EnableDefaultCheckoutProcessTypes = true;
        }
    }
    private void ucCheckoutProcess_OnCheckoutProcessDefinitionUpdate(string action)
    {
        // Check 'EcommerceModify' permission
        if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Ecommerce", "ConfigurationModify"))
        {
            RedirectToAccessDenied("CMS.Ecommerce", "ConfigurationModify");
        }

        switch (action.ToLowerCSafe())
        {
        case "update":
        case "delete":
        case "moveup":
        case "movedown":
            // Update checkout process xml definition in database
            SaveProcess();
            break;

        case "defaultprocess":
            // Set default checkout process

            ucCheckoutProcess.Value = ShoppingCart.DEFAULT_CHECKOUT_PROCESS;
            ucCheckoutProcess.ReloadData();
            SaveProcess();
            break;

        case "fromglobalprocess":
            // Set default checkout process
            if (configuredSite != null)
            {
                ucCheckoutProcess.Value = ECommerceSettings.CheckoutProcess(null);
                ucCheckoutProcess.ReloadData();
                SaveProcess();
            }
            break;
        }
    }