Example #1
0
        public bool InitTrip(TripOperation trip)
        {
            //Địa chỉ đón
            var from = new AddressInfo()
            {
                Address = trip.DiaChiDon,
                Name    = trip.DiaChiDon,
                LatLng  = new LatLng()
                {
                    Lat = trip.ToaDoDon.Lat, Lng = trip.ToaDoDon.Lng
                }
            };
            //Địa chỉ trả
            var to = new AddressInfo
            {
                Address = trip.DiaChiTra,
                Name    = trip.DiaChiTra,
                LatLng  = new LatLng()
                {
                    Lat = trip.ToaDoTra.Lat, Lng = trip.ToaDoTra.Lng
                }
            };
            // Danh sách xe đề cử
            var vehicleOptions = new List <VehicleOption>();

            if (trip.XeDieuChiDinh != null)
            {
                foreach (var s in trip.XeDieuChiDinh)
                {
                    var vehicle = new VehicleOption();
                    vehicle.Vehicle  = s.VehicleName; // Biển số
                    vehicle.Distance = s.Distance;    // Khoảng cách
                    vehicleOptions.Add(vehicle);
                }
            }

            byte carType = 0;

            if (trip.CarType == "" || trip.CarType.Split(',').Length > 1)
            {
                carType = 0;
            }
            else
            {
                carType = trip.CarType.To <byte>();
            }
            var CurrentLatLng = new LatLng();


            return(Service.TryGet(
                       p => p.SendInitTrip(trip.BookId.Value, @from, to, trip.Note, trip.Quantity, carType, trip.CustomerType, trip.Phone, vehicleOptions.ToArray(), CurrentLatLng)).Value);
        }
Example #2
0
        //public bool InitTrip(TripOperation trip, BookTripType tripType)
        //{
        //    //Địa chỉ đón
        //    var from = new AddressInfo()
        //    {
        //        Address = trip.DiaChiDon,
        //        Name = trip.DiaChiDon,
        //        LatLng = new LatLng() { Lat = trip.ToaDoDon.Lat, Lng = trip.ToaDoDon.Lng }
        //    };
        //    //Địa chỉ trả
        //    var to = new AddressInfo
        //    {
        //        Address = trip.DiaChiTra,
        //        Name = trip.DiaChiTra,
        //        LatLng = new LatLng() { Lat = trip.ToaDoTra.Lat, Lng = trip.ToaDoTra.Lng }
        //    };
        //    // Danh sách xe đề cử
        //    var vehicleOptions = new List<VehicleOption>();
        //    if (trip.XeDieuChiDinh!=null)
        //    {
        //        foreach (var s in trip.XeDieuChiDinh)
        //        {
        //            var vehicle = new VehicleOption();
        //            vehicle.Vehicle = s.VehicleName;// Biển số
        //            vehicle.Distance = s.Distance;// Khoảng cách
        //            vehicleOptions.Add(vehicle);
        //        }
        //    }

        //    byte carType = 0;
        //    if (trip.CarType == "" || trip.CarType.Split(',').Length > 1)
        //    {
        //        carType = 0;
        //    }
        //    else
        //    {
        //        carType = trip.CarType.To<byte>();
        //    }
        //    var CurrentLatLng = new LatLng();


        //    return Service.TryGet(
        //    p => p.SendInitTrip(trip.BookId.Value, @from, to, trip.Note, trip.Quantity, carType, trip.CustomerType, trip.Phone, vehicleOptions.ToArray(), CurrentLatLng, trip.VehiclesDeny, tripType, trip.Money, 0, Direction.One,)).Value;
        //}


        public bool SendOperatorCancel(GuidMsg msg)
        {
            return(Service.TryGet(p => p.SendOperatorCancel(msg.BookId, msg.Msg, ServiceG5.SourceCancelType.Unknown)).Value);
        }