/// <summary> /// Thêm thông tin Phiếu Xuất Bán Sỉ /// </summary> /// <param name="PhieuXuat"> /// MaPhieuXuat nvarchar(10) /// NgayXuat smalldatetime /// MaNhanVienBanHang nvarchar(10) /// TongTien float /// DaTra float /// KhachHang nvarchar(255) /// LoaiPhieuXuat nvarchar(100) /// TrangThai int /// </param> public int Them(clsPhieuXuatBanSiDTO PhieuXuatBanSi) { int i = -1; string sql = "sp_InsertPhieuXuatBanSi"; string[] ParameterColection = new string[7]; Object[] valueofParameter = new Object[7]; ParameterColection[0] = "@MaPhieuXuat"; valueofParameter[0] = PhieuXuatBanSi.MaPhieuXuat; ParameterColection[1] = "@NgayXuat"; valueofParameter[1] = PhieuXuatBanSi.NgayXuat; ParameterColection[2] = "@MaNhanVienBanHang"; valueofParameter[2] = PhieuXuatBanSi.NhanVien.MaNhanVien.ToString(); ParameterColection[3] = "@TongTien"; valueofParameter[3] = PhieuXuatBanSi.TongTien; ParameterColection[4] = "@DaTra"; valueofParameter[4] = PhieuXuatBanSi.DaTra; ParameterColection[5] = "@MaKhachHang"; valueofParameter[5] = PhieuXuatBanSi.KhachHang.MaKhachHang; ParameterColection[6] = "@LoaiPhieuXuat"; valueofParameter[6] = "Xuất bán sỉ"; i = sqlServer.writeData(sql, ParameterColection, valueofParameter); if (i != -1) { for (int k = 0; k < PhieuXuatBanSi.DS_ChiTietPhieuXuat.Count; k++) { i = ChiTietPhieuXuatDAO.Them(PhieuXuatBanSi.DS_ChiTietPhieuXuat[k]); } } return(i); }
/// <summary> /// Sửa thông tin phiếu xuất bán lẻ /// </summary> /// <param name="PhieuXuat"> /// MaPhieuXuat nvarchar(10) /// NgayXuat smalldatetime /// MaNhanVienBanHang nvarchar(10) /// TongTien float /// DaTra float /// KhachHang nvarchar(255) /// LoaiPhieuXuat nvarchar(100) /// TrangThai int /// </param> public int Sua(clsPhieuXuatBanLeDTO PhieuXuatBanLe) { int i = -1; string sql = "sp_UpdatePhieuXuatBanLe"; string[] ParameterColection = new string[6]; Object[] valueofParameter = new Object[6]; ParameterColection[0] = "@MaPhieuXuat"; valueofParameter[0] = PhieuXuatBanLe.MaPhieuXuat; ParameterColection[1] = "@NgayXuat"; valueofParameter[1] = PhieuXuatBanLe.NgayXuat; ParameterColection[2] = "@MaNhanVienBanHang"; valueofParameter[2] = PhieuXuatBanLe.NhanVien.MaNhanVien.ToString(); ParameterColection[3] = "@TongTien"; valueofParameter[3] = PhieuXuatBanLe.TongTien; ParameterColection[4] = "@DaTra"; valueofParameter[4] = PhieuXuatBanLe.DaTra; ParameterColection[5] = "@KhachBanLe"; valueofParameter[5] = PhieuXuatBanLe.KhachHang; i = sqlServer.writeData(sql, ParameterColection, valueofParameter); if (i != -1) { for (int k = 0; k < PhieuXuatBanLe.DS_ChiTietPhieuXuat.Count; k++) { i = ChiTietPhieuXuatDAO.Them(PhieuXuatBanLe.DS_ChiTietPhieuXuat[k]); } } return(i); }
/// <summary> /// Sửa thông tin phiếu xuất bán Sỉ /// </summary> /// <param name="PhieuXuat"> /// MaPhieuXuat nvarchar(10) /// NgayXuat smalldatetime /// MaNhanVienBanHang nvarchar(10) /// TongTien float /// DaTra float /// KhachHang nvarchar(255) /// LoaiPhieuXuat nvarchar(100) /// TrangThai int /// </param> public int Sua(clsPhieuXuatBanSiDTO PhieuXuatBanSi) { int i = -1; string sql = "sp_UpdatePhieuXuatBanSi"; string[] ParameterColection = new string[6]; Object[] valueofParameter = new Object[6]; ParameterColection[0] = "@MaPhieuXuat"; valueofParameter[0] = PhieuXuatBanSi.MaPhieuXuat; ParameterColection[1] = "@NgayXuat"; valueofParameter[1] = PhieuXuatBanSi.NgayXuat; ParameterColection[2] = "@MaNhanVienBanHang"; valueofParameter[2] = PhieuXuatBanSi.NhanVien.MaNhanVien.ToString(); ParameterColection[3] = "@TongTien"; valueofParameter[3] = PhieuXuatBanSi.TongTien; ParameterColection[4] = "@DaTra"; valueofParameter[4] = PhieuXuatBanSi.DaTra; ParameterColection[5] = "@KhachHang"; valueofParameter[5] = PhieuXuatBanSi.KhachHang.MaKhachHang; i = sqlServer.writeData(sql, ParameterColection, valueofParameter); //Thêm mới từng chi tiết phiếu xuất if (i != -1) { for (int k = 0; k < PhieuXuatBanSi.DS_ChiTietPhieuXuat.Count; k++) { if (i != -1) { i = ChiTietPhieuXuatDAO.Them(PhieuXuatBanSi.DS_ChiTietPhieuXuat[k]); } else { break; } } } return(i); }