public IResult <string> CreateProductionSchedule(ICreateProductionScheduleParameters parameters) { try { return(_productionServiceProvider.CreateProductionSchedule(parameters)); } catch (Exception ex) { _exceptionLogger.LogException(ex); return(new FailureResult <string>(null, ex.Message)); } }
public IResult <string> CreateProductionSchedule(ICreateProductionScheduleParameters parameters) { var parametersResult = parameters.ToParsedParameters(); if (!parametersResult.Success) { return(parametersResult.ConvertTo <string>()); } var createResult = new CreateProductionScheduleConductor(_productionUnitOfWork).Create(_timeStamper.CurrentTimeStamp, parametersResult.ResultingObject); if (!createResult.Success) { return(createResult.ConvertTo <string>()); } _productionUnitOfWork.Commit(); var productionScheduleKey = createResult.ResultingObject.ToProductionScheduleKey(); return(SyncParameters.Using(new SuccessResult <string>(productionScheduleKey), productionScheduleKey)); }
internal static IResult <CreateProductionScheduleParameters> ToParsedParameters(this ICreateProductionScheduleParameters parameters) { if (parameters == null) { throw new ArgumentNullException("parameters"); } var locationKey = KeyParserHelper.ParseResult <ILocationKey>(parameters.ProductionLineLocationKey); if (!locationKey.Success) { return(locationKey.ConvertTo <CreateProductionScheduleParameters>()); } return(new SuccessResult <CreateProductionScheduleParameters>(new CreateProductionScheduleParameters { Parameters = parameters, ProductionLocationKey = locationKey.ResultingObject.ToLocationKey() })); }