private bool DangNhap(string tenDangNhap, string matKhau) { bool result = false; dt = new DataTable(); dt = bd.KiemTraDangNhap(ref err, tenDangNhap, matKhau); if (dt != null) { if (dt.Rows.Count > 0) { if (dt.Rows[0]["code"].ToString().Equals("1")) { ClsMain.TenNhanVien = dt.Rows[0]["TenNhanVien"].ToString(); ClsMain.MaTaiKhoan = Convert.ToInt32(dt.Rows[0]["MaTaiKhoan"].ToString()); ClsMain.MaNhanVien = dt.Rows[0]["MaNV"].ToString(); result = true; } } else { MessageBox.Show("User name hay password không đúng"); } } else { MessageBox.Show(err); } return(result); }
private bool DangNhap(string tenDangNhap, string matKhau) { bool result = false; dt = new DataTable(); dt = bd.KiemTraDangNhap(ref err, tenDangNhap, matKhau); if (dt.Rows.Count > 0) { if (dt.Rows[0]["code"].ToString().Equals("1")) { ClsMain.TenNhanVien = dt.Rows[0]["TenNhanVien"].ToString(); ClsMain.MaTaiKhoan = Convert.ToInt32(dt.Rows[0]["MaTaiKhoan"].ToString()); ClsMain.MaNhanVien = dt.Rows[0]["MaNV"].ToString(); result = true; } } return(result); }