public Slot(int id, int spaceId, SlotSize size, bool isPremium = false) { this.parkingSpaceId = spaceId; this.slotId = id; this.size = size; this.isPremium = isPremium; }
private bool IsFull(SlotSize size) { if (availableSlots.ContainsKey(size)) { return(availableSlots[size].Count == 0); } throw new System.Exception("Slot " + size + " Has not configured in Database"); }
public void CreateSlot(SlotSize size, int count) { if (!availableSlots.ContainsKey(size)) { var queue = new Queue <Slot>(count); for (int i = 0; i < count; i++) { queue.Enqueue(new Slot(i + 1, Id, size)); } availableSlots.Add(size, queue); } }
private string GetParkingId(int spaceId, int slotId, SlotSize size) { return(spaceId + "-" + size + "" + slotId); }
public Vehical(string license, SlotSize size, Color color) { this.licenseNumber = license; this.size = size; this.color = color; }
private Slot GetFreeSlot(SlotSize size) => availableSlots[size].Dequeue();
public int GetFreeSlotCount(SlotSize size) => availableSlots.ContainsKey(size) ? availableSlots[size].Count : 0;