Example #1
0
 protected Train(TrainInfoHolder trainInfoHolder, string id)
 {
     ID   = id;
     Type = trainInfoHolder.Type;
     DepartureDateTime    = trainInfoHolder.DepartureDateTime;
     OriginStation        = trainInfoHolder.OriginStation;
     DestinationStation   = trainInfoHolder.DestinationStation;
     IntermediateStations = trainInfoHolder.IntermediateStations;
     OffersFirstClass     = trainInfoHolder.OffersFirstClass;
     Cabin = trainInfoHolder.Cabin;
 }
Example #2
0
        /// <summary>
        /// Creates the train.
        /// </summary>
        /// <param name="trainInfoHolder">The train information holder.</param>
        /// <returns></returns>
        public Train CreateTrain(TrainInfoHolder trainInfoHolder)
        {
            var type = trainInfoHolder.Type;


            switch (type)
            {
            case Train.TrainType.Express:
                return(new ExpressTrain(trainInfoHolder, GenerateTrainID("E")));

            case Train.TrainType.Stopping:
                return(new StoppingTrain(trainInfoHolder, GenerateTrainID("I")));

            case Train.TrainType.Sleeper:
                return(new SleeperTrain(trainInfoHolder, GenerateTrainID("S")));

            default:
                return(null);
            }
        }
Example #3
0
 public StoppingTrain(TrainInfoHolder trainInfoHolder, string id) : base(trainInfoHolder, id)
 {
 }
Example #4
0
 public SleeperTrain(TrainInfoHolder trainInfoHolder, string id) : base(trainInfoHolder, id)
 {
 }
Example #5
0
 public ExpressTrain(TrainInfoHolder trainInfoHolder, string id) : base(trainInfoHolder, id)
 {
 }