Beispiel #1
0
        private void btLogin_Click(object sender, EventArgs e)
        {
            DTO_Login account = new DTO_Login();

            account.UserName = txtUserName.Text;
            account.PassWord = txtPassword.Text;
            SQLAction action = new SQLAction();
            DataSet   result = action.Login(account);

            if (result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0)
            {
                MessageBox.Show("Đăng nhập thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MenuForm menu = new MenuForm();
                this.Hide();
                menu.USERNAME = result.Tables[0].Rows[0][0].ToString();
                menu.ShowDialog();
                this.Close();
            }
            else
            {
                MessageBox.Show("Tên tài khoản hoặc mật khẩu không đúng!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                load();
            }
        }