Esempio n. 1
0
        public async Task AddRange(List <Location> locations)
        {
            if (locations.Any())
            {
                string imei = locations.First().Device.IMEI;

                Object @object = await objectDataService.GetObjectByIMEI(imei);

                if (@object != null)
                {
                    List <DataAccess.Model.Location> mapped =
                        locations.Select(x => mapper.Map <Location, Object, DataAccess.Model.Location>(x, @object))
                        .ToList();

                    await locationDataService.AddRange(mapped);
                }
            }
        }
Esempio n. 2
0
        public async Task AddRange(List <Location> locations)
        {
            if (locations.Any())
            {
                string deviceId = locations.First().Device.DeviceId;

                AssetEntity asset = await assetDataService.GetAssetByIMEI(deviceId);

                if (asset != null)
                {
                    List <LocationEntity> mapped =
                        locations.Select(x => mapper.Map <Location, AssetEntity, LocationEntity>(x, asset))
                        .ToList();

                    await locationDataService.AddRange(mapped);
                }
            }
        }
Esempio n. 3
0
        public async Task AddRange(List <Location> locations, int connectionMessageId)
        {
            if (locations.Any())
            {
                string deviceId = locations.First().Device.IMEI;

                DeviceEntity device = await deviceDataService.GetActiveDeviceByDeviceId(deviceId);

                if (device != null)
                {
                    List <LocationEntity> mapped =
                        locations.Select(x => mapper.Map <Location, DeviceEntity, LocationEntity>(x, device))
                        .ToList();

                    foreach (LocationEntity locationEntity in mapped)
                    {
                        locationEntity.DeviceConnectionMessageId = connectionMessageId;
                    }

                    await locationDataService.AddRange(mapped);
                }
            }
        }