Exemple #1
0
        public static System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints> InitMapPoints(bool allOrders, string raCode, bool allRAs){using (new zAppDev.DotNet.Framework.Profiling.Profiler("MapPoints", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "InitMapPoints")) {
System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints> mapPoints = new System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints>();
try {
System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> or = new System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>();
if ((allOrders)) {
var _count0 = 0;or = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(1, 30,out _count0).ToList();}
else {
if ((raCode != null)) {
or?.AddRange(new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>((ord) => ord.OrdAgencyCode == raCode));
}
}
foreach (var order in or ?? Enumerable.Empty<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>()) {
var _var0 = order?.Warehouse;DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse warehouse = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable<DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse>((wr) => wr.Title == _var0)?.FirstOrDefault();
if ((warehouse?.GeoCoordinates != null)) {
float? originLat = (warehouse?.GeoCoordinates?.Latitude ?? 0);
float? originLong = (warehouse?.GeoCoordinates?.Longitude ?? 0);
if ((((((mapPoints?.Any((mp) => mp.Lat == originLat && mp.Long == originLong) ?? false))) == false))) {
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints warehouseMapPoint = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
warehouseMapPoint.Lat = originLat;warehouseMapPoint.Long = originLong;warehouseMapPoint.Title = (warehouse?.Title ?? "");warehouseMapPoint.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/industries.png";mapPoints?.Add(warehouseMapPoint);
}
}
}
if ((allRAs)) {
foreach (var regionalAgent in new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll<DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>() ?? Enumerable.Empty<DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>()) {
foreach (var truck in regionalAgent?.Trucks ?? Enumerable.Empty<DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck>()) {
if ((truck?.CurrentLocation == null)) {
continue;}
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints mapPointTruck = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
mapPointTruck.Lat = (truck?.CurrentLocation?.Latitude ?? 0);mapPointTruck.Long = (truck?.CurrentLocation?.Longitude ?? 0);mapPointTruck.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/transport.png";mapPointTruck.Type = "Truck";mapPointTruck.Title = (truck?.PlateNumber ?? "");mapPoints?.Add(mapPointTruck);
}
if ((regionalAgent?.AddressCoordinates == null)) {
continue;}
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints mapPoint = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
mapPoint.Lat = (regionalAgent?.AddressCoordinates?.Latitude ?? 0);mapPoint.Long = (regionalAgent?.AddressCoordinates?.Longitude ?? 0);mapPoint.Title = (regionalAgent?.AgencyDescription ?? "");mapPoint.Type = "RegionalAgent";mapPoint.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/industries.png";mapPoints?.Add(mapPoint);
}
}
else {
if (((((raCode == null || raCode == "")) == false))) {
DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent regionalAgent = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable<DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>((rag) => rag.AgencyCode == raCode)?.FirstOrDefault();
if ((regionalAgent?.AddressCoordinates != null)) {
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints mapPoint = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
mapPoint.Lat = (regionalAgent?.AddressCoordinates?.Latitude ?? 0);mapPoint.Long = (regionalAgent?.AddressCoordinates?.Longitude ?? 0);mapPoint.Title = (regionalAgent?.AgencyDescription ?? "");mapPoint.Type = "RegionalAgent";mapPoint.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/industries.png";mapPoints?.Add(mapPoint);
foreach (var truck in regionalAgent?.Trucks ?? Enumerable.Empty<DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck>()) {
if ((truck?.CurrentLocation == null)) {
continue;}
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints mapPointTruck = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
mapPointTruck.Lat = (truck?.CurrentLocation?.Latitude ?? 0);mapPointTruck.Long = (truck?.CurrentLocation?.Longitude ?? 0);mapPointTruck.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/transport.png";mapPointTruck.Type = "Truck";mapPointTruck.Title = (truck?.PlateNumber ?? "");mapPoints?.Add(mapPointTruck);
}
}
}
}
}
catch (System.Exception x) {
zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "MapPoints",  DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, x);
}
return mapPoints;
}
}
Exemple #2
0
 public static void InitAddressGeocoordinates()
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("RegionalAgent", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "InitAddressGeocoordinates")) {
         try {
             foreach (var ra in new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>() ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>())
             {
                 DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints mapPoint = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
                 DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleGeocode.Root response = DSS3_LogisticsPoolingForUrbanDistribution.BLL.ExternalRestServices.GoogleGeocodeRestService.GeoLocation((ra?.AgencyAddress ?? ""));
                 zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleGeocode.Root> ser = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleGeocode.Root>();
                 zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "RegionalAgent", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "google response " + ser.ToJson(response));
                 if ((response.results.Length == 0))
                 {
                     continue;
                 }
                 DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates addressCoordinates = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates();
                 addressCoordinates.Latitude = float.Parse(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(response.results, 0).geometry.location.lat, System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); addressCoordinates.Longitude = float.Parse(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(response.results, 0).geometry.location.lng, System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); ra.AddressCoordinates = addressCoordinates; new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Update <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>(ra);
             }
         }
         catch (System.Exception x) {
             zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "RegionalAgent", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, x);
         }
     }
 }