public IResult Execute(InventoryPickOrder pickOrder) { foreach (var item in pickOrder.Items.ToList()) { _pickOrderUnitOfWork.InventoryPickOrderItemRepository.Remove(item); } return(new SuccessResult()); }
internal static InventoryPickOrder EmptyItems(this InventoryPickOrder pickOrder) { if (pickOrder == null) { throw new ArgumentNullException("pickOrder"); } pickOrder.Items = null; return(pickOrder); }
public IResult Execute(InventoryPickOrder currentPickOrder, List <ISchedulePickOrderItemParameter> newItems) { if (currentPickOrder == null) { throw new ArgumentNullException("currentPickOrder"); } if (newItems == null) { throw new ArgumentNullException("newItems"); } var currentItems = currentPickOrder.Items != null?currentPickOrder.Items.ToList() : new List <InventoryPickOrderItem>(); var scheduledItems = ScheduleInventoryPickOrderItemsHelper.ScheduleStatus(new InventoryPickOrderKey(currentPickOrder), currentItems, newItems); var removeCommand = new RemoveInventoryPickOrderItemCommand(_inventoryPickOrderUnitOfWork); var updateCommand = new UpdateInventoryPickOrderItemCommand(_inventoryPickOrderUnitOfWork); var createCommand = new CreateInventoryPickOrderItemCommand(_inventoryPickOrderUnitOfWork); foreach (var item in scheduledItems.Where(i => i.Status == ScheduledStatus.Remove)) { var removeResult = removeCommand.Execute(item); if (!removeResult.Success) { return(removeResult); } } foreach (var item in scheduledItems.Where(i => i.Status == ScheduledStatus.Update)) { var updateResult = updateCommand.Execute(item); if (!updateResult.Success) { return(updateResult); } } foreach (var item in scheduledItems.Where(i => i.Status == ScheduledStatus.Create)) { var createResult = createCommand.Execute(item); if (!createResult.Success) { return(createResult); } } return(new SuccessResult()); }
public IResult <InventoryPickOrder> Execute(IPickedInventoryKey pickedInventoryKey) { if (pickedInventoryKey == null) { throw new ArgumentNullException("pickedInventoryKey"); } var pickOrder = new InventoryPickOrder { DateCreated = pickedInventoryKey.PickedInventoryKey_DateCreated, Sequence = pickedInventoryKey.PickedInventoryKey_Sequence }; _inventoryPickOrderUnitOfWork.InventoryPickOrderRepository.Add(pickOrder); return(new SuccessResult().ConvertTo(pickOrder)); }
private void ConstrainItemToOrder(InventoryPickOrderItem item, InventoryPickOrder order) { item.DateCreated = order.DateCreated; item.OrderSequence = order.Sequence; }