Exemplo n.º 1
0
        public IResult <string> CreateInventoryTreatmentOrder(ICreateTreatmentOrderParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            var parsedParameters = new CreateTreatmentOrderConductorParameters <ICreateTreatmentOrderParameters>(parameters);

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

            var createResult = new CreateTreatmentOrderConductor(_inventoryShipmentOrderUnitOfWork).CreateTreatmentOrder(_timeStamper.CurrentTimeStamp, parsedParameters);

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

            _inventoryShipmentOrderUnitOfWork.Commit();

            var key = createResult.ResultingObject.ToInventoryShipmentOrderKey();

            return(SyncParameters.Using(new SuccessResult <string>(key), new SyncInventoryShipmentOrderParameters
            {
                InventoryShipmentOrderKey = key,
                New = true
            }));
        }
Exemplo n.º 2
0
 public IResult <string> CreateInventoryTreatmentOrder(ICreateTreatmentOrderParameters parameters)
 {
     try
     {
         return(_treatmentOrderServiceProvider.CreateInventoryTreatmentOrder(parameters));
     }
     catch (Exception ex)
     {
         _exceptionLogger.LogException(ex);
         return(new FailureResult <string>(null, ex.Message));
     }
 }