Example #1
0
 public IResult <IQueryable <IProductionScheduleSummaryReturn> > GetProductionSchedules(FilterProductionScheduleParameters parameters = null)
 {
     try
     {
         return(_productionServiceProvider.GetProductionSchedules(parameters));
     }
     catch (Exception ex)
     {
         _exceptionLogger.LogException(ex);
         return(new FailureResult <IQueryable <IProductionScheduleSummaryReturn> >(null, ex.Message));
     }
 }
Example #2
0
        internal static IResult <ProductionSchedulePredicateBuilder.PredicateBuilderFilters> ToParsedParameters(this FilterProductionScheduleParameters parameters)
        {
            var filterParameters = new ProductionSchedulePredicateBuilder.PredicateBuilderFilters();

            if (parameters != null)
            {
                filterParameters.ProductionDate = parameters.ProductionDate;

                if (!string.IsNullOrWhiteSpace(parameters.ProductionLineLocationKey))
                {
                    var locationKeyResult = KeyParserHelper.ParseResult <ILocationKey>(parameters.ProductionLineLocationKey);
                    if (!locationKeyResult.Success)
                    {
                        return(locationKeyResult.ConvertTo <ProductionSchedulePredicateBuilder.PredicateBuilderFilters>());
                    }

                    filterParameters.ProductionLineLocationKey = locationKeyResult.ResultingObject.ToLocationKey();
                }
            }

            return(new SuccessResult <ProductionSchedulePredicateBuilder.PredicateBuilderFilters>(filterParameters));
        }
Example #3
0
        public IResult <IQueryable <IProductionScheduleSummaryReturn> > GetProductionSchedules(FilterProductionScheduleParameters parameters)
        {
            var parsedParameters = parameters.ToParsedParameters();

            if (!parsedParameters.Success)
            {
                return(parsedParameters.ConvertTo <IQueryable <IProductionScheduleSummaryReturn> >());
            }

            var predicateResult = ProductionSchedulePredicateBuilder.BuildPredicate(parsedParameters.ResultingObject);

            if (!predicateResult.Success)
            {
                return(predicateResult.ConvertTo <IQueryable <IProductionScheduleSummaryReturn> >());
            }

            var results = _productionUnitOfWork.ProductionScheduleRepository
                          .Filter(predicateResult.ResultingObject).Select(ProductionScheduleProjectors.SelectSummary());

            return(new SuccessResult <IQueryable <IProductionScheduleSummaryReturn> >(results));
        }