public IResult <string> CreateWarehouseOrder(ISetOrderParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            var parsedParameters = new SetInventoryShipmentOrderConductorParameters <ISetOrderParameters>(parameters);

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

            var createResult = new CreateInterWarehouseOrderConductor(_inventoryShipmentOrderUnitOfWork).Create(_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
            }));
        }
示例#2
0
 public IResult <string> CreateWarehouseOrder(ISetOrderParameters parameters)
 {
     try
     {
         return(_warehouseOrderServiceProvider.CreateWarehouseOrder(parameters));
     }
     catch (Exception ex)
     {
         _exceptionLogger.LogException(ex);
         return(new FailureResult <string>(null, ex.Message));
     }
 }