예제 #1
0
 private void EnterBut_Click(object sender, EventArgs e)
 {
     if (Check())
     {
         if (WorkWithBD.CheckUser(LoginTXTBox.Text, PasswordTXTBox.Text))
         {
             WorkWithMessage.MessageBoxShow("Данный логин уже занят!");
             return;
         }
         else
         {
             WorkWithBD.AddUser(LoginTXTBox.Text, PasswordTXTBox.Text);
             this.Close();
         }
     }
 }
예제 #2
0
        private void EnterBut_Click(object sender, EventArgs e)
        {
            if (WorkWithBD.CheckUser(LoginTXTBox.Text, PasswordTXTBox.Text))
            {
                switch (WorkWithBD.GetNamePrivilegeForLoginPrivelege(LoginTXTBox.Text))
                {
                case "Admin":
                {
                    this.Visible = false;
                    AdminForm form = new AdminForm(LoginTXTBox.Text);
                    LoginTXTBox.Text    = string.Empty;
                    PasswordTXTBox.Text = string.Empty;
                    form.ShowDialog();
                    this.Visible = true;
                    break;
                }

                case "User":
                {
                    this.Visible = false;
                    UserForm form = new UserForm(LoginTXTBox.Text);
                    LoginTXTBox.Text    = string.Empty;
                    PasswordTXTBox.Text = string.Empty;
                    form.ShowDialog();
                    this.Visible = true;
                    break;
                }

                default:
                {
                    WorkWithMessage.MessageBoxShow("Привилегия пользователя непоределена!");
                    break;
                }
                }
            }
            else
            {
                WorkWithMessage.MessageBoxShow("Неверный логин и пароль!");
            }
        }