private IQueryable <SupplierDto> GetDetail(SupplierSearchModel searchModel) { IQueryable <SupplierDto> list = null; if (!searchModel.HasAnyValue()) { list = _supplierService.GetAll(); } else { var predicate = PredicateBuilder.True <SupplierDto>(); if (!searchModel.SupplierCode.IsNull()) { predicate = predicate.And(c => c.SupplierCode.Contains(searchModel.SupplierCode)); } if (!searchModel.SupplierName.IsNull()) { predicate = predicate.And(c => c.SupplierName.Contains(searchModel.SupplierName)); } list = _supplierService.GetAll().AsExpandable().Where(predicate); } return(list); }
public List <Supplier> SuppliersSearch(SupplierSearchModel sup) { using (OrmocIMSEntities context = new OrmocIMSEntities()) { var search = context.Suppliers.Where(x => (x.SupplierName.Contains(sup.SupplierName) || sup.SupplierName == null) && (x.SupplierAddress.Contains(sup.SupplierAddress) || sup.SupplierAddress == null)).ToList(); return(search); } }
public List <SupplierModel> SuppliersSearch(SupplierSimpleSearchModel sup) { SupplierSearchModel query = new SupplierSearchModel(); query.SupplierName = sup.SupplierName; query.SupplierAddress = sup.SupplierAddress; var result = _supplierDataAccess.SuppliersSearch(query).Select(x => MapSupplierToSupplierModel(x)).ToList(); return(result); }
private IQueryable <SupplierDto> GetSupplier(SupplierSearchModel searchModel = null) { IQueryable <SupplierDto> list = null; if (searchModel.IsNull()) { list = _supplierService.GetAll(); } else { var predicate = PredicateBuilder.True <SupplierDto>(); var hasOtherFilter = false; if (!searchModel.SupplierCode.IsNull()) { hasOtherFilter = true; predicate = predicate.And(s => s.SupplierCode.Contains(searchModel.SupplierCode)); } if (!searchModel.SupplierName.IsNull()) { hasOtherFilter = true; predicate = predicate.And(s => s.SupplierName.Contains(searchModel.SupplierName)); } if (!searchModel.isActive.IsNull()) { hasOtherFilter = true; if (searchModel.isActive == "true") { predicate = predicate.And(a => a.IsActive); } else { predicate = predicate.And(a => !a.IsActive); } } list = _supplierService.GetAll().AsExpandable().Where(predicate); } return(list); }
public virtual ActionResult GetDetails([DataSourceRequest] DataSourceRequest request, SupplierSearchModel searchModel) { var list = GetDetail(searchModel); return(Json(list.ToDataSourceResult(request), JsonRequestBehavior.AllowGet)); }