Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string login, password, role;
            bool   flag = false;

            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                login    = dataGridView1.Rows[i].Cells[1].Value.ToString();
                password = dataGridView1.Rows[i].Cells[2].Value.ToString();
                role     = dataGridView1.Rows[i].Cells[3].Value.ToString();

                if (login == textBox1.Text && password == textBox2.Text)
                {
                    dataGridView1.Rows[i].Selected = true;
                    switch (role)
                    {
                    case "Руководитель":
                        flag = !flag;
                        Form_director a = new Form_director();
                        a.Show();
                        break;

                    case "Заказчик":
                        flag = !flag;
                        Form_client b = new Form_client();
                        b.Show();
                        break;

                    case "Кладовщик":
                        flag = !flag;
                        Form_storekeeper c = new Form_storekeeper();
                        c.Show();
                        break;

                    case "Менеджер":
                        flag = !flag;
                        Form_manager d = new Form_manager();
                        d.Show();
                        break;
                    }
                }
                else if (textBox1.Text == "" || textBox2.Text == "")
                {
                    MessageBox.Show("Заполните все поля!");
                    flag = !flag;
                }
                else if (flag != false)
                {
                    MessageBox.Show("Неправильный логин или пароль!");
                    flag = !flag;
                }
                if (flag)
                {
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            Form_manager f = new Form_manager();

            f.Show();
        }