public IEnumerable<ImexCheckModel> GetAllIMEXByFilter(ImexCheckModel model, DateTime dateFrom, DateTime dateTo) { IEnumerable<ImexCheckModel> query = new List<ImexCheckModel>(); query = this.GetAllIMEX(); query = query.Where(p => p.InvoiceDate.Date >= dateFrom.Date.Date && p.InvoiceDate.Date <= dateTo.Date.Date); if (!string.IsNullOrEmpty(model.StoreInPlanNum)) { query = query.Where(p => p.StoreInPlanNum.Contains(model.StoreInPlanNum)); } if (!string.IsNullOrEmpty(model.InvoiceNum)) { query = query.Where(p => p.InvoiceNum.Contains(model.InvoiceNum)); } return query.ToList(); }
private void butSearch_Click(object sender, EventArgs e) { ImexCheckModel model = new ImexCheckModel(); model.StoreInPlanNum = txtStoreInPlanNo.Text.Trim(); model.InvoiceNum = txtInvoiceNo.Text.Trim(); var result = _repo.GetAllIMEXByFilter(model, dtpInvoiceDateFrom.Value, dtpInvoiceDateTo.Value); SetDetail(result); }