Feature: Quick Search
Device/Job/User Search refactoring. Quick-Search implemented.
This commit is contained in:
@@ -1,22 +1,34 @@
|
||||
using System;
|
||||
using Disco.Models.Services.Searching;
|
||||
using System;
|
||||
|
||||
namespace Disco.Models.Services.Jobs.JobLists
|
||||
{
|
||||
public class JobTableItemModel
|
||||
public class JobTableItemModel : JobSearchResultItem
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int JobId { get; set; }
|
||||
|
||||
[Obsolete("Use [int] JobId instead")]
|
||||
public override string Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.JobId.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Id = value;
|
||||
this.JobId = int.Parse(value);
|
||||
}
|
||||
}
|
||||
public DateTime OpenedDate { get; set; }
|
||||
public DateTime? ClosedDate { get; set; }
|
||||
public string JobTypeId { get; set; }
|
||||
public string JobTypeDescription { get; set; }
|
||||
public string DeviceSerialNumber { get; set; }
|
||||
public int? DeviceModelId { get; set; }
|
||||
public string DeviceModelDescription { get; set; }
|
||||
public int? DeviceProfileId { get; set; }
|
||||
public int? DeviceAddressId { get; set; }
|
||||
public string DeviceAddress { get; set; }
|
||||
public string UserId { get; set; }
|
||||
public string UserDisplayName { get; set; }
|
||||
public string OpenedTechUserId { get; set; }
|
||||
public string OpenedTechUserDisplayName { get; set; }
|
||||
public string StatusDescription { get; set; }
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
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";
|
||||
|
||||
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 ScoreValue { get { return string.Format("{0} {1} {2} {3}", this.Id, this.AssignedUserId, this.AssignedUserDisplayName, this.AssetNumber); } }
|
||||
|
||||
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 int JobCount { get; set; }
|
||||
public DateTime? DecommissionedDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.Services.Searching
|
||||
{
|
||||
public interface ISearchResultItem
|
||||
{
|
||||
string Id { get; set; }
|
||||
string Type { get; }
|
||||
string Description { get; }
|
||||
string ScoreValue { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.Services.Searching
|
||||
{
|
||||
public class JobSearchResultItem : ISearchResultItem
|
||||
{
|
||||
private const string type = "Job";
|
||||
|
||||
public virtual string Id { get; set; }
|
||||
public string Type { get { return type; } }
|
||||
public string Description { get { return string.Format("{0} ({1}; {2})", this.Id, this.UserId, this.DeviceSerialNumber); } }
|
||||
public string ScoreValue { get { return string.Format("{0} {1} {2} {3}", this.Id, this.UserId, this.DeviceSerialNumber, this.UserDisplayName); } }
|
||||
|
||||
public string DeviceSerialNumber { get; set; }
|
||||
|
||||
public string UserId { get; set; }
|
||||
public string UserDisplayName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.Services.Searching
|
||||
{
|
||||
public class UserSearchResultItem : ISearchResultItem
|
||||
{
|
||||
private const string type = "User";
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Type { get { return type; } }
|
||||
public string Description { get { return string.Format("{0} ({1})", this.DisplayName, this.Id); } }
|
||||
public string ScoreValue { get { return string.Format("{0} {1}", this.Id, this.DisplayName); } }
|
||||
|
||||
public int AssignedDevicesCount { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string GivenName { get; set; }
|
||||
public int JobCount { get; set; }
|
||||
public string Surname { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user