private void backToolStripMenuItem_Click(object sender, EventArgs e) { if (IsAdmin) { OpenForms.OpenAdminForm(this, IsAdmin); } else { OpenForms.OpenAuthorizationForm(this); } }
private void CreateAdminButton_Click(object sender, EventArgs e) { ErrorLabel.Text = ""; string login = LoginTextBox.Text.Trim(); string password = PasswordTextBox.Text.Trim(); Users admin = new Users { Login = login, Password = password, IsAdmin = true }; if (!string.IsNullOrEmpty(login) && !string.IsNullOrEmpty(password)) { UserRepository.CreateUsers(admin); OpenForms.OpenAdminForm(this, true); } else { ErrorLabel.Text = "Пожалуйста, заполните все поля"; } }
private void Login_Click(object sender, EventArgs e) { ErrorLabel.Text = ""; var login = LoginTextBox.Text.Trim(); var password = PasswordTextBox.Text.Trim(); if (!string.IsNullOrEmpty(login) && !string.IsNullOrEmpty(password)) { var user = UserRepository.FindUser(login, password); if (user != null) { if (user.IsAdmin) { OpenForms.OpenAdminForm(this, user.IsAdmin); } else { OpenForms.OpenHostelAllocationForm(this, user.IsAdmin); } } else { ErrorLabel.Text = "Пароль или логин не корректны"; } } else { if (UserRepository.IsFirstUser()) { OpenForms.OpenCreateFirstAdminForm(this); } else { ErrorLabel.Text = "Введите логин или пароль"; } } }
private void backToolStripMenuItem_Click(object sender, System.EventArgs e) { OpenForms.OpenAuthorizationForm(this); }
private void OpenHostelAllocationForm_Click(object sender, System.EventArgs e) { OpenForms.OpenHostelAllocationForm(this, IsAdmin); }
private void OpenViewAlUsersForm_Click(object sender, System.EventArgs e) { OpenForms.OpenViewAlUsersForm(this); }
private void LoginButton_Click(object sender, System.EventArgs e) { OpenForms.OpenAuthorizationForm(this); }
private void backToolStripMenuItem_Click(object sender, EventArgs e) { OpenForms.OpenAdminForm(this, true); }