public void AssignOrderToMaster(Order order, User master) { if (!IsAllowedToAssign(order)) { throw new UserFriendlyException(L("NotAllowedToAssignOrder", order.OrderStatus)); } if (order.AssignedMasterId == master.Id) { return; } if (order.OrderStatus == OrderStatus.New) { order.OrderStatus = OrderStatus.InProcess; } order.AssignedMasterId = master.Id; }
public bool IsAllowedToAssign(Order order) { return order.OrderStatus == OrderStatus.New || order.OrderStatus == OrderStatus.AwaitingForParts || order.OrderStatus == OrderStatus.InProcess; }