Ejemplo n.º 1
0
        private void myradwizard_Next(object sender, NavigationButtonsEventArgs e)
        {
            if (this.myradwizard.SelectedPage == Page0) // Check if this is the desired page
            {
                if (LastName.Text == "")
                {
                    errormessage.Text = "Last Name cannot be empty";
                    LastName.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (FirstName.Text == "")
                {
                    errormessage.Text = "First Name cannot be empty";
                    FirstName.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (CityName.SelectedValue == null || PermanentCityName.SelectedValue == null)
                {
                    errormessage.Text        = "Please complete address";
                    myradwizard.SelectedPage = Page1;
                }
                else if (ContactPerson.Text == "")
                {
                    errormessage.Text = "Contact Person cannot be empty";
                    ContactPerson.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (ContactPhone.Text == "")
                {
                    errormessage.Text = "Contact Phone cannot be empty";
                    ContactPhone.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (ContactAddress.Text == "")
                {
                    errormessage.Text = "Contact Address cannot be empty";
                    ContactAddress.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (BirthDate.DateTimeText == "")
                {
                    errormessage.Text = "BirthDay cannot be empty";
                    BirthDate.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (CivilStatus.SelectedValue == null)
                {
                    errormessage.Text = "Please select Civil Status";
                    CivilStatus.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (Nationality.SelectedValue == null)
                {
                    errormessage.Text = "Please select Nationality";
                    Nationality.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (Religion.SelectedValue == null)
                {
                    errormessage.Text = "Please select Religion";
                    Religion.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (Sex.SelectedValue == null)
                {
                    errormessage.Text = "Please select Gender";
                    Sex.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (HireDate.DateTimeText == "")
                {
                    errormessage.Text = "Please select Hire Date";
                    HireDate.Focus();
                    myradwizard.SelectedPage = Page1;
                }

                else if (Department.SelectedValue == null)
                {
                    errormessage.Text = "Please select Department";
                    Department.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (Section.SelectedValue == null)
                {
                    errormessage.Text = "Please select Section";
                    Section.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (Position.SelectedValue == null)
                {
                    errormessage.Text = "Please select Position";
                    Position.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (EmploymentStatus.SelectedValue == null)
                {
                    errormessage.Text = "Please select Employee Status";
                    EmploymentStatus.Focus();
                    myradwizard.SelectedPage = Page1;
                }

                if (EmailAddress.Text.Length == 0)
                {
                }
                else
                {
                    if (!Regex.IsMatch(EmailAddress.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"))
                    {
                        errormessage.Text = "Please enter a valid email.";
                        EmailAddress.Select(0, EmailAddress.Text.Length);
                        EmailAddress.Focus();
                        myradwizard.SelectedPage = Page1;
                    }
                    else
                    {
                    }
                }
            }
        }