public static int KTHoaDon(string Ma_Ban) { try { string sQuery = string.Format("Select Ma_Hoa_Don From Hoa_Don where Ma_Ban = '{0}' and Tinh_Trang = 'C'", Ma_Ban); sProvider = new Provider(); DataTable dt = sProvider.GetData(sQuery); //List<HoaDon_DTO> HD = new List<HoaDon_DTO>(); HoaDon_DTO hd = new HoaDon_DTO(); if (dt.Rows.Count > 0) { //HoaDon_DTO a = new HoaDon_DTO(dt.Rows[0]); hd.Ma_Hoa_Don = Int32.Parse(dt.Rows[0][0].ToString()); return(hd.Ma_Hoa_Don); } else { return(-1); } } catch (Exception ex) { throw; } }
public static List <NhanVien_DTO> List_NV() { string Squery = "exec proc_LoadNV"; sprovider = new Provider(); DataTable dt = sprovider.GetData(Squery); List <NhanVien_DTO> NV = new List <NhanVien_DTO>(); for (int i = 0; i < dt.Rows.Count; i++) { NhanVien_DTO N = new NhanVien_DTO(); N.MaNV = dt.Rows[i]["Ma_NV"].ToString(); N.TenNV = dt.Rows[i]["Ten_NV"].ToString(); N.NgaySinh = DateTime.Parse(dt.Rows[i]["Ngay_Sinh"].ToString()); N.DiaChi = dt.Rows[i]["Dia_Chi"].ToString(); N.GioiTinh = dt.Rows[i]["Gioi_Tinh"].ToString(); N.Luong = Int32.Parse(dt.Rows[i]["Luong"].ToString()); N.NgayVaoLam = DateTime.Parse(dt.Rows[i]["Ngay_Vao_Lam"].ToString()); N.ChucVu = dt.Rows[i]["Chuc_Vu"].ToString(); N.Email = dt.Rows[i]["Email"].ToString(); N.SDT = dt.Rows[i]["SDT"].ToString(); NV.Add(N); } return(NV); }
public static int TongTien_All2(DoanhThu_DTO DT) { string sQuery = string.Format("exec [proc_TongTien_All2] @NgayHT = '{0}'", DT.Ngay_Hien_Tai); sprovider = new Provider(); DataTable dt = sprovider.GetData(sQuery); for (int i = 0; i < dt.Rows.Count; i++) { DT.TongThanhTien = Int32.Parse(dt.Rows[0][0].ToString()); } return(DT.TongThanhTien); }
public static List <ChiTietHD_DTO> List_CTHD(int Ma_HD) { string sQuery = string.Format("select * from Chi_Tiet_Hoa_Don where Ma_Hoa_Don = {0}", Ma_HD); sprovider = new Provider(); DataTable dt = sprovider.GetData(sQuery); List <ChiTietHD_DTO> lisChiTiet = new List <ChiTietHD_DTO>(); for (int i = 0; i < dt.Rows.Count; i++) { ChiTietHD_DTO ct = new ChiTietHD_DTO(); ct.TenSP = dt.Rows[i]["TenSP"].ToString(); ct.SoLuong = Int32.Parse(dt.Rows[i]["So_Luong"].ToString()); lisChiTiet.Add(ct); } return(lisChiTiet); }
public static List <cbxAdd> List_Ban() { string sQuery = "Select Ma_Ban,Ten_Ban from Ban"; sprovider = new Provider(); DataTable dt = sprovider.GetData(sQuery); List <cbxAdd> ListBan = new List <cbxAdd>(); for (int i = 0; i < dt.Rows.Count; i++) { cbxAdd Ban = new cbxAdd(); Ban.Ma_Ban = dt.Rows[i]["Ma_Ban"].ToString(); Ban.Ten_Ban = dt.Rows[i]["Ten_Ban"].ToString(); ListBan.Add(Ban); } return(ListBan); }
public static int TongTienBan2(DoanhThu_DTO DT) { try { string sQuery = string.Format("exec proc_TongTienBan2 @TenBan = '{0}',@NgayHT = '{1}'", DT.Ten_Ban, DT.Ngay_Hien_Tai); sprovider = new Provider(); DataTable dt = sprovider.GetData(sQuery); for (int i = 0; i < dt.Rows.Count; i++) { DT.TongThanhTien = int.Parse(dt.Rows[0][0].ToString()); } } catch (Exception ex) { DT.Error = ex.ToString(); } return(DT.TongThanhTien); }
public static int TongTienBan(DoanhThu_DTO DT) { try { string sQuery = string.Format("exec [proc_TongTienBan] @TenBan = '{0}',@NgayDau = '{1}',@NgayCuoi='{2}'", DT.Ten_Ban, DT.Ngay_Dau, DT.Ngay_cuoi); sprovider = new Provider(); DataTable dt = sprovider.GetData(sQuery); for (int i = 0; i < dt.Rows.Count; i++) { DT.TongThanhTien_First = Int32.Parse(dt.Rows[0][0].ToString()); } } catch (Exception ex) { DT.Error_First = ex.ToString(); } return(DT.TongThanhTien_First); }
public static List <ShowHoaDown_DTO> Show_HD(string Ma_Ban, int MaHD) { string sQuery = string.Format("select Hoa_Don.Ma_Hoa_Don,MENU.Ten_SP, Chi_Tiet_Hoa_Don.So_Luong,MENU.DVT,Chi_Tiet_Hoa_Don.So_Luong*MENU.Don_Gia As N'Thanh_Tien' from Ban join Hoa_Don on Ban.Ma_Ban = Hoa_Don.Ma_Ban join Chi_Tiet_Hoa_Don on Hoa_Don.Ma_Hoa_Don = Chi_Tiet_Hoa_Don.Ma_Hoa_Don join MENU on Chi_Tiet_Hoa_Don.Ma_SP = MENU.Ma_SP Where Hoa_Don.Tinh_Trang = 'C' and Ban.Ma_Ban = '{0}' and Hoa_Don.Ma_Hoa_Don = {1}", Ma_Ban, MaHD); sprovider = new Provider(); DataTable dt = sprovider.GetData(sQuery); List <ShowHoaDown_DTO> List_HD = new List <ShowHoaDown_DTO>(); for (int i = 0; i < dt.Rows.Count; i++) { ShowHoaDown_DTO Show = new ShowHoaDown_DTO(); Show.MaHD = Int32.Parse(dt.Rows[i]["Ma_Hoa_Don"].ToString()); Show.Ten_Mon = dt.Rows[i]["Ten_SP"].ToString(); Show.So_Luong = Int32.Parse(dt.Rows[i]["So_Luong"].ToString()); Show.DVT = dt.Rows[i]["DVT"].ToString(); Show.Tong_Tien = Int32.Parse(dt.Rows[i]["Thanh_Tien"].ToString()); List_HD.Add(Show); } return(List_HD); }
public static List <Menu_DTO> List_All() { string sQuery = "Select * From MENU "; sprovider = new Provider(); DataTable dt = sprovider.GetData(sQuery); List <Menu_DTO> Menu_DTO = new List <DTO.Menu_DTO>(); for (int i = 0; i < dt.Rows.Count; i++) { Menu_DTO Me = new Menu_DTO(); Me.MaSP = dt.Rows[i]["Ma_SP"].ToString(); Me.TenSP = dt.Rows[i]["Ten_SP"].ToString(); Me.LoaiSP = dt.Rows[i]["Loai_SP"].ToString(); Me.DVT = dt.Rows[i]["DVT"].ToString(); Me.DonGia = Int32.Parse(dt.Rows[i]["Don_Gia"].ToString()); Menu_DTO.Add(Me); } return(Menu_DTO); }
public static List <Menu_DTO> ListSearch_3(Menu_DTO Searching) { string sQuery = string.Format("Select * From MENU where Loai_SP like N'Dịch Vụ' and Ten_SP like N'%{0}%'", Searching.TenSP); sprovider = new Provider(); DataTable dt = sprovider.GetData(sQuery); List <Menu_DTO> Menu_DTO = new List <DTO.Menu_DTO>(); for (int i = 0; i < dt.Rows.Count; i++) { Menu_DTO Me = new Menu_DTO(); Me.MaSP = dt.Rows[i]["Ma_SP"].ToString(); Me.TenSP = dt.Rows[i]["Ten_SP"].ToString(); Me.LoaiSP = dt.Rows[i]["Loai_SP"].ToString(); Me.DVT = dt.Rows[i]["DVT"].ToString(); Me.DonGia = Int32.Parse(dt.Rows[i]["Don_Gia"].ToString()); Menu_DTO.Add(Me); } return(Menu_DTO); }
public static int GetMaHD() { try { string sQuery = "Select Max(Ma_Hoa_Don) From Hoa_Don "; sprovider = new Provider(); //int i = Convert.ToInt32(sprovider.ExcuteScalar(sQuery)); //return i; DataTable dt = sprovider.GetData(sQuery); int i = Int32.Parse(dt.Rows[0][0].ToString()); return(i); } catch (Exception ex) { throw ex; } finally { } }
public static List <DoanhThu_DTO> List_ALL(DoanhThu_DTO DT) { string sQuery = string.Format("exec [proc_All] @NgayDau = '{0}',@NgayCuoi='{1}'", DT.Ngay_Dau, DT.Ngay_cuoi); sprovider = new Provider(); DataTable dt = sprovider.GetData(sQuery); List <DoanhThu_DTO> DoanhThu = new List <DoanhThu_DTO>(); for (int i = 0; i < dt.Rows.Count; i++) { DoanhThu_DTO d = new DoanhThu_DTO(); d.Ten_Ban = dt.Rows[i]["Ten_Ban"].ToString(); d.Ngay_Lap = DateTime.Parse(dt.Rows[i]["Ngay_Lap"].ToString()); d.Ten_SP = dt.Rows[i]["Ten_SP"].ToString(); d.Loai = dt.Rows[i]["Loai_SP"].ToString(); d.Thanh_Tien = Int32.Parse(dt.Rows[i]["ThanhTien"].ToString()); DoanhThu.Add(d); } return(DoanhThu); }
//ban public static List <Ban_DTO> List_Ban() { string sQuery = "select * from Ban "; sprovider = new Provider(); DataTable dt = sprovider.GetData(sQuery); List <Ban_DTO> list_ban = new List <Ban_DTO>(); for (int i = 0; i < dt.Rows.Count; i++) { Ban_DTO Ban = new Ban_DTO(); Ban.Ma_Ban = dt.Rows[i]["Ma_Ban"].ToString(); Ban.Tenn_Ban = dt.Rows[i]["Ten_Ban"].ToString(); Ban.Ma_KV = dt.Rows[i]["Ma_KV"].ToString(); Ban.Tinh_Trang = dt.Rows[i]["Tinh_Trang"].ToString(); Ban.So = Int32.Parse(dt.Rows[i]["So_TT"].ToString()); list_ban.Add(Ban); } return(list_ban); }
public static List <TaiKhoan_DTO> List_TK(TaiKhoan_DTO tk) { try { string sQuery = string.Format("exec proc_LoadTK @MANV = '{0}'", tk.Username); sprovider = new Provider(); //var u = sprovider.ExcuteData(sQuery); DataTable dt = sprovider.GetData(sQuery); List <TaiKhoan_DTO> lslTK = new List <TaiKhoan_DTO>(); for (int i = 0; i < dt.Rows.Count; i++) { TaiKhoan_DTO t = new TaiKhoan_DTO(); t.PassWord = dt.Rows[i]["PassWord"].ToString(); t.TenNV = dt.Rows[i]["Ten_NV"].ToString(); t.Chucvu = dt.Rows[i]["Chuc_Vu"].ToString(); lslTK.Add(t); } return(lslTK); } catch (Exception ex) { throw; } }