Example #1
0
 private void exit_Click(object sender, EventArgs e)
 {
     this.Close();
     this.s1 = new SM_Director(r1);
     this.s1.Show();
 }
Example #2
0
        private void EnterB_Click(object sender, EventArgs e)
        {
            string login    = textBox1.Text;
            string password = textBox2.Text;

            string command1 = "SELECT * FROM Сотрудники WHERE Логин = '" + login + "' AND Пароль = '" + password + "'";

            db.readDatathroughAdapter(command1, dt);
            if (textBox1.Text.Replace(" ", "") == "" || textBox2.Text.Replace(" ", "") == "")
            {
                MessageBox.Show("Заполните все поля для входа!");
            }
            else
            {
                if (dt.Rows.Count > 0)
                {
                    switch ((int)dt.Rows[0].ItemArray[9])
                    {
                    case 1:
                    {
                        this.Hide();
                        this.d2 = new SM_Director(this);
                        this.d2.Show();
                        dep = (int)dt.Rows[0].ItemArray[1];
                        break;
                    }

                    case 2:
                    {
                        this.Hide();
                        this.o1 = new Otchet_worker(this);
                        this.o1.Show();
                        worker = (int)dt.Rows[0].ItemArray[0];
                        break;
                    }

                    case 3:
                    {
                        this.Hide();
                        this.d1 = new Director();
                        this.d1.Show();
                        break;
                    }

                    case 4:
                    {
                        this.Hide();
                        this.h1 = new HR_Form();
                        this.h1.Show();
                        break;
                    }

                    default:
                    {
                        break;
                    }
                    }
                }
                else
                {
                    MessageBox.Show("Введите правильные логин и пароль!");
                }
            }
        }