/// <summary> /// Parses a WTTTimwTableSurrogate object into a WTTTimeTable Object /// </summary> /// <param name="SurrogateWTTTimeTable">The source WTTTimwTableSurrogate object</param> private void ParseSurrogateWTTTimeTable(WTTTimeTableSurrogate SurrogateWTTTimeTable) { this._StartDate = SurrogateWTTTimeTable.StartDate; this.Headcode = SurrogateWTTTimeTable.Headcode; this.UID = SurrogateWTTTimeTable.UID; this.AccelBrakeIndex = SurrogateWTTTimeTable.AccelBrakeIndex; this.RunAsRequired = SurrogateWTTTimeTable.RunAsRequired; this.RunAsRequiredPercentage = SurrogateWTTTimeTable.RunAsRequiredPercentage; if (SurrogateWTTTimeTable.Delay != null) { this.Delay = new WTTDuration(SurrogateWTTTimeTable.Delay.Seconds); } if (SurrogateWTTTimeTable.DepartTime != null) { this.DepartTime = new WTTTime(SurrogateWTTTimeTable.DepartTime.Seconds); } this.Description = SurrogateWTTTimeTable.Description; this.SeedingGap = SurrogateWTTTimeTable.SeedingGap; this.EntryPoint = SurrogateWTTTimeTable.EntryPoint; this.EntryDecision = SurrogateWTTTimeTable.EntryDecision; this.EntryChoice = SurrogateWTTTimeTable.EntryChoice; this.ActualEntryPoint = SurrogateWTTTimeTable.ActualEntryPoint; this.MaxSpeed = SurrogateWTTTimeTable.MaxSpeed; this.SpeedClass = SurrogateWTTTimeTable.SpeedClass; this.Started = SurrogateWTTTimeTable.Started; this.TrainLength = SurrogateWTTTimeTable.TrainLength; this.Electrification = SurrogateWTTTimeTable.Electrification; this.OriginName = SurrogateWTTTimeTable.OriginName; this.DestinationName = SurrogateWTTTimeTable.DestinationName; this.OriginTime = SurrogateWTTTimeTable.OriginTime; this.DestinationTime = SurrogateWTTTimeTable.DestinationTime; this.OperatorCode = SurrogateWTTTimeTable.OperatorCode; this.NonARSOnEntry = SurrogateWTTTimeTable.NonARSOnEntry; this.RunAsRequiredTested = SurrogateWTTTimeTable.RunAsRequiredTested; this.StartTraction = SurrogateWTTTimeTable.StartTraction; this.SimSigTrainCategoryID = SurrogateWTTTimeTable.SimSigTrainCategoryID; this.Trip = new WTTTripCollection(SurrogateWTTTimeTable.StartDate); foreach (WTTTrip Trip in SurrogateWTTTimeTable.Trip.ToList()) { this.Trip.Add(new WTTTrip(Trip.ToSurrogateWTTTrip())); } }
/// <summary> /// Override method to deserialize a JSON string into a WTTTimeTable /// </summary> /// <returns></returns> public override object ReadJson(JsonReader Reader, Type ObjectType, object ExistingValue, JsonSerializer Serializer) { //Validate Arguments if (Serializer == null) { throw new ArgumentNullException(ExceptionHelper.GetStaticException("GeneralNullArgument", new string[] { "Serializer" }, Globals.UserSettings.GetCultureInfo())); } if (Reader == null) { throw new ArgumentNullException(ExceptionHelper.GetStaticException("GeneralNullArgument", new string[] { "Reader" }, Globals.UserSettings.GetCultureInfo())); } //Deserialize reader into surrogate object WTTTimeTableSurrogate SurrogateTimeTable = Serializer.Deserialize <WTTTimeTableSurrogate>(Reader); return(new WTTTimeTable(SurrogateTimeTable)); }
/// <summary> /// Instantiates a new WTTTimeTable object from a WTTTimeTableSurrogate object /// </summary> /// <param name="SurrogateWTTTimeTable">The source WTTTimeTableSurrogate object</param> internal WTTTimeTable(WTTTimeTableSurrogate SurrogateWTTTimeTable) { this.ParseSurrogateWTTTimeTable(SurrogateWTTTimeTable); }