예제 #1
0
        private void registerLabel_Click(object sender, EventArgs e)
        {
            this.Hide();
            RukovosShow RukovosShow = new RukovosShow();

            RukovosShow.Show();
        }
예제 #2
0
 private void registerLabel_Click(object sender, EventArgs e)
 {
     if (categoryUser.Value == "rukovoditel")
     {
         this.Hide();
         RukovosShow tablemainshow = new RukovosShow();
         tablemainshow.Show();
     }
     else
     {
         this.Hide();
         MainForm MainForm = new MainForm();
         MainForm.Show();
     }
 }
예제 #3
0
 private void label4_Click(object sender, EventArgs e)
 {
     if (categoryUser.Value == "rukovoditel")
     {
         this.Hide();
         RukovosShow tablemainshow = new RukovosShow();
         tablemainshow.Show();
     }
     else
     {
         this.Hide();
         TableMain tablemainshow = new TableMain();
         tablemainshow.Show();
     }
 }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            login.Value = textBox_login.Text;


            DB db = new DB();

            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlDataReader reader;
            MySqlDataReader reader1;
            MySqlDataReader reader2;

            MySqlCommand command               = new MySqlCommand("select * from `vxod` where login = @uL AND password = @uP", db.getConnection());
            MySqlCommand command_category      = new MySqlCommand("select наименование_должности from sotrudnik join dolznost on DOLZNOST_id = dolznost.id join VXOD on SOTRUDNIK_id = SOTRUDNIK.id where login = @uL", db.getConnection());
            MySqlCommand command_name          = new MySqlCommand("select имя from `SOTRUDNIK` join VXOD on SOTRUDNIK_id = SOTRUDNIK.id where login = @uL", db.getConnection());
            MySqlCommand command_podrazdelenie = new MySqlCommand("select PODRAZDELENIE.id from `PODRAZDELENIE` " +
                                                                  "join SOTRUDNIK on PODRAZDELENIE_id = PODRAZDELENIE.id join VXOD on SOTRUDNIK_id = SOTRUDNIK.id " +
                                                                  "where login = @uL;", db.getConnection());

            command.Parameters.Add("@uL", MySqlDbType.VarChar).Value = textBox_login.Text;
            command.Parameters.Add("@uP", MySqlDbType.VarChar).Value = textBox_pass.Text;

            command_category.Parameters.Add("@uL", MySqlDbType.VarChar).Value = textBox_login.Text;

            command_name.Parameters.Add("@uL", MySqlDbType.VarChar).Value = textBox_login.Text;

            command_podrazdelenie.Parameters.Add("@uL", MySqlDbType.VarChar).Value = textBox_login.Text;

            db.openConnection();

            adapter.SelectCommand = command;
            adapter.Fill(table);

            reader = command_category.ExecuteReader();
            while (reader.Read())
            {
                categoryUser.Value = reader["наименование_должности"].ToString();
            }

            db.closeConnection();

            db.openConnection();

            reader2 = command_podrazdelenie.ExecuteReader();
            while (reader2.Read())
            {
                podrazdelenie.Value = reader2["id"].ToString();
            }

            db.closeConnection();

            db.openConnection();

            reader1 = command_name.ExecuteReader();
            while (reader1.Read())
            {
                logos.Value = reader1["имя"].ToString();
            }


            if (table.Rows.Count > 0 && categoryUser.Value == "admin")
            {
                this.Hide();
                MainForm mainForm = new MainForm();
                mainForm.Show();
            }
            else
            if (table.Rows.Count > 0 && categoryUser.Value == "rukovoditel")
            {
                this.Hide();
                RukovosShow RukovosShow = new RukovosShow();

                RukovosShow.Show();
            }
            else
            if (table.Rows.Count > 0 && categoryUser.Value == "sotrudnik")
            {
                this.Hide();
                UserMain UserMain = new UserMain();

                UserMain.Show();
            }
            else
            {
                MessageBox.Show("Неверный логин или пароль");
            }

            db.closeConnection();
        }