using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class CustomWizard : System.Web.UI.Page
{
    /// <summary>
    /// Retrieves the sidebar image for the passed step title
    /// </summary>
    public object GetStepImage(string title)
    {
        return "images/sidebar_" + title + ".gif";
    }

    /// <summary>
    /// Retrieves the selected step sidebar image for the passed step title
    /// </summary>
    public object GetSelectedStepImage(string title)
    {
        return "images/sidebar_" + title + "_selected.gif";
    }

    /// <summary>
    /// The user has chosen to move to a new step
    /// </summary>
    protected void myWizard_ActiveStepChanged(object sender, EventArgs e)
    {

    }

    /// <summary>
    /// Evant handler for the next button
    /// </summary>
    protected void myWizard_NextButtonClick(object sender, WizardNavigationEventArgs e)
    {
        /*
        // do validation for step 1
        if (myWizard.ActiveStep == WizardStep1)
        {
            // in real example would access database, etc

            // here we will simply prevent an email of abc
            if (txtEmail.Text == "abc")
            {
                myLabel.Text += "Invalid email<br/>";
                e.Cancel = true;
            }
            // and assume that email of cba is one that makes us skip step 2
            else if (txtEmail.Text == "cba")
            {
                myWizard.MoveTo(WizardStep3);
            }
            else
            {
                myWizard.MoveTo(WizardStep2);
            }
        }
        // do validation for step 2
        else if (myWizard.ActiveStep == WizardStep2)
        {
            // validation would go here
        }
         * */
    }

    /// <summary>
    /// Evant handler for the next button
    /// </summary>
    protected void myWizard_PreviousButtonClick(object sender, WizardNavigationEventArgs e)
    {
        /*
        int a = e.NextStepIndex;
        int b = myWizard.WizardSteps.IndexOf(WizardStep2);
        
        if (e.NextStepIndex == myWizard.WizardSteps.IndexOf(WizardStep2))
        {
            // for this example, if email is cba, then display step 2
            if (txtEmail.Text == "cba")
            {
                myWizard.MoveTo(WizardStep1);
            }
            else
            {
                myWizard.MoveTo(WizardStep2);
            }
        }
         * */
    }

    /// <summary>
    /// Event handler for the finish button
    /// </summary>
    protected void myWizard_FinishButtonClick(object sender, WizardNavigationEventArgs e)
    {
        Label labConfirm = (Label)myWizard.FindControl("labConfirmation");
        labConfirm.Text = "Order has been processed for " + txtEmail.Text;
        labConfirm.Text += "<br/>Shipped via " + drpShipper.SelectedValue;
        labConfirm.Text += "<br/>Payment from " + drpPayment.SelectedValue;
    }
    protected void myWizard_SideBarButtonClick(object sender, WizardNavigationEventArgs e)
    {
        // ignore the sidebar buttons
        e.Cancel = true;
    }
}
