public bool AddSeat(Objects.VehicleSeat Seat)
 {
     if (Seat.VehicleCode == Code && !Seats.Contains(Seat))
     {
         Seats.Add(Seat);
         return(true);
     }
     return(false);
 }
Beispiel #2
0
 public virtual void RemoveSeat(int seat)
 {
     if (seat <= SeatsCount)
     {
         if (!Seats.Contains(seat))
         {
             Log.LogInfo("seat" + seat + " does not exist.");
         }
         else
         {
             Seats.Remove(seat);
             SnDict.Remove(seat);
             sfinxData[seat - 1] = null;
         }
     }
     else
     {
         Log.LogWarn("seat" + seat + " is Invalid.");
     }
 }
Beispiel #3
0
 public virtual void AddSeat(int seat, string sn)
 {
     if (seat <= SeatsCount)
     {
         if (Seats.Contains(seat))
         {
             Log.LogInfo("seat" + seat + " exists");
         }
         else
         {
             Seats.Add(seat);
             SnDict[seat] = sn;
             SfinxDataCreate(seat, sn);
         }
     }
     else
     {
         Log.LogWarn("seat:" + seat + " is Invalid.");
     }
 }
Beispiel #4
0
        public void MarkSeatsAsReserved(string trainId, BookingReference bookingReference, Seats seats)
        {
            var formerSnapshot        = trainSnapshots[trainId];
            var newSeatsConfiguration = new List <SeatWithBookingReference>(formerSnapshot.OverallTrainCapacity);

            foreach (var seatWithBookingReference in formerSnapshot.SeatsWithBookingReferences)
            {
                if (seats.Contains(seatWithBookingReference.Seat))
                {
                    // must keep the new reservation id for this seat
                    var newBookingReference = new SeatWithBookingReference(seatWithBookingReference.Seat, bookingReference);
                    newSeatsConfiguration.Add(newBookingReference);
                }
                else
                {
                    // keep the former value
                    newSeatsConfiguration.Add(seatWithBookingReference);
                }
            }

            var updatedSnapshot = new TrainSnapshot(trainId, newSeatsConfiguration);

            trainSnapshots[trainId] = updatedSnapshot;
        }