예제 #1
0
        public BusStation(Protobuf.BusStation busStationPB)
        {
            this.Id         = busStationPB.Id;
            this.Name       = busStationPB.Name;
            this.CityId     = busStationPB.CityId;
            this.Latitude   = Convert.ToDecimal(busStationPB.Latitude);
            this.Longtitude = Convert.ToDecimal(busStationPB.Longtitude);
            this.Default    = busStationPB.Default;

            this.City       = new City(busStationPB.City);
            this.RoutesFrom = (HashSet <Route>)(HashSet <Route>) busStationPB.RoutesFrom.Select(r => new Route(r));
            this.RoutesTo   = (HashSet <Route>)busStationPB.RoutesTo.Select(r => new Route(r));
        }
예제 #2
0
        public TravelReserveCL.Protobuf.BusStation ToPBMessage()
        {
            Protobuf.BusStation busStationPB = new Protobuf.BusStation();
            busStationPB.Id         = this.Id;
            busStationPB.Name       = this.Name;
            busStationPB.CityId     = this.CityId;
            busStationPB.Latitude   = (double)this.Latitude;
            busStationPB.Longtitude = (double)this.Longtitude;
            busStationPB.Default    = this.Default;

            busStationPB.City = this.City.ToPBMessage();
            busStationPB.RoutesFrom.AddRange(this.RoutesFrom.Select(r => r.ToPBMessage()));
            busStationPB.RoutesTo.AddRange(this.RoutesTo.Select(r => r.ToPBMessage()));
            return(busStationPB);
        }