27c21175d7
Migrate much of BI to Services. Added Wireless Profile Provider plugin feature. Added Certificate Authority Provider plugin feature. Modified Certificate Provider plugin feature. Database migration v17, for Device Profiles. Enrolment Client Updated to support CA Certificates, Wireless Profiles and Hardware Info. New Client Enrolment Protocol to support new features. Plugin Manifest Generator added to main solution. Improved AD search performance.
49 lines
2.1 KiB
C#
49 lines
2.1 KiB
C#
using Disco.Data.Repository;
|
|
using System;
|
|
|
|
namespace Disco.Web.Areas.Public.Models.UserHeldDevices
|
|
{
|
|
public class HeldJobDeviceModel
|
|
{
|
|
public int JobId { get; set; }
|
|
|
|
public string UserId { get; set; }
|
|
public string UserDisplayName { get; set; }
|
|
public int DeviceProfileId { get; set; }
|
|
public int? DeviceAddressId { get; set; }
|
|
public bool ReadyForReturn { get; set; }
|
|
public bool WaitingForUserAction { get; set; }
|
|
public DateTime? EstimatedReturnTime { get; set; }
|
|
public DateTime? ReadyForReturnSince { get; set; }
|
|
public DateTime? WaitingForUserActionSince { get; set; }
|
|
|
|
public UserHeldDeviceModel ToUserHeldDeviceModel(DiscoDataContext Database)
|
|
{
|
|
var uhdm = new UserHeldDeviceModel()
|
|
{
|
|
UserId = this.UserId,
|
|
UserDisplayName = this.UserDisplayName,
|
|
ReadyForReturn = this.ReadyForReturn,
|
|
WaitingForUserAction = this.WaitingForUserAction,
|
|
DeviceProfileId = this.DeviceProfileId,
|
|
DeviceAddress = (this.DeviceAddressId.HasValue ? Database.DiscoConfiguration.OrganisationAddresses.GetAddress(this.DeviceAddressId.Value).ShortName : string.Empty)
|
|
};
|
|
var n = DateTime.Now;
|
|
if (!this.ReadyForReturn && this.EstimatedReturnTime.HasValue && this.EstimatedReturnTime.Value > n)
|
|
{
|
|
uhdm.EstimatedReturnTime = this.EstimatedReturnTime.FromNow();
|
|
}
|
|
if (this.ReadyForReturn)
|
|
{
|
|
uhdm.ReadyForReturnSince = this.ReadyForReturnSince.FromNow();
|
|
uhdm.IsAlert = (this.ReadyForReturnSince.Value < DateTime.Now.AddDays(-3));
|
|
}
|
|
if (this.WaitingForUserAction)
|
|
{
|
|
uhdm.WaitingForUserActionSince = this.WaitingForUserActionSince.FromNow();
|
|
uhdm.IsAlert = (this.WaitingForUserActionSince.Value < n.AddDays(-6));
|
|
}
|
|
return uhdm;
|
|
}
|
|
}
|
|
} |