Export devices without a batch assigned #60

This commit is contained in:
Gary Sharp
2014-07-14 13:30:25 +10:00
parent 5c5e5a23a2
commit 09b1c93bf0
2 changed files with 5 additions and 2 deletions
@@ -120,7 +120,10 @@ namespace Disco.Services.Devices.Exporting
case DeviceExportTypes.All:
return GenerateExport(Database, Database.Devices, Options, TaskStatus);
case DeviceExportTypes.Batch:
if (Options.ExportTypeTargetId.HasValue && Options.ExportTypeTargetId.Value > 0)
return GenerateExport(Database, Database.Devices.Where(d => d.DeviceBatchId == Options.ExportTypeTargetId), Options, TaskStatus);
else
return GenerateExport(Database, Database.Devices.Where(d => d.DeviceBatchId == null), Options, TaskStatus);
case DeviceExportTypes.Model:
return GenerateExport(Database, Database.Devices.Where(d => d.DeviceModelId == Options.ExportTypeTargetId), Options, TaskStatus);
case DeviceExportTypes.Profile:
+1 -1
View File
@@ -93,7 +93,7 @@ namespace Disco.Web.Controllers
var m = new Models.Device.ExportModel()
{
Options = Database.DiscoConfiguration.Devices.LastExportOptions,
DeviceBatches = Database.DeviceBatches.OrderBy(db => db.Name).Select(db => new { Key = db.Id, Value = db.Name }).ToList().Select(i => new KeyValuePair<int, string>(i.Key, i.Value)),
DeviceBatches = new KeyValuePair<int, string>[] { new KeyValuePair<int, string>(0, "<No Associated Batch>") }.Concat(Database.DeviceBatches.OrderBy(db => db.Name).Select(db => new { Key = db.Id, Value = db.Name }).ToList().Select(i => new KeyValuePair<int, string>(i.Key, i.Value))),
DeviceModels = Database.DeviceModels.OrderBy(dm => dm.Description).Select(dm => new { Key = dm.Id, Value = dm.Description }).ToList().Select(i => new KeyValuePair<int, string>(i.Key, i.Value)),
DeviceProfiles = Database.DeviceProfiles.OrderBy(dp => dp.Name).Select(dp => new { Key = dp.Id, Value = dp.Name }).ToList().Select(i => new KeyValuePair<int, string>(i.Key, i.Value))
};