コード例 #1
0
    }//end OnActiveStepChanged

    /// <summary>
    /// 4. Event Handlers Evoked on last wizardStep (ADD Services) 
    /// it still triggers ActiveStepChange after this (it works as the last-next click)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void CreateUserWizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e) {
        try {
            bool isUserControlValid = true;
            System.Diagnostics.Debug.Print(e.CurrentStepIndex.ToString());
            //get userControl validation
            switch (CreateUserWizard1.ActiveStepIndex) {
                case 5://add service
                    isUserControlValid = AddServicesUserControl1.IsValidFields();
                    break;
                default:
                    System.Diagnostics.Debug.Print("CreateUserWizard1_FinishButtonClick, ActiveStepIndex: " + CreateUserWizard1.ActiveStepIndex.ToString() + "\t Unknown wizard step!");
                    break;
            }
            //stop CreateUserWizard1 going to nextStep is usercontrol isnt valid
            if (!isUserControlValid)
                e.Cancel = true;
            //check service has been added
            ShowWarning(isUserControlValid, CreateUserWizard1.ActiveStepIndex, e);

        }
        catch (Exception ex) {
            System.Diagnostics.Debug.Print("<h2>Register.aspx, CreateUserWizard1_FinishButtonClick()</h2>\n" + ex.ToString() + "\n" + ex.InnerException + "\n" + ex.Message);
            // Log the exception and notify system operators
            ExceptionUtility.LogException(ex, "Register.aspx, CreateUserWizard1_FinishButtonClick()");
            ExceptionUtility.NotifySystemOps(ex);
        }//endtry-catch
    }//end FinishButtonClick
コード例 #2
0
    }//end CreatedUser

    /// <summary>
    /// 2. Stops Wizard going to nextStep is usercontrol validation isnt valid
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void CreateUserWizard1_NextButtonClick(object sender, WizardNavigationEventArgs e) {
        try {
            bool isUserControlValid = true;

            //get userControl validation
            switch (CreateUserWizard1.ActiveStepIndex) {
                case 0://create aspUser
                    System.Diagnostics.Debug.Print("CreateUserWizard1_NextButtonClick, ActiveStepIndex: " + CreateUserWizard1.ActiveStepIndex.ToString() + "\t Created aspUser!");
                    break;
                case 1://personal Details
                    isUserControlValid = PersonalDetailsUserControl1.IsValidFields();
                    break;
                case 2://Business Details
                    isUserControlValid = IndAndNatBusUserControl1.IsValidFields();
                    break;
                case 3://business working hrs and days
                    System.Diagnostics.Debug.Print("CreateUserWizard1_NextButtonClick, ActiveStepIndex: " + CreateUserWizard1.ActiveStepIndex.ToString() + "\t Business Hrs!");
                    break;
                case 4://add staff
                    isUserControlValid = AddStaffUserControl1.IsValidFields();
                    break;
                case 5://add service (NB: NEVER RUN AS BUTTON FINISH IS PRESSED INSTEAD) goTo finish_buttonClick
                    isUserControlValid = AddServicesUserControl1.IsValidFields();
                    break;
                case 6: //complete (NB: NEVER RUN AS BUTTON CONTINUE IS PRESSED INSTEAD) goTo ContinueButtonClick
                    System.Diagnostics.Debug.Print("CreateUserWizard1_NextButtonClick, ActiveStepIndex: " + CreateUserWizard1.ActiveStepIndex.ToString() + "\t Finished Registration!");
                    break;
                default:
                    System.Diagnostics.Debug.Print("CreateUserWizard1_NextButtonClick, ActiveStepIndex: " + CreateUserWizard1.ActiveStepIndex.ToString() + "\t Unknown wizard step!");
                    break;
            }
            //stop CreateUserWizard1 going to nextStep is usercontrol isnt valid
            if (!isUserControlValid)
                e.Cancel = true;

            //check staff has been added
            if (CreateUserWizard1.ActiveStepIndex == 4)
                ShowWarning(isUserControlValid, CreateUserWizard1.ActiveStepIndex, e);
        }
        catch (Exception ex) {
            System.Diagnostics.Debug.Print("<h2>Register.aspx, CreateUserWizard1_NextButtonClick()</h2>\n" + ex.ToString() + "\n" + ex.InnerException + "\n" + ex.Message);
            // Log the exception and notify system operators
            ExceptionUtility.LogException(ex, "Register.aspx, CreateUserWizard1_NextButtonClick()");
            ExceptionUtility.NotifySystemOps(ex);
        }//endtry-catch
    }//end NextButtonClick