public int AmountDesiredOfInventoryType(string type) { RequestedItem requestedItem; if (RequestedItems.TryGetValue(type, out requestedItem) == false) { return(0); } Inventory inventory; if (DeliveredItems.TryGetValue(type, out inventory) == false) { inventory = null; } return(requestedItem.AmountDesired(inventory)); }
public RequestedItem GetFirstDesiredItem() { foreach (RequestedItem item in RequestedItems.Values) { Inventory inventory; if (DeliveredItems.TryGetValue(item.Type, out inventory) == false) { inventory = null; } if (item.DesiresMore(inventory)) { return(item); } } return(null); }
public bool HasAllMaterial() { if (RequestedItems == null) { return(true); } foreach (RequestedItem item in RequestedItems.Values) { Inventory inventory; if (DeliveredItems.TryGetValue(item.Type, out inventory) == false || item.AmountNeeded(inventory) > 0) { return(false); } } return(true); }