Ejemplo n.º 1
0
        public void AddWagon(int id)
        {
            var wagon = new Wagon(this, id);

            Wagons.Add(wagon);
            TrainsManager.SaveTrains();
        }
Ejemplo n.º 2
0
 public void DeleteWagon(Wagon wagon)
 {
     if (wagon.Seats.Any(s => s.IsBookedAnyDate()))
     {
         return;
     }
     Wagons.Remove(wagon);
     TrainsManager.SaveTrains();
 }
Ejemplo n.º 3
0
 public Train(TrainsManager trainManager, TrainData trainData)
 {
     TrainsManager = trainManager;
     Id            = trainData.Id;
     Direction     = trainData.Direction;
     Wagons        = new List <Wagon>();
     foreach (var wagonData in trainData.Wagons)
     {
         var wagon = new Wagon(this, wagonData);
         Wagons.Add(wagon);
     }
 }
Ejemplo n.º 4
0
        public User(UserManager userManager, TrainsManager trainsManager, UserData userData)
        {
            Login       = userData.Login;
            Password    = userData.Password;
            IsAdmin     = userData.IsAdmin;
            UserManager = userManager;

            BookedSeats = new List <BookedSeatPair>();
            foreach (var bookedSeatData in userData.BookedSeats)
            {
                var seat = trainsManager.FindSeatByUniqueId(bookedSeatData.Seat.UniqueIdentifier);
                if (seat == null)
                {
                    continue;
                }
                var date = new Date(bookedSeatData.Date);
                BookedSeats.Add(new BookedSeatPair(seat, date));
            }
        }
Ejemplo n.º 5
0
 public UserManager(TrainsManager trainsManager)
 {
     _trainsManager = trainsManager;
 }
Ejemplo n.º 6
0
 public Train(TrainsManager trainManager, string id, string direction)
 {
     TrainsManager = trainManager;
     Id            = id;
     Direction     = direction;
 }