예제 #1
0
        private void BackBT_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
            DirectorForm directorForm = new DirectorForm();

            directorForm.Show();
        }
예제 #2
0
        public void Button_Click_1(object sender, RoutedEventArgs e)
        {
            bool correct = CheckCaptcha();

            passwordPB.Password = checkBox.IsChecked == true ? passwordPB.Password = passwordTB.Text : passwordPB.Password;
            string    authorizeQuery = "SELECT * FROM user WHERE login='******'AND password='******'";
            DataTable dt_user        = dBContext.Authorize(authorizeQuery);

            if (dt_user.Rows.Count == 1 && correct == true)
            {
                switch (dt_user.Rows[0][4].ToString().ToLower())
                {
                case "заказчик":
                    UserForm userForm = new UserForm();
                    userForm.Show();
                    this.Hide();
                    break;

                case "менеджер":
                    ManagerForm managerForm = new ManagerForm();
                    managerForm.Show();
                    this.Hide();
                    break;

                case "мастер":
                    MasterForm masterForm = new MasterForm();
                    masterForm.Show();
                    this.Hide();
                    break;

                case "заместитель директора":
                    DeputyDirectorForm deputyDirectorForm = new DeputyDirectorForm();
                    deputyDirectorForm.Show();
                    this.Hide();
                    break;

                case "директор":
                    DirectorForm directorForm = new DirectorForm();
                    directorForm.Show();
                    this.Hide();
                    break;

                default:
                    MessageBox.Show($"Unknown role {dt_user.Rows[0][4].ToString().ToLower()}");
                    break;
                }
            }
            else if (correct == true && dt_user.Rows.Count != 1 && passwordPB.Password != "" && loginTB.Text != "")
            {
                MessageBox.Show("Пользователь не найден!");
            }
            else if (passwordPB.Password == "" || loginTB.Text == "")
            {
                MessageBox.Show("Все поля должны быть заполнены!");
            }
            else if (correct == false && passwordPB.Password != "" && loginTB.Text != "")
            {
                MessageBox.Show("Неверно введена капча!");
            }
        }