public static string ToDayId(this DaysOfOperation value)
        {
            switch (value)
            {
            case DaysOfOperation.Weekdays: return(Weekdays);

            case DaysOfOperation.Weekend: return(Weekend);

            default: throw new ArgumentOutOfRangeException(value.ToString());
            }
        }
Example #2
0
        public ValidityTimeDto GetValidityTime(DaysOfOperation day, Direction direction, int routeId, Season season, VehicleType vehicleType)
        {
            var req  = RequestUriFactory.GetValidityTimeUri(day, direction, routeId, season, vehicleType);
            var resp = HttpGetRequest(req);

            try
            {
                return((ValidityTimeDto)JsonConvert.DeserializeObject(resp.Result, typeof(ValidityTimeDto)));
            }
            catch (Exception)
            {
                return(null);
            }
        }
Example #3
0
        public List <StopDto> GetStops(DaysOfOperation day, Direction direction, int routeId, Season season, VehicleType vehicleType)
        {
            var req  = RequestUriFactory.GetStopsUri(day, direction, routeId, season, vehicleType);
            var resp = HttpGetRequest(req);

            try
            {
                return((List <StopDto>)JsonConvert.DeserializeObject(resp.Result, typeof(List <StopDto>)));
            }
            catch (Exception)
            {
                return(null);
            }
        }
Example #4
0
        public List <DirectionDto> GetDirections(DaysOfOperation day, int routeId)
        {
            var req  = RequestUriFactory.GetDirectionsUri(day, routeId);
            var resp = HttpGetRequest(req);

            try
            {
                return((List <DirectionDto>)JsonConvert.DeserializeObject(resp.Result, typeof(List <DirectionDto>)));
            }
            catch (Exception)
            {
                return(null);
            }
        }
 public static string GetValidityTimeUri(DaysOfOperation day, Direction direction, int routeId, Season season, VehicleType vehicleType)
 {
     return(GetRequestUri(string.Format(ValidityTimeRequestFormat, day.ToDayId(), (byte)direction, routeId, season.ToSeasonId(), (int)vehicleType)));
 }
 public static string GetScheduleUri(DaysOfOperation day, Direction direction, int routeId, Season season, int stopId, VehicleType vehicleType)
 {
     return(GetRequestUri(string.Format(ScheduleRequestFormat, day.ToDayId(), (byte)direction, routeId, season.ToSeasonId(), stopId, (int)vehicleType)));
 }
 public static string GetDirectionsUri(DaysOfOperation day, int routeId)
 {
     return(GetRequestUri(string.Format(DirectionRequestFormat, day.ToDayId(), routeId)));
 }