Ejemplo n.º 1
0
        internal static IResult <Expression <Func <Contact, bool> > > BuildPredicate(PredicateBuilderFilters filters)
        {
            var predicate = PredicateBuilder.True <Contact>();

            if (filters != null)
            {
                if (filters.CompanyKey != null)
                {
                    predicate = predicate.And(ContactPredicates.ByCompanyKey(filters.CompanyKey).ExpandAll());
                }
            }

            return(new SuccessResult <Expression <Func <Contact, bool> > >(predicate.ExpandAll()));
        }
        internal static IResult <Expression <Func <Company, bool> > > BuildPredicate(PredicateBuilderFilters parameters)
        {
            var predicate = CompanyPredicates.ByIncludeInactive(parameters == null ? false : parameters.IncludeInactive);

            if (parameters != null)
            {
                if (parameters.CompanyType != null)
                {
                    predicate = predicate.And(CompanyPredicates.ByCompanyType(parameters.CompanyType.Value, parameters.IncludeInactive).ExpandAll());
                }

                if (parameters.BrokerKey != null)
                {
                    predicate = predicate.And(CompanyPredicates.ByBrokerKey(parameters.BrokerKey, parameters.IncludeInactive).ExpandAll());
                }
            }

            return(new SuccessResult <Expression <Func <Company, bool> > >(predicate.ExpandAll()));
        }
Ejemplo n.º 3
0
        private static IResult <Expression <Func <Inventory, bool> > > ApplyFilters(Expression <Func <Inventory, bool> > predicate, PredicateBuilderFilters filters, IInventoryUnitOfWork inventoryUnitOfWork)
        {
            if (filters != null)
            {
                if (filters.LotKey != null)
                {
                    predicate = predicate.And(InventoryPredicates.ByLotKey(filters.LotKey.ToLotKey()).ExpandAll());
                }

                if (filters.ProductKey != null)
                {
                    predicate = predicate.And(InventoryPredicates.ByProductKey(filters.ProductKey.ToProductKey(), inventoryUnitOfWork).ExpandAll());
                }

                if (filters.FacilityKey != null)
                {
                    predicate = predicate.And(InventoryPredicates.ByFacilityKey(filters.FacilityKey.ToFacilityKey()).ExpandAll());
                }

                if (filters.ProductType != null)
                {
                    predicate = predicate.And(InventoryPredicates.ByProductType(filters.ProductType.Value, inventoryUnitOfWork).ExpandAll());
                }

                if (filters.LotType != null)
                {
                    predicate = predicate.And(InventoryPredicates.ByLotType(filters.LotType.Value).ExpandAll());
                }

                if (filters.HoldType != null)
                {
                    predicate = predicate.And(InventoryPredicates.ByLotHoldType(filters.HoldType.Value).ExpandAll());
                }

                if (filters.ToteKey != null)
                {
                    predicate = predicate.And(InventoryPredicates.ByToteKey(filters.ToteKey).ExpandAll());
                }

                if (filters.AdditiveTypeKey != null)
                {
                    predicate = predicate.And(InventoryPredicates.ByAdditiveTypeKey(filters.AdditiveTypeKey.ToAdditiveTypeKey()).ExpandAll());
                }

                if (filters.TreatmentKey != null)
                {
                    predicate = predicate.And(InventoryPredicates.ByTreatment(filters.TreatmentKey.ToInventoryTreatmentKey()).ExpandAll());
                }

                if (filters.PackagingKey != null)
                {
                    predicate = predicate.And(InventoryPredicates.ByPackaging(filters.PackagingKey.ToPackagingProductKey()).ExpandAll());
                }

                if (filters.PackagingReceivedKey != null)
                {
                    predicate = predicate.And(InventoryPredicates.ByPackagingReceived(filters.PackagingReceivedKey.ToPackagingProductKey()).ExpandAll());
                }

                if (filters.LocationKey != null)
                {
                    predicate = predicate.And(InventoryPredicates.ByLocationKey(filters.LocationKey.ToLocationKey()).ExpandAll());
                }

                if (filters.LocationGroupName != null)
                {
                    predicate = predicate.And(InventoryPredicates.ByLocationDescription(filters.LocationGroupName).ExpandAll());
                }
            }

            return(new SuccessResult <Expression <Func <Inventory, bool> > >(predicate.ExpandAll()));
        }
Ejemplo n.º 4
0
 internal static IResult <Expression <Func <Inventory, bool> > > BuildPredicate(IInventoryUnitOfWork inventoryUnitOfWork, PredicateBuilderFilters filters, IEnumerable <Expression <Func <Inventory, bool> > > predicates)
 {
     return(BuildPredicate(inventoryUnitOfWork, filters, predicates == null ? null : predicates.ToArray()));
 }
Ejemplo n.º 5
0
        internal static IResult <Expression <Func <Inventory, bool> > > BuildPredicate(IInventoryUnitOfWork inventoryUnitOfWork, PredicateBuilderFilters filters, params Expression <Func <Inventory, bool> >[] predicates)
        {
            if (inventoryUnitOfWork == null)
            {
                throw new ArgumentNullException("inventoryUnitOfWork");
            }

            var predicate = PredicateBuilder.True <Inventory>();

            if (predicates != null)
            {
                predicate = predicates.Aggregate(predicate, (c, p) => c.And(p.ExpandAll()));
            }

            return(ApplyFilters(predicate, filters, inventoryUnitOfWork));
        }
        internal static IResult <Expression <Func <Contract, bool> > > BuildPredicate(PredicateBuilderFilters filters)
        {
            var predicate = PredicateBuilder.True <Contract>();

            if (filters != null)
            {
                if (filters.CustomerKey != null)
                {
                    predicate = predicate.And(ContractPredicates.ByCustomerKey(filters.CustomerKey).ExpandAll());
                }

                if (filters.BrokerKey != null)
                {
                    predicate = predicate.And(ContractPredicates.ByBrokerKey(filters.BrokerKey.ToCompanyKey()).ExpandAll());
                }

                if (filters.ContractStatus != null)
                {
                    predicate = predicate.And(ContractPredicates.ByContractStatus(filters.ContractStatus.Value).ExpandAll());
                }

                if (filters.TermBeginRangeStart != null || filters.TermBeginRangeEnd != null)
                {
                    predicate = predicate.And(ContractPredicates.ByTermBeginInRange(filters.TermBeginRangeStart, filters.TermBeginRangeEnd).ExpandAll());
                }
            }

            return(new SuccessResult <Expression <Func <Contract, bool> > >(predicate.ExpandAll()));
        }
Ejemplo n.º 7
0
        internal static IResult <Expression <Func <ProductionSchedule, bool> > > BuildPredicate(PredicateBuilderFilters filters)
        {
            var predicate = PredicateBuilder.True <ProductionSchedule>();

            if (filters != null)
            {
                if (filters.ProductionDate != null)
                {
                    predicate = predicate.And(ProductionSchedulePredicates.ByProductionDate(filters.ProductionDate.Value).ExpandAll());
                }

                if (filters.ProductionLineLocationKey != null)
                {
                    predicate = predicate.And(ProductionSchedulePredicates.ByProductionLineLocationKey(filters.ProductionLineLocationKey).ExpandAll());
                }
            }

            return(new SuccessResult <Expression <Func <ProductionSchedule, bool> > >(predicate.ExpandAll()));
        }
        internal static IResult <Expression <Func <SalesOrder, bool> > > BuildPredicate(ISalesUnitOfWork salesUnitOfWork, PredicateBuilderFilters filters)
        {
            if (salesUnitOfWork == null)
            {
                throw new ArgumentNullException("salesUnitOfWork");
            }

            var predicate = PredicateBuilder.True <SalesOrder>();

            if (filters != null)
            {
                if (filters.SalesOrderStatus != null)
                {
                    predicate = predicate.And(CustomerOrderPredicates.ByCustomerOrderStatus(filters.SalesOrderStatus.Value).ExpandAll());
                }

                if (filters.OrderReceivedRangeStart != null || filters.OrderReceivedRangeEnd != null)
                {
                    predicate = predicate.And(CustomerOrderPredicates.ByDateOrderReceivedInRange(filters.OrderReceivedRangeStart, filters.OrderReceivedRangeEnd).ExpandAll());
                }

                if (filters.ScheduledShipDateRangeStart != null || filters.ScheduledShipDateRangeEnd != null)
                {
                    predicate = predicate.And(CustomerOrderPredicates.ByScheduledShipDateInRange(filters.ScheduledShipDateRangeStart, filters.ScheduledShipDateRangeEnd).ExpandAll());
                }

                if (filters.CustomerKey != null)
                {
                    predicate = predicate.And(CustomerOrderPredicates.ByCustomer(new CustomerKey(filters.CustomerKey)).ExpandAll());
                }

                if (filters.BrokerKey != null)
                {
                    predicate = predicate.And(CustomerOrderPredicates.ByBrokeyKey(new CompanyKey(filters.BrokerKey)).ExpandAll());
                }
            }

            return(new SuccessResult <Expression <Func <SalesOrder, bool> > >(predicate.ExpandAll()));
        }
        public static IResult <Expression <Func <SampleOrder, bool> > > BuildPredicate(PredicateBuilderFilters filters)
        {
            var predicate = PredicateBuilder.True <SampleOrder>();

            if (filters != null)
            {
                if (filters.DateReceivedStart != null || filters.DateReceivedEnd != null)
                {
                    predicate = predicate.And(SampleOrderPredicates.ByDateReceived(filters.DateReceivedStart, filters.DateReceivedEnd).ExpandAll());
                }

                if (filters.DateCompletedStart != null || filters.DateCompletedEnd != null)
                {
                    predicate = predicate.And(SampleOrderPredicates.ByDateCompleted(filters.DateCompletedStart, filters.DateCompletedEnd).ExpandAll());
                }

                if (filters.Status != null)
                {
                    predicate = predicate.And(SampleOrderPredicates.ByStatus(filters.Status.Value).ExpandAll());
                }

                if (filters.RequestedCustomerKey != null)
                {
                    predicate = predicate.And(SampleOrderPredicates.ByRequestCustomer(filters.RequestedCustomerKey).ExpandAll());
                }

                if (filters.BrokerKey != null)
                {
                    predicate = predicate.And(SampleOrderPredicates.ByBroker(filters.BrokerKey).ExpandAll());
                }
            }

            return(new SuccessResult().ConvertTo(predicate.ExpandAll()));
        }
Ejemplo n.º 10
0
        internal static IResult <Expression <Func <InventoryAdjustment, bool> > > BuildPredicate(PredicateBuilderFilters parameters = null)
        {
            var predicate = PredicateBuilder.True <InventoryAdjustment>();

            if (parameters != null)
            {
                if (parameters.LotKey != null)
                {
                    predicate = predicate.And(InventoryAdjustmentPredicates.ByLotKey(parameters.LotKey).ExpandAll());
                }

                if (parameters.AdjustmentDateRangeStart != null || parameters.AdjustmentDateRangeEnd != null)
                {
                    predicate = predicate.And(InventoryAdjustmentPredicates.ByTimeStampRange(parameters.AdjustmentDateRangeStart, parameters.AdjustmentDateRangeEnd).ExpandAll());
                }
            }

            return(new SuccessResult <Expression <Func <InventoryAdjustment, bool> > >(predicate.ExpandAll()));
        }
Ejemplo n.º 11
0
        internal static IResult <Expression <Func <SalesQuote, bool> > > BuildPredicate(PredicateBuilderFilters filters)
        {
            var predicate = PredicateBuilder.True <SalesQuote>();

            if (filters != null)
            {
                if (filters.CustomerKey != null)
                {
                    predicate = predicate.And(SalesQuotePredicates.ByCustomerKey(filters.CustomerKey).ExpandAll());
                }

                if (filters.BrokerKey != null)
                {
                    predicate = predicate.And(SalesQuotePredicates.ByBrokerKey(filters.BrokerKey).ExpandAll());
                }
            }

            return(new SuccessResult <Expression <Func <SalesQuote, bool> > >(predicate.ExpandAll()));
        }