コード例 #1
0
 public IResult UpdateProductionSchedule(IUpdateProductionScheduleParameters parameters)
 {
     try
     {
         return(_productionServiceProvider.UpdateProductionSchedule(parameters));
     }
     catch (Exception ex)
     {
         _exceptionLogger.LogException(ex);
         return(new FailureResult(ex.Message));
     }
 }
コード例 #2
0
        public IResult UpdateProductionSchedule(IUpdateProductionScheduleParameters parameters)
        {
            var parametersResult = parameters.ToParsedParameters();

            if (!parametersResult.Success)
            {
                return(parametersResult.ConvertTo <string>());
            }

            var updateResult = new UpdateProductionScheduleConductor(_productionUnitOfWork).Update(_timeStamper.CurrentTimeStamp, parametersResult.ResultingObject);

            if (!updateResult.Success)
            {
                return(updateResult.ConvertTo <string>());
            }

            _productionUnitOfWork.Commit();

            var productionScheduleKey = updateResult.ResultingObject.ToProductionScheduleKey();

            return(SyncParameters.Using(new SuccessResult <string>(productionScheduleKey), productionScheduleKey));
        }
コード例 #3
0
        internal static IResult <UpdateProductionScheduleParameters> ToParsedParameters(this IUpdateProductionScheduleParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            var productionScheduleKey = KeyParserHelper.ParseResult <IProductionScheduleKey>(parameters.ProductionScheduleKey);

            if (!productionScheduleKey.Success)
            {
                return(productionScheduleKey.ConvertTo <UpdateProductionScheduleParameters>());
            }

            var scheduledItems = new List <UpdateProductionScheduleItemParameters>();

            foreach (var item in parameters.ScheduledItems)
            {
                var parsedItem = item.ToParsedParameters();
                if (!parsedItem.Success)
                {
                    return(parsedItem.ConvertTo <UpdateProductionScheduleParameters>());
                }

                scheduledItems.Add(parsedItem.ResultingObject);
            }

            return(new SuccessResult <UpdateProductionScheduleParameters>(new UpdateProductionScheduleParameters
            {
                Parameters = parameters,
                ProductionScheduleKey = productionScheduleKey.ResultingObject.ToProductionScheduleKey(),
                ScheduledItems = scheduledItems
            }));
        }