Ejemplo n.º 1
0
 public Slot(int id, int spaceId, SlotSize size, bool isPremium = false)
 {
     this.parkingSpaceId = spaceId;
     this.slotId         = id;
     this.size           = size;
     this.isPremium      = isPremium;
 }
Ejemplo n.º 2
0
 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");
 }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
 private string GetParkingId(int spaceId, int slotId, SlotSize size)
 {
     return(spaceId + "-" + size + "" + slotId);
 }
Ejemplo n.º 5
0
 public Vehical(string license, SlotSize size, Color color)
 {
     this.licenseNumber = license;
     this.size          = size;
     this.color         = color;
 }
Ejemplo n.º 6
0
 private Slot GetFreeSlot(SlotSize size) => availableSlots[size].Dequeue();
Ejemplo n.º 7
0
 public int GetFreeSlotCount(SlotSize size) => availableSlots.ContainsKey(size) ?
 availableSlots[size].Count : 0;