Пример #1
0
 private void OnNavigate()
 {
     popLink.IsOpen = false;
     Login login = new Login();
     login.Show();
     this.Hide();
 }
Пример #2
0
 private void SignOut()
 {
     popLink.IsOpen = false;
     Login login = new Login();
     login.Show();
     this.Hide();
 }
        private void ValidateInput()
        {

            if(string.IsNullOrEmpty(txtFname.Text) || string.IsNullOrEmpty(txtLname.Text) || string.IsNullOrEmpty(txtUsername.Text) ||
                string.IsNullOrEmpty(txtPassword.Password) || string.IsNullOrEmpty(txtConfirm.Password))
            {
                MessageBox.Show("Required fields cannot be Empty","ERROR",MessageBoxButton.OK,MessageBoxImage.Error);
                return;
            }
            if (this.txtPassword.Password.Length < 8)
            {
                MessageBox.Show("Password must be 8 characters long", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            else if(!Regex.IsMatch(this.txtPassword.Password, @".*[0-9]+.*[0-9]+.*"))
            {
                MessageBox.Show("Password must contain atleast two numeric character", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            else if(string.Compare(txtPassword.Password,txtConfirm.Password) > 0)
            {
                MessageBox.Show("Password must match","ERROR",MessageBoxButton.OK,MessageBoxImage.Error);
                return;
            }

            else if((!Regex.IsMatch(txtUsername.Text, @"^((([\w]+\.[\w]+)+)|([\w]+))@(([\w]+\.)+)([A-Za-z]{1,3})$")))
            {
                MessageBox.Show("Email must contains, @jhb.dvt.co.za", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            else
            {
                SignModel sign = new SignModel();
                Person mentor = new Person();
                mentor.FirstName = txtFname.Text;
                mentor.LastName = txtLname.Text;
                mentor.Username = txtUsername.Text;
                mentor.Password = txtPassword.Password;
                mentor.RoleID = cmbStudentMentor.SelectedIndex + 1;
                MessageBox.Show(sign.InsertMentor(mentor));
                Login login = new Login();
                login.Show();
                this.Hide();
            }
        }
 private void lnk_Click(object sender, RoutedEventArgs e)
 {
     popLink.IsOpen = false;
     Login login = new Login();
     login.Show();
     this.Hide();
 }