Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        public virtual ActionResult GetDetails([DataSourceRequest] DataSourceRequest request, SupplierSearchModel searchModel)
        {
            var list = GetDetail(searchModel);

            return(Json(list.ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
        }