Exemple #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            sqlConnection.Open();
            string     str = "SELECT User_role FROM UserData WHERE User_login = '******'";
            SqlCommand cmd = new SqlCommand(str, sqlConnection);
            string     res = cmd.ExecuteScalar().ToString();

            sqlConnection.Close();
            if (res == "Менеджер")
            {
                Manager form = new Manager(login);
                form.Show();
                this.Close();
            }
            else if (res == "Клиент")
            {
                Customer form = new Customer(login);
                form.Show();
                this.Close();
            }
            else if (res == "Турагент")
            {
                TravelAgent form = new TravelAgent(login);
                form.Show();
                this.Close();
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string log  = textBox1.Text;
            string pass = hash(textBox2.Text);
            string rule = "None";

            sqlConnection.Open();
            rule = "SELECT User_role FROM UserData WHERE User_login = '******' AND User_password = '******'";
            SqlCommand cmd = new SqlCommand(rule, sqlConnection);
            string     res = (string)cmd.ExecuteScalar();

            if (res == "Менеджер")
            {
                Manager form = new Manager(log);
                form.Show();
                this.Hide();
            }
            else if (res == "Клиент")
            {
                Customer form = new Customer(log);
                form.Show();
                this.Hide();
            }
            else if (res == "Турагент")
            {
                TravelAgent form = new TravelAgent(log);
                form.Show();
                this.Hide();
            }
            else if (cmd.ExecuteNonQuery() < 1)
            {
                MessageBox.Show("Пользователя с таким логином и паролем не существует.\nПопробуйте ещё раз!", "Ошибка", MessageBoxButtons.OK);
            }
            sqlConnection.Close();
        }