예제 #1
0
        public Bus(Protobuf.Bus busPB)
        {
            this.Id        = busPB.Id;
            this.Name      = busPB.Name;
            this.CompanyId = busPB.CompanyId;
            this.Type      = busPB.Type;

            this.Company = new Company(busPB.Company);
            this.BusType = new BusType(busPB.BusType);
            this.Trip    = (HashSet <Trip>)busPB.Trip.Select((t => new Trip(t)));
        }
예제 #2
0
        public Protobuf.Bus ToPBMessage()
        {
            Protobuf.Bus busPB = new Protobuf.Bus();
            busPB.Id        = this.Id;
            busPB.Name      = this.Name;
            busPB.CompanyId = this.CompanyId;
            busPB.Type      = this.Type;

            busPB.Company = this.Company.ToPBMessage();
            busPB.BusType = this.BusType.ToPBMessage();

            busPB.Trip.AddRange(this.Trip.Select(t => t.ToPBMessage()));
            return(busPB);
        }