public static List <BanDatDTO> LayDanhSachBanDat() { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayDanhSachBanDat"; DataTable dt = DataAccessCode.ExecuteSelectCommand(command); List <BanDatDTO> list = new List <BanDatDTO>(); if (dt != null) { int maThongTinKhachHang; for (int i = 0; i < dt.Rows.Count; i++) { BanDatDTO banDat = new BanDatDTO(); banDat.MaLichBan = Int32.Parse(dt.Rows[i]["MaLichBan"].ToString()); banDat.MaBan = Int32.Parse(dt.Rows[i]["MaBan"].ToString()); banDat.NgayDatBan = DateTime.Parse(dt.Rows[i]["NgayDatBan"].ToString()); banDat.MaBuoi = Int32.Parse(dt.Rows[i]["MaBuoi"].ToString()); if (Int32.TryParse(dt.Rows[i]["MaThongTinKhachHang"].ToString(), out maThongTinKhachHang)) { banDat.MaThongTinKhachHang = maThongTinKhachHang; } banDat.SoLuong = Int32.Parse(dt.Rows[i]["SoLuong"].ToString()); banDat.TinhTrangBan = Boolean.Parse(dt.Rows[i]["TinhTrangBan"].ToString()); list.Add(banDat); } } return(list); }
public static List <ThongTinBanDTO> LayDanhSachThongTinBan(int maKhuVuc) { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayDanhSachThongTinBan"; DbParameter param = command.CreateParameter(); param.ParameterName = "@MaKhuVuc"; if (maKhuVuc == 0) { param.Value = DBNull.Value; } else { param.Value = maKhuVuc; } param.DbType = DbType.Int32; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); List <ThongTinBanDTO> list = new List <ThongTinBanDTO>(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { ThongTinBanDTO thongTinBan = new ThongTinBanDTO(); thongTinBan.MaBan = Int32.Parse(dt.Rows[i]["MaBan"].ToString()); thongTinBan.MaKhuVuc = Int32.Parse(dt.Rows[i]["MaKhuVuc"].ToString()); thongTinBan.TenBan = dt.Rows[i]["TenBan"].ToString(); thongTinBan.SucChua = Int32.Parse(dt.Rows[i]["SucChua"].ToString()); list.Add(thongTinBan); } } return(list); }
public static ArrayList layDanhSachMonAnTheoPhanLoaiMonAn(LoaiMonAnDTO loaiMonAn, int maNhaHang) { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayDanhSachMonAnTheoPhanLoaiMonAn"; DbParameter param = command.CreateParameter(); param.ParameterName = "@MaNhaHang"; param.Value = maNhaHang; param.DbType = DbType.Int32; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@MaLoaiMonAn"; param.Value = loaiMonAn.MaLoaiMonAn; param.DbType = DbType.Int32; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); ArrayList list = new ArrayList(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { PhanLoaiMonAnDTO plMA = new PhanLoaiMonAnDTO(); plMA.LoaiMonAn.MaLoaiMonAn = Convert.ToInt32(dt.Rows[i]["MaLoaiMonAn"]); plMA.MonAn.MaMonAn = Convert.ToInt32(dt.Rows[i]["MaMonAn"]); plMA.MonAn.TenMonAn = dt.Rows[i]["TenMonAn"].ToString(); plMA.NhaHang.MaNhaHang = maNhaHang; list.Add(plMA); } } return(list); }
public static DataTable ThongTinKhachVaBanDat() { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.ThongTinKhachVaBanDat"; DataTable dt = DataAccessCode.ExecuteSelectCommand(command); //List<BanDatDTO> list = new List<BanDatDTO>(); //if (dt != null) //{ // for (int i = 0; i < dt.Rows.Count; i++) // { // BanDatDTO bd = new BanDatDTO(); // //bd.MaNhaHang = Int32.Parse(dt.Rows[i]["MaNhaHang"].ToString()); // bd.HoTen = dt.Rows[i]["HoTen"].ToString(); // bd.Cmnd = dt.Rows[i]["CMND"].ToString(); // bd.DienThoai = dt.Rows[i]["DienThoai"].ToString(); // bd.MaBan = Int32.Parse(dt.Rows[i]["MaBan"].ToString()); // bd.NgayDatBan = DateTime.Parse(dt.Rows[i]["NgayDatBan"].ToString()); // bd.MaBuoi = Int32.Parse(dt.Rows[i]["MaBuoi"].ToString()); // bd.SoLuong = Int32.Parse(dt.Rows[i]["SoLuong"].ToString()); // bd.MaThongTinKhachHang = Int32.Parse(dt.Rows[i]["MaThongTinKhachHang"].ToString()); // bd.MaLichBan = Int32.Parse(dt.Rows[i]["MaLichBan"].ToString()); // list.Add(bd); // } //} if (dt == null) { dt = new DataTable(); } return(dt); }
// cấp phát public static DataTable LayBangNguoiDung() { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayTaiKhoan"; return(DataAccessCode.ExecuteSelectCommand(command)); }
public static KhoHang_NguyenLieuDTO layChiTietKhoHangNguyenLieu(int maNhaHang, NguyenLieuDTO nguyenLieuCanTim) { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.layChiTietKhoHangNguyenLieu"; DbParameter param = command.CreateParameter(); param.ParameterName = "@MaNguyenLieu"; param.Value = nguyenLieuCanTim.MaNguyenLieu; param.DbType = DbType.Int32; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@MaNhaHang"; param.Value = maNhaHang; param.DbType = DbType.Int32; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); KhoHang_NguyenLieuDTO dto = new KhoHang_NguyenLieuDTO(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { dto.NguyenLieu.MaNguyenLieu = Convert.ToInt32(dt.Rows[i]["MaNguyenLieu"]); dto.NguyenLieu.TenNguyenLieu = dt.Rows[i]["TenNguyenLieu"].ToString(); dto.NguyenLieu.DonViTinh = dt.Rows[i]["DonViTinh"].ToString(); dto.SoLuongTon = Convert.ToInt32(dt.Rows[i]["SoLuongTon"]); dto.SucChua = Convert.ToInt32(dt.Rows[i]["SucChua"]); dto.MucTonToiThieu = Convert.ToInt32(dt.Rows[i]["MucChuaToiThieu"]); } } return(dto); }
public static ArrayList traCuuNhaCungCapThoaYeuCauNguyenLieuCanDatHang(string sqlFROM) { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.traCuuNhaCungCapThoaYeuCauNguyenLieuCanDatHang"; DbParameter param = command.CreateParameter(); param.ParameterName = "@sqlFROM"; param.Value = sqlFROM; param.DbType = DbType.String; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); ArrayList list = new ArrayList(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { NhaCungCapDTO dto = new NhaCungCapDTO(); dto.MaNhaCungCap = Convert.ToInt32(dt.Rows[i]["MaNhaCungCap"]); dto.SoLuongNguyenLieuToiDaPhuHopYeuCauDatHang = Convert.ToInt32(dt.Rows[i]["SoLuongNguyenLieuDapUng"]); dto.TenNhaCungCap = dt.Rows[i]["TenNhaCungCap"].ToString(); list.Add(dto); } } return(list); }
public static DataTable LayBangNhaHang() { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayDanhSachNhaHang"; return(DataAccessCode.ExecuteSelectCommand(command)); }
public static List <KhuVucDTO> LayDanhSachKhuVuc(int maNhaHang) { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayDanhSachKhuVuc"; DbParameter param = command.CreateParameter(); param.ParameterName = "@MaNhaHang"; if (maNhaHang == 0) { param.Value = DBNull.Value; } else { param.Value = maNhaHang; } param.DbType = DbType.Int32; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); List <KhuVucDTO> list = new List <KhuVucDTO>(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { KhuVucDTO khuVuc = new KhuVucDTO(); khuVuc.MaKhuVuc = Int32.Parse(dt.Rows[i]["MaKhuVuc"].ToString()); khuVuc.TenKhuVuc = dt.Rows[i]["TenKhuVuc"].ToString(); khuVuc.GiaBan = Decimal.Parse(dt.Rows[i]["GiaBan"].ToString()); list.Add(khuVuc); } } return(list); }
internal static List <LichLamViecDTO> LoadLichLamViec() { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayDanhSachLichLamViec"; DataTable dt = DataAccessCode.ExecuteSelectCommand(command); List <LichLamViecDTO> list = new List <LichLamViecDTO>(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { LichLamViecDTO lich = new LichLamViecDTO(); lich.MaNhanVien = Int32.Parse(dt.Rows[i]["MaNhanVien"].ToString()); lich.HoNhanVien = dt.Rows[i]["HoNhanVien"].ToString(); lich.TenNhanVien = dt.Rows[i]["TenNhanVien"].ToString(); lich.Thu = Int32.Parse(dt.Rows[i]["Thu"].ToString()); lich.Ca = Int32.Parse(dt.Rows[i]["Ca"].ToString()); list.Add(lich); } } return(list); }
public static int layMaThongTinHangNhap(DateTime ngayGioNhap, int maKhoHang) { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.layIDThongTinHangNhap"; DbParameter param = command.CreateParameter(); param.ParameterName = "@ngayGioNhap"; param.Value = ngayGioNhap; param.DbType = DbType.DateTime; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@maKhoHang"; param.Value = maKhoHang; param.DbType = DbType.Int32; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); int id = -1; if (dt != null) { id = Convert.ToInt32(dt.Rows[0]["MaThongTinHangNhap"]); } return(id); }
private void button1_Click(object sender, EventArgs e) { RestaurantConfiguration.command = DataAccessCode.CreateCommand(); if (isDirtyRead) { RestaurantConfiguration.command.CommandText = "dbo.T1DirtyRead"; } else { RestaurantConfiguration.command.CommandText = "dbo.T1ResolvedDirtyRead"; } DataTable dt = DataAccessCode.ExecuteSelectCommand(RestaurantConfiguration.command); List <ThongTinNhanVienDTO> list = new List <ThongTinNhanVienDTO>(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { ThongTinNhanVienDTO thongTinNhanVien = new ThongTinNhanVienDTO(); thongTinNhanVien.MaNhanVien = Int32.Parse(dt.Rows[i]["MaNhanVien"].ToString()); //thongTinNhanVien.MaNhaHang = Int32.Parse(dt.Rows[i]["MaNhaHang"].ToString()); list.Add(thongTinNhanVien); } } dgvData.DataSource = list; }
public static DataTable GetTables() { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "SP_GETTABLES"; return(DataAccessCode.ExecuteSelectCommand(command)); }
public static List <ChiTietThucDonDTO> LayDanhSachMonAnTheoNhaHang(int maNhaHang, DateTime ngay) { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayDanhSachMonAnTheoNhaHang"; DbParameter param = command.CreateParameter(); param.ParameterName = "@MaNhaHang"; param.Value = maNhaHang; param.DbType = DbType.Int32; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@Ngay"; param.Value = ngay; param.DbType = DbType.DateTime; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); List <ChiTietThucDonDTO> list = new List <ChiTietThucDonDTO>(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { ChiTietThucDonDTO chiTietThucDon = new ChiTietThucDonDTO(); chiTietThucDon.MaChiTietThucDon = Int32.Parse(dt.Rows[i]["MaChiTietThucDon"].ToString()); chiTietThucDon.MaMonAn = Int32.Parse(dt.Rows[i]["MaMonAn"].ToString()); chiTietThucDon.TenMonAn = dt.Rows[i]["TenMonAn"].ToString(); chiTietThucDon.DonGia = Decimal.Parse(dt.Rows[i]["DonGia"].ToString()); list.Add(chiTietThucDon); } } return(list); }
public static List <LoaiNhanVienCNDTO> LayLoaiNhanVien() { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayLoaiNhanVien"; DataTable dt = DataAccessCode.ExecuteSelectCommand(command); List <LoaiNhanVienCNDTO> list = new List <LoaiNhanVienCNDTO>(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { //LoaiNhanVienDTO loaiNV = new LoaiNhanVienDTO(); int maLoaiNhanVien = Int32.Parse(dt.Rows[i]["MaLoaiNhanVien"].ToString()); string tenLoaiNhanVien = dt.Rows[i]["TenLoaiNhanVien"].ToString(); double luong = Int32.Parse(dt.Rows[i]["Luong"].ToString()); LoaiNhanVienCNDTO loaiNV = new LoaiNhanVienCNDTO(maLoaiNhanVien, tenLoaiNhanVien, luong); list.Add(loaiNV); //NhaHangDTO nhaHang = new NhaHangDTO(maNhaHang, tenNhaHang, diaChi, dienThoai); //list.Add(nhaHang); } } return(list); }
public static DataTable TTNhanVien() { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayNhanVien"; return(DataAccessCode.ExecuteSelectCommand(command)); }
public static ArrayList layDanhSachNguyenLieuTheoMonAn(MonAnDTO monAn) { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayDanhSachNguyenLieuTheoMonAn"; DbParameter param = command.CreateParameter(); param.ParameterName = "@MaMonAn"; param.Value = monAn.MaMonAn; param.DbType = DbType.Int32; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); ArrayList list = new ArrayList(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { MonAn_NguyenLieuDTO dto = new MonAn_NguyenLieuDTO(); dto.NguyenLieu.MaNguyenLieu = Convert.ToInt32(dt.Rows[i]["MaNguyenLieu"]); dto.NguyenLieu.TenNguyenLieu = dt.Rows[i]["TenNguyenLieu"].ToString(); dto.NguyenLieu.DonViTinh = dt.Rows[i]["DonViTinh"].ToString(); dto.SoLuong = Convert.ToInt32(dt.Rows[i]["SoLuong"]); list.Add(dto); } } return(list); }
public static ArrayList timKiemNhaCungCapTheoTenVaTheoTinhTrangGiaoDichCoHoacNgung(string ten, int tinhTrangGiaoDich, int maNhaHang) { DbCommand command = DataAccessCode.CreateCommand(); //command.CommandText = "dbo.timKiemNhaCungCapTheoTenVaTheoTinhTrangGiaoDichCoHoacNgung"; //phantom read //command.CommandText = "dbo.timKiemNhaCungCapTheoTenVaTheoTinhTrangGiaoDichCoHoacNgung"; //dirty //command.CommandText = "dbo.DirtyReadSolvedT1TimKiemNhaCungCapTheoTenVaTheoTinhTrangGiaoDichNgungGiaoDich"; //unrepeat command.CommandText = "dbo.timKiemNhaCungCapTheoTenVaTheoTinhTrangGiaoDichCoHoacNgung"; DbParameter param = command.CreateParameter(); param.ParameterName = "@ten"; param.Value = ten; param.DbType = DbType.String; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@tinhTrangGiaoDich"; param.Value = tinhTrangGiaoDich; param.DbType = DbType.Int32; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@maNhaHang"; param.Value = maNhaHang; param.DbType = DbType.Int32; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); ArrayList list = new ArrayList(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { NhaCungCapDTO dto = new NhaCungCapDTO(); dto.MaNhaCungCap = Convert.ToInt32(dt.Rows[i]["MaNhaCungCap"]); dto.TenNhaCungCap = dt.Rows[i]["TenNhaCungCap"].ToString(); dto.DienThoai = dt.Rows[i]["DienThoai"].ToString(); dto.SoTaiKhoan = dt.Rows[i]["SoTaiKhoan"].ToString(); if (dt.Rows[i]["TongNo"].ToString() != "") { dto.TongNo = Convert.ToDecimal(dt.Rows[i]["TongNo"]); } list.Add(dto); } } return(list); }
public static ArrayList layDanhSachNhaCungCap(int maNhaHang, string ten) { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.layDanhSachNhaCungCap"; DbParameter param = command.CreateParameter(); param.ParameterName = "@maNhaHang"; param.Value = maNhaHang; param.DbType = DbType.Int32; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@ten"; param.Value = ten; param.DbType = DbType.String; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); ArrayList list = new ArrayList(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { NhaCungCapDTO dto = new NhaCungCapDTO(); dto.MaNhaCungCap = Convert.ToInt32(dt.Rows[i]["MaNhaCungCap"]); dto.TenNhaCungCap = dt.Rows[i]["TenNhaCungCap"].ToString(); dto.DienThoai = dt.Rows[i]["DienThoai"].ToString(); dto.SoTaiKhoan = dt.Rows[i]["SoTaiKhoan"].ToString(); if (dt.Rows[i]["TinhTrang"].ToString() != "") { dto.TinhTrangGiaoDich = Convert.ToInt16(dt.Rows[i]["TinhTrang"]); } string a = dt.Rows[i]["TongNo"].ToString(); if (dt.Rows[i]["TongNo"].ToString() != "") { dto.TongNo = Convert.ToDecimal(dt.Rows[i]["TongNo"]); } list.Add(dto); } } return(list); }
internal static int SumNhanVien(int maNH, int loaiTruyXuat) { DbCommand command = DataAccessCode.CreateCommand(); if (loaiTruyXuat == 3) { command.CommandText = "dbo.T58DirtyReadSumNhanVien"; } else if (loaiTruyXuat == 4) { command.CommandText = "dbo.T58DirtyReadSolvedSumNhanVien"; } else { command.CommandText = "dbo.T58SumNhanVien"; } //// create a new parameter DbParameter param = command.CreateParameter(); param.ParameterName = "@MaNhaHang"; if (maNH == 0) { param.Value = 0; } else if (maNH == -1) { param.Value = -1; } else { param.Value = maNH; } param.DbType = DbType.Int32; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); return(Int32.Parse(dt.Rows[0]["Tong"].ToString())); }
public static DataTable LayThongTinNhanVien(/*int maNhaHang*/) { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayDanhSachNhanVien"; //DbParameter para = command.CreateParameter(); //para.ParameterName = "@maNhaHang"; //para.Value = maNhaHang; //para.DbType = DbType.Int32; //command.Parameters.Add(para); //para = command.CreateParameter(); //para.ParameterName = "@maLoaiNhanVien"; //para.Value = maLoaiNhanVien; //para.DbType = DbType.Int32; //command.Parameters.Add(para); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); return(dt); }
public static ArrayList layDanhSachLoaiMonAn() { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayDanhSachLoaiMonAn"; DataTable dt = DataAccessCode.ExecuteSelectCommand(command); ArrayList list = new ArrayList(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { LoaiMonAnDTO r = new LoaiMonAnDTO(); r.MaLoaiMonAn = Int32.Parse(dt.Rows[i]["MaLoaiMonAn"].ToString()); r.TenLoaiMonAn = dt.Rows[i]["TenLoaiMonAn"].ToString(); list.Add(r); } } return(list); }
public static List <BuoiDTO> LayDanhSachBuoi() { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayDanhSachBuoi"; DataTable dt = DataAccessCode.ExecuteSelectCommand(command); List <BuoiDTO> list = new List <BuoiDTO>(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { BuoiDTO buoi = new BuoiDTO(); buoi.MaBuoi = Int32.Parse(dt.Rows[i]["MaBuoi"].ToString()); buoi.TenBuoi = dt.Rows[i]["TenBuoi"].ToString(); list.Add(buoi); } } return(list); }
public static List <NhaHangDTO> LayDanhSachNhaHang() { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayDanhSachNhaHang"; DataTable dt = DataAccessCode.ExecuteSelectCommand(command); List <NhaHangDTO> list = new List <NhaHangDTO>(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { int maNhaHang = Int32.Parse(dt.Rows[i]["MaNhaHang"].ToString()); string tenNhaHang = dt.Rows[i]["TenNhaHang"].ToString(); string diaChi = dt.Rows[i]["DiaChi"].ToString(); string dienThoai = dt.Rows[i]["DienThoai"].ToString(); NhaHangDTO nhaHang = new NhaHangDTO(maNhaHang, tenNhaHang, diaChi, dienThoai); list.Add(nhaHang); } } return(list); }
public static ThongTinTaiKhoanDTO KiemTraDangNhap(string tenDangNhap, string matKhau) { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayThongTinTaiKhoan"; // create parameter UserName DbParameter param = command.CreateParameter(); param.ParameterName = "@UserName"; param.Value = tenDangNhap; param.DbType = DbType.String; command.Parameters.Add(param); //create Parameter Pass param = command.CreateParameter(); param.ParameterName = "@Pass"; param.Value = matKhau; param.DbType = DbType.String; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); //Cho nay ne, neu nhu username hoac pass ko dung thi no tra ve null ak ThongTinTaiKhoanDTO taiKhoan = new ThongTinTaiKhoanDTO(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { taiKhoan.ID = Int32.Parse(dt.Rows[i]["ID"].ToString()); taiKhoan.TenDangNhap = dt.Rows[i]["TenDangNhap"].ToString(); taiKhoan.MatKhau = dt.Rows[i]["MatKhau"].ToString(); taiKhoan.LoaiNhanVien = Int32.Parse(dt.Rows[i]["MaLoaiNhanVien"].ToString()); taiKhoan.MaNhaHang = dt.Rows[i]["MaNhaHang"].ToString(); //taiKhoan.CMND = (dt.Rows[i]["CMND"].ToString()); } return(taiKhoan); } return(null); //Tuc la neu user no nhap ko dung pass hoac username thi minh se tra ve null //=> cai form dang nhap ak, if kq == null thi xa messsagebox ra thui }
public static ArrayList layDanhSachNhaCungCapToiHanDuocThanhToanNoTheoThoiDiemThanhToan(int maNhaHang) { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.layDanhSachNhaCungCapToiHanDuocThanhToanNoTheoThoiDiemThanhToan"; DbParameter param = command.CreateParameter(); param.ParameterName = "@maNhaHang"; param.Value = maNhaHang; param.DbType = DbType.Int32; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); ArrayList list = new ArrayList(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { NhaCungCapDTO dto = new NhaCungCapDTO(); dto.MaNhaCungCap = Convert.ToInt32(dt.Rows[i]["MaNhaCungCap"]); dto.TenNhaCungCap = dt.Rows[i]["TenNhaCungCap"].ToString(); dto.DienThoai = dt.Rows[i]["DienThoai"].ToString(); dto.SoTaiKhoan = dt.Rows[i]["SoTaiKhoan"].ToString(); dto.ThoiDiemThanhToan = dt.Rows[i]["ThoiDiemThanhToan"].ToString(); dto.MaThoiDiemThanhToan = Convert.ToInt32(dt.Rows[i]["MaThoiDiemThanhToan"]); dto.GiaTriDinhMucNo = 0;//hien thi NULL if (dt.Rows[i]["TongNo"].ToString() != "") { dto.TongNo = Convert.ToDecimal(dt.Rows[i]["TongNo"]); } list.Add(dto); } } return(list); }
public static List <LoaiNhanVienDTO> LayDanhSachLoaiNhanVien() { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayDanhSachLoaiNhanVien"; DataTable dt = DataAccessCode.ExecuteSelectCommand(command); List <LoaiNhanVienDTO> list = new List <LoaiNhanVienDTO>(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { LoaiNhanVienDTO loaiNhanVien = new LoaiNhanVienDTO(); loaiNhanVien.MaLoaiNhanVien = Int32.Parse(dt.Rows[i]["MaLoaiNhanVien"].ToString()); loaiNhanVien.TenLoaiNhanVien = dt.Rows[i]["TenLoaiNhanVien"].ToString(); loaiNhanVien.Luong = Decimal.Parse(dt.Rows[i]["Luong"].ToString()); list.Add(loaiNhanVien); } } return(list); }
public static KhoHangDTO layThongTinKhoHangTheoNhaHang(int maNhaHang) { DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.layThongTinKhoHangTheoNhaHang"; DbParameter param = command.CreateParameter(); param.ParameterName = "@maNhaHang"; param.Value = maNhaHang; param.DbType = DbType.Int32; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); KhoHangDTO dto = new KhoHangDTO(); if (dt != null) { dto.MaKhoHang = Convert.ToInt32(dt.Rows[0]["MaKhoHang"]); dto.TenKhoHang = dt.Rows[0]["TenKhoHang"].ToString(); } return(dto); }
public static List <ThongTinTaiKhoanDTO> LayThongTinTaiKhoan(string user, string pass) { // using Data.Common DbCommand command = DataAccessCode.CreateCommand(); command.CommandText = "dbo.LayThongTinTaiKhoan"; // create parameter UserName DbParameter param = command.CreateParameter(); param.ParameterName = "@UserName"; param.DbType = DbType.String; command.Parameters.Add(param); // create Parameter Pass param = command.CreateParameter(); param.ParameterName = "@Pass"; param.DbType = DbType.String; command.Parameters.Add(param); DataTable dt = DataAccessCode.ExecuteSelectCommand(command); // tạo ra list thông tài khoản để lưu các thông tin : List <ThongTinTaiKhoanDTO> list = new List <ThongTinTaiKhoanDTO>(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { ThongTinTaiKhoanDTO taiKhoan = new ThongTinTaiKhoanDTO(); taiKhoan.ID = Int32.Parse(dt.Rows[i]["ID"].ToString()); taiKhoan.TenDangNhap = dt.Rows[i]["TenDangNhap"].ToString(); taiKhoan.MatKhau = dt.Rows[i]["MatKhau"].ToString(); taiKhoan.LoaiNhanVien = Int32.Parse(dt.Rows[i]["LoaiNhanVien"].ToString()); taiKhoan.MaNhaHang = (dt.Rows[i]["MaNhaHang"].ToString()); } } return(list); }
public static TableDetails GetTableDetails(string departmentId) { DbCommand comm = DataAccessCode.CreateCommand(); comm.CommandText = "GetTableDetails"; DbParameter param = comm.CreateParameter(); param.ParameterName = "@MaBan"; param.Value = departmentId; param.DbType = DbType.Int32; comm.Parameters.Add(param); DataTable table = DataAccessCode.ExecuteSelectCommand(comm); TableDetails details = new TableDetails(); if (table.Rows.Count > 0) { details.MaBan = table.Rows[0]["MaBan"].ToString(); details.TenBan = table.Rows[0]["TenBan"].ToString(); } return(details); }