コード例 #1
0
        public static bool UpdateTrackerInformation(CellLocationMessage message)
        {
            bool retval = true;

            GPSTrackerEntities1 context = new GPSTrackerEntities1();

            Trackers _tracker =
                context.Trackers.Where(t => t.Id == message.TrackerID).FirstOrDefault();

            _tracker.LastUpdate = DateTime.Now;
            _tracker.LastLat    = message.Latitude.Decimal;
            _tracker.LastLon    = message.Longitude.Decimal;


            context.SaveChanges();


            return(retval);
        }
コード例 #2
0
        public bool RecievedMessage(NameValueCollection message)
        {
            // need to update this to also record messages if there are multiple in the report.
            CellLocationMessage locationMessage = new CellLocationMessage(message);

            /// will only save if being used as a full tracker
            if (locationMessage.IsValid)// only store valid readings
            {
                try
                {
                    GTSBizObjects.Management.UpdateTrackerInformation(locationMessage);
                }
                catch (Exception e)
                {
                    ExceptionHandler.HandleGeneralException(e);
                    return(false);
                }
                return(true);
            }
            return(false);
        }