Example #1
0
        public static TBus ConvertToTBus(Bus bus)
        {
            TBus tbus = new TBus();

            tbus.Id           = bus.id;
            tbus.Name         = bus.name;
            tbus.BedCount     = int.Parse(bus.bed_count.ToString());
            tbus.SeatCount    = int.Parse(bus.seat_count.ToString());
            tbus.SubBedCount  = int.Parse(bus.sub_bed_count.ToString());
            tbus.SubSeatCount = int.Parse(bus.sub_seat_count.ToString());

            return(tbus);
        }
Example #2
0
        public static Bus ConvertToBus(TBus tbus)
        {
            Bus bus = new Bus();

            bus.id             = tbus.Id;
            bus.bed_count      = tbus.BedCount;
            bus.name           = tbus.Name;
            bus.seat_count     = int.Parse(tbus.SeatCount.ToString());
            bus.sub_bed_count  = tbus.SubBedCount;
            bus.sub_seat_count = tbus.SubSeatCount;

            return(bus);
        }
        public void Read(TProtocol iprot)
        {
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.List)
                    {
                        {
                            Configurations = new List <TConfiguration>();
                            TList _list0 = iprot.ReadListBegin();
                            for (int _i1 = 0; _i1 < _list0.Count; ++_i1)
                            {
                                TConfiguration _elem2 = new TConfiguration();
                                _elem2 = new TConfiguration();
                                _elem2.Read(iprot);
                                Configurations.Add(_elem2);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.List)
                    {
                        {
                            SaleTicketDates = new List <TSaleTicketDate>();
                            TList _list3 = iprot.ReadListBegin();
                            for (int _i4 = 0; _i4 < _list3.Count; ++_i4)
                            {
                                TSaleTicketDate _elem5 = new TSaleTicketDate();
                                _elem5 = new TSaleTicketDate();
                                _elem5.Read(iprot);
                                SaleTicketDates.Add(_elem5);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.List)
                    {
                        {
                            TicketPrices = new List <TTicketPrice>();
                            TList _list6 = iprot.ReadListBegin();
                            for (int _i7 = 0; _i7 < _list6.Count; ++_i7)
                            {
                                TTicketPrice _elem8 = new TTicketPrice();
                                _elem8 = new TTicketPrice();
                                _elem8.Read(iprot);
                                TicketPrices.Add(_elem8);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.List)
                    {
                        {
                            TransportPrices = new List <TTransportPrice>();
                            TList _list9 = iprot.ReadListBegin();
                            for (int _i10 = 0; _i10 < _list9.Count; ++_i10)
                            {
                                TTransportPrice _elem11 = new TTransportPrice();
                                _elem11 = new TTransportPrice();
                                _elem11.Read(iprot);
                                TransportPrices.Add(_elem11);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 5:
                    if (field.Type == TType.List)
                    {
                        {
                            GuaranteeFees = new List <TGuaranteeFee>();
                            TList _list12 = iprot.ReadListBegin();
                            for (int _i13 = 0; _i13 < _list12.Count; ++_i13)
                            {
                                TGuaranteeFee _elem14 = new TGuaranteeFee();
                                _elem14 = new TGuaranteeFee();
                                _elem14.Read(iprot);
                                GuaranteeFees.Add(_elem14);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 6:
                    if (field.Type == TType.List)
                    {
                        {
                            Buses = new List <TBus>();
                            TList _list15 = iprot.ReadListBegin();
                            for (int _i16 = 0; _i16 < _list15.Count; ++_i16)
                            {
                                TBus _elem17 = new TBus();
                                _elem17 = new TBus();
                                _elem17.Read(iprot);
                                Buses.Add(_elem17);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 7:
                    if (field.Type == TType.List)
                    {
                        {
                            Tours = new List <TTour>();
                            TList _list18 = iprot.ReadListBegin();
                            for (int _i19 = 0; _i19 < _list18.Count; ++_i19)
                            {
                                TTour _elem20 = new TTour();
                                _elem20 = new TTour();
                                _elem20.Read(iprot);
                                Tours.Add(_elem20);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }