Remove: 'Active' Device property
No longer needed.
This commit is contained in:
@@ -256,7 +256,6 @@ namespace Disco.BI.DeviceBI
|
||||
DeviceProfile = deviceProfile,
|
||||
DeviceModel = deviceModel,
|
||||
AllowUnauthenticatedEnrol = false,
|
||||
Active = true,
|
||||
CreatedDate = DateTime.Now,
|
||||
EnrolledDate = DateTime.Now
|
||||
};
|
||||
@@ -393,7 +392,6 @@ namespace Disco.BI.DeviceBI
|
||||
DeviceProfile = deviceProfile,
|
||||
DeviceModel = deviceModel,
|
||||
AllowUnauthenticatedEnrol = false,
|
||||
Active = true,
|
||||
CreatedDate = DateTime.Now,
|
||||
EnrolledDate = DateTime.Now,
|
||||
LastEnrolDate = DateTime.Now
|
||||
|
||||
@@ -1,186 +1,185 @@
|
||||
using System.Linq;
|
||||
using Disco.BI.Interop.ActiveDirectory;
|
||||
using Disco.Data.Configuration;
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.BI.DocumentTemplates;
|
||||
using Disco.Models.Repository;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Disco.Models.Interop.ActiveDirectory;
|
||||
|
||||
namespace Disco.BI.Extensions
|
||||
{
|
||||
public static class DeviceExtensions
|
||||
{
|
||||
|
||||
public static string ComputerNameRender(this Device device, DiscoDataContext context)
|
||||
{
|
||||
DeviceProfile deviceProfile = device.DeviceProfile;
|
||||
Expressions.Expression computerNameTemplateExpression = null;
|
||||
computerNameTemplateExpression = Expressions.ExpressionCache.GetValue(DeviceProfileExtensions.ComputerNameExpressionCacheModule, deviceProfile.Id.ToString(), () =>
|
||||
{
|
||||
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
|
||||
//return Expressions.Expression.TokenizeSingleDynamic(null, deviceProfile.Configuration(context).ComputerNameTemplate, 0);
|
||||
return Expressions.Expression.TokenizeSingleDynamic(null, deviceProfile.ComputerNameTemplate, 0);
|
||||
});
|
||||
System.Collections.IDictionary evaluatorVariables = Expressions.Expression.StandardVariables(null, context, UserBI.UserCache.CurrentUser, System.DateTime.Now, null);
|
||||
string rendered;
|
||||
try
|
||||
{
|
||||
rendered = computerNameTemplateExpression.EvaluateFirst<string>(device, evaluatorVariables);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InvalidOperationException(string.Format("An error occurred rendering the computer name: [{0}] {1}", ex.GetType().Name, ex.Message), ex.InnerException);
|
||||
}
|
||||
if (rendered == null || rendered.Length > 24)
|
||||
{
|
||||
throw new System.InvalidOperationException("The rendered computer name would be invalid or longer than 24 characters");
|
||||
}
|
||||
return rendered.ToString();
|
||||
}
|
||||
public static System.Collections.Generic.List<DocumentTemplate> AvailableDocumentTemplates(this Device d, DiscoDataContext Context, User User, System.DateTime TimeStamp)
|
||||
{
|
||||
List<DocumentTemplate> ats = Context.DocumentTemplates
|
||||
.Where(at => at.Scope == Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Device).ToList();
|
||||
|
||||
return ats.Where(at => at.FilterExpressionMatches(d, Context, User, TimeStamp, DocumentState.DefaultState())).ToList();
|
||||
}
|
||||
|
||||
public static bool UpdateLastNetworkLogonDate(this Device Device)
|
||||
{
|
||||
return ActiveDirectoryUpdateLastNetworkLogonDateJob.UpdateLastNetworkLogonDate(Device);
|
||||
}
|
||||
|
||||
public static DeviceAttachment CreateAttachment(this Device Device, DiscoDataContext dbContext, User CreatorUser, string Filename, string MimeType, string Comments, Stream Content, DocumentTemplate DocumentTemplate = null, byte[] PdfThumbnail = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(MimeType) || MimeType.Equals("unknown/unknown", StringComparison.InvariantCultureIgnoreCase))
|
||||
MimeType = Interop.MimeTypes.ResolveMimeType(Filename);
|
||||
|
||||
DeviceAttachment da = new DeviceAttachment()
|
||||
{
|
||||
DeviceSerialNumber = Device.SerialNumber,
|
||||
TechUserId = CreatorUser.Id,
|
||||
Filename = Filename,
|
||||
MimeType = MimeType,
|
||||
Timestamp = DateTime.Now,
|
||||
Comments = Comments
|
||||
};
|
||||
|
||||
if (DocumentTemplate != null)
|
||||
da.DocumentTemplateId = DocumentTemplate.Id;
|
||||
|
||||
dbContext.DeviceAttachments.Add(da);
|
||||
dbContext.SaveChanges();
|
||||
|
||||
da.SaveAttachment(dbContext, Content);
|
||||
Content.Position = 0;
|
||||
if (PdfThumbnail == null)
|
||||
da.GenerateThumbnail(dbContext, Content);
|
||||
else
|
||||
da.SaveThumbnailAttachment(dbContext, PdfThumbnail);
|
||||
|
||||
return da;
|
||||
}
|
||||
|
||||
public static Device AddOffline(this Device d, DiscoDataContext dbContext)
|
||||
{
|
||||
// Just Include:
|
||||
// - Serial Number
|
||||
// - Asset Number
|
||||
// - Profile Id
|
||||
// - Assigned User Id
|
||||
// - Batch
|
||||
|
||||
// Batch
|
||||
DeviceBatch db = default(DeviceBatch);
|
||||
if (d.DeviceBatchId.HasValue)
|
||||
db = dbContext.DeviceBatches.Find(d.DeviceBatchId.Value);
|
||||
|
||||
// Default Device Model
|
||||
DeviceModel dm = default(DeviceModel);
|
||||
if (db != null && db.DefaultDeviceModelId.HasValue)
|
||||
dm = dbContext.DeviceModels.Find(db.DefaultDeviceModelId); // From Batch
|
||||
else
|
||||
dm = dbContext.DeviceModels.Find(1); // Default
|
||||
|
||||
Device d2 = new Device()
|
||||
{
|
||||
SerialNumber = d.SerialNumber.ToUpper(),
|
||||
AssetNumber = d.AssetNumber,
|
||||
Location = d.Location,
|
||||
CreatedDate = DateTime.Now,
|
||||
DeviceProfileId = d.DeviceProfileId,
|
||||
DeviceProfile = dbContext.DeviceProfiles.Find(d.DeviceProfileId),
|
||||
AllowUnauthenticatedEnrol = true,
|
||||
Active = true,
|
||||
DeviceModelId = dm.Id,
|
||||
DeviceModel = dm,
|
||||
DeviceBatchId = d.DeviceBatchId,
|
||||
DeviceBatch = db
|
||||
};
|
||||
|
||||
dbContext.Devices.Add(d2);
|
||||
if (!string.IsNullOrEmpty(d.AssignedUserId))
|
||||
{
|
||||
User u = UserBI.UserCache.GetUser(d.AssignedUserId, dbContext);
|
||||
d2.AssignDevice(dbContext, u);
|
||||
}
|
||||
|
||||
return d2;
|
||||
}
|
||||
|
||||
public static DeviceUserAssignment AssignDevice(this Device d, DiscoDataContext dbContext, User u)
|
||||
{
|
||||
DeviceUserAssignment newDua = default(DeviceUserAssignment);
|
||||
|
||||
// Mark existing assignments as Unassigned
|
||||
foreach (var dua in dbContext.DeviceUserAssignments.Where(m => m.DeviceSerialNumber == d.SerialNumber && !m.UnassignedDate.HasValue))
|
||||
dua.UnassignedDate = DateTime.Now;
|
||||
|
||||
if (u != null)
|
||||
{
|
||||
// Add new Assignment
|
||||
newDua = new DeviceUserAssignment()
|
||||
{
|
||||
DeviceSerialNumber = d.SerialNumber,
|
||||
AssignedUserId = u.Id,
|
||||
AssignedDate = DateTime.Now
|
||||
};
|
||||
dbContext.DeviceUserAssignments.Add(newDua);
|
||||
|
||||
d.AssignedUserId = u.Id;
|
||||
d.AssignedUser = u;
|
||||
}
|
||||
else
|
||||
{
|
||||
d.AssignedUserId = null;
|
||||
}
|
||||
|
||||
// Update AD Account
|
||||
if (!string.IsNullOrEmpty(d.ComputerName) && d.ComputerName.Length <= 24)
|
||||
{
|
||||
var adMachineAccount = Interop.ActiveDirectory.ActiveDirectory.GetMachineAccount(d.ComputerName);
|
||||
if (adMachineAccount != null)
|
||||
{
|
||||
if (newDua == null)
|
||||
adMachineAccount.SetDescription(string.Empty);
|
||||
else
|
||||
adMachineAccount.SetDescription(d);
|
||||
}
|
||||
}
|
||||
|
||||
return newDua;
|
||||
}
|
||||
|
||||
public static ActiveDirectoryMachineAccount ActiveDirectoryAccount(this Device Device, params string[] AdditionalProperties)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Device.ComputerName))
|
||||
return Interop.ActiveDirectory.ActiveDirectory.GetMachineAccount(Device.ComputerName, AdditionalProperties: AdditionalProperties);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System.Linq;
|
||||
using Disco.BI.Interop.ActiveDirectory;
|
||||
using Disco.Data.Configuration;
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.BI.DocumentTemplates;
|
||||
using Disco.Models.Repository;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Disco.Models.Interop.ActiveDirectory;
|
||||
|
||||
namespace Disco.BI.Extensions
|
||||
{
|
||||
public static class DeviceExtensions
|
||||
{
|
||||
|
||||
public static string ComputerNameRender(this Device device, DiscoDataContext context)
|
||||
{
|
||||
DeviceProfile deviceProfile = device.DeviceProfile;
|
||||
Expressions.Expression computerNameTemplateExpression = null;
|
||||
computerNameTemplateExpression = Expressions.ExpressionCache.GetValue(DeviceProfileExtensions.ComputerNameExpressionCacheModule, deviceProfile.Id.ToString(), () =>
|
||||
{
|
||||
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
|
||||
//return Expressions.Expression.TokenizeSingleDynamic(null, deviceProfile.Configuration(context).ComputerNameTemplate, 0);
|
||||
return Expressions.Expression.TokenizeSingleDynamic(null, deviceProfile.ComputerNameTemplate, 0);
|
||||
});
|
||||
System.Collections.IDictionary evaluatorVariables = Expressions.Expression.StandardVariables(null, context, UserBI.UserCache.CurrentUser, System.DateTime.Now, null);
|
||||
string rendered;
|
||||
try
|
||||
{
|
||||
rendered = computerNameTemplateExpression.EvaluateFirst<string>(device, evaluatorVariables);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InvalidOperationException(string.Format("An error occurred rendering the computer name: [{0}] {1}", ex.GetType().Name, ex.Message), ex.InnerException);
|
||||
}
|
||||
if (rendered == null || rendered.Length > 24)
|
||||
{
|
||||
throw new System.InvalidOperationException("The rendered computer name would be invalid or longer than 24 characters");
|
||||
}
|
||||
return rendered.ToString();
|
||||
}
|
||||
public static System.Collections.Generic.List<DocumentTemplate> AvailableDocumentTemplates(this Device d, DiscoDataContext Context, User User, System.DateTime TimeStamp)
|
||||
{
|
||||
List<DocumentTemplate> ats = Context.DocumentTemplates
|
||||
.Where(at => at.Scope == Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Device).ToList();
|
||||
|
||||
return ats.Where(at => at.FilterExpressionMatches(d, Context, User, TimeStamp, DocumentState.DefaultState())).ToList();
|
||||
}
|
||||
|
||||
public static bool UpdateLastNetworkLogonDate(this Device Device)
|
||||
{
|
||||
return ActiveDirectoryUpdateLastNetworkLogonDateJob.UpdateLastNetworkLogonDate(Device);
|
||||
}
|
||||
|
||||
public static DeviceAttachment CreateAttachment(this Device Device, DiscoDataContext dbContext, User CreatorUser, string Filename, string MimeType, string Comments, Stream Content, DocumentTemplate DocumentTemplate = null, byte[] PdfThumbnail = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(MimeType) || MimeType.Equals("unknown/unknown", StringComparison.InvariantCultureIgnoreCase))
|
||||
MimeType = Interop.MimeTypes.ResolveMimeType(Filename);
|
||||
|
||||
DeviceAttachment da = new DeviceAttachment()
|
||||
{
|
||||
DeviceSerialNumber = Device.SerialNumber,
|
||||
TechUserId = CreatorUser.Id,
|
||||
Filename = Filename,
|
||||
MimeType = MimeType,
|
||||
Timestamp = DateTime.Now,
|
||||
Comments = Comments
|
||||
};
|
||||
|
||||
if (DocumentTemplate != null)
|
||||
da.DocumentTemplateId = DocumentTemplate.Id;
|
||||
|
||||
dbContext.DeviceAttachments.Add(da);
|
||||
dbContext.SaveChanges();
|
||||
|
||||
da.SaveAttachment(dbContext, Content);
|
||||
Content.Position = 0;
|
||||
if (PdfThumbnail == null)
|
||||
da.GenerateThumbnail(dbContext, Content);
|
||||
else
|
||||
da.SaveThumbnailAttachment(dbContext, PdfThumbnail);
|
||||
|
||||
return da;
|
||||
}
|
||||
|
||||
public static Device AddOffline(this Device d, DiscoDataContext dbContext)
|
||||
{
|
||||
// Just Include:
|
||||
// - Serial Number
|
||||
// - Asset Number
|
||||
// - Profile Id
|
||||
// - Assigned User Id
|
||||
// - Batch
|
||||
|
||||
// Batch
|
||||
DeviceBatch db = default(DeviceBatch);
|
||||
if (d.DeviceBatchId.HasValue)
|
||||
db = dbContext.DeviceBatches.Find(d.DeviceBatchId.Value);
|
||||
|
||||
// Default Device Model
|
||||
DeviceModel dm = default(DeviceModel);
|
||||
if (db != null && db.DefaultDeviceModelId.HasValue)
|
||||
dm = dbContext.DeviceModels.Find(db.DefaultDeviceModelId); // From Batch
|
||||
else
|
||||
dm = dbContext.DeviceModels.Find(1); // Default
|
||||
|
||||
Device d2 = new Device()
|
||||
{
|
||||
SerialNumber = d.SerialNumber.ToUpper(),
|
||||
AssetNumber = d.AssetNumber,
|
||||
Location = d.Location,
|
||||
CreatedDate = DateTime.Now,
|
||||
DeviceProfileId = d.DeviceProfileId,
|
||||
DeviceProfile = dbContext.DeviceProfiles.Find(d.DeviceProfileId),
|
||||
AllowUnauthenticatedEnrol = true,
|
||||
DeviceModelId = dm.Id,
|
||||
DeviceModel = dm,
|
||||
DeviceBatchId = d.DeviceBatchId,
|
||||
DeviceBatch = db
|
||||
};
|
||||
|
||||
dbContext.Devices.Add(d2);
|
||||
if (!string.IsNullOrEmpty(d.AssignedUserId))
|
||||
{
|
||||
User u = UserBI.UserCache.GetUser(d.AssignedUserId, dbContext);
|
||||
d2.AssignDevice(dbContext, u);
|
||||
}
|
||||
|
||||
return d2;
|
||||
}
|
||||
|
||||
public static DeviceUserAssignment AssignDevice(this Device d, DiscoDataContext dbContext, User u)
|
||||
{
|
||||
DeviceUserAssignment newDua = default(DeviceUserAssignment);
|
||||
|
||||
// Mark existing assignments as Unassigned
|
||||
foreach (var dua in dbContext.DeviceUserAssignments.Where(m => m.DeviceSerialNumber == d.SerialNumber && !m.UnassignedDate.HasValue))
|
||||
dua.UnassignedDate = DateTime.Now;
|
||||
|
||||
if (u != null)
|
||||
{
|
||||
// Add new Assignment
|
||||
newDua = new DeviceUserAssignment()
|
||||
{
|
||||
DeviceSerialNumber = d.SerialNumber,
|
||||
AssignedUserId = u.Id,
|
||||
AssignedDate = DateTime.Now
|
||||
};
|
||||
dbContext.DeviceUserAssignments.Add(newDua);
|
||||
|
||||
d.AssignedUserId = u.Id;
|
||||
d.AssignedUser = u;
|
||||
}
|
||||
else
|
||||
{
|
||||
d.AssignedUserId = null;
|
||||
}
|
||||
|
||||
// Update AD Account
|
||||
if (!string.IsNullOrEmpty(d.ComputerName) && d.ComputerName.Length <= 24)
|
||||
{
|
||||
var adMachineAccount = Interop.ActiveDirectory.ActiveDirectory.GetMachineAccount(d.ComputerName);
|
||||
if (adMachineAccount != null)
|
||||
{
|
||||
if (newDua == null)
|
||||
adMachineAccount.SetDescription(string.Empty);
|
||||
else
|
||||
adMachineAccount.SetDescription(d);
|
||||
}
|
||||
}
|
||||
|
||||
return newDua;
|
||||
}
|
||||
|
||||
public static ActiveDirectoryMachineAccount ActiveDirectoryAccount(this Device Device, params string[] AdditionalProperties)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Device.ComputerName))
|
||||
return Interop.ActiveDirectory.ActiveDirectory.GetMachineAccount(Device.ComputerName, AdditionalProperties: AdditionalProperties);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,10 @@
|
||||
<Compile Include="Migrations\201301150107063_DBv6.Designer.cs">
|
||||
<DependentUpon>201301150107063_DBv6.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\201302210057463_DBv7.cs" />
|
||||
<Compile Include="Migrations\201302210057463_DBv7.Designer.cs">
|
||||
<DependentUpon>201302210057463_DBv7.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Migrations\DiscoDataMigrator.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
@@ -124,6 +128,9 @@
|
||||
<EmbeddedResource Include="Migrations\201301150107063_DBv6.resx">
|
||||
<DependentUpon>201301150107063_DBv6.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\201302210057463_DBv7.resx">
|
||||
<DependentUpon>201302210057463_DBv7.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
@@ -137,7 +144,7 @@
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties BuildVersion_StartDate="2001/1/1" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="True" BuildVersion_BuildAction="ReBuild" />
|
||||
<UserProperties BuildVersion_BuildAction="ReBuild" BuildVersion_UseGlobalSettings="True" BuildVersion_DetectChanges="False" BuildVersion_StartDate="2001/1/1" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||
|
||||
@@ -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 DBv7 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv7));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201302210057463_DBv7"; }
|
||||
}
|
||||
|
||||
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 DBv7 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
DropColumn("dbo.Devices", "Active");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("dbo.Devices", "Active", c => c.Boolean(nullable: false));
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -32,5 +32,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("1.2.0219.1854")]
|
||||
[assembly: AssemblyFileVersion("1.2.0219.1854")]
|
||||
[assembly: AssemblyVersion("1.2.0221.1820")]
|
||||
[assembly: AssemblyFileVersion("1.2.0221.1820")]
|
||||
|
||||
@@ -96,6 +96,8 @@
|
||||
<Compile Include="Repository\User\User.cs" />
|
||||
<Compile Include="Repository\User\UserAttachment.cs" />
|
||||
<Compile Include="Repository\User\UserDetail.cs" />
|
||||
<Compile Include="UI\BaseUIModel.cs" />
|
||||
<Compile Include="UI\Job\JobShowModel.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
@@ -103,7 +105,7 @@
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties BuildVersion_BuildAction="ReBuild" BuildVersion_UseGlobalSettings="True" BuildVersion_DetectChanges="False" BuildVersion_StartDate="2001/1/1" />
|
||||
<UserProperties BuildVersion_StartDate="2001/1/1" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="True" BuildVersion_BuildAction="ReBuild" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -32,5 +32,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("1.2.0219.1854")]
|
||||
[assembly: AssemblyFileVersion("1.2.0219.1854")]
|
||||
[assembly: AssemblyVersion("1.2.0221.1820")]
|
||||
[assembly: AssemblyFileVersion("1.2.0221.1820")]
|
||||
|
||||
@@ -1,67 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Disco.Models.Repository
|
||||
{
|
||||
public class Device
|
||||
{
|
||||
[Required(ErrorMessage="The Serial Number is Required"), Key, StringLength(60)]
|
||||
public string SerialNumber { get; set; }
|
||||
|
||||
[StringLength(40)]
|
||||
public string AssetNumber { get; set; }
|
||||
[StringLength(250)]
|
||||
public string Location { get; set; }
|
||||
|
||||
public int? DeviceModelId { get; set; }
|
||||
[Range(1, int.MaxValue, ErrorMessage="A valid Device Profile is Required")]
|
||||
public int DeviceProfileId { get; set; }
|
||||
public int? DeviceBatchId { get; set; }
|
||||
|
||||
[StringLength(24)]
|
||||
public string ComputerName { get; set; }
|
||||
public string AssignedUserId { get; set; }
|
||||
public DateTime? LastNetworkLogonDate { get; set; }
|
||||
|
||||
// 2012-06-21 - Removed
|
||||
//[StringLength(24)]
|
||||
//public string CertificateStoreReference { get; set; }
|
||||
|
||||
public bool AllowUnauthenticatedEnrol { get; set; }
|
||||
|
||||
public bool Active { get; set; }
|
||||
|
||||
public DateTime CreatedDate { get; set; }
|
||||
public DateTime? EnrolledDate { get; set; }
|
||||
public DateTime? LastEnrolDate { get; set; }
|
||||
public DateTime? DecommissionedDate { get; set; }
|
||||
|
||||
[ForeignKey("DeviceModelId")]
|
||||
public virtual DeviceModel DeviceModel { get; set; }
|
||||
[ForeignKey("DeviceProfileId")]
|
||||
public virtual DeviceProfile DeviceProfile { get; set; }
|
||||
[ForeignKey("DeviceBatchId")]
|
||||
public virtual DeviceBatch DeviceBatch { get; set; }
|
||||
[ForeignKey("AssignedUserId")]
|
||||
public virtual User AssignedUser { get; set; }
|
||||
|
||||
public virtual IList<DeviceUserAssignment> DeviceUserAssignments { get; set; }
|
||||
public virtual IList<DeviceDetail> DeviceDetails { get; set; }
|
||||
public virtual IList<DeviceAttachment> DeviceAttachments { get; set; }
|
||||
|
||||
[InverseProperty("DeviceSerialNumber")]
|
||||
public virtual IList<Job> Jobs { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (DeviceModel != null)
|
||||
return string.Format("{0} - {1}", this.DeviceModel, this.SerialNumber);
|
||||
else
|
||||
return this.SerialNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Disco.Models.Repository
|
||||
{
|
||||
public class Device
|
||||
{
|
||||
[Required(ErrorMessage="The Serial Number is Required"), Key, StringLength(60)]
|
||||
public string SerialNumber { get; set; }
|
||||
|
||||
[StringLength(40)]
|
||||
public string AssetNumber { get; set; }
|
||||
[StringLength(250)]
|
||||
public string Location { get; set; }
|
||||
|
||||
public int? DeviceModelId { get; set; }
|
||||
[Range(1, int.MaxValue, ErrorMessage="A valid Device Profile is Required")]
|
||||
public int DeviceProfileId { get; set; }
|
||||
public int? DeviceBatchId { get; set; }
|
||||
|
||||
[StringLength(24)]
|
||||
public string ComputerName { get; set; }
|
||||
public string AssignedUserId { get; set; }
|
||||
public DateTime? LastNetworkLogonDate { get; set; }
|
||||
|
||||
// 2012-06-21 - Removed
|
||||
//[StringLength(24)]
|
||||
//public string CertificateStoreReference { get; set; }
|
||||
|
||||
public bool AllowUnauthenticatedEnrol { get; set; }
|
||||
|
||||
// Removed 2013-02-21 G#: Redundant - See DecommissionedDate
|
||||
//public bool Active { get; set; }
|
||||
// End Removed 2013-02-21
|
||||
|
||||
public DateTime CreatedDate { get; set; }
|
||||
public DateTime? EnrolledDate { get; set; }
|
||||
public DateTime? LastEnrolDate { get; set; }
|
||||
public DateTime? DecommissionedDate { get; set; }
|
||||
|
||||
[ForeignKey("DeviceModelId")]
|
||||
public virtual DeviceModel DeviceModel { get; set; }
|
||||
[ForeignKey("DeviceProfileId")]
|
||||
public virtual DeviceProfile DeviceProfile { get; set; }
|
||||
[ForeignKey("DeviceBatchId")]
|
||||
public virtual DeviceBatch DeviceBatch { get; set; }
|
||||
[ForeignKey("AssignedUserId")]
|
||||
public virtual User AssignedUser { get; set; }
|
||||
|
||||
public virtual IList<DeviceUserAssignment> DeviceUserAssignments { get; set; }
|
||||
public virtual IList<DeviceDetail> DeviceDetails { get; set; }
|
||||
public virtual IList<DeviceAttachment> DeviceAttachments { get; set; }
|
||||
|
||||
[InverseProperty("DeviceSerialNumber")]
|
||||
public virtual IList<Job> Jobs { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (DeviceModel != null)
|
||||
return string.Format("{0} - {1}", this.DeviceModel, this.SerialNumber);
|
||||
else
|
||||
return this.SerialNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user