private void go_back_Click(object sender, EventArgs e) { this.Close(); Main_admin m_adm = new Main_admin(); m_adm.Show(); }
private void cansel_Click(object sender, EventArgs e) { this.Close(); Main_admin main_adm = new Main_admin(); main_adm.Show(); }
private void new_user_button_Click(object sender, EventArgs e) { if (this.doublicate.Text != this.password_field.Text) { MessageBox.Show("Пароль введен с ошибкой"); login_field.Text = ""; password_field.Text = ""; doublicate.Text = ""; } else { string result = users.Check(login_field.Text, password_field.Text); if (result == "adm" || result == "che" || result == "Wrong_pas") { MessageBox.Show("Пользователь уже существует"); login_field.Text = ""; password_field.Text = ""; doublicate.Text = ""; } else { if (status.SelectedIndex == 1) { Admin admin = new Admin(login_field.Text, password_field.Text); users.Admins.Add(admin); MessageBox.Show("Пользователь успешно добавлен"); users.Save(); this.Close(); Main_admin main_adm = new Main_admin(); main_adm.Show(); } else { if (status.SelectedIndex == 0) { Chef chef = new Chef(login_field.Text, password_field.Text); users.Chefs.Add(chef); MessageBox.Show("Пользователь успешно добавлен"); users.Save(); this.Close(); Main_admin main_adm = new Main_admin(); main_adm.Show(); } else { MessageBox.Show("Выберите статус"); } } } } }
private void login_Click(object sender, EventArgs e) { users.Load(); if (users.Check(login_field.Text, password_field.Text) == "adm") { login_field.Text = ""; password_field.Text = ""; this.Hide(); Main_admin main_adm = new Main_admin(); main_adm.Show(); } else { if (users.Check(login_field.Text, password_field.Text) == "che") { login_field.Text = ""; password_field.Text = ""; this.Hide(); Main_chef main_chef = new Main_chef(); main_chef.ShowDialog(); } else { if (users.Check(login_field.Text, password_field.Text) == "Wrong_pas") { MessageBox.Show("Неправильный пароль"); login_field.Text = ""; password_field.Text = ""; } else { if (users.Check(login_field.Text, password_field.Text) == "No_such") { MessageBox.Show("Пользователь не найден"); login_field.Text = ""; password_field.Text = ""; } } } } }