public static Boolean GetCurrentMessagesImpl(string deviceUniqueKeyVar, ref ArrayList messages) { ArrayList returnValues = new ArrayList(); int deviceId = KeyToIdHelpers.ConvertDeviceKey(deviceUniqueKeyVar); if (deviceId != -1) { DeviceMessageCollection deviceMessages = new DeviceMessageCollection(); PredicateExpression filter = new PredicateExpression(DeviceMessageFields.DeviceId == deviceId); deviceMessages.GetMulti(filter); foreach (DeviceMessageEntity deviceMessage in deviceMessages) { if (deviceMessage.DeliveryTime == null) { MessageEntity message = deviceMessage.Message; if (message.IsActive) { MessageTransport messageTransport = new MessageTransport { MessageId = message.MessageId, MessageType = (short)message.MessageType, MessageTitle = message.Title, MessageBody = message.Body, MessageTime = message.CreateTime }; returnValues.Add(messageTransport); } deviceMessage.DeliveryTime = DateTime.UtcNow; deviceMessage.Save(); } } messages = returnValues; return(true); } return(false); }
public static Boolean SendCurrentStatusImpl(string deviceUniqueIdentifier, string locationUniqueKey, TrackableActions currentStatusCode, DateTime actionDateTime) { int deviceId = KeyToIdHelpers.ConvertDeviceKey(deviceUniqueIdentifier); int locationId = KeyToIdHelpers.ConvertLocationKey(locationUniqueKey); // Update the device DeviceEntity ecDeviceEntity = new DeviceEntity(deviceId); if (!ecDeviceEntity.IsNew) { ecDeviceEntity.CurrentStatus = StatusValues[(int)currentStatusCode]; ecDeviceEntity.LastReportTime = DateTime.UtcNow; ecDeviceEntity.Save(); } // Update the active Customers table for EPIC Ops View ActiveOrganizationEntity ecActiveCustomersEntity = new ActiveOrganizationEntity(); ecActiveCustomersEntity.ActivityTypeId = (short)currentStatusCode; ecActiveCustomersEntity.LocationId = locationId; ecActiveCustomersEntity.ActivityTime = actionDateTime; // Should be sent in through the request ecActiveCustomersEntity.Save(); return(true); }
public static bool SendExceptionImpl(string deviceUniqueKey, Exception ex, ExceptionAdditionalInfo exInfo) { ExceptionLogEntity ecExceptionLogEntity = new ExceptionLogEntity(); //ecExceptionLogEntity.CustomerId = customerId; ecExceptionLogEntity.DeviceId = KeyToIdHelpers.ConvertDeviceKey(deviceUniqueKey); ecExceptionLogEntity.RemoteExceptionLogId = (long)exInfo.CustomersLogExceptionId; //ecExceptionLogEntity.CustomerExceptionObject = ObjectSerialization.ObjectToByteArray(ex); ecExceptionLogEntity.Title = String.Empty; ecExceptionLogEntity.Message = ex.Message; ecExceptionLogEntity.StackTrace = ex.StackTrace; //ecExceptionLogEntity.CustomerExceptionInnerStackTrace = ex.InnerException.StackTrace; ecExceptionLogEntity.LogTime = exInfo.ExceptionDateTime; ecExceptionLogEntity.User = exInfo.ExceptionUser; ecExceptionLogEntity.FormName = exInfo.ExceptionFormName; ecExceptionLogEntity.MachineName = exInfo.ExceptionMachineName; ecExceptionLogEntity.MachineOS = exInfo.ExceptionMachineOS; ecExceptionLogEntity.ApplicationVersion = exInfo.ExceptionApplicationVersion; ecExceptionLogEntity.CLRVersion = exInfo.ExceptionCLRVersion; ecExceptionLogEntity.MemoryUsage = exInfo.ExceptionMemoryUsage; ecExceptionLogEntity.ReceivedTime = DateTime.Now; ecExceptionLogEntity.Save(); return(true); }