Example #1
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtTenTaiKhoan.Text.Trim()))
            {
                MessageBox.Show("Không được bỏ trống tài khoản");
                this.txtTenTaiKhoan.Focus();
                return;
            }
            if (String.IsNullOrEmpty(txtMatKhau.Text.Trim()))
            {
                MessageBox.Show("Không được bỏ trống mật khẩu");
                this.txtMatKhau.Focus();
                return;
            }

            int kq = QL_NguoiDung.Check_Config();

            if (kq == 0)
            {
                try
                {
                    nv = dn.getNV(txtTenTaiKhoan.Text);
                    if (nv != null)
                    {
                        MessageBox.Show("ĐĂNG NHẬP THÀNH CÔNG");
                        FormMenu from = new FormMenu();
                        from.nv = nv;
                        this.Hide();
                        from.Show();
                    }
                    else
                    {
                        MessageBox.Show("ĐĂNG NHẬP THẤT BẠI");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Lỗi kết nối");
                }
            }
            else if (kq == 1)
            {
                MessageBox.Show("Chuỗi cấu hình không tồn tại");
                frmConfig cn = new frmConfig();
                cn.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Chuỗi cấu hình không phù hợp");
                frmConfig cn = new frmConfig();
                cn.Show();
                this.Hide();
            }
        }