public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage> InitPubMessage(System.Object obj)
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("Utils", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "InitPubMessage")) {
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage> messages = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage>();
         System.Type type = obj.GetType();
         System.Collections.Generic.List <zAppDev.DotNet.Framework.Utilities.MambaRuntimeType> properties = zAppDev.DotNet.Framework.Utilities.MambaRuntimeType.FromPropertiesList(type.GetProperties());
         foreach (var property in properties ?? Enumerable.Empty <zAppDev.DotNet.Framework.Utilities.MambaRuntimeType>())
         {
             System.Object value    = property.GetValue(obj, new object[] {});
             string        name     = property.Name;
             string        datatype = zAppDev.DotNet.Framework.Utilities.Common.GetTypeName(property.PropertyType, false);
             zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "property value " + value + " property Name " + name + " property type " + datatype);
             if ((value == null))
             {
                 value = "";
             }
             DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage message = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage();
             if ((datatype == "Guid"))
             {
                 continue;
             }
             string valueString = value.ToString();
             if (((valueString?.ToLower().Contains("Sarmed".ToLower()) ?? false)))
             {
                 continue;
             }
             if (((datatype?.Contains("Date") ?? false)))
             {
                 message.type = "DateTime"; message.key = name; DateTime?time = zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DateTime?>(value);
                 message.val  = (time?.ToString("yyyy-MM-ddThh-mm-ss") ?? "");
             }
             if ((datatype == "Int64"))
             {
                 message.type = "long"; message.key = name; message.val = value.ToString();
             }
             if ((datatype == "Int32"))
             {
                 message.type = "int"; message.key = name; message.val = value.ToString();
             }
             if ((datatype == "Single"))
             {
                 message.type = "double"; message.key = name; message.val = value.ToString();
             }
             if ((datatype == "String"))
             {
                 message.type = "string"; message.key = name; message.val = zAppDev.DotNet.Framework.Utilities.Common.SafeCast <string>(value);
             }
             messages?.Add(message);
         }
         return(messages);
     }
 }
 public static void Publish(this BO.GPSLocation @this)
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("GPSLocation", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "Publish")) {
         zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.GPSLocation> gps = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.GPSLocation>();
         string gpsjson   = gps.ToJson(@this, false);
         string base64gps = zAppDev.DotNet.Framework.Utilities.Common.Base64Encode(gpsjson);
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage> message = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage>();
         DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage mes1 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage();
         DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage mes2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage();
         DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage mes3 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage();
         mes1.type = "string"; mes1.val = "truck_location"; mes1.key = "topic"; mes2.type = "string"; mes2.val = (@this?.truck_license_plate ?? ""); mes2.key = "truck_location"; mes3.type = "string"; mes3.val = base64gps; mes3.key = "payload"; message?.Add(mes1);
         message?.Add(mes2);
         message?.Add(mes3);
         DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.Publication publication = new DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.Publication();
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.PubMessage> apisPubMessage = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.PubMessage>();
         foreach (var pubs in message ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage>())
         {
             DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.PubMessage pubMessage = (new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessageDataTransformation.Transformer()).PubMessage_To_PubMessage(pubs);
             apisPubMessage.Add(pubMessage);
         }
         publication.publication = apisPubMessage.ToArray(); DSS3_LogisticsPoolingForUrbanDistribution.BLL.ExternalRestServices.LocalPubSubRestService.Publish(publication);
     }
 }
示例#3
0
 public static void Publish(this BO.OrderWMS @this)
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("OrderWMS", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "Publish")) {
         zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO> ord = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO>();
         DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO ordDTO = (new DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderTransformationDataTransformation.Transformer()).OrderWMS_To_OrderDTO(@this);
         string order    = ord.ToJson(ordDTO);
         string encorder = zAppDev.DotNet.Framework.Utilities.Common.Base64Encode(order);
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage> message = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage>();
         DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage mes1 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage();
         DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage mes2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage();
         DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage mes3 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage();
         mes1.type = "string"; mes1.val = "sarmed_order"; mes1.key = "topic"; mes2.type = "int"; mes2.val = "1"; mes2.key = "sarmed_order"; mes3.type = "string"; mes3.val = encorder; mes3.key = "payload"; message?.Add(mes1);
         message?.Add(mes2);
         message?.Add(mes3);
         DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.Publication publication = new DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.Publication();
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.PubMessage> apisPubMessage = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.PubMessage>();
         foreach (var pubs in message ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage>())
         {
             DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.PubMessage pubMessage = (new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessageDataTransformation.Transformer()).PubMessage_To_PubMessage(pubs);
             apisPubMessage.Add(pubMessage);
         }
         publication.publication = apisPubMessage.ToArray(); DSS3_LogisticsPoolingForUrbanDistribution.BLL.ExternalRestServices.LocalPubSubRestService.Publish(publication);
     }
 }
        public DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage PubMessage_To_PubMessageReversed(DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.PubMessage interfacesLocalPubSubPubMessageInput)
        {
            //Leave, if there is nothing to transform
            if (interfacesLocalPubSubPubMessageInput == null)
            {
                return(default(DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage));
            }
            // If the same Transformation has already ran, get the stored Output and return
            if (PubMessage_To_PubMessageReversed_Transformations.ContainsKey(interfacesLocalPubSubPubMessageInput))
            {
                return(PubMessage_To_PubMessageReversed_Transformations[interfacesLocalPubSubPubMessageInput]);
            }
            // Instantiate target root
            var domainPubMessageOutput = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage();

            PubMessage_To_PubMessageReversed_Transformations.Add(interfacesLocalPubSubPubMessageInput, domainPubMessageOutput);
            // PubMessage.key to PubMessage.key
            domainPubMessageOutput.key = interfacesLocalPubSubPubMessageInput?.key;
            // PubMessage.val to PubMessage.val
            domainPubMessageOutput.val = interfacesLocalPubSubPubMessageInput?.val;
            // PubMessage.type to PubMessage.type
            domainPubMessageOutput.type = interfacesLocalPubSubPubMessageInput?.type;
            return(domainPubMessageOutput);
        }
 public static void DeserializeMessage(string json)
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("Utils", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "DeserializeMessage")) {
         try {
             zAppDev.DotNet.Framework.Utilities.Serializer <System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage> > ser = new zAppDev.DotNet.Framework.Utilities.Serializer <System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage> >();
             zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO> ord     = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO>();
             System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage>             kvpairs = ser.FromJson(json);
             zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "Starting message parsing... JSON contains " + (kvpairs?.Count() ?? 0) + " objects");
             foreach (var mes in kvpairs ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage>())
             {
                 if ((mes?.key == "sarmed_order" && int.Parse((mes?.val ?? "")) > 0))
                 {
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "Order received!");
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage payload = kvpairs?.FirstOrDefault((x) => x.key == "payload");
                     string orderjson = zAppDev.DotNet.Framework.Utilities.Common.Base64Decode((payload?.val ?? ""));
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO tempDTO = ord.FromJson(orderjson);
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS temp = (new DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderTransformationDataTransformation.Transformer()).OrderWMS_To_OrderDTOReversed(tempDTO);
                     var _var0 = temp?.OrdID; DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS tempord = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>((x) => x.OrdID == _var0)?.FirstOrDefault();
                     if ((tempord != null))
                     {
                         zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "Order found in database. Updating...");
                         tempord?.CopyFields(temp);
                         if ((tempord?.OrdRoutingStatus == 30))
                         {
                             tempord.ATA = DateTime.UtcNow; System.Collections.Generic.List <string> roles = new System.Collections.Generic.List <string>();
                             foreach (var role in zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.Roles ?? Enumerable.Empty <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>())
                             {
                                 roles.Add((role?.Name ?? ""));
                             }
                             tempord.OrdStatus = 30; new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Update <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(tempord);
                             DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseSaveOrder((tempord?.OrdID ?? 0), roles.ToArray());
                         }
                         else
                         {
                             new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Save <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(tempord);
                             System.Collections.Generic.List <string> roles = new System.Collections.Generic.List <string>();
                             foreach (var role in zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.Roles ?? Enumerable.Empty <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>())
                             {
                                 roles.Add((role?.Name ?? ""));
                             }
                             DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseUpdateDatasets((tempord?.Id ?? 0), roles.ToArray());
                         }
                     }
                     else
                     {
                         zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "New order received!");
                         if ((temp?.OrdRoutingStatus == 30))
                         {
                             temp.ATA = DateTime.UtcNow;
                         }
                         new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Save <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(temp);
                     }
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "Order saved successfully.");
                     zAppDev.DotNet.Framework.Data.MiniSessionManager.Instance.Session.Flush();
                     if ((temp?.OrdRoutingStatus == 20))
                     {
                         DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOrderStarted((temp?.OrdID ?? 0), (temp?.OrdVchPlateNr ?? ""));
                     }
                     else if ((temp?.OrdRoutingStatus == 30))
                     {
                         DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOrderFinished((temp?.OrdID ?? 0));
                     }
                     else
                     {
                         System.Collections.Generic.List <string> roles = new System.Collections.Generic.List <string>();
                         foreach (var role in zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.Roles ?? Enumerable.Empty <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>())
                         {
                             roles.Add((role?.Name ?? ""));
                         }
                         DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOnOrderReceive((temp?.OrdID ?? 0), (temp?.Warehouse ?? ""), (temp?.OrdDlsCity ?? ""), (temp?.OrdAgencyDescr ?? ""), roles.ToArray());
                     }
                 }
                 else if ((mes?.key == "truck_location"))
                 {
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "Truck location received!");
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage payload = kvpairs?.FirstOrDefault((x) => x.key == "payload");
                     string gpsjson = zAppDev.DotNet.Framework.Utilities.Common.Base64Decode((payload?.val ?? ""));
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "gps data " + gpsjson);
                     zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.GPSLocation> gps = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.GPSLocation>();
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.GPSLocation temp = gps.FromJson(gpsjson);
                     DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOnGPSReceive((temp?.truck_license_plate ?? ""), (temp?.latitude?.ToString() ?? ""), (temp?.longitude?.ToString() ?? ""));
                 }
                 else if ((mes?.key == "sarmed_truck_recommendation" && int.Parse((mes?.val ?? "")) > 0))
                 {
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage payload = kvpairs?.FirstOrDefault((x) => x.key == "payload");
                     string truckRec = zAppDev.DotNet.Framework.Utilities.Common.Base64Decode((payload?.val ?? ""));
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "TruckRec " + truckRec);
                     zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.DisruptionAPI.TrucksRecommended> truckSer = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.DisruptionAPI.TrucksRecommended>();
                     DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.DisruptionAPI.TrucksRecommended truck = truckSer.FromJson(truckRec);
                     System.Collections.Generic.List <string> roles = new System.Collections.Generic.List <string>();
                     foreach (var role in zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.Roles ?? Enumerable.Empty <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>())
                     {
                         roles.Add((role?.Name ?? ""));
                     }
                     DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOnNTUARecommendationReceive(truck.order_id, zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(truck.trucks_recommended, 0), roles.ToArray());
                 }
                 else if ((mes?.key == "sarmed_truck_eta"))
                 {
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage payload = kvpairs?.FirstOrDefault((x) => x.key == "payload");
                     string trucketa = zAppDev.DotNet.Framework.Utilities.Common.Base64Decode((payload?.val ?? ""));
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "Truck eta mess " + trucketa);
                     zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.truck_eta> truckSer = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.truck_eta>();
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.truck_eta truck = truckSer.FromJson(trucketa);
                     var _var1 = truck?.order_id; DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS orderETA = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>((ordETA) => ordETA.OrdID == _var1)?.FirstOrDefault();
                     DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOnETAReceived((truck?.truck_license_plate ?? ""), (truck?.eta ?? System.Data.SqlTypes.SqlDateTime.MinValue.Value), (truck?.order_id ?? 0));
                 }
                 else if ((mes?.key == "sarmed_truck_emissions"))
                 {
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage payload = kvpairs?.FirstOrDefault((x) => x.key == "payload");
                     string truckemiss = zAppDev.DotNet.Framework.Utilities.Common.Base64Decode((payload?.val ?? ""));
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "co2 " + truckemiss);
                     zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.truck_emission> truckSer = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.truck_emission>();
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.truck_emission truck = truckSer.FromJson(truckemiss);
                     var   _var2 = truck?.truck_license_plate; DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS orderCOE = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>((ordco) => ordco.OrdVchPlateNr == _var2 && ordco.OrdRoutingStatus == 20)?.FirstOrDefault();
                     float?co2em = float.Parse((truck?.co2_emission ?? ""), System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture);
                     co2em = co2em.GetValueOrDefault(0) / 1000; truck.co2_emission = (co2em?.ToString() ?? ""); DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOnCO2Received((truck?.truck_license_plate ?? ""), (truck?.co2_emission ?? ""));
                 }
                 else if ((mes?.key == "sarmed_truck_delivery_time"))
                 {
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage payload = kvpairs?.FirstOrDefault((x) => x.key == "payload");
                     string truckAVGtime = zAppDev.DotNet.Framework.Utilities.Common.Base64Decode((payload?.val ?? ""));
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "avg time " + truckAVGtime);
                     zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.AVGTime> avgSer = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.AVGTime>();
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.AVGTime avg = avgSer.FromJson(truckAVGtime);
                     new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Save <DSS3_LogisticsPoolingForUrbanDistribution.BO.AVGTime>(avg);
                 }
             }
         }
         catch (System.Exception x) {
             zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, x);
         }
     }
 }