initial refactor of device export so it can be reused for future exporting
This commit is contained in:
@@ -49,6 +49,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BI\Config\OrganisationAddress.cs" />
|
<Compile Include="BI\Config\OrganisationAddress.cs" />
|
||||||
|
<Compile Include="Exporting\ExportFieldMetadata.cs" />
|
||||||
|
<Compile Include="Exporting\ExportFormat.cs" />
|
||||||
|
<Compile Include="Exporting\IExportRecord.cs" />
|
||||||
<Compile Include="Services\Expressions\Extensions\ImageExpressionFormat.cs" />
|
<Compile Include="Services\Expressions\Extensions\ImageExpressionFormat.cs" />
|
||||||
<Compile Include="ClientServices\EnrolmentInformation\BaseBoard.cs" />
|
<Compile Include="ClientServices\EnrolmentInformation\BaseBoard.cs" />
|
||||||
<Compile Include="ClientServices\EnrolmentInformation\Battery.cs" />
|
<Compile Include="ClientServices\EnrolmentInformation\Battery.cs" />
|
||||||
@@ -66,13 +69,13 @@
|
|||||||
<Compile Include="ClientServices\EnrolmentInformation\WirelessProfileStore.cs" />
|
<Compile Include="ClientServices\EnrolmentInformation\WirelessProfileStore.cs" />
|
||||||
<Compile Include="ClientServices\EnrolmentInformation\WirelessProfileTransformation.cs" />
|
<Compile Include="ClientServices\EnrolmentInformation\WirelessProfileTransformation.cs" />
|
||||||
<Compile Include="Repository\Device\DeviceBatchAttachment.cs" />
|
<Compile Include="Repository\Device\DeviceBatchAttachment.cs" />
|
||||||
<Compile Include="Services\Devices\Exporting\DeviceExportFieldMetadata.cs" />
|
|
||||||
<Compile Include="Services\Devices\Importing\IDeviceImportColumn.cs" />
|
<Compile Include="Services\Devices\Importing\IDeviceImportColumn.cs" />
|
||||||
<Compile Include="Services\Devices\Importing\IDeviceImportDataReader.cs" />
|
<Compile Include="Services\Devices\Importing\IDeviceImportDataReader.cs" />
|
||||||
<Compile Include="Services\Documents\DocumentField.cs" />
|
<Compile Include="Services\Documents\DocumentField.cs" />
|
||||||
<Compile Include="Services\Documents\DocumentFieldType.cs" />
|
<Compile Include="Services\Documents\DocumentFieldType.cs" />
|
||||||
<Compile Include="Services\Documents\DocumentTemplatePackage.cs" />
|
<Compile Include="Services\Documents\DocumentTemplatePackage.cs" />
|
||||||
<Compile Include="Services\Documents\OnImportUserFlagRule.cs" />
|
<Compile Include="Services\Documents\OnImportUserFlagRule.cs" />
|
||||||
|
<Compile Include="Exporting\IExportOptions.cs" />
|
||||||
<Compile Include="Services\Jobs\LocationModes.cs" />
|
<Compile Include="Services\Jobs\LocationModes.cs" />
|
||||||
<Compile Include="ClientServices\EnrolmentInformation\Certificate.cs" />
|
<Compile Include="ClientServices\EnrolmentInformation\Certificate.cs" />
|
||||||
<Compile Include="ClientServices\Register.cs" />
|
<Compile Include="ClientServices\Register.cs" />
|
||||||
@@ -126,7 +129,7 @@
|
|||||||
<Compile Include="Repository\User\UserDetail.cs" />
|
<Compile Include="Repository\User\UserDetail.cs" />
|
||||||
<Compile Include="Repository\User\AuthorizationRole.cs" />
|
<Compile Include="Repository\User\AuthorizationRole.cs" />
|
||||||
<Compile Include="Services\Devices\Exporting\DeviceExportRecord.cs" />
|
<Compile Include="Services\Devices\Exporting\DeviceExportRecord.cs" />
|
||||||
<Compile Include="Services\Devices\Exporting\DeviceExportResult.cs" />
|
<Compile Include="Exporting\ExportResult.cs" />
|
||||||
<Compile Include="Services\Devices\Exporting\DeviceExportTypes.cs" />
|
<Compile Include="Services\Devices\Exporting\DeviceExportTypes.cs" />
|
||||||
<Compile Include="Services\Devices\Exporting\DeviceExportOptions.cs" />
|
<Compile Include="Services\Devices\Exporting\DeviceExportOptions.cs" />
|
||||||
<Compile Include="Services\Devices\Importing\DeviceImportFieldTypes.cs" />
|
<Compile Include="Services\Devices\Importing\DeviceImportFieldTypes.cs" />
|
||||||
|
|||||||
+5
-5
@@ -1,16 +1,16 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Disco.Models.Services.Devices.Exporting
|
namespace Disco.Models.Exporting
|
||||||
{
|
{
|
||||||
public class DeviceExportFieldMetadata
|
public class ExportFieldMetadata<T> where T : IExportRecord
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string ColumnName { get; set; }
|
public string ColumnName { get; set; }
|
||||||
public Type ValueType { get; set; }
|
public Type ValueType { get; set; }
|
||||||
public Func<DeviceExportRecord, object> Accessor { get; set; }
|
public Func<T, object> Accessor { get; set; }
|
||||||
public Func<object, string> CsvEncoder { get; set; }
|
public Func<object, string> CsvEncoder { get; set; }
|
||||||
|
|
||||||
public DeviceExportFieldMetadata(string name, Type valueType, Func<DeviceExportRecord, object> accessor, Func<object, string> csvEncoder)
|
public ExportFieldMetadata(string name, Type valueType, Func<T, object> accessor, Func<object, string> csvEncoder)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
ValueType = valueType;
|
ValueType = valueType;
|
||||||
@@ -18,7 +18,7 @@ namespace Disco.Models.Services.Devices.Exporting
|
|||||||
CsvEncoder = csvEncoder;
|
CsvEncoder = csvEncoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeviceExportFieldMetadata(string name, string columnName, Type valueType, Func<DeviceExportRecord, object> accessor, Func<object, string> csvEncoder)
|
public ExportFieldMetadata(string name, string columnName, Type valueType, Func<T, object> accessor, Func<object, string> csvEncoder)
|
||||||
: this(name, valueType, accessor, csvEncoder)
|
: this(name, valueType, accessor, csvEncoder)
|
||||||
{
|
{
|
||||||
ColumnName = columnName;
|
ColumnName = columnName;
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Disco.Models.Exporting
|
||||||
|
{
|
||||||
|
public enum ExportFormat
|
||||||
|
{
|
||||||
|
Csv,
|
||||||
|
Xlsx,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace Disco.Models.Services.Exporting
|
||||||
|
{
|
||||||
|
public class ExportResult
|
||||||
|
{
|
||||||
|
public MemoryStream Result { get; set; }
|
||||||
|
public string Filename { get; set; }
|
||||||
|
public string MimeType { get; set; }
|
||||||
|
public int RecordCount { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Disco.Models.Exporting;
|
||||||
|
|
||||||
|
namespace Disco.Models.Services.Exporting
|
||||||
|
{
|
||||||
|
public interface IExportOptions
|
||||||
|
{
|
||||||
|
ExportFormat Format { get; }
|
||||||
|
string FilenamePrefix { get; }
|
||||||
|
string ExcelWorksheetName { get; }
|
||||||
|
string ExcelTableName { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Disco.Models.Exporting
|
||||||
|
{
|
||||||
|
public interface IExportRecord
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,18 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using Disco.Models.Exporting;
|
||||||
|
using Disco.Models.Services.Exporting;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Disco.Models.Services.Devices.Exporting
|
namespace Disco.Models.Services.Devices.Exporting
|
||||||
{
|
{
|
||||||
public class DeviceExportOptions
|
public class DeviceExportOptions : IExportOptions
|
||||||
{
|
{
|
||||||
public DeviceExportTypes ExportType { get; set; }
|
public DeviceExportTypes ExportType { get; set; }
|
||||||
public int? ExportTypeTargetId { get; set; }
|
public int? ExportTypeTargetId { get; set; }
|
||||||
|
|
||||||
public bool ExcelFormat { get; set; }
|
public ExportFormat Format { get; set; }
|
||||||
|
public string FilenamePrefix { get; } = "DiscoDeviceExport";
|
||||||
|
public string ExcelWorksheetName { get; } = "DeviceExport";
|
||||||
|
public string ExcelTableName { get; } = "Devices";
|
||||||
|
|
||||||
// Device
|
// Device
|
||||||
[Display(ShortName = "Device", Name = "Serial Number", Description = "The device serial number")]
|
[Display(ShortName = "Device", Name = "Serial Number", Description = "The device serial number")]
|
||||||
@@ -136,7 +141,7 @@ namespace Disco.Models.Services.Devices.Exporting
|
|||||||
return new DeviceExportOptions()
|
return new DeviceExportOptions()
|
||||||
{
|
{
|
||||||
ExportType = DeviceExportTypes.All,
|
ExportType = DeviceExportTypes.All,
|
||||||
ExcelFormat = true,
|
Format = ExportFormat.Xlsx,
|
||||||
DeviceSerialNumber = true,
|
DeviceSerialNumber = true,
|
||||||
ModelId = true,
|
ModelId = true,
|
||||||
ProfileId = true,
|
ProfileId = true,
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using Disco.Models.ClientServices.EnrolmentInformation;
|
using Disco.Models.ClientServices.EnrolmentInformation;
|
||||||
|
using Disco.Models.Exporting;
|
||||||
using Disco.Models.Repository;
|
using Disco.Models.Repository;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Disco.Models.Services.Devices.Exporting
|
namespace Disco.Models.Services.Devices.Exporting
|
||||||
{
|
{
|
||||||
public class DeviceExportRecord
|
public class DeviceExportRecord : IExportRecord
|
||||||
{
|
{
|
||||||
public Device Device { get; set; }
|
public Device Device { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace Disco.Models.Services.Devices.Exporting
|
|
||||||
{
|
|
||||||
public class DeviceExportResult
|
|
||||||
{
|
|
||||||
public MemoryStream Result { get; set; }
|
|
||||||
public int RecordCount { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace Disco.Models.Services.Devices.Exporting
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Disco.Models.Services.Devices.Exporting
|
|
||||||
{
|
{
|
||||||
public enum DeviceExportTypes
|
public enum DeviceExportTypes
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Disco.Models.Services.Devices.Exporting;
|
using Disco.Models.Services.Devices.Exporting;
|
||||||
|
using Disco.Models.Services.Exporting;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Disco.Models.UI.Device
|
namespace Disco.Models.UI.Device
|
||||||
@@ -8,7 +9,7 @@ namespace Disco.Models.UI.Device
|
|||||||
DeviceExportOptions Options { get; set; }
|
DeviceExportOptions Options { get; set; }
|
||||||
|
|
||||||
string ExportSessionId { get; set; }
|
string ExportSessionId { get; set; }
|
||||||
DeviceExportResult ExportSessionResult { get; set; }
|
ExportResult ExportSessionResult { get; set; }
|
||||||
|
|
||||||
IEnumerable<KeyValuePair<int, string>> DeviceBatches { get; set; }
|
IEnumerable<KeyValuePair<int, string>> DeviceBatches { get; set; }
|
||||||
IEnumerable<KeyValuePair<int, string>> DeviceModels { get; set; }
|
IEnumerable<KeyValuePair<int, string>> DeviceModels { get; set; }
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
using ClosedXML.Excel;
|
using Disco.Data.Repository;
|
||||||
using Disco.Data.Repository;
|
using Disco.Models.Exporting;
|
||||||
using Disco.Models.Repository;
|
using Disco.Models.Repository;
|
||||||
using Disco.Models.Services.Devices.Exporting;
|
using Disco.Models.Services.Devices.Exporting;
|
||||||
|
using Disco.Models.Services.Exporting;
|
||||||
using Disco.Services.Plugins.Features.DetailsProvider;
|
using Disco.Services.Plugins.Features.DetailsProvider;
|
||||||
using Disco.Services.Tasks;
|
using Disco.Services.Tasks;
|
||||||
using Disco.Services.Users;
|
using Disco.Services.Users;
|
||||||
@@ -12,14 +13,15 @@ using System.Data;
|
|||||||
using System.Data.Entity;
|
using System.Data.Entity;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Disco.Services.Devices.Exporting
|
namespace Disco.Services.Devices.Exporting
|
||||||
{
|
{
|
||||||
|
using fieldMetadata = ExportFieldMetadata<DeviceExportRecord>;
|
||||||
|
|
||||||
public static class DeviceExport
|
public static class DeviceExport
|
||||||
{
|
{
|
||||||
|
|
||||||
public static DeviceExportResult GenerateExport(DiscoDataContext Database, Func<IQueryable<Device>, IQueryable<Device>> Filter, DeviceExportOptions Options, IScheduledTaskStatus TaskStatus)
|
public static ExportResult GenerateExport(DiscoDataContext Database, Func<IQueryable<Device>, IQueryable<Device>> Filter, DeviceExportOptions Options, IScheduledTaskStatus TaskStatus)
|
||||||
{
|
{
|
||||||
|
|
||||||
TaskStatus.UpdateStatus(15, "Extracting records from the database");
|
TaskStatus.UpdateStatus(15, "Extracting records from the database");
|
||||||
@@ -112,28 +114,12 @@ namespace Disco.Services.Devices.Exporting
|
|||||||
catch (Exception) { } // Ignore Errors
|
catch (Exception) { } // Ignore Errors
|
||||||
}
|
}
|
||||||
|
|
||||||
var stream = new MemoryStream();
|
|
||||||
|
|
||||||
TaskStatus.UpdateStatus(80, string.Format("Formatting {0} records for export", records.Count));
|
TaskStatus.UpdateStatus(80, string.Format("Formatting {0} records for export", records.Count));
|
||||||
|
|
||||||
if (Options.ExcelFormat)
|
return ExportHelpers.WriteExport(Options, TaskStatus, metadata, records);
|
||||||
{
|
|
||||||
WriteXlsx(stream, metadata, records);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WriteCSV(stream, metadata, records);
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Position = 0;
|
|
||||||
return new DeviceExportResult()
|
|
||||||
{
|
|
||||||
Result = stream,
|
|
||||||
RecordCount = records.Count
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DeviceExportResult GenerateExport(DiscoDataContext Database, DeviceExportOptions Options, IScheduledTaskStatus TaskStatus)
|
public static ExportResult GenerateExport(DiscoDataContext Database, DeviceExportOptions Options, IScheduledTaskStatus TaskStatus)
|
||||||
{
|
{
|
||||||
switch (Options.ExportType)
|
switch (Options.ExportType)
|
||||||
{
|
{
|
||||||
@@ -152,62 +138,11 @@ namespace Disco.Services.Devices.Exporting
|
|||||||
throw new ArgumentException(string.Format("Unknown Device Export Type", Options.ExportType.ToString()), "Options");
|
throw new ArgumentException(string.Format("Unknown Device Export Type", Options.ExportType.ToString()), "Options");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static DeviceExportResult GenerateExport(DiscoDataContext Database, DeviceExportOptions Options)
|
public static ExportResult GenerateExport(DiscoDataContext Database, DeviceExportOptions Options)
|
||||||
{
|
{
|
||||||
return GenerateExport(Database, Options, ScheduledTaskMockStatus.Create("Device Export"));
|
return GenerateExport(Database, Options, ScheduledTaskMockStatus.Create("Device Export"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WriteCSV(Stream OutputStream, List<DeviceExportFieldMetadata> Metadata, List<DeviceExportRecord> Records)
|
|
||||||
{
|
|
||||||
using (StreamWriter writer = new StreamWriter(OutputStream, Encoding.Default, 0x400, true))
|
|
||||||
{
|
|
||||||
// Header
|
|
||||||
writer.Write('"');
|
|
||||||
writer.Write(string.Join("\",\"", Metadata.Select(m => m.ColumnName)));
|
|
||||||
writer.Write('"');
|
|
||||||
|
|
||||||
// Records
|
|
||||||
foreach (var record in Records)
|
|
||||||
{
|
|
||||||
writer.WriteLine();
|
|
||||||
for (int i = 0; i < Metadata.Count; i++)
|
|
||||||
{
|
|
||||||
if (i != 0)
|
|
||||||
{
|
|
||||||
writer.Write(',');
|
|
||||||
}
|
|
||||||
var value = Metadata[i].Accessor(record);
|
|
||||||
writer.Write(Metadata[i].CsvEncoder(value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void WriteXlsx(Stream OutputStream, List<DeviceExportFieldMetadata> Metadata, List<DeviceExportRecord> Records)
|
|
||||||
{
|
|
||||||
// Create DataTable
|
|
||||||
var dataTable = new DataTable();
|
|
||||||
foreach (var field in Metadata)
|
|
||||||
{
|
|
||||||
dataTable.Columns.Add(field.ColumnName, field.ValueType);
|
|
||||||
}
|
|
||||||
foreach (var record in Records)
|
|
||||||
{
|
|
||||||
dataTable.Rows.Add(Metadata.Select(m => m.Accessor(record)).ToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var xlWorkbook = new XLWorkbook())
|
|
||||||
{
|
|
||||||
var sheet = xlWorkbook.AddWorksheet("DeviceExport");
|
|
||||||
var table = sheet.Cell(1, 1).InsertTable(dataTable, "Devices");
|
|
||||||
table.Theme = XLTableTheme.TableStyleMedium2;
|
|
||||||
|
|
||||||
table.Columns().ForEach(c => c.WorksheetColumn().AdjustToContents(2, 15, 30));
|
|
||||||
|
|
||||||
xlWorkbook.SaveAs(OutputStream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<DeviceExportRecord> BuildRecords(IQueryable<Device> Devices)
|
private static IEnumerable<DeviceExportRecord> BuildRecords(IQueryable<Device> Devices)
|
||||||
{
|
{
|
||||||
return Devices.Select(d => new DeviceExportRecord()
|
return Devices.Select(d => new DeviceExportRecord()
|
||||||
@@ -249,7 +184,7 @@ namespace Disco.Services.Devices.Exporting
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<DeviceExportFieldMetadata> BuildMetadata(this DeviceExportOptions options, List<DeviceExportRecord> records)
|
private static List<fieldMetadata> BuildMetadata(this DeviceExportOptions options, List<DeviceExportRecord> records)
|
||||||
{
|
{
|
||||||
var processorMaxCount = Math.Max(1, records.Max(r => r.DeviceDetailProcessors?.Count ?? 0));
|
var processorMaxCount = Math.Max(1, records.Max(r => r.DeviceDetailProcessors?.Count ?? 0));
|
||||||
var memoryMaxCount = Math.Max(1, records.Max(r => r.DeviceDetailPhysicalMemory?.Count ?? 0));
|
var memoryMaxCount = Math.Max(1, records.Max(r => r.DeviceDetailPhysicalMemory?.Count ?? 0));
|
||||||
@@ -285,7 +220,7 @@ namespace Disco.Services.Devices.Exporting
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Dictionary<string, List<DeviceExportFieldMetadata>> BuildRecordAccessors(int processorMaxCount, int memoryMaxCount, int diskDriveMaxCount, int lanAdapterMaxCount, int wlanAdapterMaxCount, int certificateMaxCount, int batteriesMaxCount, IEnumerable<string> assignedUserDetailCustomKeys)
|
private static Dictionary<string, List<ExportFieldMetadata<DeviceExportRecord>>> BuildRecordAccessors(int processorMaxCount, int memoryMaxCount, int diskDriveMaxCount, int lanAdapterMaxCount, int wlanAdapterMaxCount, int certificateMaxCount, int batteriesMaxCount, IEnumerable<string> assignedUserDetailCustomKeys)
|
||||||
{
|
{
|
||||||
const string DateFormat = "yyyy-MM-dd";
|
const string DateFormat = "yyyy-MM-dd";
|
||||||
const string DateTimeFormat = DateFormat + " HH:mm:ss";
|
const string DateTimeFormat = DateFormat + " HH:mm:ss";
|
||||||
@@ -298,149 +233,149 @@ namespace Disco.Services.Devices.Exporting
|
|||||||
Func<object, string> csvNullableDateEncoded = (o) => ((DateTime?)o).HasValue ? csvDateEncoded(o) : null;
|
Func<object, string> csvNullableDateEncoded = (o) => ((DateTime?)o).HasValue ? csvDateEncoded(o) : null;
|
||||||
Func<object, string> csvNullableDateTimeEncoded = (o) => ((DateTime?)o).HasValue ? csvDateTimeEncoded(o) : null;
|
Func<object, string> csvNullableDateTimeEncoded = (o) => ((DateTime?)o).HasValue ? csvDateTimeEncoded(o) : null;
|
||||||
|
|
||||||
var metadata = new Dictionary<string, List<DeviceExportFieldMetadata>>();
|
var metadata = new Dictionary<string, List<ExportFieldMetadata<DeviceExportRecord>>>();
|
||||||
|
|
||||||
// Device
|
// Device
|
||||||
metadata.Add(nameof(DeviceExportOptions.DeviceSerialNumber), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DeviceSerialNumber), typeof(string), r => r.Device.SerialNumber, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DeviceSerialNumber), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DeviceSerialNumber), typeof(string), r => r.Device.SerialNumber, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.DeviceAssetNumber), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DeviceAssetNumber), typeof(string), r => r.Device.AssetNumber, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DeviceAssetNumber), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DeviceAssetNumber), typeof(string), r => r.Device.AssetNumber, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.DeviceLocation), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DeviceLocation), typeof(string), r => r.Device.Location, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DeviceLocation), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DeviceLocation), typeof(string), r => r.Device.Location, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.DeviceComputerName), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DeviceComputerName), typeof(string), r => r.Device.DeviceDomainId, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DeviceComputerName), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DeviceComputerName), typeof(string), r => r.Device.DeviceDomainId, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.DeviceLastNetworkLogon), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DeviceLastNetworkLogon), typeof(DateTime), r => r.Device.LastNetworkLogonDate, csvNullableDateTimeEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DeviceLastNetworkLogon), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DeviceLastNetworkLogon), typeof(DateTime), r => r.Device.LastNetworkLogonDate, csvNullableDateTimeEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.DeviceCreatedDate), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DeviceCreatedDate), typeof(DateTime), r => r.Device.CreatedDate, csvDateTimeEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DeviceCreatedDate), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DeviceCreatedDate), typeof(DateTime), r => r.Device.CreatedDate, csvDateTimeEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.DeviceFirstEnrolledDate), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DeviceFirstEnrolledDate), typeof(DateTime), r => r.Device.EnrolledDate, csvNullableDateTimeEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DeviceFirstEnrolledDate), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DeviceFirstEnrolledDate), typeof(DateTime), r => r.Device.EnrolledDate, csvNullableDateTimeEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.DeviceLastEnrolledDate), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DeviceLastEnrolledDate), typeof(DateTime), r => r.Device.LastEnrolDate, csvNullableDateTimeEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DeviceLastEnrolledDate), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DeviceLastEnrolledDate), typeof(DateTime), r => r.Device.LastEnrolDate, csvNullableDateTimeEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.DeviceAllowUnauthenticatedEnrol), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DeviceAllowUnauthenticatedEnrol), typeof(bool), r => r.Device.AllowUnauthenticatedEnrol, csvToStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DeviceAllowUnauthenticatedEnrol), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DeviceAllowUnauthenticatedEnrol), typeof(bool), r => r.Device.AllowUnauthenticatedEnrol, csvToStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.DeviceDecommissionedDate), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DeviceDecommissionedDate), typeof(DateTime), r => r.Device.DecommissionedDate, csvNullableDateTimeEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DeviceDecommissionedDate), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DeviceDecommissionedDate), typeof(DateTime), r => r.Device.DecommissionedDate, csvNullableDateTimeEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.DeviceDecommissionedReason), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DeviceDecommissionedReason), typeof(string), r => r.Device.DecommissionReason, csvToStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DeviceDecommissionedReason), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DeviceDecommissionedReason), typeof(string), r => r.Device.DecommissionReason, csvToStringEncoded) });
|
||||||
|
|
||||||
// Model
|
// Model
|
||||||
metadata.Add(nameof(DeviceExportOptions.ModelId), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.ModelId), typeof(int), r => r.ModelId, csvToStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.ModelId), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.ModelId), typeof(int), r => r.ModelId, csvToStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.ModelDescription), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.ModelDescription), typeof(string), r => r.ModelDescription, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.ModelDescription), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.ModelDescription), typeof(string), r => r.ModelDescription, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.ModelManufacturer), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.ModelManufacturer), typeof(string), r => r.ModelManufacturer, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.ModelManufacturer), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.ModelManufacturer), typeof(string), r => r.ModelManufacturer, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.ModelModel), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.ModelModel), typeof(string), r => r.ModelModel, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.ModelModel), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.ModelModel), typeof(string), r => r.ModelModel, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.ModelType), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.ModelType), typeof(string), r => r.ModelType, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.ModelType), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.ModelType), typeof(string), r => r.ModelType, csvStringEncoded) });
|
||||||
|
|
||||||
// Batch
|
// Batch
|
||||||
metadata.Add(nameof(DeviceExportOptions.BatchId), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.BatchId), typeof(int), r => r.BatchId, csvToStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.BatchId), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.BatchId), typeof(int), r => r.BatchId, csvToStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.BatchName), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.BatchName), typeof(string), r => r.BatchName, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.BatchName), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.BatchName), typeof(string), r => r.BatchName, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.BatchPurchaseDate), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.BatchPurchaseDate), typeof(DateTime), r => r.BatchPurchaseDate, csvNullableDateEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.BatchPurchaseDate), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.BatchPurchaseDate), typeof(DateTime), r => r.BatchPurchaseDate, csvNullableDateEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.BatchSupplier), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.BatchSupplier), typeof(string), r => r.BatchSupplier, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.BatchSupplier), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.BatchSupplier), typeof(string), r => r.BatchSupplier, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.BatchUnitCost), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.BatchUnitCost), typeof(decimal), r => r.BatchUnitCost, csvCurrencyEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.BatchUnitCost), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.BatchUnitCost), typeof(decimal), r => r.BatchUnitCost, csvCurrencyEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.BatchWarrantyValidUntilDate), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.BatchWarrantyValidUntilDate), typeof(DateTime), r => r.BatchWarrantyValidUntilDate, csvNullableDateEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.BatchWarrantyValidUntilDate), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.BatchWarrantyValidUntilDate), typeof(DateTime), r => r.BatchWarrantyValidUntilDate, csvNullableDateEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.BatchInsuredDate), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.BatchInsuredDate), typeof(DateTime), r => r.BatchInsuredDate, csvNullableDateEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.BatchInsuredDate), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.BatchInsuredDate), typeof(DateTime), r => r.BatchInsuredDate, csvNullableDateEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.BatchInsuranceSupplier), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.BatchInsuranceSupplier), typeof(string), r => r.BatchInsuranceSupplier, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.BatchInsuranceSupplier), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.BatchInsuranceSupplier), typeof(string), r => r.BatchInsuranceSupplier, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.BatchInsuredUntilDate), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.BatchInsuredUntilDate), typeof(DateTime), r => r.BatchInsuredUntilDate, csvNullableDateEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.BatchInsuredUntilDate), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.BatchInsuredUntilDate), typeof(DateTime), r => r.BatchInsuredUntilDate, csvNullableDateEncoded) });
|
||||||
|
|
||||||
// Profile
|
// Profile
|
||||||
metadata.Add(nameof(DeviceExportOptions.ProfileId), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.ProfileId), typeof(int), r => r.ProfileId, csvToStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.ProfileId), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.ProfileId), typeof(int), r => r.ProfileId, csvToStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.ProfileName), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.ProfileName), typeof(string), r => r.ProfileName, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.ProfileName), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.ProfileName), typeof(string), r => r.ProfileName, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.ProfileShortName), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.ProfileShortName), typeof(string), r => r.ProfileShortName, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.ProfileShortName), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.ProfileShortName), typeof(string), r => r.ProfileShortName, csvStringEncoded) });
|
||||||
|
|
||||||
// User
|
// User
|
||||||
metadata.Add(nameof(DeviceExportOptions.AssignedUserId), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.AssignedUserId), typeof(string), r => r.AssignedUser?.UserId, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.AssignedUserId), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.AssignedUserId), typeof(string), r => r.AssignedUser?.UserId, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.AssignedUserDate), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.AssignedUserDate), typeof(DateTime), r => r.DeviceUserAssignment?.AssignedDate, csvNullableDateTimeEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.AssignedUserDate), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.AssignedUserDate), typeof(DateTime), r => r.DeviceUserAssignment?.AssignedDate, csvNullableDateTimeEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.AssignedUserDisplayName), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.AssignedUserDisplayName), typeof(string), r => r.AssignedUser?.DisplayName, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.AssignedUserDisplayName), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.AssignedUserDisplayName), typeof(string), r => r.AssignedUser?.DisplayName, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.AssignedUserSurname), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.AssignedUserSurname), typeof(string), r => r.AssignedUser?.Surname, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.AssignedUserSurname), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.AssignedUserSurname), typeof(string), r => r.AssignedUser?.Surname, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.AssignedUserGivenName), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.AssignedUserGivenName), typeof(string), r => r.AssignedUser?.GivenName, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.AssignedUserGivenName), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.AssignedUserGivenName), typeof(string), r => r.AssignedUser?.GivenName, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.AssignedUserPhoneNumber), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.AssignedUserPhoneNumber), typeof(string), r => r.AssignedUser?.PhoneNumber, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.AssignedUserPhoneNumber), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.AssignedUserPhoneNumber), typeof(string), r => r.AssignedUser?.PhoneNumber, csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.AssignedUserEmailAddress), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.AssignedUserEmailAddress), typeof(string), r => r.AssignedUser?.EmailAddress, csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.AssignedUserEmailAddress), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.AssignedUserEmailAddress), typeof(string), r => r.AssignedUser?.EmailAddress, csvStringEncoded) });
|
||||||
if (assignedUserDetailCustomKeys != null)
|
if (assignedUserDetailCustomKeys != null)
|
||||||
{
|
{
|
||||||
var assignedUserDetailCustomFields = new List<DeviceExportFieldMetadata>();
|
var assignedUserDetailCustomFields = new List<fieldMetadata>();
|
||||||
foreach (var detailKey in assignedUserDetailCustomKeys.OrderBy(k => k, StringComparer.OrdinalIgnoreCase))
|
foreach (var detailKey in assignedUserDetailCustomKeys.OrderBy(k => k, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var key = detailKey;
|
var key = detailKey;
|
||||||
assignedUserDetailCustomFields.Add(new DeviceExportFieldMetadata(detailKey, detailKey, typeof(string), r => r.AssignedUserCustomDetails != null && r.AssignedUserCustomDetails.TryGetValue(key, out var value) ? value : null, csvStringEncoded));
|
assignedUserDetailCustomFields.Add(new fieldMetadata(detailKey, detailKey, typeof(string), r => r.AssignedUserCustomDetails != null && r.AssignedUserCustomDetails.TryGetValue(key, out var value) ? value : null, csvStringEncoded));
|
||||||
}
|
}
|
||||||
metadata.Add(nameof(DeviceExportOptions.AssignedUserDetailCustom), assignedUserDetailCustomFields);
|
metadata.Add(nameof(DeviceExportOptions.AssignedUserDetailCustom), assignedUserDetailCustomFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Jobs
|
// Jobs
|
||||||
metadata.Add(nameof(DeviceExportOptions.JobsTotalCount), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.JobsTotalCount), typeof(int), r => r.JobsTotalCount, csvToStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.JobsTotalCount), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.JobsTotalCount), typeof(int), r => r.JobsTotalCount, csvToStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.JobsOpenCount), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.JobsOpenCount), typeof(int), r => r.JobsOpenCount, csvToStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.JobsOpenCount), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.JobsOpenCount), typeof(int), r => r.JobsOpenCount, csvToStringEncoded) });
|
||||||
|
|
||||||
// Attachments
|
// Attachments
|
||||||
metadata.Add(nameof(DeviceExportOptions.AttachmentsCount), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.AttachmentsCount), typeof(int), r => r.AttachmentsCount, csvToStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.AttachmentsCount), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.AttachmentsCount), typeof(int), r => r.AttachmentsCount, csvToStringEncoded) });
|
||||||
|
|
||||||
// Certificates
|
// Certificates
|
||||||
var certificateFields = new List<DeviceExportFieldMetadata>(certificateMaxCount * 4);
|
var certificateFields = new List<fieldMetadata>(certificateMaxCount * 4);
|
||||||
for (int i = 0; i < certificateMaxCount; i++)
|
for (int i = 0; i < certificateMaxCount; i++)
|
||||||
{
|
{
|
||||||
var v = i;
|
var v = i;
|
||||||
var index = i + 1;
|
var index = i + 1;
|
||||||
certificateFields.Add(new DeviceExportFieldMetadata($"Certificate{index}Name", $"Certificate {index} Name", typeof(string), r => r.DeviceCertificates.Skip(v).FirstOrDefault()?.Name, csvStringEncoded));
|
certificateFields.Add(new fieldMetadata($"Certificate{index}Name", $"Certificate {index} Name", typeof(string), r => r.DeviceCertificates.Skip(v).FirstOrDefault()?.Name, csvStringEncoded));
|
||||||
certificateFields.Add(new DeviceExportFieldMetadata($"Certificate{index}AllocationDate", $"Certificate {index} Allocation Date", typeof(DateTime), r => r.DeviceCertificates.Skip(v).FirstOrDefault()?.AllocatedDate, csvNullableDateTimeEncoded));
|
certificateFields.Add(new fieldMetadata($"Certificate{index}AllocationDate", $"Certificate {index} Allocation Date", typeof(DateTime), r => r.DeviceCertificates.Skip(v).FirstOrDefault()?.AllocatedDate, csvNullableDateTimeEncoded));
|
||||||
certificateFields.Add(new DeviceExportFieldMetadata($"Certificate{index}ExpirationDate", $"Certificate {index} Expiration Date", typeof(DateTime), r => r.DeviceCertificates.Skip(v).FirstOrDefault()?.ExpirationDate, csvNullableDateTimeEncoded));
|
certificateFields.Add(new fieldMetadata($"Certificate{index}ExpirationDate", $"Certificate {index} Expiration Date", typeof(DateTime), r => r.DeviceCertificates.Skip(v).FirstOrDefault()?.ExpirationDate, csvNullableDateTimeEncoded));
|
||||||
certificateFields.Add(new DeviceExportFieldMetadata($"Certificate{index}ProviderId", $"Certificate {index} Provider Id", typeof(string), r => r.DeviceCertificates.Skip(v).FirstOrDefault()?.ProviderId, csvStringEncoded));
|
certificateFields.Add(new fieldMetadata($"Certificate{index}ProviderId", $"Certificate {index} Provider Id", typeof(string), r => r.DeviceCertificates.Skip(v).FirstOrDefault()?.ProviderId, csvStringEncoded));
|
||||||
}
|
}
|
||||||
metadata.Add(nameof(DeviceExportOptions.Certificates), certificateFields);
|
metadata.Add(nameof(DeviceExportOptions.Certificates), certificateFields);
|
||||||
|
|
||||||
// Details
|
// Details
|
||||||
var biosFields = new List<DeviceExportFieldMetadata>()
|
var biosFields = new List<fieldMetadata>()
|
||||||
{
|
{
|
||||||
new DeviceExportFieldMetadata("BIOSManufacturer", "BIOS Manufacturer", typeof(string), r => r.DeviceDetailBios?.FirstOrDefault()?.Manufacturer, csvStringEncoded),
|
new fieldMetadata("BIOSManufacturer", "BIOS Manufacturer", typeof(string), r => r.DeviceDetailBios?.FirstOrDefault()?.Manufacturer, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("BIOSSerialNumber", "BIOS Serial Number", typeof(string), r => r.DeviceDetailBios?.FirstOrDefault()?.SerialNumber, csvStringEncoded),
|
new fieldMetadata("BIOSSerialNumber", "BIOS Serial Number", typeof(string), r => r.DeviceDetailBios?.FirstOrDefault()?.SerialNumber, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("BIOSVersion", "BIOS Version", typeof(string), r => {
|
new fieldMetadata("BIOSVersion", "BIOS Version", typeof(string), r => {
|
||||||
var bios = r.DeviceDetailBios?.FirstOrDefault();
|
var bios = r.DeviceDetailBios?.FirstOrDefault();
|
||||||
if (bios?.SMBIOSBIOSVersion != null)
|
if (bios?.SMBIOSBIOSVersion != null)
|
||||||
return $"{bios.SMBIOSBIOSVersion} {bios.SMBIOSMajorVersion}.{bios.SMBIOSMinorVersion}";
|
return $"{bios.SMBIOSBIOSVersion} {bios.SMBIOSMajorVersion}.{bios.SMBIOSMinorVersion}";
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}, csvStringEncoded),
|
}, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("BIOSSystemVersion", "BIOS System Version", typeof(string), r => {
|
new fieldMetadata("BIOSSystemVersion", "BIOS System Version", typeof(string), r => {
|
||||||
var bios = r.DeviceDetailBios?.FirstOrDefault();
|
var bios = r.DeviceDetailBios?.FirstOrDefault();
|
||||||
if (bios?.SystemBiosMajorVersion.HasValue ?? false)
|
if (bios?.SystemBiosMajorVersion.HasValue ?? false)
|
||||||
return $"{bios.SystemBiosMajorVersion}.{bios.SystemBiosMinorVersion}";
|
return $"{bios.SystemBiosMajorVersion}.{bios.SystemBiosMinorVersion}";
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}, csvStringEncoded),
|
}, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("BIOSReleaseDate", "BIOS Release Date", typeof(DateTime), r => r.DeviceDetailBios?.FirstOrDefault()?.ReleaseDate, csvNullableDateTimeEncoded),
|
new fieldMetadata("BIOSReleaseDate", "BIOS Release Date", typeof(DateTime), r => r.DeviceDetailBios?.FirstOrDefault()?.ReleaseDate, csvNullableDateTimeEncoded),
|
||||||
};
|
};
|
||||||
metadata.Add(nameof(DeviceExportOptions.DetailBios), biosFields);
|
metadata.Add(nameof(DeviceExportOptions.DetailBios), biosFields);
|
||||||
|
|
||||||
var baseBoardFields = new List<DeviceExportFieldMetadata>()
|
var baseBoardFields = new List<fieldMetadata>()
|
||||||
{
|
{
|
||||||
new DeviceExportFieldMetadata("BaseBoardManufacturer", "Base Board Manufacturer", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.Manufacturer, csvStringEncoded),
|
new fieldMetadata("BaseBoardManufacturer", "Base Board Manufacturer", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.Manufacturer, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("BaseBoardModel", "Base Board Model", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.Model, csvStringEncoded),
|
new fieldMetadata("BaseBoardModel", "Base Board Model", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.Model, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("BaseBoardProduct", "Base Board Product", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.Product, csvStringEncoded),
|
new fieldMetadata("BaseBoardProduct", "Base Board Product", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.Product, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("BaseBoardPartNumber", "Base Board Part Number", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.PartNumber, csvStringEncoded),
|
new fieldMetadata("BaseBoardPartNumber", "Base Board Part Number", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.PartNumber, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("BaseBoardSKU", "Base Board SKU", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.SKU, csvStringEncoded),
|
new fieldMetadata("BaseBoardSKU", "Base Board SKU", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.SKU, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("BaseBoardSerialNumber", "Base Board Serial Number", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.SerialNumber, csvStringEncoded),
|
new fieldMetadata("BaseBoardSerialNumber", "Base Board Serial Number", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.SerialNumber, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("BaseBoardConfigOptions", "Base Board Config Options", typeof(string), r => {
|
new fieldMetadata("BaseBoardConfigOptions", "Base Board Config Options", typeof(string), r => {
|
||||||
var baseBoard = r.DeviceDetailBaseBoard?.FirstOrDefault();
|
var baseBoard = r.DeviceDetailBaseBoard?.FirstOrDefault();
|
||||||
if (baseBoard?.ConfigOptions != null)
|
if (baseBoard?.ConfigOptions != null)
|
||||||
return string.Join("; ", baseBoard.ConfigOptions);
|
return string.Join("; ", baseBoard.ConfigOptions);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}, csvStringEncoded),
|
}, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("BaseBoardVersion", "Base Board Version", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.Version, csvStringEncoded),
|
new fieldMetadata("BaseBoardVersion", "Base Board Version", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.Version, csvStringEncoded),
|
||||||
};
|
};
|
||||||
metadata.Add(nameof(DeviceExportOptions.DetailBaseBoard), baseBoardFields);
|
metadata.Add(nameof(DeviceExportOptions.DetailBaseBoard), baseBoardFields);
|
||||||
|
|
||||||
var computerSystemFields = new List<DeviceExportFieldMetadata>()
|
var computerSystemFields = new List<fieldMetadata>()
|
||||||
{
|
{
|
||||||
new DeviceExportFieldMetadata("ComputerSystemDescription", "System Description", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.Description, csvStringEncoded),
|
new fieldMetadata("ComputerSystemDescription", "System Description", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.Description, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("ComputerSystemPCSystemType", "System Form Factor", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.PCSystemType, csvStringEncoded),
|
new fieldMetadata("ComputerSystemPCSystemType", "System Form Factor", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.PCSystemType, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("ComputerSystemSystemType", "System Type", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.SystemType, csvStringEncoded),
|
new fieldMetadata("ComputerSystemSystemType", "System Type", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.SystemType, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("ComputerSystemPrimaryOwnerName", "System Primary Owner Name", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.PrimaryOwnerName, csvStringEncoded),
|
new fieldMetadata("ComputerSystemPrimaryOwnerName", "System Primary Owner Name", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.PrimaryOwnerName, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("ComputerSystemPrimaryOwnerContact", "System Primary Owner Contact", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.PrimaryOwnerContact, csvStringEncoded),
|
new fieldMetadata("ComputerSystemPrimaryOwnerContact", "System Primary Owner Contact", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.PrimaryOwnerContact, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("ComputerSystemChassisSKU", "System Chassis SKU", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.ChassisSKUNumber, csvStringEncoded),
|
new fieldMetadata("ComputerSystemChassisSKU", "System Chassis SKU", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.ChassisSKUNumber, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("ComputerSystemSystemSKU", "System SKU", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.SystemSKUNumber, csvStringEncoded),
|
new fieldMetadata("ComputerSystemSystemSKU", "System SKU", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.SystemSKUNumber, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("ComputerSystemOEMReference", "System OEM Reference", typeof(string), r => {
|
new fieldMetadata("ComputerSystemOEMReference", "System OEM Reference", typeof(string), r => {
|
||||||
var computerSystem = r.DeviceDetailComputerSystem?.FirstOrDefault();
|
var computerSystem = r.DeviceDetailComputerSystem?.FirstOrDefault();
|
||||||
if (computerSystem?.OEMStringArray != null)
|
if (computerSystem?.OEMStringArray != null)
|
||||||
return string.Join("; ", computerSystem.OEMStringArray);
|
return string.Join("; ", computerSystem.OEMStringArray);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}, csvStringEncoded),
|
}, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("ComputerSystemCurrentTimeZone", "System Time Zone", typeof(string), r => {
|
new fieldMetadata("ComputerSystemCurrentTimeZone", "System Time Zone", typeof(string), r => {
|
||||||
var computerSystem = r.DeviceDetailComputerSystem?.FirstOrDefault();
|
var computerSystem = r.DeviceDetailComputerSystem?.FirstOrDefault();
|
||||||
if (computerSystem?.CurrentTimeZone.HasValue ?? false)
|
if (computerSystem?.CurrentTimeZone.HasValue ?? false)
|
||||||
return $"{computerSystem.CurrentTimeZone.Value / 60:00}:{Math.Abs(computerSystem.CurrentTimeZone.Value % 60):00}";
|
return $"{computerSystem.CurrentTimeZone.Value / 60:00}:{Math.Abs(computerSystem.CurrentTimeZone.Value % 60):00}";
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}, csvStringEncoded),
|
}, csvStringEncoded),
|
||||||
new DeviceExportFieldMetadata("ComputerSystemRoles", "System Roles", typeof(string), r => {
|
new fieldMetadata("ComputerSystemRoles", "System Roles", typeof(string), r => {
|
||||||
var computerSystem = r.DeviceDetailComputerSystem?.FirstOrDefault();
|
var computerSystem = r.DeviceDetailComputerSystem?.FirstOrDefault();
|
||||||
if (computerSystem?.Roles != null)
|
if (computerSystem?.Roles != null)
|
||||||
return string.Join("; ", computerSystem.Roles);
|
return string.Join("; ", computerSystem.Roles);
|
||||||
@@ -450,88 +385,88 @@ namespace Disco.Services.Devices.Exporting
|
|||||||
};
|
};
|
||||||
metadata.Add(nameof(DeviceExportOptions.DetailComputerSystem), computerSystemFields);
|
metadata.Add(nameof(DeviceExportOptions.DetailComputerSystem), computerSystemFields);
|
||||||
|
|
||||||
var processorFields = new List<DeviceExportFieldMetadata>(processorMaxCount * 6);
|
var processorFields = new List<fieldMetadata>(processorMaxCount * 6);
|
||||||
for (int i = 0; i < processorMaxCount; i++)
|
for (int i = 0; i < processorMaxCount; i++)
|
||||||
{
|
{
|
||||||
var v = i;
|
var v = i;
|
||||||
var index = i + 1;
|
var index = i + 1;
|
||||||
processorFields.Add(new DeviceExportFieldMetadata($"Processor{index}Name", $"Processor {index} Name", typeof(string), r => r.DeviceDetailProcessors?.Skip(v).FirstOrDefault()?.Name, csvStringEncoded));
|
processorFields.Add(new fieldMetadata($"Processor{index}Name", $"Processor {index} Name", typeof(string), r => r.DeviceDetailProcessors?.Skip(v).FirstOrDefault()?.Name, csvStringEncoded));
|
||||||
processorFields.Add(new DeviceExportFieldMetadata($"Processor{index}Description", $"Processor {index} Description", typeof(string), r => r.DeviceDetailProcessors?.Skip(v).FirstOrDefault()?.Description, csvStringEncoded));
|
processorFields.Add(new fieldMetadata($"Processor{index}Description", $"Processor {index} Description", typeof(string), r => r.DeviceDetailProcessors?.Skip(v).FirstOrDefault()?.Description, csvStringEncoded));
|
||||||
processorFields.Add(new DeviceExportFieldMetadata($"Processor{index}Architecture", $"Processor {index} Architecture", typeof(string), r => r.DeviceDetailProcessors?.Skip(v).FirstOrDefault()?.Architecture, csvStringEncoded));
|
processorFields.Add(new fieldMetadata($"Processor{index}Architecture", $"Processor {index} Architecture", typeof(string), r => r.DeviceDetailProcessors?.Skip(v).FirstOrDefault()?.Architecture, csvStringEncoded));
|
||||||
processorFields.Add(new DeviceExportFieldMetadata($"Processor{index}ClockSpeed", $"Processor {index} Clock Speed", typeof(string), r => r.DeviceDetailProcessors?.Skip(v).FirstOrDefault()?.MaxClockSpeedFriendly(), csvStringEncoded));
|
processorFields.Add(new fieldMetadata($"Processor{index}ClockSpeed", $"Processor {index} Clock Speed", typeof(string), r => r.DeviceDetailProcessors?.Skip(v).FirstOrDefault()?.MaxClockSpeedFriendly(), csvStringEncoded));
|
||||||
processorFields.Add(new DeviceExportFieldMetadata($"Processor{index}Cores", $"Processor {index} Cores", typeof(int), r => r.DeviceDetailProcessors?.Skip(v).FirstOrDefault()?.NumberOfCores, csvToStringEncoded));
|
processorFields.Add(new fieldMetadata($"Processor{index}Cores", $"Processor {index} Cores", typeof(int), r => r.DeviceDetailProcessors?.Skip(v).FirstOrDefault()?.NumberOfCores, csvToStringEncoded));
|
||||||
processorFields.Add(new DeviceExportFieldMetadata($"Processor{index}LogicalProcessors", $"Processor {index} Logical Processors", typeof(int), r => r.DeviceDetailProcessors?.Skip(v).FirstOrDefault()?.NumberOfLogicalProcessors, csvToStringEncoded));
|
processorFields.Add(new fieldMetadata($"Processor{index}LogicalProcessors", $"Processor {index} Logical Processors", typeof(int), r => r.DeviceDetailProcessors?.Skip(v).FirstOrDefault()?.NumberOfLogicalProcessors, csvToStringEncoded));
|
||||||
}
|
}
|
||||||
metadata.Add(nameof(DeviceExportOptions.DetailProcessors), processorFields);
|
metadata.Add(nameof(DeviceExportOptions.DetailProcessors), processorFields);
|
||||||
var memoryFields = new List<DeviceExportFieldMetadata>((memoryMaxCount * 6) + 1);
|
var memoryFields = new List<fieldMetadata>((memoryMaxCount * 6) + 1);
|
||||||
memoryFields.Add(new DeviceExportFieldMetadata($"MemoryTotalCapacity", $"Memory Total Capacity", typeof(string), r => MeasurementUnitExtensions.ByteSizeToFriendly((ulong)(r.DeviceDetailPhysicalMemory?.Sum(m => (long)m.Capacity) ?? 0L)), csvStringEncoded));
|
memoryFields.Add(new fieldMetadata($"MemoryTotalCapacity", $"Memory Total Capacity", typeof(string), r => MeasurementUnitExtensions.ByteSizeToFriendly((ulong)(r.DeviceDetailPhysicalMemory?.Sum(m => (long)m.Capacity) ?? 0L)), csvStringEncoded));
|
||||||
for (int i = 0; i < memoryMaxCount; i++)
|
for (int i = 0; i < memoryMaxCount; i++)
|
||||||
{
|
{
|
||||||
var v = i;
|
var v = i;
|
||||||
var index = i + 1;
|
var index = i + 1;
|
||||||
memoryFields.Add(new DeviceExportFieldMetadata($"Memory{index}Location", $"Memory {index} Location", typeof(string), r => r.DeviceDetailPhysicalMemory?.Skip(v).FirstOrDefault()?.DeviceLocator, csvStringEncoded));
|
memoryFields.Add(new fieldMetadata($"Memory{index}Location", $"Memory {index} Location", typeof(string), r => r.DeviceDetailPhysicalMemory?.Skip(v).FirstOrDefault()?.DeviceLocator, csvStringEncoded));
|
||||||
memoryFields.Add(new DeviceExportFieldMetadata($"Memory{index}Manufacturer", $"Memory {index} Manufacturer", typeof(string), r => r.DeviceDetailPhysicalMemory?.Skip(v).FirstOrDefault()?.Manufacturer, csvStringEncoded));
|
memoryFields.Add(new fieldMetadata($"Memory{index}Manufacturer", $"Memory {index} Manufacturer", typeof(string), r => r.DeviceDetailPhysicalMemory?.Skip(v).FirstOrDefault()?.Manufacturer, csvStringEncoded));
|
||||||
memoryFields.Add(new DeviceExportFieldMetadata($"Memory{index}PartNumber", $"Memory {index} Part Number", typeof(string), r => r.DeviceDetailPhysicalMemory?.Skip(v).FirstOrDefault()?.PartNumber, csvStringEncoded));
|
memoryFields.Add(new fieldMetadata($"Memory{index}PartNumber", $"Memory {index} Part Number", typeof(string), r => r.DeviceDetailPhysicalMemory?.Skip(v).FirstOrDefault()?.PartNumber, csvStringEncoded));
|
||||||
memoryFields.Add(new DeviceExportFieldMetadata($"Memory{index}SerialNumber", $"Memory {index} Serial Number", typeof(string), r => r.DeviceDetailPhysicalMemory?.Skip(v).FirstOrDefault()?.SerialNumber, csvStringEncoded));
|
memoryFields.Add(new fieldMetadata($"Memory{index}SerialNumber", $"Memory {index} Serial Number", typeof(string), r => r.DeviceDetailPhysicalMemory?.Skip(v).FirstOrDefault()?.SerialNumber, csvStringEncoded));
|
||||||
memoryFields.Add(new DeviceExportFieldMetadata($"Memory{index}Capacity", $"Memory {index} Capacity", typeof(string), r => r.DeviceDetailPhysicalMemory?.Skip(v).FirstOrDefault()?.CapacityFriendly(), csvStringEncoded));
|
memoryFields.Add(new fieldMetadata($"Memory{index}Capacity", $"Memory {index} Capacity", typeof(string), r => r.DeviceDetailPhysicalMemory?.Skip(v).FirstOrDefault()?.CapacityFriendly(), csvStringEncoded));
|
||||||
memoryFields.Add(new DeviceExportFieldMetadata($"Memory{index}ConfiguredClockSpeed", $"Memory {index} Clock Speed", typeof(int), r => r.DeviceDetailPhysicalMemory?.Skip(v).FirstOrDefault()?.ConfiguredClockSpeed, csvToStringEncoded));
|
memoryFields.Add(new fieldMetadata($"Memory{index}ConfiguredClockSpeed", $"Memory {index} Clock Speed", typeof(int), r => r.DeviceDetailPhysicalMemory?.Skip(v).FirstOrDefault()?.ConfiguredClockSpeed, csvToStringEncoded));
|
||||||
}
|
}
|
||||||
metadata.Add(nameof(DeviceExportOptions.DetailMemory), memoryFields);
|
metadata.Add(nameof(DeviceExportOptions.DetailMemory), memoryFields);
|
||||||
var diskFields = new List<DeviceExportFieldMetadata>(diskDriveMaxCount * 6);
|
var diskFields = new List<fieldMetadata>(diskDriveMaxCount * 6);
|
||||||
for (int i = 0; i < diskDriveMaxCount; i++)
|
for (int i = 0; i < diskDriveMaxCount; i++)
|
||||||
{
|
{
|
||||||
var v = i;
|
var v = i;
|
||||||
var index = i + 1;
|
var index = i + 1;
|
||||||
diskFields.Add(new DeviceExportFieldMetadata($"Disk{index}Manufacturer", $"Disk {index} Manufacturer", typeof(string), r => r.DeviceDetailDiskDrives?.Skip(v).FirstOrDefault()?.Manufacturer, csvStringEncoded));
|
diskFields.Add(new fieldMetadata($"Disk{index}Manufacturer", $"Disk {index} Manufacturer", typeof(string), r => r.DeviceDetailDiskDrives?.Skip(v).FirstOrDefault()?.Manufacturer, csvStringEncoded));
|
||||||
diskFields.Add(new DeviceExportFieldMetadata($"Disk{index}Model", $"Disk {index} Model", typeof(string), r => r.DeviceDetailDiskDrives?.Skip(v).FirstOrDefault()?.Model, csvStringEncoded));
|
diskFields.Add(new fieldMetadata($"Disk{index}Model", $"Disk {index} Model", typeof(string), r => r.DeviceDetailDiskDrives?.Skip(v).FirstOrDefault()?.Model, csvStringEncoded));
|
||||||
diskFields.Add(new DeviceExportFieldMetadata($"Disk{index}SerialNumber", $"Disk {index} Serial Number", typeof(string), r => r.DeviceDetailDiskDrives?.Skip(v).FirstOrDefault()?.SerialNumber, csvStringEncoded));
|
diskFields.Add(new fieldMetadata($"Disk{index}SerialNumber", $"Disk {index} Serial Number", typeof(string), r => r.DeviceDetailDiskDrives?.Skip(v).FirstOrDefault()?.SerialNumber, csvStringEncoded));
|
||||||
diskFields.Add(new DeviceExportFieldMetadata($"Disk{index}Firmware", $"Disk {index} Firmware", typeof(string), r => r.DeviceDetailDiskDrives?.Skip(v).FirstOrDefault()?.FirmwareRevision, csvStringEncoded));
|
diskFields.Add(new fieldMetadata($"Disk{index}Firmware", $"Disk {index} Firmware", typeof(string), r => r.DeviceDetailDiskDrives?.Skip(v).FirstOrDefault()?.FirmwareRevision, csvStringEncoded));
|
||||||
diskFields.Add(new DeviceExportFieldMetadata($"Disk{index}Capacity", $"Disk {index} Size", typeof(string), r => r.DeviceDetailDiskDrives?.Skip(v).FirstOrDefault()?.SizeFriendly(), csvStringEncoded));
|
diskFields.Add(new fieldMetadata($"Disk{index}Capacity", $"Disk {index} Size", typeof(string), r => r.DeviceDetailDiskDrives?.Skip(v).FirstOrDefault()?.SizeFriendly(), csvStringEncoded));
|
||||||
diskFields.Add(new DeviceExportFieldMetadata($"Disk{index}Capacity", $"Disk {index} Total Free Space", typeof(string), r => MeasurementUnitExtensions.ByteSizeToFriendly((ulong)(r.DeviceDetailDiskDrives?.Skip(v).FirstOrDefault()?.Partitions?.Sum(p => (long)(p.LogicalDisk?.FreeSpace ?? 0L)) ?? 0L)), csvStringEncoded));
|
diskFields.Add(new fieldMetadata($"Disk{index}Capacity", $"Disk {index} Total Free Space", typeof(string), r => MeasurementUnitExtensions.ByteSizeToFriendly((ulong)(r.DeviceDetailDiskDrives?.Skip(v).FirstOrDefault()?.Partitions?.Sum(p => (long)(p.LogicalDisk?.FreeSpace ?? 0L)) ?? 0L)), csvStringEncoded));
|
||||||
}
|
}
|
||||||
metadata.Add(nameof(DeviceExportOptions.DetailDiskDrives), diskFields);
|
metadata.Add(nameof(DeviceExportOptions.DetailDiskDrives), diskFields);
|
||||||
var lanAdapterFields = new List<DeviceExportFieldMetadata>(lanAdapterMaxCount * 5);
|
var lanAdapterFields = new List<fieldMetadata>(lanAdapterMaxCount * 5);
|
||||||
for (int i = 0; i < lanAdapterMaxCount; i++)
|
for (int i = 0; i < lanAdapterMaxCount; i++)
|
||||||
{
|
{
|
||||||
var v = i;
|
var v = i;
|
||||||
var index = i + 1;
|
var index = i + 1;
|
||||||
lanAdapterFields.Add(new DeviceExportFieldMetadata($"LanAdapter{index}Connection", $"Lan Adapter {index} Connection", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => !a.IsWlanAdapter).Skip(v).FirstOrDefault()?.NetConnectionID, csvStringEncoded));
|
lanAdapterFields.Add(new fieldMetadata($"LanAdapter{index}Connection", $"Lan Adapter {index} Connection", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => !a.IsWlanAdapter).Skip(v).FirstOrDefault()?.NetConnectionID, csvStringEncoded));
|
||||||
lanAdapterFields.Add(new DeviceExportFieldMetadata($"LanAdapter{index}Manufacturer", $"Lan Adapter {index} Manufacturer", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => !a.IsWlanAdapter).Skip(v).FirstOrDefault()?.Manufacturer, csvStringEncoded));
|
lanAdapterFields.Add(new fieldMetadata($"LanAdapter{index}Manufacturer", $"Lan Adapter {index} Manufacturer", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => !a.IsWlanAdapter).Skip(v).FirstOrDefault()?.Manufacturer, csvStringEncoded));
|
||||||
lanAdapterFields.Add(new DeviceExportFieldMetadata($"LanAdapter{index}ProductName", $"Lan Adapter {index} Product Name", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => !a.IsWlanAdapter).Skip(v).FirstOrDefault()?.ProductName, csvStringEncoded));
|
lanAdapterFields.Add(new fieldMetadata($"LanAdapter{index}ProductName", $"Lan Adapter {index} Product Name", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => !a.IsWlanAdapter).Skip(v).FirstOrDefault()?.ProductName, csvStringEncoded));
|
||||||
lanAdapterFields.Add(new DeviceExportFieldMetadata($"LanAdapter{index}Speed", $"Lan Adapter {index} Speed", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => !a.IsWlanAdapter).Skip(v).FirstOrDefault()?.SpeedFriendly(), csvStringEncoded));
|
lanAdapterFields.Add(new fieldMetadata($"LanAdapter{index}Speed", $"Lan Adapter {index} Speed", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => !a.IsWlanAdapter).Skip(v).FirstOrDefault()?.SpeedFriendly(), csvStringEncoded));
|
||||||
lanAdapterFields.Add(new DeviceExportFieldMetadata($"LanAdapter{index}MacAddress", $"Lan Adapter {index} Mac Address", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => !a.IsWlanAdapter).Skip(v).FirstOrDefault()?.MACAddress ?? r.DeviceDetailLanMacAddresses?.Skip(v).FirstOrDefault(), csvStringEncoded));
|
lanAdapterFields.Add(new fieldMetadata($"LanAdapter{index}MacAddress", $"Lan Adapter {index} Mac Address", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => !a.IsWlanAdapter).Skip(v).FirstOrDefault()?.MACAddress ?? r.DeviceDetailLanMacAddresses?.Skip(v).FirstOrDefault(), csvStringEncoded));
|
||||||
}
|
}
|
||||||
metadata.Add(nameof(DeviceExportOptions.DetailLanAdapters), lanAdapterFields);
|
metadata.Add(nameof(DeviceExportOptions.DetailLanAdapters), lanAdapterFields);
|
||||||
var fields = new List<DeviceExportFieldMetadata>(wlanAdapterMaxCount * 5);
|
var fields = new List<fieldMetadata>(wlanAdapterMaxCount * 5);
|
||||||
for (int i = 0; i < wlanAdapterMaxCount; i++)
|
for (int i = 0; i < wlanAdapterMaxCount; i++)
|
||||||
{
|
{
|
||||||
var v = i;
|
var v = i;
|
||||||
var wlanAdapterFields = i + 1;
|
var wlanAdapterFields = i + 1;
|
||||||
fields.Add(new DeviceExportFieldMetadata($"WlanAdapter{wlanAdapterFields}Connection", $"Wlan Adapter {wlanAdapterFields} Connection", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => a.IsWlanAdapter).Skip(v).FirstOrDefault()?.NetConnectionID, csvStringEncoded));
|
fields.Add(new fieldMetadata($"WlanAdapter{wlanAdapterFields}Connection", $"Wlan Adapter {wlanAdapterFields} Connection", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => a.IsWlanAdapter).Skip(v).FirstOrDefault()?.NetConnectionID, csvStringEncoded));
|
||||||
fields.Add(new DeviceExportFieldMetadata($"WlanAdapter{wlanAdapterFields}Manufacturer", $"Wlan Adapter {wlanAdapterFields} Manufacturer", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => a.IsWlanAdapter).Skip(v).FirstOrDefault()?.Manufacturer, csvStringEncoded));
|
fields.Add(new fieldMetadata($"WlanAdapter{wlanAdapterFields}Manufacturer", $"Wlan Adapter {wlanAdapterFields} Manufacturer", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => a.IsWlanAdapter).Skip(v).FirstOrDefault()?.Manufacturer, csvStringEncoded));
|
||||||
fields.Add(new DeviceExportFieldMetadata($"WlanAdapter{wlanAdapterFields}ProductName", $"Wlan Adapter {wlanAdapterFields} Product Name", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => a.IsWlanAdapter).Skip(v).FirstOrDefault()?.ProductName, csvStringEncoded));
|
fields.Add(new fieldMetadata($"WlanAdapter{wlanAdapterFields}ProductName", $"Wlan Adapter {wlanAdapterFields} Product Name", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => a.IsWlanAdapter).Skip(v).FirstOrDefault()?.ProductName, csvStringEncoded));
|
||||||
fields.Add(new DeviceExportFieldMetadata($"WlanAdapter{wlanAdapterFields}Speed", $"Wlan Adapter {wlanAdapterFields} Speed", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => a.IsWlanAdapter).Skip(v).FirstOrDefault()?.SpeedFriendly(), csvStringEncoded));
|
fields.Add(new fieldMetadata($"WlanAdapter{wlanAdapterFields}Speed", $"Wlan Adapter {wlanAdapterFields} Speed", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => a.IsWlanAdapter).Skip(v).FirstOrDefault()?.SpeedFriendly(), csvStringEncoded));
|
||||||
fields.Add(new DeviceExportFieldMetadata($"WlanAdapter{wlanAdapterFields}MacAddress", $"Wlan Adapter {wlanAdapterFields} Mac Address", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => a.IsWlanAdapter).Skip(v).FirstOrDefault()?.MACAddress ?? r.DeviceDetailWlanMacAddresses?.Skip(v).FirstOrDefault(), csvStringEncoded));
|
fields.Add(new fieldMetadata($"WlanAdapter{wlanAdapterFields}MacAddress", $"Wlan Adapter {wlanAdapterFields} Mac Address", typeof(string), r => r.DeviceDetailNetworkAdapters?.Where(a => a.IsWlanAdapter).Skip(v).FirstOrDefault()?.MACAddress ?? r.DeviceDetailWlanMacAddresses?.Skip(v).FirstOrDefault(), csvStringEncoded));
|
||||||
}
|
}
|
||||||
metadata.Add(nameof(DeviceExportOptions.DetailWLanAdapters), fields);
|
metadata.Add(nameof(DeviceExportOptions.DetailWLanAdapters), fields);
|
||||||
|
|
||||||
metadata.Add(nameof(DeviceExportOptions.DetailACAdapter), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DetailACAdapter), typeof(string), r => r.DeviceDetails.Where(dd => dd.Key == DeviceDetail.HardwareKeyACAdapter).Select(dd => dd.Value).FirstOrDefault(), csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DetailACAdapter), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DetailACAdapter), typeof(string), r => r.DeviceDetails.Where(dd => dd.Key == DeviceDetail.HardwareKeyACAdapter).Select(dd => dd.Value).FirstOrDefault(), csvStringEncoded) });
|
||||||
metadata.Add(nameof(DeviceExportOptions.DetailBattery), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DetailBattery), typeof(string), r => r.DeviceDetails.Where(dd => dd.Key == DeviceDetail.HardwareKeyBattery).Select(dd => dd.Value).FirstOrDefault(), csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DetailBattery), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DetailBattery), typeof(string), r => r.DeviceDetails.Where(dd => dd.Key == DeviceDetail.HardwareKeyBattery).Select(dd => dd.Value).FirstOrDefault(), csvStringEncoded) });
|
||||||
var batteriesFields = new List<DeviceExportFieldMetadata>(processorMaxCount * 6);
|
var batteriesFields = new List<fieldMetadata>(processorMaxCount * 6);
|
||||||
for (int i = 0; i < batteriesMaxCount; i++)
|
for (int i = 0; i < batteriesMaxCount; i++)
|
||||||
{
|
{
|
||||||
var v = i;
|
var v = i;
|
||||||
var index = i + 1;
|
var index = i + 1;
|
||||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}Name", $"Battery {index} Name", typeof(string), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.Name, csvStringEncoded));
|
batteriesFields.Add(new fieldMetadata($"Batteries{index}Name", $"Battery {index} Name", typeof(string), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.Name, csvStringEncoded));
|
||||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}Description", $"Battery {index} Description", typeof(string), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.Description, csvStringEncoded));
|
batteriesFields.Add(new fieldMetadata($"Batteries{index}Description", $"Battery {index} Description", typeof(string), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.Description, csvStringEncoded));
|
||||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}Availability", $"Battery {index} Availability", typeof(string), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.Availability, csvStringEncoded));
|
batteriesFields.Add(new fieldMetadata($"Batteries{index}Availability", $"Battery {index} Availability", typeof(string), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.Availability, csvStringEncoded));
|
||||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}Chemistry", $"Battery {index} Chemistry", typeof(string), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.Chemistry, csvStringEncoded));
|
batteriesFields.Add(new fieldMetadata($"Batteries{index}Chemistry", $"Battery {index} Chemistry", typeof(string), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.Chemistry, csvStringEncoded));
|
||||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}DesignVoltage", $"Battery {index} Design Voltage", typeof(long), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.DesignVoltage, csvToStringEncoded));
|
batteriesFields.Add(new fieldMetadata($"Batteries{index}DesignVoltage", $"Battery {index} Design Voltage", typeof(long), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.DesignVoltage, csvToStringEncoded));
|
||||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}DesignCapacity", $"Battery {index} Design Capacity", typeof(int), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.DesignCapacity, csvToStringEncoded));
|
batteriesFields.Add(new fieldMetadata($"Batteries{index}DesignCapacity", $"Battery {index} Design Capacity", typeof(int), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.DesignCapacity, csvToStringEncoded));
|
||||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}FullChargeCapacity", $"Battery {index} Capacity", typeof(int), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.FullChargeCapacity, csvToStringEncoded));
|
batteriesFields.Add(new fieldMetadata($"Batteries{index}FullChargeCapacity", $"Battery {index} Capacity", typeof(int), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.FullChargeCapacity, csvToStringEncoded));
|
||||||
}
|
}
|
||||||
metadata.Add(nameof(DeviceExportOptions.DetailBatteries), batteriesFields);
|
metadata.Add(nameof(DeviceExportOptions.DetailBatteries), batteriesFields);
|
||||||
metadata.Add(nameof(DeviceExportOptions.DetailKeyboard), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DetailKeyboard), typeof(string), r => r.DeviceDetails.Where(dd => dd.Key == DeviceDetail.HardwareKeyKeyboard).Select(dd => dd.Value).FirstOrDefault(), csvStringEncoded) });
|
metadata.Add(nameof(DeviceExportOptions.DetailKeyboard), new List<fieldMetadata>() { new fieldMetadata(nameof(DeviceExportOptions.DetailKeyboard), typeof(string), r => r.DeviceDetails.Where(dd => dd.Key == DeviceDetail.HardwareKeyKeyboard).Select(dd => dd.Value).FirstOrDefault(), csvStringEncoded) });
|
||||||
|
|
||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Disco.Services.Tasks;
|
using Disco.Services.Tasks;
|
||||||
using Quartz;
|
using Quartz;
|
||||||
using Disco.Data.Repository;
|
using Disco.Data.Repository;
|
||||||
|
using Disco.Services.Exporting;
|
||||||
|
|
||||||
namespace Disco.Services.Devices.Exporting
|
namespace Disco.Services.Devices.Exporting
|
||||||
{
|
{
|
||||||
@@ -13,10 +14,10 @@ namespace Disco.Services.Devices.Exporting
|
|||||||
public override bool SingleInstanceTask { get { return false; } }
|
public override bool SingleInstanceTask { get { return false; } }
|
||||||
public override bool CancelInitiallySupported { get { return false; } }
|
public override bool CancelInitiallySupported { get { return false; } }
|
||||||
|
|
||||||
public static DeviceExportTaskContext ScheduleNow(DeviceExportOptions Options)
|
public static ExportTaskContext<DeviceExportOptions> ScheduleNow(DeviceExportOptions Options)
|
||||||
{
|
{
|
||||||
// Build Context
|
// Build Context
|
||||||
var context = new DeviceExportTaskContext(Options);
|
var context = new ExportTaskContext<DeviceExportOptions>(Options);
|
||||||
|
|
||||||
// Build Data Map
|
// Build Data Map
|
||||||
var task = new DeviceExportTask();
|
var task = new DeviceExportTask();
|
||||||
@@ -30,7 +31,7 @@ namespace Disco.Services.Devices.Exporting
|
|||||||
|
|
||||||
protected override void ExecuteTask()
|
protected override void ExecuteTask()
|
||||||
{
|
{
|
||||||
var context = (DeviceExportTaskContext)ExecutionContext.JobDetail.JobDataMap[JobDataMapContext];
|
var context = (ExportTaskContext<DeviceExportOptions>)ExecutionContext.JobDetail.JobDataMap[JobDataMapContext];
|
||||||
|
|
||||||
Status.UpdateStatus(10, "Exporting Device Records", "Starting...");
|
Status.UpdateStatus(10, "Exporting Device Records", "Starting...");
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
using Disco.Models.Services.Devices.Exporting;
|
|
||||||
using Disco.Services.Tasks;
|
|
||||||
|
|
||||||
namespace Disco.Services.Devices.Exporting
|
|
||||||
{
|
|
||||||
public class DeviceExportTaskContext
|
|
||||||
{
|
|
||||||
public DeviceExportOptions Options { get; private set; }
|
|
||||||
|
|
||||||
public ScheduledTaskStatus TaskStatus { get; set; }
|
|
||||||
|
|
||||||
public DeviceExportResult Result { get; set; }
|
|
||||||
|
|
||||||
public DeviceExportTaskContext(DeviceExportOptions Options)
|
|
||||||
{
|
|
||||||
this.Options = Options;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -247,7 +247,8 @@
|
|||||||
<Compile Include="Devices\Enrolment\LogMacAddressImportingTask.cs" />
|
<Compile Include="Devices\Enrolment\LogMacAddressImportingTask.cs" />
|
||||||
<Compile Include="Devices\Exporting\DeviceExport.cs" />
|
<Compile Include="Devices\Exporting\DeviceExport.cs" />
|
||||||
<Compile Include="Devices\Exporting\DeviceExportTask.cs" />
|
<Compile Include="Devices\Exporting\DeviceExportTask.cs" />
|
||||||
<Compile Include="Devices\Exporting\DeviceExportTaskContext.cs" />
|
<Compile Include="Exporting\ExportHelpers.cs" />
|
||||||
|
<Compile Include="Exporting\ExportTaskContext.cs" />
|
||||||
<Compile Include="Devices\Importing\BaseDeviceImportContext.cs" />
|
<Compile Include="Devices\Importing\BaseDeviceImportContext.cs" />
|
||||||
<Compile Include="Devices\Importing\CsvDeviceImportDataReader.cs" />
|
<Compile Include="Devices\Importing\CsvDeviceImportDataReader.cs" />
|
||||||
<Compile Include="Devices\Importing\DeviceImport.cs" />
|
<Compile Include="Devices\Importing\DeviceImport.cs" />
|
||||||
|
|||||||
@@ -0,0 +1,109 @@
|
|||||||
|
using ClosedXML.Excel;
|
||||||
|
using Disco.Models.Exporting;
|
||||||
|
using Disco.Models.Services.Exporting;
|
||||||
|
using Disco.Services.Tasks;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Disco.Services
|
||||||
|
{
|
||||||
|
internal class ExportHelpers
|
||||||
|
{
|
||||||
|
public static ExportResult WriteExport<T>(IExportOptions options, IScheduledTaskStatus status, List<ExportFieldMetadata<T>> metadata, List<T> records) where T : IExportRecord
|
||||||
|
{
|
||||||
|
var filenameWithoutExtension = $"{options.FilenamePrefix}-{status.StartedTimestamp.Value:yyyyMMdd-HHmmss}";
|
||||||
|
MemoryStream stream;
|
||||||
|
string filename;
|
||||||
|
string mimeType;
|
||||||
|
|
||||||
|
switch (options.Format)
|
||||||
|
{
|
||||||
|
case ExportFormat.Csv:
|
||||||
|
stream = WriteCSV(filenameWithoutExtension, metadata, records, out filename, out mimeType);
|
||||||
|
break;
|
||||||
|
case ExportFormat.Xlsx:
|
||||||
|
stream = WriteXlsx(filenameWithoutExtension, options.ExcelWorksheetName, options.ExcelTableName, metadata, records, out filename, out mimeType);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new NotSupportedException($"Unsupported export format: {options.Format}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ExportResult()
|
||||||
|
{
|
||||||
|
Result = stream,
|
||||||
|
RecordCount = records.Count,
|
||||||
|
Filename = filename,
|
||||||
|
MimeType = mimeType,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MemoryStream WriteCSV<T>(string filenameWithoutExtension, List<ExportFieldMetadata<T>> metadata, List<T> records, out string filename, out string mimeType) where T : IExportRecord
|
||||||
|
{
|
||||||
|
var stream = new MemoryStream();
|
||||||
|
mimeType = "text/csv";
|
||||||
|
filename = $"{filenameWithoutExtension}.csv";
|
||||||
|
|
||||||
|
using (StreamWriter writer = new StreamWriter(stream, Encoding.Default, 0x400, true))
|
||||||
|
{
|
||||||
|
// Header
|
||||||
|
writer.Write('"');
|
||||||
|
writer.Write(string.Join("\",\"", metadata.Select(m => m.ColumnName)));
|
||||||
|
writer.Write('"');
|
||||||
|
|
||||||
|
// Records
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
writer.WriteLine();
|
||||||
|
for (int i = 0; i < metadata.Count; i++)
|
||||||
|
{
|
||||||
|
if (i != 0)
|
||||||
|
{
|
||||||
|
writer.Write(',');
|
||||||
|
}
|
||||||
|
var value = metadata[i].Accessor(record);
|
||||||
|
writer.Write(metadata[i].CsvEncoder(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stream.Position = 0;
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MemoryStream WriteXlsx<T>(string filenameWithoutExtension, string worksheetName, string tableName, List<ExportFieldMetadata<T>> metadata, List<T> records, out string filename, out string mimeType) where T : IExportRecord
|
||||||
|
{
|
||||||
|
var stream = new MemoryStream();
|
||||||
|
mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||||
|
filename = $"{filenameWithoutExtension}.xlsx";
|
||||||
|
|
||||||
|
// Create DataTable
|
||||||
|
var dataTable = new DataTable();
|
||||||
|
foreach (var field in metadata)
|
||||||
|
{
|
||||||
|
dataTable.Columns.Add(field.ColumnName, field.ValueType);
|
||||||
|
}
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
dataTable.Rows.Add(metadata.Select(m => m.Accessor(record)).ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var xlWorkbook = new XLWorkbook())
|
||||||
|
{
|
||||||
|
var sheet = xlWorkbook.AddWorksheet(worksheetName);
|
||||||
|
var table = sheet.Cell(1, 1).InsertTable(dataTable, tableName);
|
||||||
|
table.Theme = XLTableTheme.TableStyleMedium2;
|
||||||
|
|
||||||
|
table.Columns().ForEach(c => c.WorksheetColumn().AdjustToContents(2, 15, 30));
|
||||||
|
|
||||||
|
xlWorkbook.SaveAs(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
stream.Position = 0;
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using Disco.Models.Services.Exporting;
|
||||||
|
using Disco.Services.Tasks;
|
||||||
|
|
||||||
|
namespace Disco.Services.Exporting
|
||||||
|
{
|
||||||
|
public class ExportTaskContext<T> where T : IExportOptions
|
||||||
|
{
|
||||||
|
public T Options { get; private set; }
|
||||||
|
|
||||||
|
public ScheduledTaskStatus TaskStatus { get; set; }
|
||||||
|
|
||||||
|
public ExportResult Result { get; set; }
|
||||||
|
|
||||||
|
public ExportTaskContext(T Options)
|
||||||
|
{
|
||||||
|
this.Options = Options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,6 +13,8 @@ namespace Disco.Services.Tasks
|
|||||||
double ProgressMultiplier { get; set; }
|
double ProgressMultiplier { get; set; }
|
||||||
byte ProgressOffset { get; set; }
|
byte ProgressOffset { get; set; }
|
||||||
|
|
||||||
|
DateTime? StartedTimestamp { get; }
|
||||||
|
|
||||||
string FinishedMessage { get; }
|
string FinishedMessage { get; }
|
||||||
string FinishedUrl { get; }
|
string FinishedUrl { get; }
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ namespace Disco.Services.Tasks
|
|||||||
public double ProgressMultiplier { get; set; }
|
public double ProgressMultiplier { get; set; }
|
||||||
public byte ProgressOffset { get; set; }
|
public byte ProgressOffset { get; set; }
|
||||||
|
|
||||||
|
public DateTime? StartedTimestamp { get; } = DateTime.Now;
|
||||||
|
|
||||||
public string FinishedMessage { get; set; }
|
public string FinishedMessage { get; set; }
|
||||||
public string FinishedUrl { get; set; }
|
public string FinishedUrl { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Disco.BI.Extensions;
|
using Disco.BI.Extensions;
|
||||||
using Disco.Models.Repository;
|
using Disco.Models.Repository;
|
||||||
|
using Disco.Models.Services.Devices.Exporting;
|
||||||
using Disco.Models.Services.Devices.Importing;
|
using Disco.Models.Services.Devices.Importing;
|
||||||
using Disco.Models.Services.Documents;
|
using Disco.Models.Services.Documents;
|
||||||
using Disco.Services;
|
using Disco.Services;
|
||||||
@@ -7,6 +8,7 @@ using Disco.Services.Authorization;
|
|||||||
using Disco.Services.Devices.Exporting;
|
using Disco.Services.Devices.Exporting;
|
||||||
using Disco.Services.Devices.Importing;
|
using Disco.Services.Devices.Importing;
|
||||||
using Disco.Services.Documents;
|
using Disco.Services.Documents;
|
||||||
|
using Disco.Services.Exporting;
|
||||||
using Disco.Services.Interop;
|
using Disco.Services.Interop;
|
||||||
using Disco.Services.Interop.ActiveDirectory;
|
using Disco.Services.Interop.ActiveDirectory;
|
||||||
using Disco.Services.Users;
|
using Disco.Services.Users;
|
||||||
@@ -678,7 +680,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
throw new ArgumentNullException("Id");
|
throw new ArgumentNullException("Id");
|
||||||
|
|
||||||
string key = string.Format(ExportSessionCacheKey, Id);
|
string key = string.Format(ExportSessionCacheKey, Id);
|
||||||
var context = HttpRuntime.Cache.Get(key) as DeviceExportTaskContext;
|
var context = HttpRuntime.Cache.Get(key) as ExportTaskContext<DeviceExportOptions>;
|
||||||
|
|
||||||
if (context == null)
|
if (context == null)
|
||||||
throw new ArgumentException("The Id specified is invalid, or the export data expired (60 minutes)", "Id");
|
throw new ArgumentException("The Id specified is invalid, or the export data expired (60 minutes)", "Id");
|
||||||
@@ -686,22 +688,9 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (context.Result == null || context.Result.Result == null)
|
if (context.Result == null || context.Result.Result == null)
|
||||||
throw new ArgumentException("The export session is still running, or failed to complete successfully", "Id");
|
throw new ArgumentException("The export session is still running, or failed to complete successfully", "Id");
|
||||||
|
|
||||||
string filename;
|
|
||||||
string mimeType;
|
|
||||||
if (context.Options.ExcelFormat)
|
|
||||||
{
|
|
||||||
filename = $"DiscoDeviceExport-{context.TaskStatus.StartedTimestamp.Value:yyyyMMdd-HHmmss}.xlsx";
|
|
||||||
mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
filename = $"DiscoDeviceExport-{context.TaskStatus.StartedTimestamp.Value:yyyyMMdd-HHmmss}.csv";
|
|
||||||
mimeType = "text/csv";
|
|
||||||
}
|
|
||||||
|
|
||||||
var fileStream = context.Result.Result;
|
var fileStream = context.Result.Result;
|
||||||
|
|
||||||
return this.File(fileStream.GetBuffer(), 0, (int)fileStream.Length, mimeType, filename);
|
return this.File(fileStream.GetBuffer(), 0, (int)fileStream.Length, context.Result.MimeType, context.Result.Filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Disco.Models.Services.Jobs.JobLists;
|
|||||||
using Disco.Models.UI.Device;
|
using Disco.Models.UI.Device;
|
||||||
using Disco.Services;
|
using Disco.Services;
|
||||||
using Disco.Services.Authorization;
|
using Disco.Services.Authorization;
|
||||||
using Disco.Services.Devices.Exporting;
|
using Disco.Services.Exporting;
|
||||||
using Disco.Services.Interop.ActiveDirectory;
|
using Disco.Services.Interop.ActiveDirectory;
|
||||||
using Disco.Services.Plugins.Features.DetailsProvider;
|
using Disco.Services.Plugins.Features.DetailsProvider;
|
||||||
using Disco.Services.Plugins.Features.UIExtension;
|
using Disco.Services.Plugins.Features.UIExtension;
|
||||||
@@ -118,7 +118,7 @@ namespace Disco.Web.Controllers
|
|||||||
if (!string.IsNullOrWhiteSpace(DownloadId))
|
if (!string.IsNullOrWhiteSpace(DownloadId))
|
||||||
{
|
{
|
||||||
string key = string.Format(Areas.API.Controllers.DeviceController.ExportSessionCacheKey, DownloadId);
|
string key = string.Format(Areas.API.Controllers.DeviceController.ExportSessionCacheKey, DownloadId);
|
||||||
var context = HttpRuntime.Cache.Get(key) as DeviceExportTaskContext;
|
var context = HttpRuntime.Cache.Get(key) as ExportTaskContext<DeviceExportOptions>;
|
||||||
|
|
||||||
if (context != null)
|
if (context != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Disco.Models.Services.Devices.Exporting;
|
using Disco.Models.Services.Devices.Exporting;
|
||||||
|
using Disco.Models.Services.Exporting;
|
||||||
using Disco.Models.UI.Device;
|
using Disco.Models.UI.Device;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
@@ -9,7 +10,7 @@ namespace Disco.Web.Models.Device
|
|||||||
public DeviceExportOptions Options { get; set; }
|
public DeviceExportOptions Options { get; set; }
|
||||||
|
|
||||||
public string ExportSessionId { get; set; }
|
public string ExportSessionId { get; set; }
|
||||||
public DeviceExportResult ExportSessionResult { get; set; }
|
public ExportResult ExportSessionResult { get; set; }
|
||||||
|
|
||||||
public IEnumerable<KeyValuePair<int, string>> DeviceBatches { get; set; }
|
public IEnumerable<KeyValuePair<int, string>> DeviceBatches { get; set; }
|
||||||
public IEnumerable<KeyValuePair<int, string>> DeviceModels { get; set; }
|
public IEnumerable<KeyValuePair<int, string>> DeviceModels { get; set; }
|
||||||
|
|||||||
@@ -33,9 +33,9 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th> </th>
|
<th>@Html.LabelFor(m => m.Options.Format)</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.CheckBoxFor(m => m.Options.ExcelFormat) <label for="Options_ExcelFormat">Microsoft Excel Format</label>
|
@Html.DropDownListFor(m => m.Options.Format, Enum.GetNames(typeof(Disco.Models.Exporting.ExportFormat)).Select(v => new SelectListItem() { Value = v, Text = v }))
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -141,7 +141,7 @@
|
|||||||
if ($exportingDialog == null) {
|
if ($exportingDialog == null) {
|
||||||
$exportingDialog = $('#Devices_Export_Exporting').dialog({
|
$exportingDialog = $('#Devices_Export_Exporting').dialog({
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 160,
|
height: 164,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
autoOpen: false
|
autoOpen: false
|
||||||
@@ -159,6 +159,7 @@
|
|||||||
|
|
||||||
$('#Devices_Export_Download_Dialog').dialog({
|
$('#Devices_Export_Download_Dialog').dialog({
|
||||||
width: 400,
|
width: 400,
|
||||||
|
height: 164,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
autoOpen: true
|
autoOpen: true
|
||||||
@@ -181,7 +182,7 @@
|
|||||||
$('#Devices_Export_Download_Dialog')
|
$('#Devices_Export_Download_Dialog')
|
||||||
.dialog({
|
.dialog({
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 160,
|
height: 164,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
autoOpen: true
|
autoOpen: true
|
||||||
|
|||||||
@@ -165,24 +165,28 @@ WriteLiteral(" ");
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n </div>\r\n </td>\r\n </tr" +
|
WriteLiteral("\r\n </div>\r\n </td>\r\n </tr" +
|
||||||
">\r\n <tr>\r\n <th> </th>\r\n " +
|
">\r\n <tr>\r\n <th>");
|
||||||
" <td>\r\n");
|
|
||||||
|
|
||||||
|
#line 36 "..\..\Views\Device\Export.cshtml"
|
||||||
|
Write(Html.LabelFor(m => m.Options.Format));
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral("</th>\r\n <td>\r\n");
|
||||||
|
|
||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 38 "..\..\Views\Device\Export.cshtml"
|
#line 38 "..\..\Views\Device\Export.cshtml"
|
||||||
Write(Html.CheckBoxFor(m => m.Options.ExcelFormat));
|
Write(Html.DropDownListFor(m => m.Options.Format, Enum.GetNames(typeof(Disco.Models.Exporting.ExportFormat)).Select(v => new SelectListItem() { Value = v, Text = v })));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" <label");
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n " +
|
||||||
|
" </div>\r\n");
|
||||||
WriteLiteral(" for=\"Options_ExcelFormat\"");
|
|
||||||
|
|
||||||
WriteLiteral(">Microsoft Excel Format</label>\r\n </td>\r\n </tr>" +
|
|
||||||
"\r\n </table>\r\n </div>\r\n");
|
|
||||||
|
|
||||||
WriteLiteral(" <div");
|
WriteLiteral(" <div");
|
||||||
|
|
||||||
@@ -310,40 +314,40 @@ WriteLiteral(">\r\n");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" <li");
|
WriteLiteral(" <li");
|
||||||
|
|
||||||
WriteAttribute("title", Tuple.Create(" title=\"", 3823), Tuple.Create("\"", 3854)
|
WriteAttribute("title", Tuple.Create(" title=\"", 3907), Tuple.Create("\"", 3938)
|
||||||
|
|
||||||
#line 66 "..\..\Views\Device\Export.cshtml"
|
#line 66 "..\..\Views\Device\Export.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 3831), Tuple.Create<System.Object, System.Int32>(optionItem.Description
|
, Tuple.Create(Tuple.Create("", 3915), Tuple.Create<System.Object, System.Int32>(optionItem.Description
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 3831), false)
|
, 3915), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">\r\n <input");
|
WriteLiteral(">\r\n <input");
|
||||||
|
|
||||||
WriteLiteral(" type=\"checkbox\"");
|
WriteLiteral(" type=\"checkbox\"");
|
||||||
|
|
||||||
WriteAttribute("id", Tuple.Create(" id=\"", 3936), Tuple.Create("\"", 3973)
|
WriteAttribute("id", Tuple.Create(" id=\"", 4020), Tuple.Create("\"", 4057)
|
||||||
, Tuple.Create(Tuple.Create("", 3941), Tuple.Create("Options_", 3941), true)
|
, Tuple.Create(Tuple.Create("", 4025), Tuple.Create("Options_", 4025), true)
|
||||||
|
|
||||||
#line 67 "..\..\Views\Device\Export.cshtml"
|
#line 67 "..\..\Views\Device\Export.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 3949), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
, Tuple.Create(Tuple.Create("", 4033), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 3949), false)
|
, 4033), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteAttribute("name", Tuple.Create(" name=\"", 3974), Tuple.Create("\"", 4013)
|
WriteAttribute("name", Tuple.Create(" name=\"", 4058), Tuple.Create("\"", 4097)
|
||||||
, Tuple.Create(Tuple.Create("", 3981), Tuple.Create("Options.", 3981), true)
|
, Tuple.Create(Tuple.Create("", 4065), Tuple.Create("Options.", 4065), true)
|
||||||
|
|
||||||
#line 67 "..\..\Views\Device\Export.cshtml"
|
#line 67 "..\..\Views\Device\Export.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 3989), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
, Tuple.Create(Tuple.Create("", 4073), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 3989), false)
|
, 4073), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" value=\"true\"");
|
WriteLiteral(" value=\"true\"");
|
||||||
@@ -359,15 +363,15 @@ WriteLiteral(" ");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("/><label");
|
WriteLiteral("/><label");
|
||||||
|
|
||||||
WriteAttribute("for", Tuple.Create(" for=\"", 4083), Tuple.Create("\"", 4121)
|
WriteAttribute("for", Tuple.Create(" for=\"", 4167), Tuple.Create("\"", 4205)
|
||||||
, Tuple.Create(Tuple.Create("", 4089), Tuple.Create("Options_", 4089), true)
|
, Tuple.Create(Tuple.Create("", 4173), Tuple.Create("Options_", 4173), true)
|
||||||
|
|
||||||
#line 67 "..\..\Views\Device\Export.cshtml"
|
#line 67 "..\..\Views\Device\Export.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 4097), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
, Tuple.Create(Tuple.Create("", 4181), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 4097), false)
|
, 4181), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">");
|
WriteLiteral(">");
|
||||||
@@ -415,40 +419,40 @@ WriteLiteral(">\r\n");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" <li");
|
WriteLiteral(" <li");
|
||||||
|
|
||||||
WriteAttribute("title", Tuple.Create(" title=\"", 4656), Tuple.Create("\"", 4687)
|
WriteAttribute("title", Tuple.Create(" title=\"", 4740), Tuple.Create("\"", 4771)
|
||||||
|
|
||||||
#line 75 "..\..\Views\Device\Export.cshtml"
|
#line 75 "..\..\Views\Device\Export.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 4664), Tuple.Create<System.Object, System.Int32>(optionItem.Description
|
, Tuple.Create(Tuple.Create("", 4748), Tuple.Create<System.Object, System.Int32>(optionItem.Description
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 4664), false)
|
, 4748), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">\r\n <input");
|
WriteLiteral(">\r\n <input");
|
||||||
|
|
||||||
WriteLiteral(" type=\"checkbox\"");
|
WriteLiteral(" type=\"checkbox\"");
|
||||||
|
|
||||||
WriteAttribute("id", Tuple.Create(" id=\"", 4769), Tuple.Create("\"", 4806)
|
WriteAttribute("id", Tuple.Create(" id=\"", 4853), Tuple.Create("\"", 4890)
|
||||||
, Tuple.Create(Tuple.Create("", 4774), Tuple.Create("Options_", 4774), true)
|
, Tuple.Create(Tuple.Create("", 4858), Tuple.Create("Options_", 4858), true)
|
||||||
|
|
||||||
#line 76 "..\..\Views\Device\Export.cshtml"
|
#line 76 "..\..\Views\Device\Export.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 4782), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
, Tuple.Create(Tuple.Create("", 4866), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 4782), false)
|
, 4866), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteAttribute("name", Tuple.Create(" name=\"", 4807), Tuple.Create("\"", 4846)
|
WriteAttribute("name", Tuple.Create(" name=\"", 4891), Tuple.Create("\"", 4930)
|
||||||
, Tuple.Create(Tuple.Create("", 4814), Tuple.Create("Options.", 4814), true)
|
, Tuple.Create(Tuple.Create("", 4898), Tuple.Create("Options.", 4898), true)
|
||||||
|
|
||||||
#line 76 "..\..\Views\Device\Export.cshtml"
|
#line 76 "..\..\Views\Device\Export.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 4822), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
, Tuple.Create(Tuple.Create("", 4906), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 4822), false)
|
, 4906), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" value=\"true\"");
|
WriteLiteral(" value=\"true\"");
|
||||||
@@ -464,15 +468,15 @@ WriteLiteral(" ");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("/><label");
|
WriteLiteral("/><label");
|
||||||
|
|
||||||
WriteAttribute("for", Tuple.Create(" for=\"", 4916), Tuple.Create("\"", 4954)
|
WriteAttribute("for", Tuple.Create(" for=\"", 5000), Tuple.Create("\"", 5038)
|
||||||
, Tuple.Create(Tuple.Create("", 4922), Tuple.Create("Options_", 4922), true)
|
, Tuple.Create(Tuple.Create("", 5006), Tuple.Create("Options_", 5006), true)
|
||||||
|
|
||||||
#line 76 "..\..\Views\Device\Export.cshtml"
|
#line 76 "..\..\Views\Device\Export.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 4930), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
, Tuple.Create(Tuple.Create("", 5014), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 4930), false)
|
, 5014), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">");
|
WriteLiteral(">");
|
||||||
@@ -543,7 +547,7 @@ WriteLiteral(" <script>\r\n $(function () {\r\n
|
|||||||
"put:checked\').length;\r\n\r\n if (exportFieldCount > 0) {\r\n\r\n " +
|
"put:checked\').length;\r\n\r\n if (exportFieldCount > 0) {\r\n\r\n " +
|
||||||
" if ($exportingDialog == null) {\r\n " +
|
" if ($exportingDialog == null) {\r\n " +
|
||||||
" $exportingDialog = $(\'#Devices_Export_Exporting\').dialog({\r\n " +
|
" $exportingDialog = $(\'#Devices_Export_Exporting\').dialog({\r\n " +
|
||||||
" width: 400,\r\n height: 160,\r\n " +
|
" width: 400,\r\n height: 164,\r\n " +
|
||||||
" resizable: false,\r\n modal" +
|
" resizable: false,\r\n modal" +
|
||||||
": true,\r\n autoOpen: false\r\n " +
|
": true,\r\n autoOpen: false\r\n " +
|
||||||
" });\r\n }\r\n $exportingDialog.d" +
|
" });\r\n }\r\n $exportingDialog.d" +
|
||||||
@@ -552,14 +556,14 @@ WriteLiteral(" <script>\r\n $(function () {\r\n
|
|||||||
"e field to export.\');\r\n }\r\n $.validator.unobtrusiv" +
|
"e field to export.\');\r\n }\r\n $.validator.unobtrusiv" +
|
||||||
"e.parse($form);\r\n $form.data(\"validator\").settings.submitHandler " +
|
"e.parse($form);\r\n $form.data(\"validator\").settings.submitHandler " +
|
||||||
"= submitHandler;\r\n\r\n $(\'#Devices_Export_Download_Dialog\').dialog(" +
|
"= submitHandler;\r\n\r\n $(\'#Devices_Export_Download_Dialog\').dialog(" +
|
||||||
"{\r\n width: 400,\r\n resizable: false,\r\n " +
|
"{\r\n width: 400,\r\n height: 164,\r\n " +
|
||||||
" modal: true,\r\n autoOpen: true\r\n " +
|
" resizable: false,\r\n modal: true,\r\n " +
|
||||||
" });\r\n $(\'#Devices_Export_Button\').click(function () {\r\n " +
|
" autoOpen: true\r\n });\r\n $(\'#Devices_Export_Butto" +
|
||||||
" $form.submit();\r\n });\r\n });\r\n </scri" +
|
"n\').click(function () {\r\n $form.submit();\r\n })" +
|
||||||
"pt>\r\n");
|
";\r\n });\r\n </script>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 171 "..\..\Views\Device\Export.cshtml"
|
#line 172 "..\..\Views\Device\Export.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -568,7 +572,7 @@ WriteLiteral(" <script>\r\n $(function () {\r\n
|
|||||||
WriteLiteral("</div>\r\n");
|
WriteLiteral("</div>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 173 "..\..\Views\Device\Export.cshtml"
|
#line 174 "..\..\Views\Device\Export.cshtml"
|
||||||
if (Model.ExportSessionId != null)
|
if (Model.ExportSessionId != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -586,7 +590,7 @@ WriteLiteral(" title=\"Export Devices\"");
|
|||||||
WriteLiteral(">\r\n <h4>");
|
WriteLiteral(">\r\n <h4>");
|
||||||
|
|
||||||
|
|
||||||
#line 176 "..\..\Views\Device\Export.cshtml"
|
#line 177 "..\..\Views\Device\Export.cshtml"
|
||||||
Write(Model.ExportSessionResult.RecordCount);
|
Write(Model.ExportSessionResult.RecordCount);
|
||||||
|
|
||||||
|
|
||||||
@@ -595,7 +599,7 @@ WriteLiteral(">\r\n <h4>");
|
|||||||
WriteLiteral(" record");
|
WriteLiteral(" record");
|
||||||
|
|
||||||
|
|
||||||
#line 176 "..\..\Views\Device\Export.cshtml"
|
#line 177 "..\..\Views\Device\Export.cshtml"
|
||||||
Write(Model.ExportSessionResult.RecordCount != 1 ? "s" : null);
|
Write(Model.ExportSessionResult.RecordCount != 1 ? "s" : null);
|
||||||
|
|
||||||
|
|
||||||
@@ -603,14 +607,14 @@ WriteLiteral(" record");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" were successfully exported.</h4>\r\n <a");
|
WriteLiteral(" were successfully exported.</h4>\r\n <a");
|
||||||
|
|
||||||
WriteAttribute("href", Tuple.Create(" href=\"", 9297), Tuple.Create("\"", 9369)
|
WriteAttribute("href", Tuple.Create(" href=\"", 9415), Tuple.Create("\"", 9487)
|
||||||
|
|
||||||
#line 177 "..\..\Views\Device\Export.cshtml"
|
#line 178 "..\..\Views\Device\Export.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 9304), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ExportRetrieve(Model.ExportSessionId))
|
, Tuple.Create(Tuple.Create("", 9422), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ExportRetrieve(Model.ExportSessionId))
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 9304), false)
|
, 9422), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" class=\"button\"");
|
WriteLiteral(" class=\"button\"");
|
||||||
@@ -626,7 +630,7 @@ WriteLiteral(@" <script>
|
|||||||
$('#Devices_Export_Download_Dialog')
|
$('#Devices_Export_Download_Dialog')
|
||||||
.dialog({
|
.dialog({
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 160,
|
height: 164,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
autoOpen: true
|
autoOpen: true
|
||||||
@@ -636,7 +640,7 @@ WriteLiteral(@" <script>
|
|||||||
");
|
");
|
||||||
|
|
||||||
|
|
||||||
#line 191 "..\..\Views\Device\Export.cshtml"
|
#line 192 "..\..\Views\Device\Export.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user