a0e18ef963
Document Template import status and Device Enrolment status fixes. Attachment download fixes for SignalR foreverFrame transport. Database queries for Devices, Jobs and Users updated. Device attributes (model, profile, batch) now shown in various places.
72 lines
2.3 KiB
C#
72 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Disco.Models.Services.Searching
|
|
{
|
|
public class DeviceSearchResultItem : ISearchResultItem
|
|
{
|
|
private const string type = "Device";
|
|
private Lazy<string[]> LazyScoreValue;
|
|
|
|
public DeviceSearchResultItem()
|
|
{
|
|
this.LazyScoreValue = new Lazy<string[]>(BuildScoreValues, false);
|
|
}
|
|
|
|
public string Id { get; set; }
|
|
public string Type { get { return type; } }
|
|
public string Description { get { return string.Format("{0} ({1})", this.Id, this.ComputerName); } }
|
|
public string[] ScoreValues { get { return LazyScoreValue.Value; } }
|
|
|
|
public string AssetNumber { get; set; }
|
|
public string AssignedUserDescription
|
|
{
|
|
get
|
|
{
|
|
if (AssignedUserId != null)
|
|
{
|
|
if (AssignedUserDisplayName != null)
|
|
return string.Format("{0} ({1})", AssignedUserDisplayName, AssignedUserId);
|
|
else
|
|
return AssignedUserId;
|
|
}
|
|
return string.Empty;
|
|
}
|
|
}
|
|
public string AssignedUserDisplayName { get; set; }
|
|
public string AssignedUserId { get; set; }
|
|
public string ComputerName { get; set; }
|
|
public string DeviceModelDescription { get; set; }
|
|
public string DeviceProfileDescription { get; set; }
|
|
public string DeviceBatchName { get; set; }
|
|
public int JobCount { get; set; }
|
|
public DateTime? DecommissionedDate { get; set; }
|
|
|
|
private string[] BuildScoreValues()
|
|
{
|
|
if (this.AssignedUserId == null)
|
|
{
|
|
return new string[] {
|
|
this.Id,
|
|
this.AssetNumber,
|
|
this.ComputerName
|
|
};
|
|
}
|
|
else
|
|
{
|
|
return new string[] {
|
|
this.Id,
|
|
this.AssetNumber,
|
|
this.ComputerName,
|
|
this.AssignedUserId.Substring(this.AssignedUserId.IndexOf('\\') + 1),
|
|
this.AssignedUserId,
|
|
this.AssignedUserDisplayName
|
|
};
|
|
}
|
|
}
|
|
}
|
|
}
|