public static List<P_DonDatHang> find(oDonDatHang obj) { using (var model = ModelConnector.Connector()) { var list = from lst in model.P_DonDatHang select lst; if (!string.IsNullOrEmpty(obj.SoDonDatHang)) list = list.Where(lst => lst.SoDonDatHang.Contains(obj.SoDonDatHang)); if (!string.IsNullOrEmpty(obj.F_NgayDatHang.ToString())) list = list.Where(lst => lst.NgayDatHang >= obj.F_NgayDatHang); if (!string.IsNullOrEmpty(obj.T_NgayDatHang.ToString())) list = list.Where(lst => lst.NgayDatHang <= obj.T_NgayDatHang); if (!string.IsNullOrEmpty(obj.SoHoaDon)) list = list.Where(lst => lst.SoHoaDon == obj.SoHoaDon); return list.ToList(); } }
List<P_DonDatHang> lstDDH() { objDonDatHang = new oDonDatHang(); objDonDatHang.SoDonDatHang = txtSoDonDatHang.Text; if (chkFDate.Checked) objDonDatHang.F_NgayDatHang = Utils_DateTime.FromDate(dateF.DateTime); if (chkTDate.Checked) objDonDatHang.T_NgayDatHang = Utils_DateTime.ToDate(dateT.DateTime); return ADonDatHang.find(objDonDatHang); }