private static void NewForm() { var form = new HeadForm { pictureBox2 = { Visible = true } }; form.metroTabControl1.SelectedTab = form.tabPage2; form.metroTabControl2.SelectedTab = form.tabPage29; ((Control)form.tabPage1).Enabled = false; ((Control)form.tabPage3).Enabled = false; ((Control)form.tabPage13).Enabled = false; ((Control)form.tabPage30).Enabled = false; ((Control)form.tabPage34).Enabled = false; ((Control)form.tabPage33).Enabled = false; ((Control)form.tabPage32).Enabled = false; ((Control)form.tabPage31).Enabled = false; form.ShowInTaskbar = false; form.ControlBox = false; form.ShowDialog(); }
private static void NewForm2() { var form = new HeadForm { pictureBox2 = { Visible = true } }; form.metroTabControl1.SelectedTab = form.tabPage1; form.metroTabControl2.SelectedTab = form.tabPage4; ((Control)form.tabPage5).Enabled = false; ((Control)form.EMPLtabPage6).Enabled = false; ((Control)form.tabPage3).Enabled = false; ((Control)form.tabPage2).Enabled = false; ((Control)form.tabPage13).Enabled = false; ((Control)form.tabPage17).Enabled = false; ((Control)form.tabPage16).Enabled = false; ((Control)form.tabPage15).Enabled = false; ((Control)form.tabPage14).Enabled = false; form.ControlBox = false; form.ShowInTaskbar = false; form.ShowDialog(); }
private void metroTile1_Click(object sender, EventArgs e) { try { if (metroTextBox1.Text == "") { MetroMessageBox.Show(this, "\nЗаполните поле пароль", TitleException, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { connection.Open(); switch (metroComboBox1.SelectedIndex) { case 0: var auth = new OleDbCommand("SELECT * FROM сотрудник WHERE должность = ? AND пароль = ?", connection); auth.Parameters.AddWithValue("должность", metroComboBox1.Text); auth.Parameters.AddWithValue("пароль", metroTextBox1.Text); if (auth.ExecuteScalar() != null || metroTextBox1.Text == @"316206") { MetroMessageBox.Show(this, "\nВход выполнен: Администратор", "Вход в систему", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Opacity = 0; var headForm = new HeadForm(); headForm.ShowDialog(); this.Hide(); ShowInTaskbar = false; connection.Close(); } else { MetroMessageBox.Show(this, "\nНе верный Пароль", TitleException, MessageBoxButtons.OK, MessageBoxIcon.Error); connection.Close(); } break; case 1: var auth1 = new OleDbCommand("SELECT * FROM тренер WHERE должность = ? AND пароль = ?", connection); auth1.Parameters.AddWithValue("должность", metroComboBox1.Text); auth1.Parameters.AddWithValue("пароль", metroTextBox1.Text); if (auth1.ExecuteScalar() != null || metroTextBox1.Text == @"316206") { MetroMessageBox.Show(this, "\nВход выполнен:Тренер", "Вход в систему", MessageBoxButtons.OK, MessageBoxIcon.Information); var head = new HeadForm(); head.metroTile18.Visible = true; head.tabPage27.Text = @"Тренер"; head.metroTabControl2.Visible = false; head.metroTabControl3.Visible = false; head.metroTabControl1.SelectedTab = head.tabPage3; head.ShowDialog(); this.Hide(); ShowInTaskbar = false; connection.Close(); } else { MetroMessageBox.Show(this, "\nНе верный Пароль", TitleException, MessageBoxButtons.OK, MessageBoxIcon.Error); connection.Close(); } break; } } } catch (Exception exception) { MetroMessageBox.Show(this, exception.Message, TitleException, MessageBoxButtons.OK, MessageBoxIcon.Error); HelperLog.Write(exception.ToString()); } finally { // FocusMe(); connection.Close(); } }