Remove: 'Active' Device property

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