Ejemplo n.º 1
0
        public IList<VVehicleSearchResult> VehicleSearch(string maxEncodeLatLon, string minEncodeLatLon, string tenantCode, string userCode,
            string permissionCode,int rowIndex,int pageSize,ref int rowCount)
        {
            PES.MapService.MapSearchService.MapService mapService = new PES.MapService.MapSearchService.MapService();

            LatLon maxLatLon = mapService.Decode(maxEncodeLatLon);
            LatLon minLatLon = mapService.Decode(minEncodeLatLon);

            IVehicleManager vm = new VehicleManager();

            IList<EBaseVehicle> ltVehicle = vm.Get(tenantCode, userCode, permissionCode);

            Rectangle rec = new Rectangle(maxLatLon.Latitude, maxLatLon.Longitude, minLatLon.Latitude, minLatLon.Longitude);

            IGPSTrackManager trackManager = new GPSTrackManager();

            IList<EGPSCurrentInfo> ltCurrentInfo = trackManager.SearchVehicleInRectange(rec, ltVehicle.Select(s => s.Code).ToArray(), rowIndex, pageSize,ref rowCount);

            Dictionary<Guid, string> dcVehicle = ltVehicle.ToDictionary(new Func<EBaseVehicle, Guid>(c => c.Code),
                    new Func<EBaseVehicle, string>(c => c.LicenceNumber));

            IList<VVehicleSearchResult> ltResult = new List<VVehicleSearchResult>();

            if (ltCurrentInfo == null)
                return ltResult;
            foreach (EGPSCurrentInfo currentInfo in ltCurrentInfo)
            {
                string licenceNumber = dcVehicle[currentInfo.VehicleCode.Value];

                VVehicleSearchResult result = new VVehicleSearchResult(currentInfo.VehicleCode.Value, licenceNumber, currentInfo.GPSCode, currentInfo.ReportTime.ToString(),currentInfo.Latitude,currentInfo.Longitude);

                ltResult.Add(result);
            }
            SetEncodeLatLon(mapService, ltResult);

            return ltResult;
        }
Ejemplo n.º 2
0
        public IList<Guid> VehicleSearch(string maxEncodeLatLon,string minEncodeLatLon,string tenantCode)
        {
            PES.MapService.MapSearchService.MapService mapService = new PES.MapService.MapSearchService.MapService();

            LatLon maxLatLon = mapService.Decode(maxEncodeLatLon);
            LatLon minLatLon = mapService.Decode(minEncodeLatLon);

            IGPSInstallationManager installManager = new GPSInstallationManager();
            
            IList<string> ltGPSCode = installManager.GetGPSCode(tenantCode);

            IGPSTrackManager trackManager = new GPSTrackManager();

            Rectangle rec = new Rectangle(maxLatLon.Latitude, maxLatLon.Longitude, minLatLon.Latitude, minLatLon.Longitude);

            IList<EGPSCurrentInfo> ltCurrentInfo = trackManager.SearchVehicleInRectange(rec, ltGPSCode.ToArray<string>());


            if (ltCurrentInfo == null || ltCurrentInfo.Count == 0)
                return null;

            return ltCurrentInfo.Select(s => s.VehicleCode.Value).ToList();
        }