示例#1
0
    /// <summary>
    /// BtnEdit click event handler.
    /// </summary>
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        ListingMode             = false;
        plcDefaultTypes.Visible = this.EnableDefaultCheckoutProcessTypes;

        // Load step data to the form
        CheckoutProcessStepInfo stepObj = this.CheckoutProcess.GetCheckoutProcessStepInfo(((ImageButton)(sender)).CommandArgument);

        if (stepObj != null)
        {
            lblCurrentStep.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(stepObj.Caption));

            txtStepCaption.Text          = stepObj.Caption;
            txtStepControlPath.Text      = stepObj.ControlPath;
            txtStepImageUrl.Text         = stepObj.Icon;
            txtStepName.Text             = stepObj.Name;
            chkLiveSite.Checked          = stepObj.ShowOnLiveSite;
            chkCMSDeskOrder.Checked      = stepObj.ShowInCMSDeskOrder;
            chkCMSDeskCustomer.Checked   = stepObj.ShowInCMSDeskCustomer;
            chkCMSDeskOrderItems.Checked = stepObj.ShowInCMSDeskOrderItems;

            // Save original step name
            this.OriginalStepName = stepObj.Name;
        }
    }
    /// <summary>
    /// BtnOk click event handler.
    /// </summary>
    protected void btnOk_Click(object sender, EventArgs e)
    {
        lblCurrentStep.Text = GetString("CheckoutProcess.NewStep");

        string errorMessage = ValidateForm();

        if (errorMessage == "")
        {
            CheckoutProcessStepInfo stepObj = this.CheckoutProcess.GetCheckoutProcessStepInfo(txtStepName.Text.Trim());
            if ((stepObj == null) || (stepObj.Name.ToLower() == this.OriginalStepName.ToLower()))
            {
                if (stepObj == null)
                {
                    stepObj = new CheckoutProcessStepInfo();
                }

                // Get step data from form
                stepObj.Caption = txtStepCaption.Text.Trim();
                stepObj.Name = txtStepName.Text.Trim();
                stepObj.ControlPath = txtStepControlPath.Text.Trim();
                stepObj.Icon = txtStepImageUrl.Text.Trim();
                stepObj.ShowInCMSDeskCustomer = chkCMSDeskCustomer.Checked;
                stepObj.ShowInCMSDeskOrder = chkCMSDeskOrder.Checked;
                stepObj.ShowOnLiveSite = chkLiveSite.Checked;
                stepObj.ShowInCMSDeskOrderItems = chkCMSDeskOrderItems.Checked;

                if ((this.OriginalStepName != "") && (this.OriginalStepName.ToLower() != txtStepName.Text.ToLower()))
                {
                    // Replace node
                    this.CheckoutProcess.ReplaceCheckoutProcessStepNode(stepObj, this.OriginalStepName);
                }
                else
                {
                    // Update or insert node
                    this.CheckoutProcess.SetCheckoutProcessStepNode(stepObj);
                }

                // Update Xml definition in viewstate
                this.CheckoutProcessXml = this.CheckoutProcess.GetXmlDefinition();

                if (OnCheckoutProcessDefinitionUpdate != null)
                {
                    OnCheckoutProcessDefinitionUpdate("update");
                }

                //lblInfo.Visible = true;
                //lblInfo.Text = GetString("General.ChangesSaved");

                lblCurrentStep.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(stepObj.Caption));

                ListingMode = true;
                ReloadData();
            }
            else
            {
                errorMessage = GetString("CheckoutProcess.ErrorStepNameNotUnique");
            }
        }

        // Show error message
        if (errorMessage != "")
        {
            lblErrorEdit.Visible = true;
            lblErrorEdit.Text = errorMessage;

            // If error during editing, set original caption to breadcrumbs
            if (!string.IsNullOrEmpty(this.OriginalStepName))
            {
                CheckoutProcessStepInfo stepObj = this.CheckoutProcess.GetCheckoutProcessStepInfo(this.OriginalStepName);
                if (stepObj != null)
                {
                    lblCurrentStep.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(stepObj.Caption));
                }
            }
        }
    }
示例#3
0
    /// <summary>
    /// BtnOk click event handler.
    /// </summary>
    protected void btnOk_Click(object sender, EventArgs e)
    {
        lblCurrentStep.Text = GetString("CheckoutProcess.NewStep");

        string errorMessage = ValidateForm();

        if (errorMessage == "")
        {
            CheckoutProcessStepInfo stepObj = this.CheckoutProcess.GetCheckoutProcessStepInfo(txtStepName.Text.Trim());
            if ((stepObj == null) || (stepObj.Name.ToLower() == this.OriginalStepName.ToLower()))
            {
                if (stepObj == null)
                {
                    stepObj = new CheckoutProcessStepInfo();
                }

                // Get step data from form
                stepObj.Caption                 = txtStepCaption.Text.Trim();
                stepObj.Name                    = txtStepName.Text.Trim();
                stepObj.ControlPath             = txtStepControlPath.Text.Trim();
                stepObj.Icon                    = txtStepImageUrl.Text.Trim();
                stepObj.ShowInCMSDeskCustomer   = chkCMSDeskCustomer.Checked;
                stepObj.ShowInCMSDeskOrder      = chkCMSDeskOrder.Checked;
                stepObj.ShowOnLiveSite          = chkLiveSite.Checked;
                stepObj.ShowInCMSDeskOrderItems = chkCMSDeskOrderItems.Checked;

                if ((this.OriginalStepName != "") && (this.OriginalStepName.ToLower() != txtStepName.Text.ToLower()))
                {
                    // Replace node
                    this.CheckoutProcess.ReplaceCheckoutProcessStepNode(stepObj, this.OriginalStepName);
                }
                else
                {
                    // Update or insert node
                    this.CheckoutProcess.SetCheckoutProcessStepNode(stepObj);
                }

                // Update Xml definition in viewstate
                this.CheckoutProcessXml = this.CheckoutProcess.GetXmlDefinition();

                if (OnCheckoutProcessDefinitionUpdate != null)
                {
                    OnCheckoutProcessDefinitionUpdate("update");
                }

                //lblInfo.Visible = true;
                //lblInfo.Text = GetString("General.ChangesSaved");

                lblCurrentStep.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(stepObj.Caption));

                ListingMode = true;
                ReloadData();
            }
            else
            {
                errorMessage = GetString("CheckoutProcess.ErrorStepNameNotUnique");
            }
        }

        // Show error message
        if (errorMessage != "")
        {
            lblErrorEdit.Visible = true;
            lblErrorEdit.Text    = errorMessage;

            // If error during editing, set original caption to breadcrumbs
            if (!string.IsNullOrEmpty(this.OriginalStepName))
            {
                CheckoutProcessStepInfo stepObj = this.CheckoutProcess.GetCheckoutProcessStepInfo(this.OriginalStepName);
                if (stepObj != null)
                {
                    lblCurrentStep.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(stepObj.Caption));
                }
            }
        }
    }
    /// <summary>
    /// BtnOk click event handler.
    /// </summary>
    protected void btnOk_Click(object sender, EventArgs e)
    {
        breadcrumbsText = GetString("CheckoutProcess.NewStep");

        string errorMessage = ValidateForm();

        if (errorMessage == "")
        {
            CheckoutProcessStepInfo stepObj = CheckoutProcess.GetCheckoutProcessStepInfo(txtStepName.Text.Trim());
            if ((stepObj == null) || (stepObj.Name.ToLowerCSafe() == OriginalStepName.ToLowerCSafe()))
            {
                if (stepObj == null)
                {
                    stepObj = new CheckoutProcessStepInfo();
                }

                // Save localization
                txtStepCaption.Save();

                // Get step data from form
                stepObj.Caption                 = txtStepCaption.Text.Trim();
                stepObj.Name                    = txtStepName.Text.Trim();
                stepObj.ControlPath             = txtStepControlPath.Text.Trim();
                stepObj.Icon                    = txtStepImageUrl.Text.Trim();
                stepObj.ShowInCMSDeskCustomer   = chkCMSDeskCustomer.Checked;
                stepObj.ShowInCMSDeskOrder      = chkCMSDeskOrder.Checked;
                stepObj.ShowOnLiveSite          = chkLiveSite.Checked;
                stepObj.ShowInCMSDeskOrderItems = chkCMSDeskOrderItems.Checked;

                if ((OriginalStepName != "") && (OriginalStepName.ToLowerCSafe() != txtStepName.Text.ToLowerCSafe()))
                {
                    // Replace node
                    CheckoutProcess.ReplaceCheckoutProcessStepNode(stepObj, OriginalStepName);
                }
                else
                {
                    // Update or insert node
                    CheckoutProcess.SetCheckoutProcessStepNode(stepObj);
                }

                // Update Xml definition in viewstate
                CheckoutProcessXml = CheckoutProcess.GetXmlDefinition();

                if (OnCheckoutProcessDefinitionUpdate != null)
                {
                    OnCheckoutProcessDefinitionUpdate("update");
                }

                breadcrumbsText = ResHelper.LocalizeString(stepObj.Caption);

                ListingMode = true;
                ReloadData();
                ugSteps.ReloadData();
            }
            else
            {
                errorMessage = GetString("CheckoutProcess.ErrorStepNameNotUnique");
            }
        }

        // Show error message
        if (errorMessage != "")
        {
            plcMessNew.ShowError(errorMessage);

            // If error during editing, set original caption to breadcrumbs
            if (!string.IsNullOrEmpty(OriginalStepName))
            {
                CheckoutProcessStepInfo stepObj = CheckoutProcess.GetCheckoutProcessStepInfo(OriginalStepName);
                if (stepObj != null)
                {
                    breadcrumbsText = ResHelper.LocalizeString(stepObj.Caption);
                }
            }
        }
    }
    /// <summary>
    /// Handles unigrid actions.
    /// </summary>
    protected void ugSteps_OnAction(string actionName, object actionArgument)
    {
        // Name of checkout process step
        string stepName = ValidationHelper.GetString(actionArgument, "");

        switch (actionName.ToLowerCSafe())
        {
        case "up":
            // Move node up in xml
            CheckoutProcess.MoveCheckoutProcessStepNodeUp(stepName);

            // Update xml definition in view state
            CheckoutProcessXml = CheckoutProcess.GetXmlDefinition();

            RaiseDefinitionUpdate("moveup");

            ReloadData();
            break;

        case "down":
            // Move node down in xml definition
            CheckoutProcess.MoveCheckoutProcessStepNodeDown(stepName);

            // Update xml definition in viewstate
            CheckoutProcessXml = CheckoutProcess.GetXmlDefinition();

            RaiseDefinitionUpdate("movedown");

            ReloadData();
            break;

        case "edit":
            ListingMode             = false;
            plcDefaultTypes.Visible = EnableDefaultCheckoutProcessTypes;

            // Load step data to the form
            CheckoutProcessStepInfo stepObj = CheckoutProcess.GetCheckoutProcessStepInfo(stepName);
            if (stepObj != null)
            {
                breadcrumbsText = ResHelper.LocalizeString(stepObj.Caption);

                txtStepCaption.Text          = stepObj.Caption;
                txtStepControlPath.Text      = stepObj.ControlPath;
                txtStepImageUrl.Text         = stepObj.Icon;
                txtStepName.Text             = stepObj.Name;
                chkLiveSite.Checked          = stepObj.ShowOnLiveSite;
                chkCMSDeskOrder.Checked      = stepObj.ShowInCMSDeskOrder;
                chkCMSDeskCustomer.Checked   = stepObj.ShowInCMSDeskCustomer;
                chkCMSDeskOrderItems.Checked = stepObj.ShowInCMSDeskOrderItems;

                // Save original step name
                OriginalStepName = stepObj.Name;
            }
            break;

        case "delete":
            // Remove node from xml
            CheckoutProcess.RemoveCheckoutProcessStepNode(stepName);
            // Update xml definition in view state
            CheckoutProcessXml = CheckoutProcess.GetXmlDefinition();

            RaiseDefinitionUpdate("delete");

            ReloadData();
            break;
        }
    }
    /// <summary>
    /// Creates checkout process step. Called when the "Create step" button is pressed.
    /// </summary>
    private bool CreateCheckoutProcessStep()
    {
        // Create new checkout process step object
        CheckoutProcessStepInfo newStep = new CheckoutProcessStepInfo();

        // Set the properties
        newStep.Name = "MyNewStep";
        newStep.Caption = "My new step";
        newStep.ControlPath = "";
        newStep.ShowInCMSDeskCustomer = true;
        newStep.ShowInCMSDeskOrder = true;
        newStep.ShowOnLiveSite = true;
        newStep.ShowInCMSDeskOrderItems = true;

        // Insert node
        CheckoutProcessInfo checkoutProcess = new CheckoutProcessInfo();
        checkoutProcess.LoadXmlDefinition(ECommerceSettings.CheckoutProcess(CMSContext.CurrentSiteName));
        checkoutProcess.SetCheckoutProcessStepNode(newStep);

        // Create the checkout process
        SettingsKeyProvider.SetValue(CMSContext.CurrentSiteName + "." + ECommerceSettings.CHECKOUT_PROCESS, checkoutProcess.GetXmlDefinition());

        return true;
    }
    /// <summary>
    /// BtnOk click event handler.
    /// </summary>
    protected void btnOk_Click(object sender, EventArgs e)
    {
        breadcrumbsText = GetString("CheckoutProcess.NewStep");

        string errorMessage = ValidateForm();

        if (errorMessage == "")
        {
            CheckoutProcessStepInfo stepObj = CheckoutProcess.GetCheckoutProcessStepInfo(txtStepName.Text.Trim());
            if ((stepObj == null) || (stepObj.Name.ToLowerCSafe() == OriginalStepName.ToLowerCSafe()))
            {
                if (stepObj == null)
                {
                    stepObj = new CheckoutProcessStepInfo();
                }

                // Save localization
                txtStepCaption.Save();

                // Get step data from form
                stepObj.Caption = txtStepCaption.Text.Trim();
                stepObj.Name = txtStepName.Text.Trim();
                stepObj.ControlPath = txtStepControlPath.Text.Trim();
                stepObj.Icon = txtStepImageUrl.Text.Trim();
                stepObj.ShowInCMSDeskCustomer = chkCMSDeskCustomer.Checked;
                stepObj.ShowInCMSDeskOrder = chkCMSDeskOrder.Checked;
                stepObj.ShowOnLiveSite = chkLiveSite.Checked;
                stepObj.ShowInCMSDeskOrderItems = chkCMSDeskOrderItems.Checked;

                if ((OriginalStepName != "") && (OriginalStepName.ToLowerCSafe() != txtStepName.Text.ToLowerCSafe()))
                {
                    // Replace node
                    CheckoutProcess.ReplaceCheckoutProcessStepNode(stepObj, OriginalStepName);
                }
                else
                {
                    // Update or insert node
                    CheckoutProcess.SetCheckoutProcessStepNode(stepObj);
                }

                // Update Xml definition in viewstate
                CheckoutProcessXml = CheckoutProcess.GetXmlDefinition();

                if (OnCheckoutProcessDefinitionUpdate != null)
                {
                    OnCheckoutProcessDefinitionUpdate("update");
                }

                breadcrumbsText = ResHelper.LocalizeString(stepObj.Caption);

                ListingMode = true;
                ReloadData();
                ugSteps.ReloadData();
            }
            else
            {
                errorMessage = GetString("CheckoutProcess.ErrorStepNameNotUnique");
            }
        }

        // Show error message
        if (errorMessage != "")
        {
            plcMessNew.ShowError(errorMessage);

            // If error during editing, set original caption to breadcrumbs
            if (!string.IsNullOrEmpty(OriginalStepName))
            {
                CheckoutProcessStepInfo stepObj = CheckoutProcess.GetCheckoutProcessStepInfo(OriginalStepName);
                if (stepObj != null)
                {
                    breadcrumbsText = ResHelper.LocalizeString(stepObj.Caption);
                }
            }
        }
    }