Esempio n. 1
0
        private void button6_Click(object sender, EventArgs e)
        {
            Close();
            ManagmentScreen ms = new ManagmentScreen();

            ms.Show();
        }
Esempio n. 2
0
        private async void button1_Click(object sender, EventArgs e)
        {
            string          login = textBox1.Text;
            string          pass  = textBox2.Text;
            MySqlConnection conn  = DBUtils.GetDBConnection();
            await conn.OpenAsync();

            MySqlCommand cmd  = new MySqlCommand();
            string       sql  = "SELECT Password FROM user Where Login = @login";
            MySqlCommand ddos = new MySqlCommand();

            cmd.Connection  = conn;
            cmd.CommandText = sql;
            cmd.Parameters.Add(new MySqlParameter("login", login));
            var password = (string)cmd.ExecuteScalar();

            if (string.IsNullOrWhiteSpace(password))
            {
                MessageBox.Show("Неверный логин или пароль", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (pass == password)
            {
                MessageBox.Show("Успешный вход !", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Form1 f1 = new Form1();
                Hide();
                ManagmentScreen f2 = new ManagmentScreen();
                f2.Show();
            }

            else
            {
                MessageBox.Show("Неверный пароль", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }