コード例 #1
0
        private RoadCondition Map(RoadConditionFileRow fileRow)
        {
            var travelRestrictions = MapTravelRestrictions(fileRow);

            double? temperature = null;
            if(!string.IsNullOrWhiteSpace(fileRow.Temperature))
                temperature = double.Parse(fileRow.Temperature);

            return new RoadCondition
            {
                Start = DateTime.Parse(fileRow.DateUpdated),
                End = DateTime.Today,
                RoadConditionText = fileRow.RoadCondition,
                Temperature = temperature,
                Weather = fileRow.Weather,
                TravelRestrictions = travelRestrictions
            };
        }
コード例 #2
0
        private List<TravelRestriction> MapTravelRestrictions(RoadConditionFileRow fileRow)
        {
            var travelRestrictions = new List<TravelRestriction>();

            var eastboundRestriction = MapTravelRestriction(fileRow.RestrictionText1, Direction.Eastbound);
            var westboundRestriction = MapTravelRestriction(fileRow.RestrictionText2, Direction.Westbound);
            travelRestrictions.Add(eastboundRestriction);
            travelRestrictions.Add(westboundRestriction);

            return travelRestrictions;
        }