示例#1
0
        /*Dispose(bool disposing) executes in two distinct scenarios.
        *  // If disposing equals true, the method has been called directly
        *  // or indirectly by a user's code. Managed and unmanaged resources
        *  // can be disposed.
        *  // If disposing equals false, the method has been called by the
        *  // runtime from inside the finalizer and you should not reference
        *  // other objects. Only unmanaged resources can be disposed.*/

        /// <summary>
        /// Disposes of managed & unmanaged resources
        /// </summary>
        /// <param name="disposing">True: called directly/indirectly by user's code; False: called by the runtime from inside the finalizer</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)// Check to see if Dispose has already been called.
            {
                // If disposing equals true, dispose all managed and unmanaged resources
                if (disposing)
                {
                    GeotabAPI.Dispose();            // Dispose managed resources.
                }
                // Call the appropriate methods to clean up unmanaged resources here.
                // If disposing is false, only the following code is executed.
                GGP               = null;
                DBP               = null;
                ConStr            = null;
                GeoGoTable        = null;
                AccessDBEntries   = null;
                odometerCalls     = null;
                engineHoursCalls  = null;
                locationCalls     = null;
                driverCalls       = null;
                _deviceCache      = null;
                _deviceNameCache  = null;
                _driverCache      = null;
                DeviceEntriesList = null;
                DeviceErrorList   = null;
                GeoGoEntries      = null;

                disposed = true;// Note disposing has been done.
            }
        }
示例#2
0
        private async Task GetCallsList()
        {
            if (CT.IsCancellationRequested)
            {
                return;
            }
            odometerCalls    = new GeotabAPI.MultiCallList <StatusData>();
            engineHoursCalls = new GeotabAPI.MultiCallList <StatusData>();
            locationCalls    = new GeotabAPI.MultiCallList <LogRecord>();
            driverCalls      = new GeotabAPI.MultiCallList <DriverChange>();
            foreach ((Device device, DBEntry entry) in from DeviceEntry deviceEntry in DeviceEntriesList
                     let device = deviceEntry.Device
                                  let entry = deviceEntry.Entry
                                              select(device, entry))
            {
                odometerCalls.AddCall("Get", new
                {
                    search = new StatusDataSearch
                    {
                        FromDate         = entry.Timestamp,
                        ToDate           = entry.Timestamp,
                        DiagnosticSearch = new DiagnosticSearch(KnownId.DiagnosticOdometerAdjustmentId),
                        DeviceSearch     = new DeviceSearch(device.Id)
                    }
                });
                engineHoursCalls.AddCall("Get", new
                {
                    search = new StatusDataSearch
                    {
                        FromDate         = entry.Timestamp,
                        ToDate           = entry.Timestamp,
                        DiagnosticSearch = new DiagnosticSearch(KnownId.DiagnosticEngineHoursAdjustmentId),
                        DeviceSearch     = new DeviceSearch(device.Id)
                    }
                });
                locationCalls.AddCall("Get", new
                {
                    search = new LogRecordSearch
                    {
                        FromDate     = entry.Timestamp,
                        ToDate       = entry.Timestamp,
                        DeviceSearch = new DeviceSearch
                        {
                            Id = device.Id
                        }
                    }
                });
                driverCalls.AddCall("Get", new
                {
                    search = new DriverChangeSearch
                    {
                        FromDate     = entry.Timestamp,
                        ToDate       = entry.Timestamp,
                        DeviceSearch = new DeviceSearch
                        {
                            Id = device.Id
                        },
                        IncludeOverlappedChanges = true
                    }
                });
            }

            await UpdateProgress(50);

            return;
        }