// Kiểm tra tài khoản public static bool KiemTraTaiKhoan(string tenTaiKhoan) { string query = "select COUNT(*) from TAIKHOAN where TENTK = @TENTK"; List <SqlParameter> parameters = new List <SqlParameter>() { new SqlParameter("@TENTK", SqlDbType.VarChar) { Value = tenTaiKhoan }, }; int count = 0; try { count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString()); } catch (Exception ex) { Utility.Log(ex); } if (count == 0) { return(false); } else { return(true); } }
// Kiểm tra nhân viên public static bool KiemTraNhanVien(string maNV) { string query = "select COUNT(*) from NHANVIEN where MANV = @MANV"; List <SqlParameter> parameters = new List <SqlParameter>() { new SqlParameter("@MANV", SqlDbType.Char) { Value = maNV }, }; int count = 0; try { count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString()); } catch (Exception ex) { Utility.Log(ex); } if (count == 0) { return(false); } else { return(true); } }
public static int DemMonAn(string tenMonAn, string loaiMonAn, uint donGia = 0) { string query = "EXEC uspDemMonAn @tenMonAn,@loaiMonAn,@donGia"; //truyền tham số vào câu truy vấn List <SqlParameter> parameters = new List <SqlParameter>() { new SqlParameter("@tenMonAn", SqlDbType.NVarChar) { IsNullable = false, Value = tenMonAn }, new SqlParameter("@loaiMonAn", SqlDbType.NVarChar) { IsNullable = false, Value = loaiMonAn }, new SqlParameter("@donGia", SqlDbType.Decimal) { IsNullable = false, Value = donGia }, }; int count = 0; try { count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString()); } catch (Exception ex) { Utility.Log(ex); } return(count); }
public static int DemPhieuNhapNguyenLieu(int loai) { string query = "EXEC uspDemPhieuNhapNguyenLieu @loai"; List <SqlParameter> parameters = new List <SqlParameter>() { new SqlParameter("@loai", SqlDbType.Int) { IsNullable = false, Value = loai }, }; int count = 0; try { count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString()); } catch (Exception ex) { Utility.Log(ex); } return(count); }
public static int DemNhaCungCap(string tenNhaCungCap) { string query = "EXEC uspDemNhaCungCap @tenNhaCungCap"; List <SqlParameter> parameters = new List <SqlParameter>() { new SqlParameter("@tenNhaCungCap", SqlDbType.NVarChar) { IsNullable = false, Value = tenNhaCungCap }, }; int count = 0; try { count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString()); } catch (Exception ex) { Utility.Log(ex); } return(count); }