Compare commits
149 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 09f9f2d427 | |||
| 390857e065 | |||
| e0d620bf67 | |||
| 78b7b059ea | |||
| bb846d14c5 | |||
| 565e1707ce | |||
| a675e4a6e9 | |||
| d8eb8fec83 | |||
| f90eda4101 | |||
| 37e2e5a08c | |||
| 6af83cbdb2 | |||
| 5f4cb20900 | |||
| aee467cb53 | |||
| 6ce6e2cccf | |||
| cd858c2215 | |||
| 7e07c07171 | |||
| 15e2806731 | |||
| 53baf4eb78 | |||
| 8c48ab6ecd | |||
| 8afe4195a9 | |||
| dcc4fcb984 | |||
| 4631903019 | |||
| 85d51c0e45 | |||
| 974a07f3bb | |||
| b576aec641 | |||
| a2aaa4c913 | |||
| 318a70d9a3 | |||
| 53e57d4017 | |||
| 143dc1b3e6 | |||
| a4f18d1d49 | |||
| 46222f2a78 | |||
| 2e091383ec | |||
| 7ace4d1c7e | |||
| f901d45d78 | |||
| 028d1ccc64 | |||
| 7b6a44921d | |||
| 23406e5e39 | |||
| 83557e6f0c | |||
| 1c90c89158 | |||
| 9924153e82 | |||
| 3ec2ea7d37 | |||
| b6945d9bbd | |||
| 6740a7479a | |||
| a3fb09440d | |||
| 7353405b16 | |||
| 6fcb1a1eae | |||
| e204ea4d5f | |||
| 0a4a2816a0 | |||
| 473b02f718 | |||
| 5a2c29ea0b | |||
| 1a8ec32f0f | |||
| 9e7daf2043 | |||
| 0c690cff5a | |||
| b55b77de9f | |||
| 937508c440 | |||
| cfe4c4b912 | |||
| d75663a219 | |||
| 1e24844e88 | |||
| 273b67c422 | |||
| 13549e7ec4 | |||
| bbb40bd5c4 | |||
| 22dad072b9 | |||
| 215e9863a2 | |||
| 190abc72dd | |||
| af75a55d44 | |||
| e05206d405 | |||
| 53eed02a4f | |||
| 57a7f67c3a | |||
| 47e11c0fd6 | |||
| 708ca16de8 | |||
| 535a3f2967 | |||
| ebd1c79f64 | |||
| 7194dd612d | |||
| 584bc07824 | |||
| 2bd9238090 | |||
| b11fa5b1d6 | |||
| 7667eaa49e | |||
| 9f7c0f965e | |||
| a274a33cf6 | |||
| 4acfd54319 | |||
| 941f1cf13e | |||
| f225edd2d4 | |||
| 5824680e2a | |||
| ed4ec890da | |||
| 56453fa081 | |||
| 11c824518f | |||
| d720303a83 | |||
| 02b29948ce | |||
| a152365312 | |||
| dba6c383f6 | |||
| ba32b3b717 | |||
| 51cebd0706 | |||
| 983bdbefb9 | |||
| be99083d6a | |||
| 4c19a1ef63 | |||
| 4f9f0fd0a8 | |||
| 05593a1466 | |||
| 2873b4be8a | |||
| 7a1ff211a0 | |||
| fcf70f724e | |||
| 99be87ed9c | |||
| 261baf669e | |||
| b0fddd491b | |||
| dff47c0e8b | |||
| ed58619919 | |||
| 2a2731b9f3 | |||
| 13e666d95a | |||
| 96cccab958 | |||
| e463a7361e | |||
| 58e467b6d6 | |||
| 81bd6ccd83 | |||
| 3e7db6b552 | |||
| 09a6369693 | |||
| 9bfeff8c42 | |||
| 3e57af394d | |||
| e11d0871c4 | |||
| f7fdfb0c8a | |||
| 806aadd161 | |||
| af4a94870e | |||
| 486ce17857 | |||
| f82b47dd46 | |||
| f1d27732c7 | |||
| 28e5901929 | |||
| e531ffe2b7 | |||
| 4fca015afa | |||
| a80ed14038 | |||
| f3e0939a06 | |||
| 2cd6ddfa24 | |||
| b4a30061e3 | |||
| cb033c0b70 | |||
| 3c197e7b2f | |||
| 9f62da9ccd | |||
| df721d7d6e | |||
| 8278efb9a6 | |||
| d477ad5d9c | |||
| 0755b6fc8a | |||
| 78dd494304 | |||
| 0497e145ea | |||
| 4d6aa18095 | |||
| fdf1bd4bc6 | |||
| 82183f6508 | |||
| d6ee70b860 | |||
| 5ce9e51ae7 | |||
| ed66f4f285 | |||
| 526f8547f7 | |||
| d8e93cb31b | |||
| 5fa74a8cc0 | |||
| a0d643eda1 | |||
| 0887eb447e |
@@ -0,0 +1,4 @@
|
||||
[*.cs]
|
||||
|
||||
# VSSpell001: Spell Check
|
||||
dotnet_diagnostic.VSSpell001.severity = suggestion
|
||||
@@ -8,8 +8,8 @@ using Disco.Services.Expressions;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using iTextSharp.text.pdf;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
@@ -17,28 +17,58 @@ namespace Disco.BI.Extensions
|
||||
{
|
||||
public static class DocumentTemplateExtensions
|
||||
{
|
||||
internal const string CacheTemplate = "DocumentTemplate_{0}";
|
||||
|
||||
public static ConcurrentDictionary<string, Expression> PdfExpressionsFromCache(this DocumentTemplate dt, DiscoDataContext Database)
|
||||
private static Tuple<Dictionary<string, Expression>, List<DocumentField>> CreateExpressions(DocumentTemplate dt, DiscoDataContext database)
|
||||
{
|
||||
string cacheModuleKey = string.Format(CacheTemplate, dt.Id);
|
||||
var module = ExpressionCache.GetModule(cacheModuleKey);
|
||||
if (module == null)
|
||||
Dictionary<string, Expression> expressions = new Dictionary<string, Expression>();
|
||||
List<DocumentField> fields = new List<DocumentField>();
|
||||
|
||||
string templateFilename = dt.RepositoryFilename(database);
|
||||
PdfReader pdfReader = new PdfReader(templateFilename);
|
||||
int pdfFieldOrdinal = 0;
|
||||
foreach (string pdfFieldKey in pdfReader.AcroFields.Fields.Keys)
|
||||
{
|
||||
// Cache
|
||||
string templateFilename = dt.RepositoryFilename(Database);
|
||||
PdfReader pdfReader = new PdfReader(templateFilename);
|
||||
int pdfFieldOrdinal = 0;
|
||||
foreach (string pdfFieldKey in pdfReader.AcroFields.Fields.Keys)
|
||||
var pdfField = pdfReader.AcroFields.Fields[pdfFieldKey];
|
||||
var pdfFieldPositions = pdfReader.AcroFields.GetFieldPositions(pdfFieldKey);
|
||||
var pdfFieldFlags = pdfField.GetMerged(0).GetAsNumber(PdfName.FF)?.IntValue ?? 0;
|
||||
var isRequired = (pdfFieldFlags & 2) == 2;
|
||||
var isReadOnly = (pdfFieldFlags & 1) == 1;
|
||||
|
||||
var pdfFieldValue = pdfReader.AcroFields.GetField(pdfFieldKey);
|
||||
var pdfFieldPosition = default(RectangleF?);
|
||||
if (pdfFieldPositions != null && pdfFieldPositions.Count > 0)
|
||||
{
|
||||
var pdfFieldValue = pdfReader.AcroFields.GetField(pdfFieldKey);
|
||||
ExpressionCache.SetValue(cacheModuleKey, pdfFieldKey, Expression.Tokenize(pdfFieldKey, pdfFieldValue, pdfFieldOrdinal));
|
||||
pdfFieldOrdinal++;
|
||||
var position = pdfFieldPositions.First().position;
|
||||
pdfFieldPosition = new RectangleF(position.Left, position.Top, position.Width, position.Height);
|
||||
}
|
||||
pdfReader.Close();
|
||||
module = ExpressionCache.GetModule(cacheModuleKey, true);
|
||||
var fieldTypeId = pdfReader.AcroFields.GetFieldType(pdfFieldKey);
|
||||
var fieldType = DocumentFieldType.None;
|
||||
if (fieldTypeId <= 8 && fieldTypeId > 0)
|
||||
fieldType = (DocumentFieldType)fieldTypeId;
|
||||
|
||||
var fixedValues = default(List<string>);
|
||||
|
||||
if (fieldType == DocumentFieldType.RadioButton || fieldType == DocumentFieldType.Checkbox)
|
||||
{
|
||||
fixedValues = pdfReader.AcroFields.GetAppearanceStates(pdfFieldKey).ToList();
|
||||
}
|
||||
|
||||
expressions[pdfFieldKey] = Expression.Tokenize(pdfFieldKey, pdfFieldValue, pdfFieldOrdinal, isRequired, isReadOnly, pdfFieldPosition);
|
||||
fields.Add(new DocumentField(pdfFieldKey, pdfFieldValue, pdfFieldOrdinal, fieldType, isRequired, isReadOnly, fixedValues));
|
||||
pdfFieldOrdinal++;
|
||||
}
|
||||
return module;
|
||||
pdfReader.Close();
|
||||
|
||||
return Tuple.Create(expressions, fields);
|
||||
}
|
||||
|
||||
public static Dictionary<string, Expression> PdfExpressionsFromCache(this DocumentTemplate dt, DiscoDataContext Database)
|
||||
{
|
||||
return ExpressionCache.GetOrCreateExpressions(dt, () => CreateExpressions(dt, Database));
|
||||
}
|
||||
|
||||
public static List<DocumentField> PdfFieldsFromCache(this DocumentTemplate dt, DiscoDataContext Database)
|
||||
{
|
||||
return ExpressionCache.GetOrCreateFields(dt, () => CreateExpressions(dt, Database));
|
||||
}
|
||||
|
||||
public static List<Expression> ExtractPdfExpressions(this DocumentTemplate dt, DiscoDataContext Database)
|
||||
@@ -46,14 +76,6 @@ namespace Disco.BI.Extensions
|
||||
return dt.PdfExpressionsFromCache(Database).Values.OrderBy(e => e.Ordinal).ToList();
|
||||
}
|
||||
|
||||
public static Stream GeneratePdfBulk(this DocumentTemplate dt, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, params string[] DataObjectsIds)
|
||||
{
|
||||
return Interop.Pdf.PdfGenerator.GenerateBulkFromTemplate(dt, Database, CreatorUser, Timestamp, InsertBlankPages, DataObjectsIds);
|
||||
}
|
||||
public static Stream GeneratePdfBulk(this DocumentTemplate dt, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, params IAttachmentTarget[] DataObjects)
|
||||
{
|
||||
return Interop.Pdf.PdfGenerator.GenerateBulkFromTemplate(dt, Database, CreatorUser, Timestamp, InsertBlankPages, DataObjects);
|
||||
}
|
||||
public static Stream GeneratePdf(this DocumentTemplate dt, DiscoDataContext Database, IAttachmentTarget Target, User CreatorUser, DateTime TimeStamp, DocumentState State, bool FlattenFields = false)
|
||||
{
|
||||
bool generateExpression = !string.IsNullOrEmpty(dt.OnGenerateExpression);
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.BI.Expressions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Models.Services.Documents;
|
||||
using Disco.Models.Services.Expressions.Extensions;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Documents;
|
||||
using Disco.Services.Expressions;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using Disco.Services.Tasks;
|
||||
using Disco.Services.Users;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text.pdf.codec;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -120,15 +120,19 @@ namespace Disco.BI.Interop.Pdf
|
||||
return bulkPdf;
|
||||
}
|
||||
}
|
||||
public static Stream GenerateBulkFromTemplate(DocumentTemplate dt, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, params IAttachmentTarget[] DataObjects)
|
||||
public static Stream GenerateBulkFromTemplate(DocumentTemplate dt, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, List<IAttachmentTarget> DataObjects, IScheduledTaskStatus taskStatus)
|
||||
{
|
||||
if (DataObjects.Length > 0)
|
||||
if (DataObjects.Count > 0)
|
||||
{
|
||||
List<Stream> generatedPdfs = new List<Stream>(DataObjects.Length);
|
||||
List<Stream> generatedPdfs = new List<Stream>(DataObjects.Count);
|
||||
var progressPerDoc = 80d / DataObjects.Count;
|
||||
var progressDoc = 10d;
|
||||
using (var state = DocumentState.DefaultState())
|
||||
{
|
||||
taskStatus.UpdateStatus(10, "Rendering", "Starting");
|
||||
foreach (var d in DataObjects)
|
||||
{
|
||||
taskStatus.UpdateStatus(progressDoc += progressPerDoc, $"Rendering {d.AttachmentReferenceId}");
|
||||
generatedPdfs.Add(dt.GeneratePdf(Database, d, CreatorUser, Timestamp, state, true));
|
||||
state.SequenceNumber++;
|
||||
state.FlushScopeCache();
|
||||
@@ -140,6 +144,7 @@ namespace Disco.BI.Interop.Pdf
|
||||
}
|
||||
else
|
||||
{
|
||||
taskStatus.UpdateStatus(90, "Merging", "Merging documents");
|
||||
Stream bulkPdf = Utilities.JoinPdfs(InsertBlankPages, generatedPdfs);
|
||||
foreach (Stream singlePdf in generatedPdfs)
|
||||
singlePdf.Dispose();
|
||||
@@ -149,35 +154,57 @@ namespace Disco.BI.Interop.Pdf
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Stream GenerateBulkFromTemplate(DocumentTemplate dt, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, params string[] DataObjectsIds)
|
||||
public static Stream GenerateBulkFromTemplate(DocumentTemplate dt, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, List<string> DataObjectsIds, IScheduledTaskStatus taskStatus)
|
||||
{
|
||||
IAttachmentTarget[] DataObjects;
|
||||
Dictionary<string, IAttachmentTarget> dataObjectLookup;
|
||||
List<string> dataObjectIds = DataObjectsIds;
|
||||
|
||||
taskStatus.UpdateStatus(0, "Resolving targets", "Resolving render targets");
|
||||
|
||||
switch (dt.Scope)
|
||||
{
|
||||
case DocumentTemplate.DocumentTemplateScopes.Device:
|
||||
DataObjects = Database.Devices.Where(d => DataObjectsIds.Contains(d.SerialNumber)).ToArray();
|
||||
dataObjectLookup = Database.Devices.Where(d => DataObjectsIds.Contains(d.SerialNumber)).AsEnumerable().Cast<IAttachmentTarget>().ToDictionary(i => i.AttachmentReferenceId, StringComparer.OrdinalIgnoreCase);
|
||||
break;
|
||||
case DocumentTemplate.DocumentTemplateScopes.Job:
|
||||
int[] intDataObjectsIds = DataObjectsIds.Select(i => int.Parse(i)).ToArray();
|
||||
DataObjects = Database.Jobs.Where(j => intDataObjectsIds.Contains(j.Id)).ToArray();
|
||||
var intDataObjectsIds = DataObjectsIds.Select(i => int.Parse(i)).ToList();
|
||||
dataObjectLookup = Database.Jobs.Where(j => intDataObjectsIds.Contains(j.Id)).AsEnumerable().Cast<IAttachmentTarget>().ToDictionary(i => i.AttachmentReferenceId, StringComparer.OrdinalIgnoreCase);
|
||||
break;
|
||||
case DocumentTemplate.DocumentTemplateScopes.User:
|
||||
DataObjects = new IAttachmentTarget[DataObjectsIds.Length];
|
||||
for (int idIndex = 0; idIndex < DataObjectsIds.Length; idIndex++)
|
||||
dataObjectLookup = new Dictionary<string, IAttachmentTarget>(DataObjectsIds.Count, StringComparer.OrdinalIgnoreCase);
|
||||
dataObjectIds = new List<string>(DataObjectsIds.Count);
|
||||
foreach (var userId in DataObjectsIds)
|
||||
{
|
||||
string dataObjectId = DataObjectsIds[idIndex];
|
||||
|
||||
DataObjects[idIndex] = UserService.GetUser(ActiveDirectory.ParseDomainAccountId(dataObjectId), Database, true);
|
||||
if (DataObjects[idIndex] == null)
|
||||
throw new Exception($"Unknown Username specified: {dataObjectId}");
|
||||
var user = UserService.GetUser(ActiveDirectory.ParseDomainAccountId(userId), Database, true);
|
||||
if (user == null)
|
||||
{
|
||||
dataObjectIds.Add(userId);
|
||||
continue;
|
||||
}
|
||||
dataObjectIds.Add(user.UserId);
|
||||
dataObjectLookup.Add(user.UserId, user);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException("Invalid DocumentType Scope");
|
||||
}
|
||||
|
||||
return GenerateBulkFromTemplate(dt, Database, CreatorUser, Timestamp, InsertBlankPages, DataObjects);
|
||||
// recreate list to honor the sort-order provided in DataObjectsIds
|
||||
var dataObjects = new List<IAttachmentTarget>(DataObjectsIds.Count);
|
||||
var missingIds = new List<string>();
|
||||
foreach (var id in dataObjectIds)
|
||||
{
|
||||
if (dataObjectLookup.TryGetValue(id, out var dataObject))
|
||||
dataObjects.Add(dataObject);
|
||||
else
|
||||
missingIds.Add(id);
|
||||
}
|
||||
if (missingIds.Any())
|
||||
{
|
||||
throw new Exception($"Unknown id specified: {string.Join("; ", missingIds)}");
|
||||
}
|
||||
|
||||
return GenerateBulkFromTemplate(dt, Database, CreatorUser, Timestamp, InsertBlankPages, dataObjects, taskStatus);
|
||||
}
|
||||
|
||||
public static Stream GenerateFromTemplate(DocumentTemplate dt, DiscoDataContext Database, IAttachmentTarget Data, User CreatorUser, DateTime TimeStamp, DocumentState State, bool FlattenFields = false)
|
||||
@@ -207,7 +234,7 @@ namespace Disco.BI.Interop.Pdf
|
||||
if (dt.FlattenForm)
|
||||
FlattenFields = true;
|
||||
|
||||
ConcurrentDictionary<string, Expression> expressionCache = dt.PdfExpressionsFromCache(Database);
|
||||
var expressionCache = dt.PdfExpressionsFromCache(Database);
|
||||
|
||||
string templateFilename = dt.RepositoryFilename(Database);
|
||||
PdfReader pdfReader = new PdfReader(templateFilename);
|
||||
@@ -218,7 +245,7 @@ namespace Disco.BI.Interop.Pdf
|
||||
pdfStamper.FormFlattening = FlattenFields;
|
||||
pdfStamper.Writer.CloseStream = false;
|
||||
|
||||
IDictionary expressionVariables = Expression.StandardVariables(dt, Database, CreatorUser, TimeStamp, State);
|
||||
IDictionary expressionVariables = Expression.StandardVariables(dt, Database, CreatorUser, TimeStamp, State, Data);
|
||||
|
||||
foreach (string pdfFieldKey in pdfStamper.AcroFields.Fields.Keys)
|
||||
{
|
||||
@@ -227,7 +254,7 @@ namespace Disco.BI.Interop.Pdf
|
||||
AcroFields.Item fields = pdfStamper.AcroFields.Fields[pdfFieldKey];
|
||||
string fieldValue = dt.CreateUniqueIdentifier(Database, Data, CreatorUser, TimeStamp, 0).ToJson();
|
||||
if (FlattenFields)
|
||||
pdfStamper.AcroFields.SetField(pdfFieldKey, String.Empty);
|
||||
pdfStamper.AcroFields.SetField(pdfFieldKey, string.Empty);
|
||||
else
|
||||
pdfStamper.AcroFields.SetField(pdfFieldKey, fieldValue);
|
||||
|
||||
@@ -241,16 +268,15 @@ namespace Disco.BI.Interop.Pdf
|
||||
var pageUniqueIdBytes = pageUniqueId.ToQRCodeBytes();
|
||||
|
||||
// Encode to QRCode byte array
|
||||
var pageUniqueIdWidth = (int)pdfFieldPosition.position.Width;
|
||||
var pageUniqueIdHeight = (int)pdfFieldPosition.position.Height;
|
||||
var pageUniqueIdEncoded = QRCodeBinaryEncoder.Encode(pageUniqueIdBytes, pageUniqueIdWidth, pageUniqueIdHeight);
|
||||
var pageUniqueIdEncoded = QRCodeBinaryEncoder.Encode(pageUniqueIdBytes, out var qrWidth, out var qrHeight);
|
||||
|
||||
// Encode byte array to Image
|
||||
var pageUniqueIdImageData = CCITTG4Encoder.Compress(pageUniqueIdEncoded, pageUniqueIdWidth, pageUniqueIdHeight);
|
||||
var pageUniqueIdImage = iTextSharp.text.Image.GetInstance(pageUniqueIdWidth, pageUniqueIdHeight, false, 256, 1, pageUniqueIdImageData, null);
|
||||
var pageUniqueIdImageData = CCITTG4Encoder.Compress(pageUniqueIdEncoded, qrWidth, qrHeight);
|
||||
var pageUniqueIdImage = iTextSharp.text.Image.GetInstance(qrWidth, qrHeight, false, 256, 1, pageUniqueIdImageData, null);
|
||||
|
||||
// Add to the pdf page
|
||||
pageUniqueIdImage.SetAbsolutePosition(pdfFieldPosition.position.Left, pdfFieldPosition.position.Bottom);
|
||||
pageUniqueIdImage.ScaleToFit(pdfFieldPosition.position.Width, pdfFieldPosition.position.Height);
|
||||
pdfStamper.GetOverContent(pdfFieldPosition.page).AddImage(pageUniqueIdImage);
|
||||
}
|
||||
// Hide Fields
|
||||
@@ -288,8 +314,24 @@ namespace Disco.BI.Interop.Pdf
|
||||
for (int pdfFieldOrdinal = 0; pdfFieldOrdinal < fields.Size; pdfFieldOrdinal++)
|
||||
{
|
||||
AcroFields.FieldPosition pdfFieldPosition = pdfFieldPositions[pdfFieldOrdinal];
|
||||
iTextSharp.text.Image pdfImage = iTextSharp.text.Image.GetInstance(imageResult.GetImage((int)pdfFieldPosition.position.Width, (int)pdfFieldPosition.position.Height));
|
||||
|
||||
iTextSharp.text.Image pdfImage;
|
||||
var imageWidth = (int)(pdfFieldPosition.position.Width * 1.6);
|
||||
var imageHeight = (int)(pdfFieldPosition.position.Height * 1.6);
|
||||
if (imageResult.Format == ImageExpressionFormat.Jpeg || imageResult.Format == ImageExpressionFormat.Png)
|
||||
{
|
||||
pdfImage = iTextSharp.text.Image.GetInstance(imageResult.GetImage(imageWidth, imageHeight));
|
||||
}
|
||||
else if (imageResult.Format == ImageExpressionFormat.CcittG4)
|
||||
{
|
||||
var imageData = imageResult.GetImage(out imageWidth, out imageHeight);
|
||||
pdfImage = iTextSharp.text.Image.GetInstance(imageWidth, imageHeight, false, 256, 1, imageData.GetBuffer(), null);
|
||||
}
|
||||
else
|
||||
throw new NotSupportedException($"Unexpected image format {imageResult.Format}");
|
||||
|
||||
pdfImage.SetAbsolutePosition(pdfFieldPosition.position.Left, pdfFieldPosition.position.Bottom);
|
||||
pdfImage.ScaleToFit(pdfFieldPosition.position.Width, pdfFieldPosition.position.Height);
|
||||
pdfStamper.GetOverContent(pdfFieldPosition.page).AddImage(pdfImage);
|
||||
}
|
||||
if (!fieldExpressionResult.Item2 && !imageResult.ShowField)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using iTextSharp.text;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text.pdf.codec;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
@@ -7,6 +9,11 @@ namespace Disco.BI.Interop.Pdf
|
||||
{
|
||||
public static class Utilities
|
||||
{
|
||||
public static Func<byte[], int, int, byte[]> GetCCITTG4EncoderCompressDelegate()
|
||||
{
|
||||
return CCITTG4Encoder.Compress;
|
||||
}
|
||||
|
||||
public static Stream JoinPdfs(bool InsertBlankPages, List<Stream> Pdfs)
|
||||
{
|
||||
if (Pdfs.Count == 0)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Disco</RootNamespace>
|
||||
<AssemblyName>Disco.BI</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.2.16320.1300")]
|
||||
[assembly: AssemblyFileVersion("2.2.16320.1300")]
|
||||
[assembly: AssemblyVersion("2.4.24270.0000")]
|
||||
[assembly: AssemblyFileVersion("2.4.24270.0000")]
|
||||
+1
-1
@@ -19,7 +19,7 @@ namespace Disco.Properties {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
+22
-22
@@ -1,56 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
||||
</configSections>
|
||||
<system.serviceModel>
|
||||
<bindings />
|
||||
<client />
|
||||
<bindings/>
|
||||
<client/>
|
||||
</system.serviceModel>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
|
||||
<parameters>
|
||||
<parameter value="Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True" />
|
||||
<parameter value="Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True"/>
|
||||
</parameters>
|
||||
</defaultConnectionFactory>
|
||||
</entityFramework>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
|
||||
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
|
||||
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
|
||||
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
|
||||
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -9,9 +9,8 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Disco.Client</RootNamespace>
|
||||
<AssemblyName>Disco.Client</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
@@ -24,6 +23,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -33,6 +33,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>Disco.Client.Program</StartupObject>
|
||||
@@ -48,8 +49,8 @@
|
||||
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.2\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -65,12 +66,24 @@
|
||||
<Compile Include="..\Disco.Models\ClientServices\Enrol.cs">
|
||||
<Link>Models\ClientServices\Enrol.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\BaseBoard.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\BaseBoard.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\Battery.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\Battery.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\Bios.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\Bios.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\Certificate.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\Certificate.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\CertificateStore.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\CertificateStore.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\ComputerSystem.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\ComputerSystem.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\DeviceHardware.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\DeviceHardware.cs</Link>
|
||||
</Compile>
|
||||
@@ -169,6 +182,11 @@
|
||||
"$(ProjectDir)Package Creation\7z.exe" a -tzip "$(ProjectDir)Package Creation\PreparationClient.zip" "$(TargetDir)*.*" -x!*.tmp -x!*.vshost.* -x!Newtonsoft.Json.xml -x!*.pdb
|
||||
COPY "$(ProjectDir)Package Creation\PreparationClient.zip" "$(ProjectDir)..\Disco.Web\ClientBin"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties BuildVersion_StartDate="2000/1/1" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@@ -8,13 +8,13 @@ namespace Disco.Client.Extensions
|
||||
{
|
||||
public static class ClientServicesExtensions
|
||||
{
|
||||
#if DEBUG
|
||||
public const string ServicePathAuthenticatedTemplate = "http://WS-GSHARP:57252/Services/Client/Authenticated/{0}";
|
||||
public const string ServicePathUnauthenticatedTemplate = "http://WS-GSHARP:57252/Services/Client/Unauthenticated/{0}";
|
||||
#else
|
||||
//#if DEBUG
|
||||
// public const string ServicePathAuthenticatedTemplate = "http://WS-GSHARP:57252/Services/Client/Authenticated/{0}";
|
||||
// public const string ServicePathUnauthenticatedTemplate = "http://WS-GSHARP:57252/Services/Client/Unauthenticated/{0}";
|
||||
//#else
|
||||
public const string ServicePathAuthenticatedTemplate = "http://DISCO:9292/Services/Client/Authenticated/{0}";
|
||||
public const string ServicePathUnauthenticatedTemplate = "http://DISCO:9292/Services/Client/Unauthenticated/{0}";
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
public static ResponseType Post<ResponseType>(this ServiceBase<ResponseType> Service, bool Authenticated)
|
||||
{
|
||||
|
||||
@@ -41,6 +41,9 @@ namespace Disco.Client.Extensions
|
||||
if (!string.IsNullOrEmpty(enrolResponse.ErrorMessage))
|
||||
throw new ClientServiceException("Enrolment", enrolResponse.ErrorMessage);
|
||||
|
||||
if (enrolResponse.IsPending)
|
||||
return;
|
||||
|
||||
// Offline Domain Join
|
||||
bool requireReboot = enrolResponse.ApplyOfflineDomainJoin();
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Disco.Models.ClientServices;
|
||||
using Disco.Models.ClientServices.EnrolmentInformation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
|
||||
@@ -40,18 +42,239 @@ namespace Disco.Client.Interop
|
||||
throw new Exception($"The serial number reported by this device is over 60 characters long:\r\n{audit.SerialNumber}");
|
||||
}
|
||||
|
||||
#warning TODO: Processors, PhysicalMemory, DiskDrives, etc
|
||||
audit.ApplyProcessorInformation();
|
||||
audit.ApplyPhysicalMemoryInformation();
|
||||
audit.ApplyDiskDriveInformation();
|
||||
audit.ApplyBatteryInformation();
|
||||
|
||||
audit.NetworkAdapters = Network.GetNetworkAdapters();
|
||||
|
||||
return audit;
|
||||
}
|
||||
|
||||
private static void ApplyBIOSInformation(this DeviceHardware DeviceHardware)
|
||||
private static void ApplyProcessorInformation(this DeviceHardware deviceHardware)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT SerialNumber, SMBIOSBIOSVersion FROM Win32_BIOS WHERE PrimaryBios=true"))
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT DeviceID, Manufacturer, Name, Description, Architecture, Family, MaxClockSpeed, NumberOfCores, NumberOfLogicalProcessors FROM Win32_Processor"))
|
||||
{
|
||||
using (var mResults = mSearcher.Get())
|
||||
{
|
||||
if (mResults.Count > 0)
|
||||
{
|
||||
var processors = new List<Processor>(mResults.Count);
|
||||
foreach (var mItem in mResults.Cast<ManagementObject>())
|
||||
{
|
||||
if (mItem != null)
|
||||
{
|
||||
var processor = new Processor();
|
||||
|
||||
processor.DeviceID = (string)mItem.GetPropertyValue("DeviceID");
|
||||
processor.Manufacturer = (string)mItem.GetPropertyValue("Manufacturer");
|
||||
processor.Name = (string)mItem.GetPropertyValue("Name");
|
||||
processor.Description = (string)mItem.GetPropertyValue("Description");
|
||||
processor.Family = (ushort?)mItem.GetPropertyValue("Family");
|
||||
processor.MaxClockSpeed = (uint?)mItem.GetPropertyValue("MaxClockSpeed");
|
||||
processor.NumberOfCores = (uint?)mItem.GetPropertyValue("NumberOfCores");
|
||||
processor.NumberOfLogicalProcessors = (uint?)mItem.GetPropertyValue("NumberOfLogicalProcessors");
|
||||
processor.Architecture = ((ProcessorArchitectures?)(ushort?)mItem.GetPropertyValue("Architecture"))?.ToString();
|
||||
|
||||
processors.Add(processor);
|
||||
}
|
||||
}
|
||||
deviceHardware.Processors = processors;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignore errors to ensure backwards compatibility
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplyPhysicalMemoryInformation(this DeviceHardware deviceHardware)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT Tag, SerialNumber, Manufacturer, PartNumber, Capacity, ConfiguredClockSpeed, Speed, DeviceLocator FROM Win32_PhysicalMemory"))
|
||||
{
|
||||
using (var mResults = mSearcher.Get())
|
||||
{
|
||||
if (mResults.Count > 0)
|
||||
{
|
||||
var physicalMemories = new List<PhysicalMemory>(mResults.Count);
|
||||
foreach (var mItem in mResults.Cast<ManagementObject>())
|
||||
{
|
||||
if (mItem != null)
|
||||
{
|
||||
var physicalMemory = new PhysicalMemory();
|
||||
|
||||
physicalMemory.Tag = (string)mItem.GetPropertyValue("Tag");
|
||||
physicalMemory.SerialNumber = (string)mItem.GetPropertyValue("SerialNumber");
|
||||
physicalMemory.Manufacturer = (string)mItem.GetPropertyValue("Manufacturer");
|
||||
physicalMemory.PartNumber = (string)mItem.GetPropertyValue("PartNumber");
|
||||
physicalMemory.Capacity = (ulong?)mItem.GetPropertyValue("Capacity");
|
||||
physicalMemory.ConfiguredClockSpeed = (uint?)mItem.GetPropertyValue("ConfiguredClockSpeed");
|
||||
physicalMemory.Speed = (uint?)mItem.GetPropertyValue("Speed");
|
||||
physicalMemory.DeviceLocator = (string)mItem.GetPropertyValue("DeviceLocator");
|
||||
|
||||
physicalMemories.Add(physicalMemory);
|
||||
}
|
||||
}
|
||||
deviceHardware.PhysicalMemory = physicalMemories;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignore errors to ensure backwards compatibility
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplyDiskDriveInformation(this DeviceHardware deviceHardware)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var diskSearcher = new ManagementObjectSearcher("SELECT DeviceID, Manufacturer, Model, MediaType, InterfaceType, SerialNumber, FirmwareRevision, Size FROM Win32_DiskDrive"))
|
||||
{
|
||||
using (var diskResults = diskSearcher.Get())
|
||||
{
|
||||
if (diskResults.Count > 0)
|
||||
{
|
||||
var diskDrives = new List<DiskDrive>(diskResults.Count);
|
||||
foreach (var diskResult in diskResults.Cast<ManagementObject>())
|
||||
{
|
||||
if (diskResult != null)
|
||||
{
|
||||
var diskDrive = new DiskDrive();
|
||||
|
||||
diskDrive.DeviceID = (string)diskResult.GetPropertyValue("DeviceID");
|
||||
diskDrive.Manufacturer = (string)diskResult.GetPropertyValue("Manufacturer");
|
||||
diskDrive.Model = (string)diskResult.GetPropertyValue("Model");
|
||||
diskDrive.MediaType = (string)diskResult.GetPropertyValue("MediaType");
|
||||
diskDrive.InterfaceType = (string)diskResult.GetPropertyValue("InterfaceType");
|
||||
diskDrive.SerialNumber = (string)diskResult.GetPropertyValue("SerialNumber");
|
||||
diskDrive.FirmwareRevision = (string)diskResult.GetPropertyValue("FirmwareRevision");
|
||||
diskDrive.Size = (ulong?)diskResult.GetPropertyValue("Size");
|
||||
|
||||
using (var partitionSearcher = new ManagementObjectSearcher($"ASSOCIATORS OF {{Win32_DiskDrive.DeviceID=\"{diskDrive.DeviceID.Replace(@"\", @"\\")}\"}} WHERE AssocClass = Win32_DiskDriveToDiskPartition"))
|
||||
{
|
||||
using (var partitionResults = partitionSearcher.Get())
|
||||
{
|
||||
if (partitionResults.Count > 0)
|
||||
{
|
||||
var partitions = new List<DiskDrivePartition>(partitionResults.Count);
|
||||
foreach (var partitionResult in partitionResults.Cast<ManagementObject>())
|
||||
{
|
||||
if (partitionResult != null)
|
||||
{
|
||||
var partition = new DiskDrivePartition();
|
||||
|
||||
partition.DeviceID = (string)partitionResult.GetPropertyValue("DeviceID");
|
||||
partition.Bootable = (bool?)partitionResult.GetPropertyValue("Bootable");
|
||||
partition.BootPartition = (bool?)partitionResult.GetPropertyValue("BootPartition");
|
||||
partition.PrimaryParition = (bool?)partitionResult.GetPropertyValue("PrimaryPartition");
|
||||
partition.Size = (ulong?)partitionResult.GetPropertyValue("Size");
|
||||
partition.StartingOffset = (ulong?)partitionResult.GetPropertyValue("StartingOffset");
|
||||
partition.Type = (string)partitionResult.GetPropertyValue("Type");
|
||||
|
||||
using (var logicalSearcher = new ManagementObjectSearcher($"ASSOCIATORS OF {{Win32_DiskPartition.DeviceID=\"{partition.DeviceID}\"}} WHERE AssocClass = Win32_LogicalDiskToPartition"))
|
||||
{
|
||||
using (var logicalResults = logicalSearcher.Get())
|
||||
{
|
||||
if (logicalResults.Count > 0)
|
||||
{
|
||||
foreach (var logicalResult in logicalResults.Cast<ManagementObject>().Take(1))
|
||||
{
|
||||
if (logicalResult != null)
|
||||
{
|
||||
var logical = new DiskLogical();
|
||||
|
||||
logical.DeviceID = (string)logicalResult.GetPropertyValue("DeviceID");
|
||||
logical.Description = (string)logicalResult.GetPropertyValue("Description");
|
||||
logical.DriveType = ((DiskLogicalDriveTypes?)(uint?)logicalResult.GetPropertyValue("DriveType")).ToString();
|
||||
logical.MediaType = ((DiskLogicalMediaTypes?)(uint?)logicalResult.GetPropertyValue("MediaType")).ToString();
|
||||
logical.FileSystem = (string)logicalResult.GetPropertyValue("FileSystem");
|
||||
logical.Size = (ulong?)logicalResult.GetPropertyValue("Size");
|
||||
logical.FreeSpace = (ulong?)logicalResult.GetPropertyValue("FreeSpace");
|
||||
logical.VolumeName = (string)logicalResult.GetPropertyValue("VolumeName");
|
||||
logical.VolumeSerialNumber = (string)logicalResult.GetPropertyValue("VolumeSerialNumber");
|
||||
|
||||
partition.LogicalDisk = logical;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
partitions.Add(partition);
|
||||
}
|
||||
}
|
||||
diskDrive.Partitions = partitions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
diskDrives.Add(diskDrive);
|
||||
}
|
||||
}
|
||||
|
||||
deviceHardware.DiskDrives = diskDrives;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignore errors to ensure backwards compatibility
|
||||
}
|
||||
}
|
||||
private static void ApplyBatteryInformation(this DeviceHardware deviceHardware)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT DeviceID, Availability, Chemistry, Description, DesignCapacity, DesignVoltage, FullChargeCapacity, Name FROM Win32_Battery"))
|
||||
{
|
||||
using (var mResults = mSearcher.Get())
|
||||
{
|
||||
if (mResults.Count > 0)
|
||||
{
|
||||
var batteries = new List<Battery>(mResults.Count);
|
||||
foreach (var mItem in mResults.Cast<ManagementObject>())
|
||||
{
|
||||
if (mItem != null)
|
||||
{
|
||||
var battery = new Battery();
|
||||
|
||||
battery.Availability = ((BatteryAvailability?)(ushort?)mItem.GetPropertyValue("Availability"))?.ToString();
|
||||
battery.Chemistry = ((BatteryChemistry?)(ushort?)mItem.GetPropertyValue("Chemistry"))?.ToString();
|
||||
battery.Description = (string)mItem.GetPropertyValue("Description");
|
||||
battery.DesignCapacity = (uint?)mItem.GetPropertyValue("DesignCapacity");
|
||||
battery.DeviceID = (string)mItem.GetPropertyValue("DeviceID");
|
||||
battery.FullChargeCapacity = (uint?)mItem.GetPropertyValue("FullChargeCapacity");
|
||||
battery.Name = (string)mItem.GetPropertyValue("Name");
|
||||
|
||||
batteries.Add(battery);
|
||||
}
|
||||
}
|
||||
deviceHardware.Batteries = batteries;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignore errors to ensure backwards compatibility
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplyBIOSInformation(this DeviceHardware deviceHardware)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT BIOSVersion, Manufacturer, ReleaseDate, SerialNumber, SMBIOSBIOSVersion, SMBIOSMajorVersion, SMBIOSMinorVersion, SystemBiosMajorVersion, SystemBiosMinorVersion FROM Win32_BIOS WHERE PrimaryBios=true"))
|
||||
{
|
||||
using (var mResults = mSearcher.Get())
|
||||
{
|
||||
@@ -61,11 +284,42 @@ namespace Disco.Client.Interop
|
||||
{
|
||||
var serialNumber = (string)mItem.GetPropertyValue("SerialNumber");
|
||||
if (!string.IsNullOrWhiteSpace(serialNumber))
|
||||
{
|
||||
DeviceHardware.SerialNumber = serialNumber.Trim();
|
||||
}
|
||||
deviceHardware.SerialNumber = serialNumber.Trim();
|
||||
|
||||
ErrorReporting.DeviceIdentifier = DeviceHardware.SerialNumber;
|
||||
var manufacturer = (string)mItem.GetPropertyValue("Manufacturer");
|
||||
if (deviceHardware.Manufacturer == null && !string.IsNullOrWhiteSpace(manufacturer))
|
||||
deviceHardware.Manufacturer = manufacturer.Trim();
|
||||
|
||||
ErrorReporting.DeviceIdentifier = deviceHardware.SerialNumber;
|
||||
|
||||
var biosVersion = (string[])mItem.GetPropertyValue("BIOSVersion");
|
||||
var releaseDate = default(DateTime?);
|
||||
var releaseDateString = (string)mItem.GetPropertyValue("ReleaseDate");
|
||||
if (releaseDateString != null && releaseDateString.Length == 25 && int.TryParse(releaseDateString.Substring(22), out var offsetMinutes))
|
||||
{
|
||||
releaseDateString = $"{releaseDateString.Substring(0, 22)}{offsetMinutes / 60:00}:{Math.Abs(offsetMinutes % 60):00}";
|
||||
if (DateTime.TryParseExact(releaseDateString, "yyyyMMddHHmmss.ffffffzzz", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out var releaseDateResult))
|
||||
releaseDate = releaseDateResult;
|
||||
}
|
||||
var sMBIOSBIOSVersion = (string)mItem.GetPropertyValue("SMBIOSBIOSVersion");
|
||||
var sMBIOSMajorVersion = (ushort?)mItem.GetPropertyValue("SMBIOSMajorVersion");
|
||||
var sMBIOSMinorVersion = (ushort?)mItem.GetPropertyValue("SMBIOSMinorVersion");
|
||||
var systemBiosMajorVersion = (byte?)mItem.GetPropertyValue("SystemBiosMajorVersion");
|
||||
var systemBiosMinorVersion = (byte?)mItem.GetPropertyValue("SystemBiosMinorVersion");
|
||||
|
||||
var bios = new Bios()
|
||||
{
|
||||
BIOSVersion = biosVersion,
|
||||
Manufacturer = manufacturer,
|
||||
ReleaseDate = releaseDate,
|
||||
SerialNumber = serialNumber,
|
||||
SMBIOSBIOSVersion = sMBIOSBIOSVersion,
|
||||
SMBIOSMajorVersion = sMBIOSMajorVersion,
|
||||
SMBIOSMinorVersion = sMBIOSMinorVersion,
|
||||
SystemBiosMajorVersion = systemBiosMajorVersion,
|
||||
SystemBiosMinorVersion = systemBiosMinorVersion,
|
||||
};
|
||||
deviceHardware.Bios = new List<Bios>() { bios };
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -77,15 +331,15 @@ namespace Disco.Client.Interop
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Disco Client was unable to retrieve BIOS information from WMI", ex);
|
||||
throw new Exception("Disco ICT Client was unable to retrieve BIOS information from WMI", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplySystemInformation(this DeviceHardware DeviceHardware)
|
||||
private static void ApplySystemInformation(this DeviceHardware deviceHardware)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT Manufacturer, Model, PartOfDomain, PCSystemType, Domain FROM Win32_ComputerSystem"))
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT ChassisSKUNumber, CurrentTimeZone, Description, Manufacturer, Model, OEMStringArray, PCSystemType, PrimaryOwnerContact, PrimaryOwnerName, Roles, SystemSKUNumber, SystemType FROM Win32_ComputerSystem"))
|
||||
{
|
||||
using (var mResults = mSearcher.Get())
|
||||
{
|
||||
@@ -95,17 +349,40 @@ namespace Disco.Client.Interop
|
||||
{
|
||||
var manufacturer = (string)mItem.GetPropertyValue("Manufacturer");
|
||||
if (!string.IsNullOrWhiteSpace(manufacturer))
|
||||
{
|
||||
DeviceHardware.Manufacturer = manufacturer.Trim();
|
||||
}
|
||||
deviceHardware.Manufacturer = manufacturer.Trim();
|
||||
|
||||
var model = (string)mItem.GetPropertyValue("Model");
|
||||
if (!string.IsNullOrWhiteSpace(model))
|
||||
{
|
||||
DeviceHardware.Model = model.ToString();
|
||||
}
|
||||
deviceHardware.Model = model;
|
||||
|
||||
DeviceHardware.ModelType = ((PCSystemTypes)mItem.GetPropertyValue("PCSystemType")).Description();
|
||||
deviceHardware.ModelType = ((PCSystemTypes)mItem.GetPropertyValue("PCSystemType")).Description();
|
||||
|
||||
var chassisSKUNumber = (string)mItem.GetPropertyValue("ChassisSKUNumber");
|
||||
var currentTimeZone = (short?)mItem.GetPropertyValue("CurrentTimeZone");
|
||||
var description = (string)mItem.GetPropertyValue("Description");
|
||||
var oemStringArray = (string[])mItem.GetPropertyValue("OEMStringArray");
|
||||
var pcSystemType = ((PCSystemTypes)mItem.GetPropertyValue("PCSystemType")).ToString();
|
||||
var primaryOwnerContact = (string)mItem.GetPropertyValue("PrimaryOwnerContact");
|
||||
var primaryOwnerName = (string)mItem.GetPropertyValue("PrimaryOwnerName");
|
||||
var roles = (string[])mItem.GetPropertyValue("Roles");
|
||||
var systemSKUNumber = (string)mItem.GetPropertyValue("SystemSKUNumber");
|
||||
var systemType = (string)mItem.GetPropertyValue("SystemType");
|
||||
|
||||
var computerSystem = new ComputerSystem()
|
||||
{
|
||||
ChassisSKUNumber = chassisSKUNumber,
|
||||
CurrentTimeZone = currentTimeZone,
|
||||
Description = description,
|
||||
OEMStringArray = oemStringArray,
|
||||
PCSystemType = pcSystemType,
|
||||
PrimaryOwnerContact = primaryOwnerContact,
|
||||
PrimaryOwnerName = primaryOwnerName,
|
||||
Roles = roles,
|
||||
SystemSKUNumber = systemSKUNumber,
|
||||
SystemType = systemType,
|
||||
};
|
||||
|
||||
deviceHardware.ComputerSystem = new List<ComputerSystem>() { computerSystem };
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -117,11 +394,11 @@ namespace Disco.Client.Interop
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Disco Client was unable to retrieve ComputerSystem information from WMI", ex);
|
||||
throw new Exception("Disco ICT Client was unable to retrieve ComputerSystem information from WMI", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ApplySystemInformation(this Enrol Enrol)
|
||||
public static void ApplySystemInformation(this Enrol enrol)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -133,11 +410,11 @@ namespace Disco.Client.Interop
|
||||
{
|
||||
if (mItem != null)
|
||||
{
|
||||
Enrol.IsPartOfDomain = (bool)mItem.GetPropertyValue("PartOfDomain");
|
||||
enrol.IsPartOfDomain = (bool)mItem.GetPropertyValue("PartOfDomain");
|
||||
|
||||
if (Enrol.IsPartOfDomain)
|
||||
if (enrol.IsPartOfDomain)
|
||||
{
|
||||
Enrol.DNSDomainName = (string)mItem.GetPropertyValue("Domain");
|
||||
enrol.DNSDomainName = (string)mItem.GetPropertyValue("Domain");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -150,52 +427,88 @@ namespace Disco.Client.Interop
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Disco Client was unable to retrieve ComputerSystem information from WMI", ex);
|
||||
throw new Exception("Disco ICT Client was unable to retrieve ComputerSystem information from WMI", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplyBaseBoardInformation(this DeviceHardware DeviceHardware)
|
||||
private static void ApplyBaseBoardInformation(this DeviceHardware deviceHardware)
|
||||
{
|
||||
// Added 2012-11-22 G# - Lenovo IdeaPad Serial SHIM
|
||||
// http://www.discoict.com.au/forum/feature-requests/2012/11/serial-number-detection-on-ideapads.aspx
|
||||
if (string.IsNullOrWhiteSpace(DeviceHardware.SerialNumber) ||
|
||||
(DeviceHardware.Manufacturer.Equals("LENOVO", StringComparison.OrdinalIgnoreCase) &&
|
||||
(DeviceHardware.Model.Equals("S10-3", StringComparison.OrdinalIgnoreCase) // S10-3
|
||||
|| DeviceHardware.Model.Equals("2957", StringComparison.OrdinalIgnoreCase)))) // S10-2
|
||||
try
|
||||
{
|
||||
try
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT ConfigOptions, Manufacturer, Model, PartNumber, Product, SerialNumber, SKU, Version FROM Win32_BaseBoard"))
|
||||
{
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT SerialNumber FROM Win32_BaseBoard"))
|
||||
using (var mResults = mSearcher.Get())
|
||||
{
|
||||
using (var mResults = mSearcher.Get())
|
||||
using (var mItem = mResults.Cast<ManagementObject>().FirstOrDefault())
|
||||
{
|
||||
using (var mItem = mResults.Cast<ManagementObject>().FirstOrDefault())
|
||||
if (mItem != null)
|
||||
{
|
||||
if (mItem != null)
|
||||
// Apply Manufacturer/Model information only if not previously found in Win32_ComputerSystem
|
||||
var manufacturer = (string)mItem.GetPropertyValue("Manufacturer");
|
||||
if (deviceHardware.Manufacturer == null && !string.IsNullOrWhiteSpace(manufacturer))
|
||||
{
|
||||
var serialNumber = (string)mItem.GetPropertyValue("SerialNumber");
|
||||
if (!string.IsNullOrWhiteSpace(serialNumber))
|
||||
{
|
||||
DeviceHardware.SerialNumber = serialNumber.Trim();
|
||||
ErrorReporting.DeviceIdentifier = DeviceHardware.SerialNumber;
|
||||
}
|
||||
deviceHardware.Manufacturer = manufacturer.Trim();
|
||||
}
|
||||
else
|
||||
|
||||
var model = (string)mItem.GetPropertyValue("Model");
|
||||
if (deviceHardware.Model == null && !string.IsNullOrWhiteSpace(model))
|
||||
{
|
||||
throw new Exception("No Win32_BaseBoard was found");
|
||||
deviceHardware.Model = model;
|
||||
}
|
||||
|
||||
var product = (string)mItem.GetPropertyValue("Product");
|
||||
if (deviceHardware.Model == null && !string.IsNullOrWhiteSpace(product))
|
||||
{
|
||||
deviceHardware.Model = product;
|
||||
}
|
||||
|
||||
// Added 2012-11-22 G# - Lenovo IdeaPad Serial SHIM
|
||||
// http://www.discoict.com.au/forum/feature-requests/2012/11/serial-number-detection-on-ideapads.aspx
|
||||
var serialNumber = (string)mItem.GetPropertyValue("SerialNumber");
|
||||
if (!string.IsNullOrWhiteSpace(serialNumber) &&
|
||||
(deviceHardware.SerialNumber == null ||
|
||||
((deviceHardware.Manufacturer?.Equals("LENOVO", StringComparison.OrdinalIgnoreCase) ?? false) &&
|
||||
((deviceHardware.Model?.Equals("S10-3", StringComparison.OrdinalIgnoreCase) ?? false) // S10-3
|
||||
|| (deviceHardware.Model?.Equals("2957", StringComparison.OrdinalIgnoreCase) ?? false)))))
|
||||
{
|
||||
deviceHardware.SerialNumber = serialNumber.Trim();
|
||||
ErrorReporting.DeviceIdentifier = deviceHardware.SerialNumber;
|
||||
}
|
||||
|
||||
var configOptions = (string[])mItem.GetPropertyValue("ConfigOptions");
|
||||
var partNumber = (string)mItem.GetPropertyValue("PartNumber");
|
||||
var sku = (string)mItem.GetPropertyValue("SKU");
|
||||
var version = (string)mItem.GetPropertyValue("Version");
|
||||
|
||||
var baseBoard = new BaseBoard()
|
||||
{
|
||||
ConfigOptions = configOptions,
|
||||
Manufacturer = manufacturer,
|
||||
Model = model,
|
||||
PartNumber = partNumber,
|
||||
Product = product,
|
||||
SerialNumber = serialNumber,
|
||||
SKU = sku,
|
||||
Version = version,
|
||||
};
|
||||
|
||||
deviceHardware.BasebBoard = new List<BaseBoard>() { baseBoard };
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("No Win32_BaseBoard was found");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Disco Client was unable to retrieve BaseBoard information from WMI", ex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Disco ICT Client was unable to retrieve BaseBoard information from WMI", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplySystemProductInformation(this DeviceHardware DeviceHardware)
|
||||
private static void ApplySystemProductInformation(this DeviceHardware deviceHardware)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -207,19 +520,31 @@ namespace Disco.Client.Interop
|
||||
{
|
||||
if (mItem != null)
|
||||
{
|
||||
if (DeviceHardware.SerialNumber == null)
|
||||
if (deviceHardware.SerialNumber == null)
|
||||
{
|
||||
var serialNumber = mItem.GetPropertyValue("IdentifyingNumber") as string;
|
||||
if (!string.IsNullOrWhiteSpace(serialNumber))
|
||||
{
|
||||
DeviceHardware.SerialNumber = serialNumber.Trim();
|
||||
ErrorReporting.DeviceIdentifier = DeviceHardware.SerialNumber;
|
||||
deviceHardware.SerialNumber = serialNumber.Trim();
|
||||
ErrorReporting.DeviceIdentifier = deviceHardware.SerialNumber;
|
||||
}
|
||||
}
|
||||
|
||||
var uUID = (string)mItem.GetPropertyValue("UUID");
|
||||
if (!string.IsNullOrWhiteSpace(uUID))
|
||||
DeviceHardware.UUID = uUID.Trim();
|
||||
{
|
||||
deviceHardware.UUID = uUID.Trim();
|
||||
|
||||
// if serial number is absent attempt using UUID if valid
|
||||
if (string.IsNullOrWhiteSpace(deviceHardware.SerialNumber))
|
||||
{
|
||||
Guid uuidGuid;
|
||||
if (Guid.TryParse(deviceHardware.UUID, out uuidGuid) && uuidGuid != Guid.Empty)
|
||||
{
|
||||
deviceHardware.SerialNumber = $"UUID{uuidGuid:N}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -231,7 +556,7 @@ namespace Disco.Client.Interop
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Disco Client was unable to retrieve ComputerSystemProduct information from WMI", ex);
|
||||
throw new Exception("Disco ICT Client was unable to retrieve ComputerSystemProduct information from WMI", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,5 +598,93 @@ namespace Disco.Client.Interop
|
||||
PerformanceServer,
|
||||
Maximum
|
||||
}
|
||||
|
||||
private enum ProcessorArchitectures : ushort
|
||||
{
|
||||
x86 = 0,
|
||||
MIPS = 1,
|
||||
Alpha = 2,
|
||||
PowerPC = 3,
|
||||
ia64 = 6,
|
||||
x64 = 9,
|
||||
}
|
||||
|
||||
private enum DiskLogicalDriveTypes : uint
|
||||
{
|
||||
Unknown = 0,
|
||||
NoRootDirectory,
|
||||
Removable,
|
||||
Fixed,
|
||||
Remote,
|
||||
CDRom,
|
||||
RAMDisk,
|
||||
}
|
||||
|
||||
private enum DiskLogicalMediaTypes : uint
|
||||
{
|
||||
Unknown = 0,
|
||||
F5_1Pt2_512,
|
||||
F3_1Pt44_512,
|
||||
F3_2Pt88_512,
|
||||
F3_20Pt8_512,
|
||||
F3_720_512,
|
||||
F5_360_512,
|
||||
F5_320_512,
|
||||
F5_320_1024,
|
||||
F5_180_512,
|
||||
F5_160_512,
|
||||
RemovableMedia,
|
||||
FixedMedia,
|
||||
F3_120M_512,
|
||||
F3_640_512,
|
||||
F5_640_512,
|
||||
F5_720_512,
|
||||
F3_1Pt2_512,
|
||||
F3_1Pt23_1024,
|
||||
F5_1Pt23_1024,
|
||||
F3_128Mb_512,
|
||||
F3_230Mb_512,
|
||||
F8_256_128,
|
||||
F3_200Mb_512,
|
||||
F3_240M_512,
|
||||
F3_32M_512,
|
||||
}
|
||||
|
||||
private enum BatteryAvailability : ushort
|
||||
{
|
||||
Other = 1,
|
||||
Unknown = 2,
|
||||
RunningFullPower = 3,
|
||||
Warning = 4,
|
||||
InTest = 5,
|
||||
NotApplicable = 6,
|
||||
PowerOff = 7,
|
||||
OffLine = 8,
|
||||
OffDuty = 9,
|
||||
Degraded = 10,
|
||||
NotInstalled = 11,
|
||||
InstallError = 12,
|
||||
PowerSaveUnknown = 13,
|
||||
PowerSaveLowPowerMode = 14,
|
||||
PowerSaveStandby = 15,
|
||||
PowerCycle = 16,
|
||||
PowerSaveWarning = 17,
|
||||
Paused = 18,
|
||||
NotReady = 19,
|
||||
NotConfigured = 20,
|
||||
Quiesced = 21,
|
||||
}
|
||||
|
||||
private enum BatteryChemistry : ushort
|
||||
{
|
||||
Other = 1,
|
||||
Unknown = 2,
|
||||
LeadAcid = 3,
|
||||
NickelCadmium = 4,
|
||||
NickelMetalHydride = 5,
|
||||
LithiumIon = 6,
|
||||
ZincAir = 7,
|
||||
LithiumPolymer = 8,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Disco.Client.Interop
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Disco Client was unable to retrieve NetworkAdapter information from WMI", ex);
|
||||
throw new Exception("Disco ICT Client was unable to retrieve NetworkAdapter information from WMI", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Disco.Client.Interop
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Disco Client was unable to retrieve Wireless NetworkAdapter information from WlanApi", ex);
|
||||
throw new Exception("Disco ICT Client was unable to retrieve Wireless NetworkAdapter information from WlanApi", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Disco.Client.Interop
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Disco Client was unable to retrieve Wireless Profiles from WlanApi", ex);
|
||||
throw new Exception("Disco ICT Client was unable to retrieve Wireless Profiles from WlanApi", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ namespace Disco.Client.Interop
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Disco Client was unable to apply Wireless Profile Changes using WlanApi", ex);
|
||||
throw new Exception("Disco ICT Client was unable to apply Wireless Profile Changes using WlanApi", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+30
-7
@@ -122,17 +122,40 @@ namespace Disco.Client
|
||||
EnrolResponse response = null;
|
||||
|
||||
// Build Request
|
||||
Presentation.UpdateStatus("Enrolling Device", "Building enrolment request and preparing to send data to the server.", true, -1);
|
||||
Presentation.UpdateStatus("Enrolling Device", "Building enrollment request and preparing to send data to the server.", true, -1);
|
||||
request = new Enrol();
|
||||
request.Build();
|
||||
|
||||
// Send Request
|
||||
Presentation.UpdateStatus("Enrolling Device", "Sending the enrolment request to the server.", true, -1);
|
||||
response = request.Post(Program.IsAuthenticated);
|
||||
var startTime = DateTimeOffset.Now;
|
||||
do
|
||||
{
|
||||
// Send Request
|
||||
Presentation.UpdateStatus("Enrolling Device", "Sending the enrollment request to the server.", true, -1);
|
||||
response = request.Post(Program.IsAuthenticated);
|
||||
|
||||
// Process Response
|
||||
Presentation.UpdateStatus("Enrolling Device", "Processing the enrolment response from the server.", true, -1);
|
||||
response.Process();
|
||||
// Process Response
|
||||
Presentation.UpdateStatus("Enrolling Device", "Processing the enrollment response from the server.", true, -1);
|
||||
response.Process();
|
||||
|
||||
if (response.IsPending)
|
||||
{
|
||||
request.PendingSessionId = response.SessionId;
|
||||
request.PendingAuthorization = response.PendingAuthorization;
|
||||
|
||||
// Session Pending
|
||||
var totalSeconds = (response.PendingTimeout - startTime).TotalSeconds;
|
||||
var secondsConsumed = (DateTimeOffset.Now - startTime).TotalSeconds;
|
||||
var progress = (int)((secondsConsumed / totalSeconds) * 100);
|
||||
|
||||
Presentation.UpdateStatus($"Pending Device Enrollment Approval: {response.PendingIdentifier}", $"Waiting for enrollment session '{response.PendingIdentifier}' to be approved.{Environment.NewLine}Reason: {response.PendingReason}", true, progress);
|
||||
System.Threading.Thread.Sleep(TimeSpan.FromSeconds(10));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Session Complete
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
// Complete
|
||||
return true;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.2.16320.1300")]
|
||||
[assembly: AssemblyFileVersion("2.2.16320.1300")]
|
||||
[assembly: AssemblyVersion("2.4.24270.0000")]
|
||||
[assembly: AssemblyFileVersion("2.4.24270.0000")]
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net40-Client" />
|
||||
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net40-client" />
|
||||
</packages>
|
||||
@@ -20,13 +20,13 @@ namespace Disco.ClientBootstrapper
|
||||
private StringBuilder errorMessage;
|
||||
private Process clientProcess;
|
||||
|
||||
#if DEBUG
|
||||
public const string DiscoServerName = "WS-GSHARP";
|
||||
public const int DiscoServerPort = 57252;
|
||||
#else
|
||||
//#if DEBUG
|
||||
// public const string DiscoServerName = "WS-GSHARP";
|
||||
// public const int DiscoServerPort = 57252;
|
||||
//#else
|
||||
public const string DiscoServerName = "DISCO";
|
||||
public const int DiscoServerPort = 9292;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
public BootstrapperLoop(IStatus StatusUI, LoopCompleteCallback Callback)
|
||||
{
|
||||
@@ -85,12 +85,12 @@ namespace Disco.ClientBootstrapper
|
||||
|
||||
// Check for Network Connectivity
|
||||
statusUI.UpdateStatus(null, "Detecting Network", "Checking network connectivity, Please wait...", true, -1);
|
||||
if (!Interop.NetworkInterop.PingDisco(DiscoServerName))
|
||||
if (!Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
|
||||
{
|
||||
statusUI.UpdateStatus(null, "Detecting Network", "No network connectivity detected, Diagnosing...", true, -1);
|
||||
statusUI_WriteAdapterInfo();
|
||||
|
||||
if (!Interop.NetworkInterop.PingDisco(DiscoServerName))
|
||||
if (!Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
|
||||
{
|
||||
// Check for Wireless
|
||||
var hasWireless = (Interop.NetworkInterop.NetworkAdapters.Count(na => na.IsWireless) > 0);
|
||||
@@ -105,17 +105,17 @@ namespace Disco.ClientBootstrapper
|
||||
statusUI_WriteAdapterInfo();
|
||||
statusUI.UpdateStatus(null, null, null, true, i);
|
||||
Program.SleepThread(500, false);
|
||||
if (Interop.NetworkInterop.PingDisco(DiscoServerName))
|
||||
if (Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
|
||||
break;
|
||||
}
|
||||
if (!Interop.NetworkInterop.PingDisco(DiscoServerName))
|
||||
if (!Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
|
||||
{
|
||||
statusUI.UpdateStatus(null, "Wireless Network Failed", "Unable to connect to the wireless network, please connect the network cable...", false);
|
||||
Program.SleepThread(3000, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Interop.NetworkInterop.PingDisco(DiscoServerName))
|
||||
if (!Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
|
||||
{
|
||||
// Instruct user to connect network cable
|
||||
statusUI.UpdateStatus(null, "Please connect the network cable", null);
|
||||
@@ -124,13 +124,13 @@ namespace Disco.ClientBootstrapper
|
||||
statusUI_WriteAdapterInfo();
|
||||
statusUI.UpdateStatus(null, null, null, true, i);
|
||||
Program.SleepThread(500, false);
|
||||
if (Interop.NetworkInterop.PingDisco(DiscoServerName))
|
||||
if (Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Interop.NetworkInterop.PingDisco(DiscoServerName))
|
||||
if (!Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
|
||||
{
|
||||
// Client Failed
|
||||
if (this.mLoopCompleteCallback != null)
|
||||
|
||||
@@ -8,4 +8,4 @@ BootstrapperLocation = Mid(WScript.ScriptFullName, 1, InStrRev(WScript.ScriptFul
|
||||
|
||||
Call objShell.Run("""" & BootstrapperLocation & """ /Install", , True)
|
||||
|
||||
WScript.Echo "Disco Client Bootstrapper Installed"
|
||||
WScript.Echo "Disco ICT Client Bootstrapper Installed"
|
||||
@@ -10,8 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Disco.ClientBootstrapper</RootNamespace>
|
||||
<AssemblyName>Disco.ClientBootstrapper</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
|
||||
+2
-2
@@ -85,7 +85,7 @@
|
||||
this.labelVersion.Name = "labelVersion";
|
||||
this.labelVersion.Size = new System.Drawing.Size(167, 20);
|
||||
this.labelVersion.TabIndex = 0;
|
||||
this.labelVersion.Text = "Disco Bootstrapper v";
|
||||
this.labelVersion.Text = "Disco ICT Bootstrapper v";
|
||||
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// FormStatus
|
||||
@@ -106,7 +106,7 @@
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Disco - Client Bootstrapper";
|
||||
this.Text = "Disco ICT - Client Bootstrapper";
|
||||
this.TopMost = true;
|
||||
this.TransparencyKey = System.Drawing.Color.Magenta;
|
||||
this.ResumeLayout(false);
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Disco.ClientBootstrapper
|
||||
this.progressBar.Visible = true;
|
||||
if (Progress.HasValue)
|
||||
{
|
||||
if (Progress.Value > 0)
|
||||
if (Progress.Value >= 0)
|
||||
{
|
||||
this.progressBar.Value = Math.Min(Progress.Value, 100);
|
||||
this.progressBar.Style = ProgressBarStyle.Continuous;
|
||||
|
||||
@@ -16,8 +16,9 @@ namespace Disco.ClientBootstrapper.Interop
|
||||
if (_tempCerts != null && _tempCerts.Count > 0)
|
||||
{
|
||||
Remove(StoreName.My, StoreLocation.LocalMachine, _tempCerts);
|
||||
Remove(StoreName.CertificateAuthority, StoreLocation.LocalMachine, _tempCerts);
|
||||
Remove(StoreName.Root, StoreLocation.LocalMachine, _tempCerts);
|
||||
// dont remove root/intermediate certs as they may be have installed by client
|
||||
//Remove(StoreName.CertificateAuthority, StoreLocation.LocalMachine, _tempCerts);
|
||||
//Remove(StoreName.Root, StoreLocation.LocalMachine, _tempCerts);
|
||||
}
|
||||
}
|
||||
public static void AddTempCerts()
|
||||
@@ -106,7 +107,26 @@ namespace Disco.ClientBootstrapper.Interop
|
||||
public static string ShortSubjectName(this X509Certificate2 Certificate)
|
||||
{
|
||||
string s = Certificate.Subject;
|
||||
return s.Substring(s.IndexOf("=") + 1, s.IndexOf(",") - s.IndexOf("=") - 1);
|
||||
if (string.IsNullOrWhiteSpace(s))
|
||||
{
|
||||
return $"Unknown Certificate: {Certificate.Thumbprint}";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s.Length > 3 && s.StartsWith("CN=", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var nameLength = s.IndexOf(',') - 3;
|
||||
if (nameLength > 0)
|
||||
{
|
||||
return s.Substring(3, nameLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
return s.Substring(3);
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Add(StoreName StoreName, StoreLocation StoreLocation, X509Certificate2 Certificate)
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace Disco.ClientBootstrapper.Interop
|
||||
}
|
||||
}
|
||||
|
||||
public static bool PingDisco(string ServerName)
|
||||
public static bool PingDiscoIct(string ServerName)
|
||||
{
|
||||
using (Ping p = new Ping())
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.2.16320.1300")]
|
||||
[assembly: AssemblyFileVersion("2.2.16320.1300")]
|
||||
[assembly: AssemblyVersion("2.4.24270.0000")]
|
||||
[assembly: AssemblyFileVersion("2.4.24270.0000")]
|
||||
@@ -15,6 +15,6 @@
|
||||
</defaultConnectionFactory>
|
||||
</entityFramework>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -34,11 +34,11 @@ namespace Disco.Data.Configuration
|
||||
|
||||
private void SetValue<T>(string Key, T Value)
|
||||
{
|
||||
ConfigurationCache.SetValue(Database, this.Scope, Key, Value);
|
||||
ConfigurationCache.Helpers<T>.SetValue(Database, this.Scope, Key, Value);
|
||||
}
|
||||
private T GetValue<T>(string Key, T Default)
|
||||
{
|
||||
return ConfigurationCache.GetValue(Database, this.Scope, Key, Default);
|
||||
return ConfigurationCache.Helpers<T>.GetValue(Database, this.Scope, Key, Default);
|
||||
}
|
||||
|
||||
protected void Set<T>(T Value, [CallerMemberName] string Key = null)
|
||||
|
||||
@@ -202,89 +202,95 @@ namespace Disco.Data.Configuration
|
||||
#endregion
|
||||
|
||||
#region Cache Getters/Setters
|
||||
internal static T GetValue<T>(DiscoDataContext Database, string Scope, string Key, T Default)
|
||||
internal static class Helpers<T>
|
||||
{
|
||||
var item = CacheGetItem(Database, Scope, Key);
|
||||
private static readonly IEqualityComparer<T> comparer = EqualityComparer<T>.Default;
|
||||
|
||||
if (item == null)
|
||||
return Default;
|
||||
else
|
||||
internal static T GetValue(DiscoDataContext Database, string Scope, string Key, T Default)
|
||||
{
|
||||
if (item.Item2 != null && item.Item2.GetType() == typeof(T))
|
||||
{
|
||||
// Return Cached Item
|
||||
return (T)item.Item2;
|
||||
}
|
||||
var item = CacheGetItem(Database, Scope, Key);
|
||||
|
||||
if (item == null)
|
||||
return Default;
|
||||
else
|
||||
{
|
||||
// Convert Serialized Item
|
||||
Type itemType = typeof(T);
|
||||
object itemValue;
|
||||
|
||||
if (itemType == typeof(string))
|
||||
if (item.Item2 != null && item.Item2.GetType() == typeof(T))
|
||||
{
|
||||
// string
|
||||
itemValue = item.Item1.Value;
|
||||
}
|
||||
else if (itemType == typeof(object))
|
||||
{
|
||||
// object
|
||||
itemValue = item.Item1.Value;
|
||||
}
|
||||
else if (IsConvertableFromString(itemType))
|
||||
{
|
||||
// IConvertable
|
||||
itemValue = Convert.ChangeType(item.Item1.Value, itemType);
|
||||
}
|
||||
else if (itemType.BaseType != null && itemType.BaseType == typeof(Enum))
|
||||
{
|
||||
// Enum
|
||||
itemValue = Enum.Parse(typeof(T), item.Item1.Value);
|
||||
// Return Cached Item
|
||||
return (T)item.Item2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// JSON Deserialize
|
||||
itemValue = JsonConvert.DeserializeObject<T>(item.Item1.Value);
|
||||
// Convert Serialized Item
|
||||
Type itemType = typeof(T);
|
||||
object itemValue;
|
||||
|
||||
if (itemType == typeof(string))
|
||||
{
|
||||
// string
|
||||
itemValue = item.Item1.Value;
|
||||
}
|
||||
else if (itemType == typeof(object))
|
||||
{
|
||||
// object
|
||||
itemValue = item.Item1.Value;
|
||||
}
|
||||
else if (IsConvertableFromString(itemType))
|
||||
{
|
||||
// IConvertable
|
||||
itemValue = Convert.ChangeType(item.Item1.Value, itemType);
|
||||
}
|
||||
else if (itemType.BaseType != null && itemType.BaseType == typeof(Enum))
|
||||
{
|
||||
// Enum
|
||||
itemValue = Enum.Parse(typeof(T), item.Item1.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
// JSON Deserialize
|
||||
itemValue = JsonConvert.DeserializeObject<T>(item.Item1.Value);
|
||||
}
|
||||
|
||||
// Set Item in Cache
|
||||
SetItemTypeValue(item, itemValue);
|
||||
|
||||
return (T)itemValue;
|
||||
}
|
||||
|
||||
// Set Item in Cache
|
||||
SetItemTypeValue(item, itemValue);
|
||||
|
||||
return (T)itemValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
internal static void SetValue<T>(DiscoDataContext Database, string Scope, string Key, T Value)
|
||||
{
|
||||
Type valueType = typeof(T);
|
||||
string stringValue;
|
||||
internal static void SetValue(DiscoDataContext Database, string Scope, string Key, T Value)
|
||||
{
|
||||
Type valueType = typeof(T);
|
||||
string stringValue;
|
||||
|
||||
if (Value == null)
|
||||
{
|
||||
stringValue = null;
|
||||
}
|
||||
else if (valueType == typeof(object))
|
||||
{
|
||||
throw new ArgumentException(string.Format("Cannot serialize the configuration item [{0}].[{1}] which defines a type of [System.Object]", Scope, Key), "Value");
|
||||
}
|
||||
else if (IsConvertableFromString(valueType))
|
||||
{
|
||||
// string or supports IConvertable
|
||||
stringValue = Value.ToString();
|
||||
}
|
||||
else if (valueType.BaseType != null && valueType.BaseType == typeof(Enum))
|
||||
{
|
||||
// Enum
|
||||
stringValue = Value.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
// JSON Serialize
|
||||
stringValue = JsonConvert.SerializeObject(Value);
|
||||
}
|
||||
if (comparer.Equals(Value, default(T)))
|
||||
{
|
||||
stringValue = null;
|
||||
}
|
||||
else if (valueType == typeof(object))
|
||||
{
|
||||
throw new ArgumentException(string.Format("Cannot serialize the configuration item [{0}].[{1}] which defines a type of [System.Object]", Scope, Key), "Value");
|
||||
}
|
||||
else if (IsConvertableFromString(valueType))
|
||||
{
|
||||
// string or supports IConvertable
|
||||
stringValue = Value.ToString();
|
||||
}
|
||||
else if (valueType.BaseType != null && valueType.BaseType == typeof(Enum))
|
||||
{
|
||||
// Enum
|
||||
stringValue = Value.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
// JSON Serialize
|
||||
stringValue = JsonConvert.SerializeObject(Value);
|
||||
}
|
||||
|
||||
CacheSetItem(Database, Scope, Key, stringValue, Value);
|
||||
CacheSetItem(Database, Scope, Key, stringValue, Value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Cache Helpers
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Disco.Data.Repository;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Disco.Data.Configuration.Modules
|
||||
{
|
||||
@@ -24,12 +26,36 @@ namespace Disco.Data.Configuration.Modules
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("User SearchAllServers instead"), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool? SearchAllForestServers
|
||||
{
|
||||
get { return Get<bool?>(null); }
|
||||
set { Set(value); }
|
||||
}
|
||||
|
||||
public bool? SearchAllServers
|
||||
{
|
||||
get {
|
||||
var value = Get<bool?>(null);
|
||||
|
||||
/// migrate <see cref="SearchAllForestServers"/>
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
if (value == null)
|
||||
{
|
||||
value = SearchAllForestServers;
|
||||
if (value != null)
|
||||
{
|
||||
SearchAllForestServers = null;
|
||||
SearchAllServers = value;
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
return value;
|
||||
}
|
||||
set { Set(value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If true LDAP filters contain wildcards only at the end of the search term.
|
||||
/// This greatly improves performance in very large AD environments (ie: EDU001/EDU002)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Disco.Data.Repository;
|
||||
using System;
|
||||
|
||||
namespace Disco.Data.Configuration.Modules
|
||||
{
|
||||
@@ -6,33 +7,24 @@ namespace Disco.Data.Configuration.Modules
|
||||
{
|
||||
public BootstrapperConfiguration(DiscoDataContext Database) : base(Database) { }
|
||||
|
||||
public override string Scope
|
||||
{
|
||||
get { return "Bootstrapper"; }
|
||||
}
|
||||
public override string Scope { get; } = "Bootstrapper";
|
||||
|
||||
public string MacSshUsername
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Get("root");
|
||||
}
|
||||
set
|
||||
{
|
||||
this.Set(value);
|
||||
}
|
||||
get => Get("root");
|
||||
set => Set(value);
|
||||
}
|
||||
|
||||
public string MacSshPassword
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetDeobsfucated(string.Empty);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.SetObsfucated(value);
|
||||
}
|
||||
get => GetDeobsfucated(string.Empty);
|
||||
set => SetObsfucated(value);
|
||||
}
|
||||
|
||||
public TimeSpan PendingTimeout
|
||||
{
|
||||
get => TimeSpan.FromSeconds(Get(30 * 60)); // 30 minutes default
|
||||
set => Set((int)value.TotalSeconds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,12 @@ namespace Disco.Data.Configuration.Modules
|
||||
set { Set(value); }
|
||||
}
|
||||
|
||||
public string OnDeviceReadyForReturnExpression
|
||||
{
|
||||
get { return Get<string>(null); }
|
||||
set { Set(value); }
|
||||
}
|
||||
|
||||
public string OnCloseExpression
|
||||
{
|
||||
get { return Get<string>(null); }
|
||||
|
||||
@@ -150,6 +150,15 @@ namespace Disco.Data.Configuration
|
||||
return System.IO.Path.Combine(DataStoreLocation, @"PluginPackages\");
|
||||
}
|
||||
}
|
||||
|
||||
public string PluginUserPhotosLocation
|
||||
=> Path.Combine(DataStoreLocation, @"PluginUserPhotos\");
|
||||
|
||||
public DateTime PluginDetailsCacheExpiration
|
||||
{
|
||||
get => Get(DateTime.MinValue);
|
||||
set => Set(value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Organisation Details
|
||||
@@ -271,21 +280,66 @@ namespace Disco.Data.Configuration
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Email Configuration
|
||||
public string EmailSmtpServer
|
||||
{
|
||||
get => Get<string>(null);
|
||||
set => Set(value);
|
||||
}
|
||||
public int EmailSmtpPort
|
||||
{
|
||||
get => Get(25);
|
||||
set => Set(value);
|
||||
}
|
||||
public bool EmailEnableSsl
|
||||
{
|
||||
get => Get(false);
|
||||
set => Set(value);
|
||||
}
|
||||
public string EmailFromAddress
|
||||
{
|
||||
get => Get<string>(null);
|
||||
set => Set(value);
|
||||
}
|
||||
public string EmailReplyToAddress
|
||||
{
|
||||
get => Get<string>(null);
|
||||
set => Set(value);
|
||||
}
|
||||
public string EmailUsername
|
||||
{
|
||||
get => Get<string>(null);
|
||||
set => Set(value);
|
||||
}
|
||||
public string EmailPassword
|
||||
{
|
||||
get => GetDeobsfucated(null);
|
||||
set => SetObsfucated(value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UpdateCheck
|
||||
public string DeploymentId
|
||||
public bool IsLicensed
|
||||
{
|
||||
get
|
||||
{
|
||||
return Get<string>(null);
|
||||
}
|
||||
get => LicenseKey != null && LicenseExpiresOn != null && LicenseExpiresOn > DateTime.UtcNow && LicenseError == null;
|
||||
}
|
||||
public string DeploymentSecret
|
||||
public string LicenseKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return Get<string>(null);
|
||||
}
|
||||
get => Get<string>(null);
|
||||
set => Set(value);
|
||||
}
|
||||
public DateTime? LicenseExpiresOn
|
||||
{
|
||||
get => Get<DateTime?>(null);
|
||||
set => Set(value);
|
||||
}
|
||||
public string LicenseError
|
||||
{
|
||||
get => Get<string>(null);
|
||||
set => Set(value);
|
||||
}
|
||||
public string DeploymentId => Get<string>(null);
|
||||
public string DeploymentSecret => Get<string>(null);
|
||||
public short DeploymentChecksum
|
||||
{
|
||||
get
|
||||
@@ -304,22 +358,10 @@ namespace Disco.Data.Configuration
|
||||
}
|
||||
public UpdateResponseV2 UpdateLastCheckResponse
|
||||
{
|
||||
get
|
||||
{
|
||||
return Get<UpdateResponseV2>(null);
|
||||
}
|
||||
set
|
||||
{
|
||||
Set(value);
|
||||
}
|
||||
}
|
||||
public bool UpdateBetaDeployment
|
||||
{
|
||||
get
|
||||
{
|
||||
return Get(false);
|
||||
}
|
||||
get => Get<UpdateResponseV2>(null);
|
||||
set => Set(value);
|
||||
}
|
||||
public bool UpdateBetaDeployment => Get(false);
|
||||
public Version InstalledDatabaseVersion
|
||||
{
|
||||
get
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Disco.Data</RootNamespace>
|
||||
<AssemblyName>Disco.Data</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
@@ -40,8 +40,8 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
@@ -163,6 +163,26 @@
|
||||
<Compile Include="Migrations\201611100557315_DBv19.Designer.cs">
|
||||
<DependentUpon>201611100557315_DBv19.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202011260525547_DBv20.cs" />
|
||||
<Compile Include="Migrations\202011260525547_DBv20.Designer.cs">
|
||||
<DependentUpon>202011260525547_DBv20.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202102110443550_DBv21.cs" />
|
||||
<Compile Include="Migrations\202102110443550_DBv21.Designer.cs">
|
||||
<DependentUpon>202102110443550_DBv21.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202304150715559_DBv22.cs" />
|
||||
<Compile Include="Migrations\202304150715559_DBv22.Designer.cs">
|
||||
<DependentUpon>202304150715559_DBv22.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202401130531317_DBv23.cs" />
|
||||
<Compile Include="Migrations\202401130531317_DBv23.Designer.cs">
|
||||
<DependentUpon>202401130531317_DBv23.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202403030134280_DBv24.cs" />
|
||||
<Compile Include="Migrations\202403030134280_DBv24.Designer.cs">
|
||||
<DependentUpon>202403030134280_DBv24.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Migrations\DiscoDataMigrator.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
@@ -235,6 +255,21 @@
|
||||
<EmbeddedResource Include="Migrations\201611100557315_DBv19.resx">
|
||||
<DependentUpon>201611100557315_DBv19.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202011260525547_DBv20.resx">
|
||||
<DependentUpon>202011260525547_DBv20.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202102110443550_DBv21.resx">
|
||||
<DependentUpon>202102110443550_DBv21.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202304150715559_DBv22.resx">
|
||||
<DependentUpon>202304150715559_DBv22.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202401130531317_DBv23.resx">
|
||||
<DependentUpon>202401130531317_DBv23.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202403030134280_DBv24.resx">
|
||||
<DependentUpon>202403030134280_DBv24.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
@@ -246,6 +281,11 @@
|
||||
<None Include="Resources\EmptyLogo.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties BuildVersion_StartDate="2000/1/1" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv20 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv20));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202011260525547_DBv20"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv20 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.DeviceBatchAttachments",
|
||||
c => new
|
||||
{
|
||||
Id = c.Int(nullable: false, identity: true),
|
||||
DeviceBatchId = c.Int(nullable: false),
|
||||
TechUserId = c.String(nullable: false, maxLength: 50),
|
||||
Filename = c.String(nullable: false, maxLength: 500),
|
||||
MimeType = c.String(nullable: false, maxLength: 500),
|
||||
Timestamp = c.DateTime(nullable: false),
|
||||
Comments = c.String(nullable: false, maxLength: 500),
|
||||
})
|
||||
.PrimaryKey(t => t.Id)
|
||||
.ForeignKey("dbo.DeviceBatches", t => t.DeviceBatchId)
|
||||
.ForeignKey("dbo.Users", t => t.TechUserId)
|
||||
.Index(t => t.DeviceBatchId)
|
||||
.Index(t => t.TechUserId);
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("dbo.DeviceBatchAttachments", new[] { "TechUserId" });
|
||||
DropIndex("dbo.DeviceBatchAttachments", new[] { "DeviceBatchId" });
|
||||
DropForeignKey("dbo.DeviceBatchAttachments", "TechUserId", "dbo.Users");
|
||||
DropForeignKey("dbo.DeviceBatchAttachments", "DeviceBatchId", "dbo.DeviceBatches");
|
||||
DropTable("dbo.DeviceBatchAttachments");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,27 @@
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv21 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv21));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202102110443550_DBv21"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv21 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.UserAttachments", "HandlerId", c => c.String(maxLength: 30));
|
||||
AddColumn("dbo.UserAttachments", "HandlerReferenceId", c => c.String(maxLength: 50));
|
||||
AddColumn("dbo.UserAttachments", "HandlerData", c => c.String());
|
||||
AddColumn("dbo.JobAttachments", "HandlerId", c => c.String(maxLength: 30));
|
||||
AddColumn("dbo.JobAttachments", "HandlerReferenceId", c => c.String(maxLength: 50));
|
||||
AddColumn("dbo.JobAttachments", "HandlerData", c => c.String());
|
||||
AddColumn("dbo.DeviceAttachments", "HandlerId", c => c.String(maxLength: 30));
|
||||
AddColumn("dbo.DeviceAttachments", "HandlerReferenceId", c => c.String(maxLength: 50));
|
||||
AddColumn("dbo.DeviceAttachments", "HandlerData", c => c.String());
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.DeviceAttachments", "HandlerData");
|
||||
DropColumn("dbo.DeviceAttachments", "HandlerReferenceId");
|
||||
DropColumn("dbo.DeviceAttachments", "HandlerId");
|
||||
DropColumn("dbo.JobAttachments", "HandlerData");
|
||||
DropColumn("dbo.JobAttachments", "HandlerReferenceId");
|
||||
DropColumn("dbo.JobAttachments", "HandlerId");
|
||||
DropColumn("dbo.UserAttachments", "HandlerData");
|
||||
DropColumn("dbo.UserAttachments", "HandlerReferenceId");
|
||||
DropColumn("dbo.UserAttachments", "HandlerId");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,27 @@
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv22 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv22));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202304150715559_DBv22"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv22 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.DocumentTemplates", "OnImportUserFlagRules", c => c.String());
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.DocumentTemplates", "OnImportUserFlagRules");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,27 @@
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv23 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv23));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202401130531317_DBv23"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv23 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.DeviceFlagAssignments",
|
||||
c => new
|
||||
{
|
||||
Id = c.Int(nullable: false, identity: true),
|
||||
DeviceFlagId = c.Int(nullable: false),
|
||||
DeviceSerialNumber = c.String(nullable: false, maxLength: 60),
|
||||
AddedDate = c.DateTime(nullable: false),
|
||||
AddedUserId = c.String(nullable: false, maxLength: 50),
|
||||
RemovedDate = c.DateTime(),
|
||||
RemovedUserId = c.String(maxLength: 50),
|
||||
Comments = c.String(),
|
||||
OnAssignmentExpressionResult = c.String(),
|
||||
OnUnassignmentExpressionResult = c.String(),
|
||||
})
|
||||
.PrimaryKey(t => t.Id)
|
||||
.ForeignKey("dbo.DeviceFlags", t => t.DeviceFlagId)
|
||||
.ForeignKey("dbo.Devices", t => t.DeviceSerialNumber)
|
||||
.ForeignKey("dbo.Users", t => t.AddedUserId)
|
||||
.ForeignKey("dbo.Users", t => t.RemovedUserId)
|
||||
.Index(t => t.DeviceFlagId)
|
||||
.Index(t => t.DeviceSerialNumber)
|
||||
.Index(t => t.AddedUserId)
|
||||
.Index(t => t.RemovedUserId);
|
||||
|
||||
CreateTable(
|
||||
"dbo.DeviceFlags",
|
||||
c => new
|
||||
{
|
||||
Id = c.Int(nullable: false, identity: true),
|
||||
Name = c.String(nullable: false, maxLength: 100),
|
||||
Description = c.String(maxLength: 500),
|
||||
Icon = c.String(nullable: false, maxLength: 25),
|
||||
IconColour = c.String(nullable: false, maxLength: 10),
|
||||
DevicesLinkedGroup = c.String(),
|
||||
DeviceUsersLinkedGroup = c.String(),
|
||||
OnAssignmentExpression = c.String(),
|
||||
OnUnassignmentExpression = c.String(),
|
||||
})
|
||||
.PrimaryKey(t => t.Id);
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("dbo.DeviceFlagAssignments", new[] { "RemovedUserId" });
|
||||
DropIndex("dbo.DeviceFlagAssignments", new[] { "AddedUserId" });
|
||||
DropIndex("dbo.DeviceFlagAssignments", new[] { "DeviceSerialNumber" });
|
||||
DropIndex("dbo.DeviceFlagAssignments", new[] { "DeviceFlagId" });
|
||||
DropForeignKey("dbo.DeviceFlagAssignments", "RemovedUserId", "dbo.Users");
|
||||
DropForeignKey("dbo.DeviceFlagAssignments", "AddedUserId", "dbo.Users");
|
||||
DropForeignKey("dbo.DeviceFlagAssignments", "DeviceSerialNumber", "dbo.Devices");
|
||||
DropForeignKey("dbo.DeviceFlagAssignments", "DeviceFlagId", "dbo.DeviceFlags");
|
||||
DropTable("dbo.DeviceFlags");
|
||||
DropTable("dbo.DeviceFlagAssignments");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,27 @@
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv24 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv24));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202403030134280_DBv24"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv24 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.JobMetaInsurances", "Insurer", c => c.String(maxLength: 200));
|
||||
AddColumn("dbo.JobMetaInsurances", "InsurerReference", c => c.String(maxLength: 200));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.JobMetaInsurances", "InsurerReference");
|
||||
DropColumn("dbo.JobMetaInsurances", "Insurer");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.2.16320.1300")]
|
||||
[assembly: AssemblyFileVersion("2.2.16320.1300")]
|
||||
[assembly: AssemblyVersion("2.4.24270.0000")]
|
||||
[assembly: AssemblyFileVersion("2.4.24270.0000")]
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -19,7 +19,7 @@ namespace Disco.Data.Properties {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Disco.Models.Repository;
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using Disco.Models.Repository;
|
||||
using System.Data.Entity.ModelConfiguration.Conventions;
|
||||
|
||||
namespace Disco.Data.Repository
|
||||
@@ -22,6 +19,7 @@ namespace Disco.Data.Repository
|
||||
public virtual DbSet<DocumentTemplate> DocumentTemplates { get; set; }
|
||||
|
||||
public virtual DbSet<User> Users { get; set; }
|
||||
public virtual DbSet<UserDetail> UserDetails { get; set; }
|
||||
public virtual DbSet<UserAttachment> UserAttachments { get; set; }
|
||||
public virtual DbSet<UserFlag> UserFlags { get; set; }
|
||||
public virtual DbSet<UserFlagAssignment> UserFlagAssignments { get; set; }
|
||||
@@ -34,8 +32,11 @@ namespace Disco.Data.Repository
|
||||
public virtual DbSet<DeviceModel> DeviceModels { get; set; }
|
||||
public virtual DbSet<DeviceProfile> DeviceProfiles { get; set; }
|
||||
public virtual DbSet<DeviceBatch> DeviceBatches { get; set; }
|
||||
public virtual DbSet<DeviceBatchAttachment> DeviceBatchAttachments { get; set; }
|
||||
public virtual DbSet<DeviceComponent> DeviceComponents { get; set; }
|
||||
public virtual DbSet<DeviceAttachment> DeviceAttachments { get; set; }
|
||||
public virtual DbSet<DeviceFlag> DeviceFlags { get; set; }
|
||||
public virtual DbSet<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
|
||||
|
||||
public virtual DbSet<DeviceCertificate> DeviceCertificates { get; set; }
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Models.Repository;
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
using System.DirectoryServices.ActiveDirectory;
|
||||
using System.DirectoryServices;
|
||||
using System.DirectoryServices.ActiveDirectory;
|
||||
using System.Linq;
|
||||
|
||||
namespace Disco.Data.Repository
|
||||
{
|
||||
@@ -370,7 +368,7 @@ DELETE [Users] WHERE [Id]=@IdExisting;";
|
||||
string defaultNamingContext;
|
||||
using (Domain d = Domain.GetComputerDomain())
|
||||
{
|
||||
string ldapPath = string.Format("LDAP://{0}/", d.Name);
|
||||
string ldapPath = $"LDAP://{d.Name}/";
|
||||
string configurationNamingContext;
|
||||
|
||||
using (var adRootDSE = new DirectoryEntry(ldapPath + "RootDSE"))
|
||||
@@ -381,7 +379,7 @@ DELETE [Users] WHERE [Id]=@IdExisting;";
|
||||
|
||||
using (var configSearchRoot = new DirectoryEntry(ldapPath + "CN=Partitions," + configurationNamingContext))
|
||||
{
|
||||
var configSearchFilter = string.Format("(&(objectcategory=Crossref)(dnsRoot={0})(netBIOSName=*))", d.Name);
|
||||
var configSearchFilter = $"(&(objectcategory=Crossref)(dnsRoot={d.Name})(netBIOSName=*))";
|
||||
var configSearchLoadProperites = new string[] { "NetBIOSName" };
|
||||
|
||||
using (var configSearcher = new DirectorySearcher(configSearchRoot, configSearchFilter, configSearchLoadProperites, SearchScope.OneLevel))
|
||||
@@ -403,14 +401,14 @@ DELETE [Users] WHERE [Id]=@IdExisting;";
|
||||
// Authorization Roles
|
||||
foreach (var authRole in Database.AuthorizationRoles.Where(ar => ar.SubjectIds != null).ToList())
|
||||
{
|
||||
var ids = string.Join(",", authRole.SubjectIds.Split(',').Select(id => id.Contains('\\') ? id : string.Format("{0}\\{1}", netBiosName, id)));
|
||||
var ids = string.Join(",", authRole.SubjectIds.Split(',').Select(id => id.Contains('\\') ? id : $@"{netBiosName}\{id}"));
|
||||
if (ids != authRole.SubjectIds)
|
||||
authRole.SubjectIds = ids;
|
||||
}
|
||||
// Job Queues
|
||||
foreach (var jobQueue in Database.JobQueues.Where(jq => jq.SubjectIds != null).ToList())
|
||||
{
|
||||
var ids = string.Join(",", jobQueue.SubjectIds.Split(',').Select(id => id.Contains('\\') ? id : string.Format("{0}\\{1}", netBiosName, id)));
|
||||
var ids = string.Join(",", jobQueue.SubjectIds.Split(',').Select(id => id.Contains('\\') ? id : $@"{netBiosName}\{id}"));
|
||||
if (ids != jobQueue.SubjectIds)
|
||||
jobQueue.SubjectIds = ids;
|
||||
}
|
||||
@@ -418,9 +416,9 @@ DELETE [Users] WHERE [Id]=@IdExisting;";
|
||||
foreach (var deviceProfile in Database.DeviceProfiles.Where(dp => dp.OrganisationalUnit == null || !dp.OrganisationalUnit.Contains(@"DC=")).ToList())
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(deviceProfile.OrganisationalUnit))
|
||||
deviceProfile.OrganisationalUnit = string.Format("CN=Computers,{0}", defaultNamingContext);
|
||||
deviceProfile.OrganisationalUnit = $"CN=Computers,{defaultNamingContext}";
|
||||
else
|
||||
deviceProfile.OrganisationalUnit = string.Format("{0},{1}", deviceProfile.OrganisationalUnit, defaultNamingContext);
|
||||
deviceProfile.OrganisationalUnit = $"{deviceProfile.OrganisationalUnit},{defaultNamingContext}";
|
||||
}
|
||||
Database.SaveChanges();
|
||||
|
||||
@@ -451,7 +449,7 @@ DELETE [Users] WHERE [Id]=@IdExisting;";
|
||||
// MIGRATE DEVICES
|
||||
foreach (var device in Database.Devices.Where(d => d.DeviceDomainId != null && !d.DeviceDomainId.Contains(@"\")).ToList())
|
||||
{
|
||||
device.DeviceDomainId = string.Format("{0}\\{1}", netBiosName, device.DeviceDomainId);
|
||||
device.DeviceDomainId = $@"{netBiosName}\{device.DeviceDomainId}";
|
||||
}
|
||||
Database.SaveChanges();
|
||||
|
||||
@@ -462,7 +460,7 @@ DELETE [Users] WHERE [Id]=@IdExisting;";
|
||||
idExisting.Value = user.UserId;
|
||||
|
||||
SqlParameter idNew = new SqlParameter("@IdNew", System.Data.SqlDbType.NVarChar, 50);
|
||||
idNew.Value = string.Format("{0}\\{1}", netBiosName, user.UserId);
|
||||
idNew.Value = $@"{netBiosName}\{user.UserId}";
|
||||
|
||||
Database.Database.ExecuteSqlCommand(MigratePreDomainUsers_Sql, idExisting, idNew);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Disco.Data.Repository
|
||||
var connectionString = DiscoDataContextConnectionString;
|
||||
if (connectionString == null)
|
||||
{
|
||||
throw new InvalidOperationException("The Disco DataContext Connection String has not been configured");
|
||||
throw new InvalidOperationException("The Disco ICT DataContext Connection String has not been configured");
|
||||
}
|
||||
|
||||
// Build DiscoDataContext - Use Default Connection Factory (SQLClient)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EntityFramework" version="5.0.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net45" />
|
||||
<package id="Rx-Core" version="2.2.5" targetFramework="net45" />
|
||||
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
|
||||
<package id="Rx-Linq" version="2.2.5" targetFramework="net45" />
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
</defaultConnectionFactory>
|
||||
</entityFramework>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -25,5 +25,8 @@ namespace Disco.Models.ClientServices
|
||||
public List<Certificate> Certificates { get; set; }
|
||||
|
||||
public List<WirelessProfile> WirelessProfiles { get; set; }
|
||||
|
||||
public string PendingSessionId { get; set; }
|
||||
public string PendingAuthorization { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Disco.Models.ClientServices.EnrolmentInformation;
|
||||
using System;
|
||||
|
||||
namespace Disco.Models.ClientServices
|
||||
{
|
||||
@@ -26,5 +27,11 @@ namespace Disco.Models.ClientServices
|
||||
public bool RequireReboot { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public bool IsPending { get; set; }
|
||||
public string PendingAuthorization { get; set; }
|
||||
public string PendingReason { get; set; }
|
||||
public DateTimeOffset PendingTimeout { get; set; }
|
||||
public string PendingIdentifier { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
{
|
||||
public class BaseBoard
|
||||
{
|
||||
public string[] ConfigOptions { get; set; }
|
||||
public string Manufacturer { get; set; }
|
||||
public string Model { get; set; }
|
||||
public string PartNumber { get; set; }
|
||||
public string Product { get; set; }
|
||||
public string SerialNumber { get; set; }
|
||||
public string SKU { get; set; }
|
||||
public string Version { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
{
|
||||
public class Battery
|
||||
{
|
||||
public string Availability { get; set; }
|
||||
public string Chemistry { get; set; }
|
||||
public string Description { get; set; }
|
||||
public uint? DesignCapacity { get; set; }
|
||||
public ulong? DesignVoltage { get; set; }
|
||||
public string DeviceID { get; set; }
|
||||
public uint? FullChargeCapacity { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
{
|
||||
public class Bios
|
||||
{
|
||||
public string[] BIOSVersion { get; set; }
|
||||
public string Manufacturer { get; set; }
|
||||
public DateTime? ReleaseDate { get; set; }
|
||||
public string SerialNumber { get; set; }
|
||||
public string SMBIOSBIOSVersion { get; set; }
|
||||
public ushort? SMBIOSMajorVersion { get; set; }
|
||||
public ushort? SMBIOSMinorVersion { get; set; }
|
||||
public byte? SystemBiosMajorVersion { get; set; }
|
||||
public byte? SystemBiosMinorVersion { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
{
|
||||
public class ComputerSystem
|
||||
{
|
||||
public string ChassisSKUNumber { get; set; }
|
||||
public short? CurrentTimeZone { get; set;}
|
||||
public string Description { get; set; }
|
||||
public string[] OEMStringArray { get; set; }
|
||||
public string PCSystemType { get; set; }
|
||||
public string PrimaryOwnerContact { get; set; }
|
||||
public string PrimaryOwnerName { get; set; }
|
||||
public string[] Roles { get; set; }
|
||||
public string SystemSKUNumber { get; set; }
|
||||
public string SystemType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,13 @@ namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
public string Model { get; set; }
|
||||
public string ModelType { get; set; }
|
||||
|
||||
public List<Bios> Bios { get; set; }
|
||||
public List<BaseBoard> BasebBoard { get; set; }
|
||||
public List<ComputerSystem> ComputerSystem { get; set; }
|
||||
public List<Processor> Processors { get; set; }
|
||||
public List<PhysicalMemory> PhysicalMemory { get; set; }
|
||||
public List<DiskDrive> DiskDrives { get; set; }
|
||||
public List<NetworkAdapter> NetworkAdapters { get; set; }
|
||||
|
||||
public List<Battery> Batteries { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
{
|
||||
@@ -12,8 +11,7 @@ namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
public string InterfaceType { get; set; }
|
||||
public string SerialNumber { get; set; }
|
||||
public string FirmwareRevision { get; set; }
|
||||
public DateTime InstallDate { get; set; }
|
||||
public ulong Size { get; set; }
|
||||
public ulong? Size { get; set; }
|
||||
|
||||
public List<DiskDrivePartition> Partitions { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
{
|
||||
public class DiskDrivePartition
|
||||
{
|
||||
public bool DeviceID { get; set; }
|
||||
public bool Bootable { get; set; }
|
||||
public bool BootPartition { get; set; }
|
||||
public bool PrimaryParition { get; set; }
|
||||
public ulong Size { get; set; }
|
||||
public ulong StartingOffset { get; set; }
|
||||
public string DeviceID { get; set; }
|
||||
public bool? Bootable { get; set; }
|
||||
public bool? BootPartition { get; set; }
|
||||
public bool? PrimaryParition { get; set; }
|
||||
public ulong? Size { get; set; }
|
||||
public ulong? StartingOffset { get; set; }
|
||||
public string Type { get; set; }
|
||||
|
||||
public List<DiskLogical> LogicalDisks { get; set; }
|
||||
public DiskLogical LogicalDisk { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
{
|
||||
public class DiskLogical
|
||||
{
|
||||
|
||||
public string DeviceID { get; set; }
|
||||
public string Description { get; set; }
|
||||
public int DriveType { get; set; }
|
||||
public int MediaType { get; set; }
|
||||
public string DriveType { get; set; }
|
||||
public string MediaType { get; set; }
|
||||
public string FileSystem { get; set; }
|
||||
public ulong Size { get; set; }
|
||||
public ulong FreeSpace { get; set; }
|
||||
public ulong? Size { get; set; }
|
||||
public ulong? FreeSpace { get; set; }
|
||||
public string VolumeName { get; set; }
|
||||
public string VolumeSerialNumber { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
{
|
||||
public class PhysicalMemory
|
||||
{
|
||||
@@ -13,11 +7,10 @@ namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
public string Manufacturer { get; set; }
|
||||
public string PartNumber { get; set; }
|
||||
|
||||
public ulong Capacity { get; set; }
|
||||
public int ClockSpeed { get; set; }
|
||||
public int Voltage { get; set; }
|
||||
|
||||
public string Location { get; set; }
|
||||
public ulong? Capacity { get; set; }
|
||||
public uint? ConfiguredClockSpeed { get; set; }
|
||||
public uint? Speed { get; set; }
|
||||
|
||||
public string DeviceLocator { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
{
|
||||
public class Processor
|
||||
{
|
||||
@@ -13,9 +7,9 @@ namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Architecture { get; set; }
|
||||
public short Family { get; set; }
|
||||
public int MaxClockSpeed { get; set; }
|
||||
public int NumberOfCores { get; set; }
|
||||
public int NumberOfLogicalProcessors { get; set; }
|
||||
public ushort? Family { get; set; }
|
||||
public uint? MaxClockSpeed { get; set; }
|
||||
public uint? NumberOfCores { get; set; }
|
||||
public uint? NumberOfLogicalProcessors { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Disco.Models</RootNamespace>
|
||||
<AssemblyName>Disco.Models</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
@@ -34,8 +34,8 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
@@ -49,6 +49,18 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BI\Config\OrganisationAddress.cs" />
|
||||
<Compile Include="Exporting\ExportFieldMetadata.cs" />
|
||||
<Compile Include="Exporting\ExportFormat.cs" />
|
||||
<Compile Include="Exporting\IExportRecord.cs" />
|
||||
<Compile Include="Repository\Device\Flag\DeviceFlag.cs" />
|
||||
<Compile Include="Repository\Device\Flag\DeviceFlagAssignment.cs" />
|
||||
<Compile Include="Services\Devices\DeviceFlags\DeviceFlagExportOptions.cs" />
|
||||
<Compile Include="Services\Devices\DeviceFlags\DeviceFlagExportRecord.cs" />
|
||||
<Compile Include="Services\Expressions\Extensions\ImageExpressionFormat.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\BaseBoard.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\Battery.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\Bios.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\ComputerSystem.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\DiskLogical.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\DeviceHardware.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\DiskDrive.cs" />
|
||||
@@ -60,7 +72,14 @@
|
||||
<Compile Include="ClientServices\EnrolmentInformation\WirelessProfile.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\WirelessProfileStore.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\WirelessProfileTransformation.cs" />
|
||||
<Compile Include="Repository\Device\DeviceBatchAttachment.cs" />
|
||||
<Compile Include="Services\Devices\Importing\IDeviceImportColumn.cs" />
|
||||
<Compile Include="Services\Devices\Importing\IDeviceImportDataReader.cs" />
|
||||
<Compile Include="Services\Documents\DocumentField.cs" />
|
||||
<Compile Include="Services\Documents\DocumentFieldType.cs" />
|
||||
<Compile Include="Services\Documents\DocumentTemplatePackage.cs" />
|
||||
<Compile Include="Services\Documents\OnImportUserFlagRule.cs" />
|
||||
<Compile Include="Exporting\IExportOptions.cs" />
|
||||
<Compile Include="Services\Jobs\LocationModes.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\Certificate.cs" />
|
||||
<Compile Include="ClientServices\Register.cs" />
|
||||
@@ -75,7 +94,7 @@
|
||||
<Compile Include="Services\Authorization\IClaimNavigatorItem.cs" />
|
||||
<Compile Include="Services\Authorization\IRoleToken.cs" />
|
||||
<Compile Include="Services\Documents\DocumentState.cs" />
|
||||
<Compile Include="BI\Expressions\IImageExpressionResult.cs" />
|
||||
<Compile Include="Services\Expressions\Extensions\IImageExpressionResult.cs" />
|
||||
<Compile Include="Services\Jobs\Statistics\DailyOpenedClosedItem.cs" />
|
||||
<Compile Include="ClientServices\EnrolResponse.cs" />
|
||||
<Compile Include="ClientServices\MacEnrol.cs" />
|
||||
@@ -114,7 +133,7 @@
|
||||
<Compile Include="Repository\User\UserDetail.cs" />
|
||||
<Compile Include="Repository\User\AuthorizationRole.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\DeviceExportOptions.cs" />
|
||||
<Compile Include="Services\Devices\Importing\DeviceImportFieldTypes.cs" />
|
||||
@@ -135,10 +154,16 @@
|
||||
<Compile Include="Services\Jobs\JobLists\JobTableStatusQueueItemModel.cs" />
|
||||
<Compile Include="Services\Jobs\JobQueues\IJobQueueToken.cs" />
|
||||
<Compile Include="Services\Jobs\Noticeboards\IHeldDeviceItem.cs" />
|
||||
<Compile Include="Services\Messaging\Email.cs" />
|
||||
<Compile Include="Services\Messaging\EmailAttachment.cs" />
|
||||
<Compile Include="Services\Users\Contact\UserContact.cs" />
|
||||
<Compile Include="Services\Users\Contact\UserContactType.cs" />
|
||||
<Compile Include="Services\Searching\DeviceSearchResultItem.cs" />
|
||||
<Compile Include="Services\Searching\ISearchResultItem.cs" />
|
||||
<Compile Include="Services\Searching\JobSearchResultItem.cs" />
|
||||
<Compile Include="Services\Searching\UserSearchResultItem.cs" />
|
||||
<Compile Include="Services\Users\UserFlags\UserFlagExportOptions.cs" />
|
||||
<Compile Include="Services\Users\UserFlags\UserFlagExportRecord.cs" />
|
||||
<Compile Include="UI\BaseUIModel.cs" />
|
||||
<Compile Include="UI\Config\AuthorizationRole\ConfigAuthorizationRoleCreateModel.cs" />
|
||||
<Compile Include="UI\Config\AuthorizationRole\ConfigAuthorizationRoleIndexModel.cs" />
|
||||
@@ -158,6 +183,7 @@
|
||||
<Compile Include="UI\Config\DeviceProfile\ConfigDeviceProfileIndexModel.cs" />
|
||||
<Compile Include="UI\Config\DeviceProfile\ConfigDeviceProfileIndexModelItem.cs" />
|
||||
<Compile Include="UI\Config\DeviceProfile\ConfigDeviceProfileShowModel.cs" />
|
||||
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateBulkGenerate.cs" />
|
||||
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateCreatePackageModel.cs" />
|
||||
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateCreateModel.cs" />
|
||||
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateExpressionBrowserModel.cs" />
|
||||
@@ -173,11 +199,17 @@
|
||||
<Compile Include="UI\Config\JobQueue\ConfigJobQueueIndexModel.cs" />
|
||||
<Compile Include="UI\Config\JobQueue\ConfigJobQueueShowModel.cs" />
|
||||
<Compile Include="UI\Config\Logging\ConfigLoggingIndexModel.cs" />
|
||||
<Compile Include="UI\Config\Shared\ConfigSharedDeviceGroupDocumentTemplateBulkGenerate.cs" />
|
||||
<Compile Include="UI\Config\Shared\ConfigSharedTaskStatusModel.cs" />
|
||||
<Compile Include="UI\Config\Organisation\ConfigOrganisationIndexModel.cs" />
|
||||
<Compile Include="UI\Config\DeviceFlag\ConfigDeviceFlagCreateModel.cs" />
|
||||
<Compile Include="UI\Config\DeviceFlag\ConfigDeviceFlagExportModel.cs" />
|
||||
<Compile Include="UI\Config\DeviceFlag\ConfigDeviceFlagIndexModel.cs" />
|
||||
<Compile Include="UI\Config\DeviceFlag\ConfigDeviceFlagShowModel.cs" />
|
||||
<Compile Include="UI\Config\UserFlag\ConfigUserFlagCreateModel.cs" />
|
||||
<Compile Include="UI\Config\UserFlag\ConfigUserFlagIndexModel.cs" />
|
||||
<Compile Include="UI\Config\UserFlag\ConfigUserFlagShowModel.cs" />
|
||||
<Compile Include="UI\Config\UserFlag\ConfigUserFlagExportModel.cs" />
|
||||
<Compile Include="UI\Device\DeviceAddOfflineModel.cs" />
|
||||
<Compile Include="UI\Device\DeviceExportModel.cs" />
|
||||
<Compile Include="UI\Device\DeviceImportHeadersModel.cs" />
|
||||
@@ -199,6 +231,11 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties BuildVersion_StartDate="2000/1/1" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
|
||||
namespace Disco.Models.Exporting
|
||||
{
|
||||
public class ExportFieldMetadata<T> where T : IExportRecord
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string ColumnName { get; set; }
|
||||
public Type ValueType { get; set; }
|
||||
public Func<T, object> Accessor { get; set; }
|
||||
public Func<object, string> CsvEncoder { get; set; }
|
||||
|
||||
public ExportFieldMetadata(string name, Type valueType, Func<T, object> accessor, Func<object, string> csvEncoder)
|
||||
{
|
||||
Name = name;
|
||||
ValueType = valueType;
|
||||
Accessor = accessor;
|
||||
CsvEncoder = csvEncoder;
|
||||
}
|
||||
|
||||
public ExportFieldMetadata(string name, string columnName, Type valueType, Func<T, object> accessor, Func<object, string> csvEncoder)
|
||||
: this(name, valueType, accessor, csvEncoder)
|
||||
{
|
||||
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,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.2.16320.1300")]
|
||||
[assembly: AssemblyFileVersion("2.2.16320.1300")]
|
||||
[assembly: AssemblyVersion("2.4.24270.0000")]
|
||||
[assembly: AssemblyFileVersion("2.4.24270.0000")]
|
||||
@@ -4,6 +4,7 @@
|
||||
{
|
||||
Device,
|
||||
Job,
|
||||
User
|
||||
User,
|
||||
DeviceBatch,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,5 +20,9 @@ namespace Disco.Models.Repository
|
||||
string DocumentTemplateId { get; set; }
|
||||
|
||||
AttachmentTypes AttachmentType { get; }
|
||||
|
||||
string HandlerId { get; set; }
|
||||
string HandlerReferenceId { get; set; }
|
||||
string HandlerData { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,22 @@ namespace Disco.Models.Repository
|
||||
|
||||
[InverseProperty("DeviceSerialNumber")]
|
||||
public virtual IList<Job> Jobs { get; set; }
|
||||
public virtual IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of the current device assignments, ordered by the most recent assignment date.
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public IList<DeviceUserAssignment> CurrentDeviceUserAssignments
|
||||
{
|
||||
get
|
||||
{
|
||||
return DeviceUserAssignments?
|
||||
.Where(dua => dua.UnassignedDate is null)
|
||||
.OrderByDescending(dua => dua.AssignedDate)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
@@ -21,6 +21,12 @@ namespace Disco.Models.Repository
|
||||
|
||||
public string DocumentTemplateId { get; set; }
|
||||
|
||||
[StringLength(30)]
|
||||
public string HandlerId { get; set; }
|
||||
[StringLength(50)]
|
||||
public string HandlerReferenceId { get; set; }
|
||||
public string HandlerData { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public object Reference { get { return DeviceSerialNumber; } }
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace Disco.Models.Repository
|
||||
[ForeignKey("DefaultDeviceModelId")]
|
||||
public virtual DeviceModel DefaultDeviceModel { get; set; }
|
||||
|
||||
public virtual IList<DeviceBatchAttachment> DeviceBatchAttachments { get; set; }
|
||||
public virtual IList<Device> Devices { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Disco.Models.Repository
|
||||
{
|
||||
public class DeviceBatchAttachment : IAttachment
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public int DeviceBatchId { get; set; }
|
||||
[Required]
|
||||
public string TechUserId { get; set; }
|
||||
[StringLength(500), Required]
|
||||
public string Filename { get; set; }
|
||||
[Required, StringLength(500)]
|
||||
public string MimeType { get; set; }
|
||||
public DateTime Timestamp { get; set; }
|
||||
[Required, StringLength(500)]
|
||||
public string Comments { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string HandlerId { get => null; set { } }
|
||||
[NotMapped]
|
||||
public string HandlerReferenceId { get => null; set { } }
|
||||
[NotMapped]
|
||||
public string HandlerData { get => null; set { } }
|
||||
|
||||
[NotMapped]
|
||||
public object Reference => DeviceBatchId;
|
||||
|
||||
[NotMapped]
|
||||
public AttachmentTypes AttachmentType => AttachmentTypes.DeviceBatch;
|
||||
|
||||
[NotMapped]
|
||||
public string DocumentTemplateId { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
|
||||
|
||||
|
||||
[InverseProperty(nameof(Repository.DeviceBatch.DeviceBatchAttachments)), ForeignKey(nameof(DeviceBatchId))]
|
||||
public virtual DeviceBatch DeviceBatch { get; set; }
|
||||
|
||||
[ForeignKey("TechUserId")]
|
||||
public virtual User TechUser { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Disco.Models.Repository
|
||||
@@ -16,6 +12,14 @@ namespace Disco.Models.Repository
|
||||
public const string HardwareKeyACAdapter = "ACAdapter";
|
||||
public const string HardwareKeyBattery = "Battery";
|
||||
public const string HardwareKeyKeyboard = "Keyboard";
|
||||
public const string HardwareKeyNetworkAdapters = "NetworkAdapters";
|
||||
public const string HardwareKeyProcessors = "Processors";
|
||||
public const string HardwareKeyPhysicalMemory = "PhysicalMemory";
|
||||
public const string HardwareKeyDiskDrives = "DiskDrives";
|
||||
public const string HardwareKeyBios = "Bios";
|
||||
public const string HardwareKeyBaseBoard = "BaseBoard";
|
||||
public const string HardwareKeyComputerSystem = "ComputerSystem";
|
||||
public const string HardwareKeyBatteries = "Batteries";
|
||||
|
||||
[Column(Order = 0), Key]
|
||||
public string DeviceSerialNumber { get; set; }
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Disco.Models.Repository
|
||||
{
|
||||
public class DeviceFlag
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required, StringLength(100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[StringLength(500), DataType(DataType.MultilineText)]
|
||||
public string Description { get; set; }
|
||||
|
||||
[Required, StringLength(25)]
|
||||
public string Icon { get; set; }
|
||||
[Required, StringLength(10)]
|
||||
public string IconColour { get; set; }
|
||||
|
||||
public string DevicesLinkedGroup { get; set; }
|
||||
public string DeviceUsersLinkedGroup { get; set; }
|
||||
|
||||
[DataType(DataType.MultilineText)]
|
||||
public string OnAssignmentExpression { get; set; }
|
||||
[DataType(DataType.MultilineText)]
|
||||
public string OnUnassignmentExpression { get; set; }
|
||||
|
||||
public virtual IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Disco.Models.Repository
|
||||
{
|
||||
public class DeviceFlagAssignment
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int DeviceFlagId { get; set; }
|
||||
[Required]
|
||||
public string DeviceSerialNumber { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime AddedDate { get; set; }
|
||||
[Required]
|
||||
public string AddedUserId { get; set; }
|
||||
public DateTime? RemovedDate { get; set; }
|
||||
public string RemovedUserId { get; set; }
|
||||
|
||||
public string Comments { get; set; }
|
||||
|
||||
public string OnAssignmentExpressionResult { get; set; }
|
||||
public string OnUnassignmentExpressionResult { get; set; }
|
||||
|
||||
[ForeignKey(nameof(DeviceFlagId)), InverseProperty("DeviceFlagAssignments")]
|
||||
public virtual DeviceFlag DeviceFlag { get; set; }
|
||||
|
||||
[ForeignKey(nameof(DeviceSerialNumber)), InverseProperty("DeviceFlagAssignments")]
|
||||
public virtual Device Device { get; set; }
|
||||
|
||||
[ForeignKey("AddedUserId")]
|
||||
public virtual User AddedUser { get; set; }
|
||||
[ForeignKey("RemovedUserId")]
|
||||
public virtual User RemovedUser { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Device Flag Id: {DeviceFlagId}; Device Serial Number: {DeviceSerialNumber}; Added: {AddedDate:s}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ namespace Disco.Models.Repository
|
||||
public string OnGenerateExpression { get; set; }
|
||||
[DataType(DataType.MultilineText)]
|
||||
public string OnImportAttachmentExpression { get; set; }
|
||||
public string OnImportUserFlagRules { get; set; }
|
||||
|
||||
// Feature Request 2012-05-10 by G#: https://disco.uservoice.com/forums/159707-feedback/suggestions/2811092-document-template-option-flatten-form-on-generate
|
||||
public bool FlattenForm { get; set; }
|
||||
|
||||
@@ -22,6 +22,12 @@ namespace Disco.Models.Repository
|
||||
|
||||
public string DocumentTemplateId { get; set; }
|
||||
|
||||
[StringLength(30)]
|
||||
public string HandlerId { get; set; }
|
||||
[StringLength(50)]
|
||||
public string HandlerReferenceId { get; set; }
|
||||
public string HandlerData { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public object Reference { get { return JobId; } }
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
@@ -58,6 +55,10 @@ namespace Disco.Models.Repository
|
||||
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
|
||||
public DateTime? ClaimFormSentDate { get; set; }
|
||||
public string ClaimFormSentUserId { get; set; }
|
||||
[StringLength(200)]
|
||||
public string Insurer { get; set; }
|
||||
[StringLength(200)]
|
||||
public string InsurerReference { get; set; }
|
||||
|
||||
[Required, ForeignKey("JobId")]
|
||||
public virtual Job Job { get; set; }
|
||||
|
||||
@@ -71,21 +71,40 @@ namespace Disco.Models.Repository
|
||||
return string.Format("{0} ({1})", this.DisplayName, this.UserId);
|
||||
}
|
||||
|
||||
public void UpdateSelf(User u)
|
||||
public bool UpdateSelf(User u)
|
||||
{
|
||||
var changed = false;
|
||||
|
||||
if (!this.UserId.Equals(u.UserId, StringComparison.OrdinalIgnoreCase))
|
||||
throw new ArgumentException("User Id's do not match", "u");
|
||||
|
||||
if (this.Surname != u.Surname)
|
||||
{
|
||||
this.Surname = u.Surname;
|
||||
changed = true;
|
||||
}
|
||||
if (this.GivenName != u.GivenName)
|
||||
{
|
||||
this.GivenName = u.GivenName;
|
||||
changed = true;
|
||||
}
|
||||
if (this.DisplayName != u.DisplayName)
|
||||
{
|
||||
this.DisplayName = u.DisplayName;
|
||||
changed = true;
|
||||
}
|
||||
if (this.EmailAddress != u.EmailAddress)
|
||||
{
|
||||
this.EmailAddress = u.EmailAddress;
|
||||
changed = true;
|
||||
}
|
||||
if (this.PhoneNumber != u.PhoneNumber)
|
||||
{
|
||||
this.PhoneNumber = u.PhoneNumber;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,12 @@ namespace Disco.Models.Repository
|
||||
|
||||
public string DocumentTemplateId { get; set; }
|
||||
|
||||
[StringLength(30)]
|
||||
public string HandlerId { get; set; }
|
||||
[StringLength(50)]
|
||||
public string HandlerReferenceId { get; set; }
|
||||
public string HandlerData { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public object Reference { get { return UserId; } }
|
||||
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
using Disco.Models.Exporting;
|
||||
using Disco.Models.Services.Exporting;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Disco.Models.Services.Devices.DeviceFlag
|
||||
{
|
||||
public class DeviceFlagExportOptions : IExportOptions
|
||||
{
|
||||
public ExportFormat Format { get; set; }
|
||||
public string FilenamePrefix { get; } = "DiscoDeviceFlagExport";
|
||||
public string ExcelWorksheetName { get; } = "DeviceFlagExport";
|
||||
public string ExcelTableName { get; } = "DeviceFlags";
|
||||
|
||||
[Required]
|
||||
public List<int> DeviceFlagIds { get; set; } = new List<int>();
|
||||
|
||||
[Display(Name = "Current Only")]
|
||||
public bool CurrentOnly { get; set; }
|
||||
|
||||
// Device Flag
|
||||
[Display(ShortName = "Device Flag", Name = "Identifier", Description = "The identifier of the device flag")]
|
||||
public bool Id { get; set; }
|
||||
[Display(ShortName = "Device Flag", Name = "Name", Description = "The name of the device flag")]
|
||||
public bool Name { get; set; }
|
||||
[Display(ShortName = "Device Flag", Name = "Description", Description = "The description of the device flag")]
|
||||
public bool Description { get; set; }
|
||||
[Display(ShortName = "Device Flag", Name = "Icon", Description = "The icon assigned to the device flag")]
|
||||
public bool Icon { get; set; }
|
||||
[Display(ShortName = "Device Flag", Name = "Icon Colour", Description = "The icon colour assigned to the device flag")]
|
||||
public bool IconColour { get; set; }
|
||||
[Display(ShortName = "Device Flag", Name = "Assignment Identifier", Description = "The identifier of the device flag assignment")]
|
||||
public bool AssignmentId { get; set; }
|
||||
[Display(ShortName = "Device Flag", Name = "Added Date", Description = "The date the device flag was assigned to the user")]
|
||||
public bool AddedDate { get; set; }
|
||||
[Display(ShortName = "Device Flag", Name = "Added User Identifier", Description = "The identifier of the user who assigned the device flag")]
|
||||
public bool AddedUserId { get; set; }
|
||||
[Display(ShortName = "Device Flag", Name = "Removed Date", Description = "The date the device flag was unassigned from the user")]
|
||||
public bool RemovedDate { get; set; }
|
||||
[Display(ShortName = "Device Flag", Name = "Removed User Identifier", Description = "The identifier of the user who unassigned the device flag")]
|
||||
public bool RemovedUserId { get; set; }
|
||||
[Display(ShortName = "Device Flag", Name = "Comments", Description = "The comments associated with the device flag assignment")]
|
||||
public bool Comments { get; set; }
|
||||
|
||||
// Device
|
||||
[Display(ShortName = "Device", Name = "Serial Number", Description = "The device serial number")]
|
||||
public bool DeviceSerialNumber { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Asset Number", Description = "The device asset number")]
|
||||
public bool DeviceAssetNumber { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Location", Description = "The device location")]
|
||||
public bool DeviceLocation { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Computer Name", Description = "The device computer name")]
|
||||
public bool DeviceComputerName { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Last Network Logon", Description = "The last recorded time the device access the network")]
|
||||
public bool DeviceLastNetworkLogon { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Created Date", Description = "The date the device was created in Disco ICT")]
|
||||
public bool DeviceCreatedDate { get; set; }
|
||||
[Display(ShortName = "Device", Name = "First Enrolled Date", Description = "The date the device was first enrolled in Disco ICT")]
|
||||
public bool DeviceFirstEnrolledDate { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Last Enrolled Date", Description = "The date the device was last enrolled in Disco ICT")]
|
||||
public bool DeviceLastEnrolledDate { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Enrolment Trusted", Description = "The device is trusted to complete an unauthenticated enrolment")]
|
||||
public bool DeviceAllowUnauthenticatedEnrol { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Decommissioned Date", Description = "The date the device was decommissioned in Disco ICT")]
|
||||
public bool DeviceDecommissionedDate { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Decommissioned Reason", Description = "The reason the device was decommissioned")]
|
||||
public bool DeviceDecommissionedReason { get; set; }
|
||||
|
||||
public bool HasDeviceOptions()
|
||||
{
|
||||
return DeviceSerialNumber ||
|
||||
DeviceAssetNumber ||
|
||||
DeviceLocation ||
|
||||
DeviceComputerName ||
|
||||
DeviceLastNetworkLogon ||
|
||||
DeviceCreatedDate ||
|
||||
DeviceFirstEnrolledDate ||
|
||||
DeviceLastEnrolledDate ||
|
||||
DeviceAllowUnauthenticatedEnrol ||
|
||||
DeviceDecommissionedDate ||
|
||||
DeviceDecommissionedReason;
|
||||
}
|
||||
|
||||
// Model
|
||||
[Display(ShortName = "Model", Name = "Identifier", Description = "The identifier of the device model associated with the device")]
|
||||
public bool ModelId { get; set; }
|
||||
[Display(ShortName = "Model", Name = "Description", Description = "The description of the device model associated with the device")]
|
||||
public bool ModelDescription { get; set; }
|
||||
[Display(ShortName = "Model", Name = "Manufacturer", Description = "The manufacturer of the device model associated with the device")]
|
||||
public bool ModelManufacturer { get; set; }
|
||||
[Display(ShortName = "Model", Name = "Model", Description = "The model of the device model associated with the device")]
|
||||
public bool ModelModel { get; set; }
|
||||
[Display(ShortName = "Model", Name = "Type", Description = "The type of device model associated with the device")]
|
||||
public bool ModelType { get; set; }
|
||||
public bool HasDeviceModelOptions()
|
||||
{
|
||||
return ModelId ||
|
||||
ModelDescription ||
|
||||
ModelManufacturer ||
|
||||
ModelModel ||
|
||||
ModelType;
|
||||
}
|
||||
|
||||
// Batch
|
||||
[Display(ShortName = "Batch", Name = "Identifier", Description = "The identifier of the device batch associated with the device")]
|
||||
public bool BatchId { get; set; }
|
||||
[Display(ShortName = "Batch", Name = "Name", Description = "The name of the device batch associated with the device")]
|
||||
public bool BatchName { get; set; }
|
||||
[Display(ShortName = "Batch", Name = "Purchase Date", Description = "The purchase date of the device batch associated with the device")]
|
||||
public bool BatchPurchaseDate { get; set; }
|
||||
[Display(ShortName = "Batch", Name = "Supplier", Description = "The supplier of the device batch associated with the device")]
|
||||
public bool BatchSupplier { get; set; }
|
||||
[Display(ShortName = "Batch", Name = "Unit Cost", Description = "The unit cost of the device batch associated with the device")]
|
||||
public bool BatchUnitCost { get; set; }
|
||||
[Display(ShortName = "Batch", Name = "Warranty Valid Until Date", Description = "The warranty valid until date of the device batch associated with the device")]
|
||||
public bool BatchWarrantyValidUntilDate { get; set; }
|
||||
[Display(ShortName = "Batch", Name = "Insured Date", Description = "The insured date of the device batch associated with the device")]
|
||||
public bool BatchInsuredDate { get; set; }
|
||||
[Display(ShortName = "Batch", Name = "Insurance Supplier", Description = "The insurance supplier of the device batch associated with the device")]
|
||||
public bool BatchInsuranceSupplier { get; set; }
|
||||
[Display(ShortName = "Batch", Name = "Insured Until Date", Description = "The insured until date of the device batch associated with the device")]
|
||||
public bool BatchInsuredUntilDate { get; set; }
|
||||
public bool HasDeviceBatchOptions()
|
||||
{
|
||||
return BatchId ||
|
||||
BatchName ||
|
||||
BatchPurchaseDate ||
|
||||
BatchSupplier ||
|
||||
BatchUnitCost ||
|
||||
BatchWarrantyValidUntilDate ||
|
||||
BatchInsuredDate ||
|
||||
BatchInsuranceSupplier ||
|
||||
BatchInsuredUntilDate;
|
||||
}
|
||||
|
||||
// Profile
|
||||
[Display(ShortName = "Profile", Name = "Identifier", Description = "The identifier of the device profile associated with the device")]
|
||||
public bool ProfileId { get; set; }
|
||||
[Display(ShortName = "Profile", Name = "Name", Description = "The name of the device profile associated with the device")]
|
||||
public bool ProfileName { get; set; }
|
||||
[Display(ShortName = "Profile", Name = "Short Name", Description = "The short name of the device profile associated with the device")]
|
||||
public bool ProfileShortName { get; set; }
|
||||
public bool HasDeviceProfileOptions()
|
||||
{
|
||||
return ProfileId ||
|
||||
ProfileName ||
|
||||
ProfileShortName;
|
||||
}
|
||||
|
||||
// Assigned User
|
||||
[Display(ShortName = "Assigned User", Name = "Identifier", Description = "The identifier of the user assigned to the device flag")]
|
||||
public bool AssignedUserId { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Display Name", Description = "The display name of the user assigned to the device flag")]
|
||||
public bool AssignedUserDisplayName { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Surname", Description = "The surname of the user assigned to the device flag")]
|
||||
public bool AssignedUserSurname { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Given Name", Description = "The given name of the user assigned to the device flag")]
|
||||
public bool AssignedUserGivenName { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Phone Number", Description = "The phone number of the user assigned to the device flag")]
|
||||
public bool AssignedUserPhoneNumber { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Email Address", Description = "The email address of the user assigned to the device flag")]
|
||||
public bool AssignedUserEmailAddress { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Custom Details", Description = "The custom details provided by plugins for the user assigned to the device flag")]
|
||||
public bool AssignedUserDetailCustom { get; set; }
|
||||
public bool HasAssignedUserOptions()
|
||||
{
|
||||
return AssignedUserId ||
|
||||
AssignedUserDisplayName ||
|
||||
AssignedUserSurname ||
|
||||
AssignedUserGivenName ||
|
||||
AssignedUserPhoneNumber ||
|
||||
AssignedUserEmailAddress;
|
||||
}
|
||||
|
||||
public static DeviceFlagExportOptions DefaultOptions()
|
||||
{
|
||||
return new DeviceFlagExportOptions()
|
||||
{
|
||||
Format = ExportFormat.Xlsx,
|
||||
CurrentOnly = true,
|
||||
Name = true,
|
||||
AddedDate = true,
|
||||
DeviceSerialNumber = true,
|
||||
ModelDescription = true,
|
||||
ProfileName = true,
|
||||
AssignedUserId = true,
|
||||
AssignedUserDisplayName = true,
|
||||
Comments = true,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Disco.Models.Exporting;
|
||||
using Disco.Models.Repository;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Disco.Models.Services.Devices.DeviceFlag
|
||||
{
|
||||
public class DeviceFlagExportRecord : IExportRecord
|
||||
{
|
||||
public DeviceFlagAssignment Assignment { get; set; }
|
||||
public Dictionary<string, string> AssignedUserCustomDetails { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Disco.Models.Exporting;
|
||||
using Disco.Models.Services.Exporting;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.Services.Devices.Exporting
|
||||
{
|
||||
public class DeviceExportOptions
|
||||
public class DeviceExportOptions : IExportOptions
|
||||
{
|
||||
public DeviceExportTypes ExportType { get; set; }
|
||||
public int? ExportTypeTargetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Adds '=' to the beginning of the string to stop Excel removing the leading zeros
|
||||
/// </summary>
|
||||
public bool ExcelCsvFormat { get; set; }
|
||||
public ExportFormat Format { get; set; }
|
||||
public string FilenamePrefix { get; } = "DiscoDeviceExport";
|
||||
public string ExcelWorksheetName { get; } = "DeviceExport";
|
||||
public string ExcelTableName { get; } = "Devices";
|
||||
|
||||
// Device
|
||||
[Display(ShortName = "Device", Name = "Serial Number", Description = "The device serial number")]
|
||||
@@ -28,31 +25,19 @@ namespace Disco.Models.Services.Devices.Exporting
|
||||
public bool DeviceComputerName { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Last Network Logon", Description = "The last recorded time the device access the network")]
|
||||
public bool DeviceLastNetworkLogon { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Created Date", Description = "The date the device was created in Disco")]
|
||||
[Display(ShortName = "Device", Name = "Created Date", Description = "The date the device was created in Disco ICT")]
|
||||
public bool DeviceCreatedDate { get; set; }
|
||||
[Display(ShortName = "Device", Name = "First Enrolled Date", Description = "The date the device was first enrolled in Disco")]
|
||||
[Display(ShortName = "Device", Name = "First Enrolled Date", Description = "The date the device was first enrolled in Disco ICT")]
|
||||
public bool DeviceFirstEnrolledDate { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Last Enrolled Date", Description = "The date the device was last enrolled in Disco")]
|
||||
[Display(ShortName = "Device", Name = "Last Enrolled Date", Description = "The date the device was last enrolled in Disco ICT")]
|
||||
public bool DeviceLastEnrolledDate { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Enrolment Trusted", Description = "The device is trusted to complete an unauthenticated enrolment")]
|
||||
public bool DeviceAllowUnauthenticatedEnrol { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Decommissioned Date", Description = "The date the device was decommissioned in Disco")]
|
||||
[Display(ShortName = "Device", Name = "Decommissioned Date", Description = "The date the device was decommissioned in Disco ICT")]
|
||||
public bool DeviceDecommissionedDate { get; set; }
|
||||
[Display(ShortName = "Device", Name = "Decommissioned Reason", Description = "The reason the device was decommissioned")]
|
||||
public bool DeviceDecommissionedReason { get; set; }
|
||||
|
||||
// Details
|
||||
[Display(ShortName = "Details", Name = "LAN MAC Address", Description = "The LAN MAC Address associated with the device")]
|
||||
public bool DetailLanMacAddress { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Wireless LAN MAC Address", Description = "The Wireless LAN MAC Address associated with the device")]
|
||||
public bool DetailWLanMacAddress { get; set; }
|
||||
[Display(ShortName = "Details", Name = "AC Adapter", Description = "The AC Adapter associated with the device")]
|
||||
public bool DetailACAdapter { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Battery", Description = "The Battery associated with the device")]
|
||||
public bool DetailBattery { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Keyboard", Description = "The Keyboard associated with the device")]
|
||||
public bool DetailKeyboard { get; set; }
|
||||
|
||||
// Model
|
||||
[Display(ShortName = "Model", Name = "Identifier", Description = "The identifier of the device model associated with the device")]
|
||||
public bool ModelId { get; set; }
|
||||
@@ -108,6 +93,8 @@ namespace Disco.Models.Services.Devices.Exporting
|
||||
public bool AssignedUserPhoneNumber { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Email Address", Description = "The email address of the user assigned to the device")]
|
||||
public bool AssignedUserEmailAddress { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Custom Details", Description = "The custom details provided by plugins for the user assigned to the device")]
|
||||
public bool AssignedUserDetailCustom { get; set; }
|
||||
|
||||
// Jobs
|
||||
[Display(ShortName = "Jobs", Name = "Count", Description = "The total number of jobs associated with the device")]
|
||||
@@ -120,22 +107,41 @@ namespace Disco.Models.Services.Devices.Exporting
|
||||
public bool AttachmentsCount { get; set; }
|
||||
|
||||
// Certificates
|
||||
[Display(ShortName = "Certificates", Name = "Name", Description = "The name of the most recently assigned active certificate associated with the device")]
|
||||
public bool CertificateName { get; set; }
|
||||
[Display(ShortName = "Certificates", Name = "Allocated Date", Description = "The allocated date of the most recently assigned active certificate associated with the device")]
|
||||
public bool CertificateAllocatedDate { get; set; }
|
||||
[Display(ShortName = "Certificates", Name = "Expiration Date", Description = "The expiration date of the most recently assigned active certificate associated with the device")]
|
||||
public bool CertificateExpirationDate { get; set; }
|
||||
[Display(ShortName = "Certificates", Name = "Provider Id", Description = "The provider identifier of the most recently assigned active certificate associated with the device")]
|
||||
public bool CertificateProviderId { get; set; }
|
||||
[Display(ShortName = "Certificates", Name = "Certificates", Description = "The assigned active certificates associated with the device")]
|
||||
public bool Certificates { get; set; }
|
||||
|
||||
// Details
|
||||
[Display(ShortName = "Details", Name = "BIOS", Description = "The BIOS associated with the device")]
|
||||
public bool DetailBios { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Base Board", Description = "The Base Board associated with the device")]
|
||||
public bool DetailBaseBoard { get; set; }
|
||||
[Display(ShortName = "Details", Name = "System", Description = "The System information associated with the device")]
|
||||
public bool DetailComputerSystem { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Processors", Description = "The CPU Processors associated with the device")]
|
||||
public bool DetailProcessors { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Memory", Description = "The Memory/RAM associated with the device")]
|
||||
public bool DetailMemory { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Disk Drives", Description = "The Disk Drives associated with the device")]
|
||||
public bool DetailDiskDrives { get; set; }
|
||||
[Display(ShortName = "Details", Name = "LAN Adapters", Description = "The LAN Adapters associated with the device")]
|
||||
public bool DetailLanAdapters { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Wireless LAN Adapters", Description = "The Wireless LAN Adapters associated with the device")]
|
||||
public bool DetailWLanAdapters { get; set; }
|
||||
[Display(ShortName = "Details", Name = "AC Adapter", Description = "The AC Adapter associated with the device")]
|
||||
public bool DetailACAdapter { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Battery", Description = "The manually entered battery associated with the device")]
|
||||
public bool DetailBatteries { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Batteries", Description = "The reported batteries associated with the device")]
|
||||
public bool DetailBattery { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Keyboard", Description = "The Keyboard associated with the device")]
|
||||
public bool DetailKeyboard { get; set; }
|
||||
|
||||
public static DeviceExportOptions DefaultOptions()
|
||||
{
|
||||
return new DeviceExportOptions()
|
||||
{
|
||||
ExportType = DeviceExportTypes.All,
|
||||
ExcelCsvFormat = true,
|
||||
Format = ExportFormat.Xlsx,
|
||||
DeviceSerialNumber = true,
|
||||
ModelId = true,
|
||||
ProfileId = true,
|
||||
|
||||
@@ -1,15 +1,27 @@
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Models.ClientServices.EnrolmentInformation;
|
||||
using Disco.Models.Exporting;
|
||||
using Disco.Models.Repository;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Disco.Models.Services.Devices.Exporting
|
||||
{
|
||||
public class DeviceExportRecord
|
||||
public class DeviceExportRecord : IExportRecord
|
||||
{
|
||||
public Device Device { get; set; }
|
||||
|
||||
// Details
|
||||
public IEnumerable<DeviceDetail> DeviceDetails { get; set; }
|
||||
public IList<DeviceDetail> DeviceDetails { get; set; }
|
||||
public List<Bios> DeviceDetailBios { get; set; }
|
||||
public List<BaseBoard> DeviceDetailBaseBoard { get; set; }
|
||||
public List<ComputerSystem> DeviceDetailComputerSystem { get; set; }
|
||||
public List<Processor> DeviceDetailProcessors { get; set; }
|
||||
public List<PhysicalMemory> DeviceDetailPhysicalMemory { get; set; }
|
||||
public List<DiskDrive> DeviceDetailDiskDrives { get; set; }
|
||||
public List<NetworkAdapter> DeviceDetailNetworkAdapters { get; set; }
|
||||
public List<string> DeviceDetailLanMacAddresses { get; set; }
|
||||
public List<string> DeviceDetailWlanMacAddresses { get; set; }
|
||||
public List<Battery> DeviceDetailBatteries { get; set; }
|
||||
|
||||
// Model
|
||||
public int? ModelId { get; set; }
|
||||
@@ -37,6 +49,8 @@ namespace Disco.Models.Services.Devices.Exporting
|
||||
// User
|
||||
public DeviceUserAssignment DeviceUserAssignment { get; set; }
|
||||
public User AssignedUser { get; set; }
|
||||
public IList<UserDetail> AssignedUserDetails { get; set; }
|
||||
public Dictionary<string, string> AssignedUserCustomDetails { get; set; }
|
||||
|
||||
// Jobs
|
||||
public int JobsTotalCount { get; set; }
|
||||
@@ -46,6 +60,6 @@ namespace Disco.Models.Services.Devices.Exporting
|
||||
public int AttachmentsCount { get; set; }
|
||||
|
||||
// Certificates
|
||||
public DeviceCertificate DeviceCertificate { get; set; }
|
||||
public IEnumerable<DeviceCertificate> DeviceCertificates { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Disco.Models.Services.Devices.Exporting
|
||||
{
|
||||
public class DeviceExportResult
|
||||
{
|
||||
public MemoryStream CsvResult { get; set; }
|
||||
public int RecordCount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.Services.Devices.Exporting
|
||||
namespace Disco.Models.Services.Devices.Exporting
|
||||
{
|
||||
public enum DeviceExportTypes
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Disco.Models.Services.Devices.Importing
|
||||
{
|
||||
@@ -11,13 +6,15 @@ namespace Disco.Models.Services.Devices.Importing
|
||||
{
|
||||
[Required, Display(Name = "Device Serial Number", Description = "The device serial number")]
|
||||
DeviceSerialNumber,
|
||||
[Display(Name = "Device Computer Name", Description = "The device computer name")]
|
||||
DeviceComputerName,
|
||||
[Display(Name = "Device Asset Number", Description = "The device asset number")]
|
||||
DeviceAssetNumber,
|
||||
[Display(Name = "Device Location", Description = "The device location")]
|
||||
DeviceLocation,
|
||||
[Display(Name = "Device Enrolment Trusted", Description = "The device is trusted to complete an unauthenticated enrolment")]
|
||||
DeviceAllowUnauthenticatedEnrol,
|
||||
[Display(Name = "Device Decommissioned Date", Description = "The date the device was decommissioned in Disco")]
|
||||
[Display(Name = "Device Decommissioned Date", Description = "The date the device was decommissioned in Disco ICT")]
|
||||
DeviceDecommissionedDate,
|
||||
[Display(Name = "Device Decommissioned Reason", Description = "The reason the device was decommissioned")]
|
||||
DeviceDecommissionedReason,
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace Disco.Models.Services.Devices.Importing
|
||||
{
|
||||
public interface IDeviceImportColumn
|
||||
{
|
||||
int Index { get; }
|
||||
string Name { get; }
|
||||
DeviceImportFieldTypes Type { get; }
|
||||
Type Handler { get; }
|
||||
|
||||
IDeviceImportField GetHandlerInstance();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.Services.Devices.Importing
|
||||
{
|
||||
@@ -10,11 +7,19 @@ namespace Disco.Models.Services.Devices.Importing
|
||||
{
|
||||
string SessionId { get; }
|
||||
string Filename { get; }
|
||||
List<Tuple<string, DeviceImportFieldTypes>> Header { get; }
|
||||
List<Tuple<string, DeviceImportFieldTypes, Func<string[], string>, Type>> ParsedHeaders { get; }
|
||||
List<string[]> RawData { get; }
|
||||
string DatasetName { get; }
|
||||
int ColumnCount { get; }
|
||||
IEnumerable<IDeviceImportColumn> Columns { get; }
|
||||
IDeviceImportColumn GetColumn(int Index);
|
||||
void SetColumnType(int Index, DeviceImportFieldTypes Type);
|
||||
int? GetColumnByType(DeviceImportFieldTypes FieldType);
|
||||
|
||||
List<IDeviceImportRecord> Records { get; }
|
||||
int AffectedRecords { get; }
|
||||
int RecordCount { get; }
|
||||
|
||||
IDeviceImportDataReader GetDataReader();
|
||||
IEnumerable<KeyValuePair<DeviceImportFieldTypes, Type>> GetFieldHandlers();
|
||||
|
||||
List<IDeviceImportRecord> Records { get; set; }
|
||||
int AffectedRecords { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.Services.Devices.Importing
|
||||
{
|
||||
public interface IDeviceImportDataReader : IDisposable
|
||||
{
|
||||
void Reset();
|
||||
bool Read();
|
||||
|
||||
int Index { get; }
|
||||
|
||||
int GetRowNumber(int Index);
|
||||
|
||||
string GetString(int ColumnIndex);
|
||||
IEnumerable<string> GetStrings(int ColumnIndex);
|
||||
|
||||
bool TryGetNullableInt(int ColumnIndex, out int? value);
|
||||
|
||||
bool TryGetNullableBool(int ColumnIndex, out bool? value);
|
||||
|
||||
bool TryGetNullableDateTime(int ColumnIndex, out DateTime? value);
|
||||
|
||||
bool TestAllNotEmpty(int ColumnIndex);
|
||||
bool TestAllNullableInt(int ColumnIndex);
|
||||
bool TestAllInt(int ColumnIndex);
|
||||
bool TestAllNullableBool(int ColumnIndex);
|
||||
bool TestAllNullableDateTime(int ColumnIndex);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
|
||||
namespace Disco.Models.Services.Devices.Importing
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Disco.Models.Services.Devices.Importing
|
||||
{
|
||||
public interface IDeviceImportRecord
|
||||
{
|
||||
int Index { get; }
|
||||
string DeviceSerialNumber { get; }
|
||||
|
||||
IEnumerable<IDeviceImportField> Fields { get; }
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user