public BindingList <PhieuBanHang_DTO> Search(int sophieu, int makh, string tenkh, string ngayban, string ngaythanhtoan, decimal tongtienmin, decimal tongtienmax, decimal sotientramin, decimal sotientramax) { IEnumerable <MPhieuBanHang_SearchResult> phieuban; phieuban = datacontext.MPhieuBanHang_Search(sophieu, makh, tenkh, DateTime.Parse(ngayban), DateTime.Parse(ngaythanhtoan), tongtienmin, tongtienmax, sotientramin, sotientramax ); var myquery = (from x in phieuban select new PhieuBanHang_DTO { SoPhieuBan = x.SoPhieuBan, MaKH = x.MaKH.GetValueOrDefault(), TenKh = x.TenKh, NgayBan = x.NgayBan.Value.ToShortDateString(), NgayThanhToan = x.NgayThanhToan.Value.ToShortDateString(), TongTien = x.TongTien.GetValueOrDefault(), SoTienTra = x.SoTienTra.GetValueOrDefault() }); var r = new BindingList <PhieuBanHang_DTO>(myquery.ToList()); return(r); }