qol: remove this

This commit is contained in:
Gary Sharp
2025-07-20 11:39:42 +10:00
parent b4e54c9edf
commit 4e518d6684
56 changed files with 282 additions and 282 deletions
+10 -10
View File
@@ -30,15 +30,15 @@ namespace Disco.ClientBootstrapper
public BootstrapperLoop(IStatus StatusUI, LoopCompleteCallback Callback)
{
this.statusUI = StatusUI;
this.mLoopCompleteCallback = Callback;
this.errorMessage = new StringBuilder();
statusUI = StatusUI;
mLoopCompleteCallback = Callback;
errorMessage = new StringBuilder();
}
public void Start()
{
this.LoopThread = new Thread(new ThreadStart(loopHost));
this.LoopThread.Start();
LoopThread = new Thread(new ThreadStart(loopHost));
LoopThread.Start();
}
private void loopHost()
@@ -133,9 +133,9 @@ namespace Disco.ClientBootstrapper
if (!Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
{
// Client Failed
if (this.mLoopCompleteCallback != null)
if (mLoopCompleteCallback != null)
{
this.mLoopCompleteCallback.BeginInvoke(null, null);
mLoopCompleteCallback.BeginInvoke(null, null);
}
return;
}
@@ -197,15 +197,15 @@ namespace Disco.ClientBootstrapper
Interop.CertificateInterop.RemoveTempCerts();
// Pause if Error
if (this.errorMessage.Length > 0)
if (errorMessage.Length > 0)
{
Program.SleepThread(10000, true);
}
// End Of Loop
if (this.mLoopCompleteCallback != null)
if (mLoopCompleteCallback != null)
{
this.mLoopCompleteCallback.BeginInvoke(null, null);
mLoopCompleteCallback.BeginInvoke(null, null);
}
}
+6 -6
View File
@@ -22,9 +22,9 @@ namespace Disco.ClientBootstrapper
public void Start(CompleteCallback Callback)
{
this.mCompleteCallback = Callback;
this.LoopThread = new Thread(new ThreadStart(loopHost));
this.LoopThread.Start();
mCompleteCallback = Callback;
LoopThread = new Thread(new ThreadStart(loopHost));
LoopThread.Start();
}
private void loopHost()
{
@@ -33,10 +33,10 @@ namespace Disco.ClientBootstrapper
//Program.Status.UpdateStatus(null, null, "Testing UI");
//Program.SleepThread(5000, false);
Interop.InstallInterop.Install(this.InstallLocation, this.WimImageId, this.TempPath);
if (this.mCompleteCallback != null)
Interop.InstallInterop.Install(InstallLocation, WimImageId, TempPath);
if (mCompleteCallback != null)
{
this.mCompleteCallback.BeginInvoke(null, null);
mCompleteCallback.BeginInvoke(null, null);
}
}
catch (Exception ex)
@@ -27,28 +27,28 @@ namespace Disco.ClientBootstrapper.Interop
private void UpdateFromWmi(ManagementObject wmiObject)
{
this.WmiPath = (string)wmiObject.GetPropertyValue("__PATH");
this.Index = (UInt32)wmiObject.GetPropertyValue("Index");
this.Guid = Guid.Parse((string)wmiObject.GetPropertyValue("GUID"));
this.MACAddress = (string)wmiObject.GetPropertyValue("MACAddress");
this.Name = (string)wmiObject.GetPropertyValue("Name");
this.NetConnectionID = (string)wmiObject.GetPropertyValue("NetConnectionID");
this.Speed = (UInt64)wmiObject.GetPropertyValue("Speed");
WmiPath = (string)wmiObject.GetPropertyValue("__PATH");
Index = (UInt32)wmiObject.GetPropertyValue("Index");
Guid = Guid.Parse((string)wmiObject.GetPropertyValue("GUID"));
MACAddress = (string)wmiObject.GetPropertyValue("MACAddress");
Name = (string)wmiObject.GetPropertyValue("Name");
NetConnectionID = (string)wmiObject.GetPropertyValue("NetConnectionID");
Speed = (UInt64)wmiObject.GetPropertyValue("Speed");
var connectionStatus = ConnectionStatus;
this.IsWireless = true;
IsWireless = true;
try
{
var wirelessConnectionStatus = WirelessConnectionStatus;
}
catch (Exception) {
this.IsWireless = false;
IsWireless = false;
};
}
public int WirelessConnectionStatus
{
get {
if (this.IsWireless)
if (IsWireless)
{
IntPtr handle = IntPtr.Zero;
uint negotiatedVersion;
@@ -61,17 +61,17 @@ namespace Disco.ClientBootstrapper.Interop
uint dataSize;
var interfaceGuid = this.Guid;
var interfaceGuid = Guid;
if (NetworkInterop.WlanQueryInterface(handle, ref interfaceGuid, NetworkInterop.WLAN_INTF_OPCODE.wlan_intf_opcode_interface_state, IntPtr.Zero, out dataSize, ref ptr, IntPtr.Zero) != 0)
throw new NotSupportedException("This network adapter does not support Wireless");
this.LastWirelessConnectionStatus = Marshal.ReadInt32(ptr);
LastWirelessConnectionStatus = Marshal.ReadInt32(ptr);
NetworkInterop.WlanFreeMemory(ptr);
return this.LastWirelessConnectionStatus;
return LastWirelessConnectionStatus;
}
finally
{
@@ -115,11 +115,11 @@ namespace Disco.ClientBootstrapper.Interop
{
get
{
using (var wmiObject = new ManagementObject(this.WmiPath))
using (var wmiObject = new ManagementObject(WmiPath))
{
this.LastConnectionStatus = (UInt16)wmiObject.GetPropertyValue("NetConnectionStatus");
LastConnectionStatus = (UInt16)wmiObject.GetPropertyValue("NetConnectionStatus");
}
return this.LastConnectionStatus;
return LastConnectionStatus;
}
}
public string ConnectionStatusMeaning(UInt16 status)
@@ -239,7 +239,7 @@ namespace Disco.ClientBootstrapper.Interop
public bool AddProfile(IntPtr WlanHandle, Guid interfaceGuid)
{
var pInterfaceGuid = interfaceGuid;
var pProfileXml = this.ProfileXml;
var pProfileXml = ProfileXml;
uint pFlag = 0;
uint failReason;
return (WlanSetProfile(WlanHandle, ref pInterfaceGuid, pFlag, pProfileXml, null, true, IntPtr.Zero, out failReason) == 0);
@@ -80,20 +80,20 @@ namespace Disco.ClientBootstrapper.Interop
uint regHive = (uint)hive;
this.Hive = hive;
this.SubKey = subKey;
Hive = hive;
SubKey = subKey;
RegLoadKey(regHive, subKey, filePath);
this.IsUnloaded = false;
IsUnloaded = false;
}
public void Unload()
{
if (!IsUnloaded)
{
uint regHive = (uint)this.Hive;
string subKey = this.SubKey;
uint regHive = (uint)Hive;
string subKey = SubKey;
RegUnLoadKey(regHive, subKey);
this.IsUnloaded = true;
IsUnloaded = true;
}
}
@@ -480,7 +480,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
//
//Never commit changes when destroying this object.
//
this.DismountImage(false);
DismountImage(false);
}
GC.KeepAlive(this);
}
+13 -13
View File
@@ -28,17 +28,17 @@ namespace Disco.Data.Configuration
{
get
{
return ConfigurationCache.GetScopeKeys(Database, this.Scope);
return ConfigurationCache.GetScopeKeys(Database, Scope);
}
}
private void SetValue<T>(string Key, T Value)
{
ConfigurationCache.Helpers<T>.SetValue(Database, this.Scope, Key, Value);
ConfigurationCache.Helpers<T>.SetValue(Database, Scope, Key, Value);
}
private T GetValue<T>(string Key, T Default)
{
return ConfigurationCache.Helpers<T>.GetValue(Database, this.Scope, Key, Default);
return ConfigurationCache.Helpers<T>.GetValue(Database, Scope, Key, Default);
}
protected void Set<T>(T Value, [CallerMemberName] string Key = null)
@@ -46,7 +46,7 @@ namespace Disco.Data.Configuration
if (Key == null)
throw new ArgumentNullException("Key");
this.SetValue(Key, Value);
SetValue(Key, Value);
}
protected T Get<T>(T Default, [CallerMemberName] string Key = null)
@@ -54,17 +54,17 @@ namespace Disco.Data.Configuration
if (Key == null)
throw new ArgumentNullException("Key");
return this.GetValue(Key, Default);
return GetValue(Key, Default);
}
protected void SetObsfucated(string Value, [CallerMemberName] string Key = null)
{
this.Set(Value.Obsfucate(), Key);
Set(Value.Obsfucate(), Key);
}
protected string GetDeobsfucated(string Default, [CallerMemberName] string Key = null)
{
var obsfucatedValue = this.Get<string>(null, Key);
var obsfucatedValue = Get<string>(null, Key);
if (obsfucatedValue == null)
return Default;
@@ -74,35 +74,35 @@ namespace Disco.Data.Configuration
protected void RemoveScope()
{
ConfigurationCache.RemoveScope(Database, this.Scope);
ConfigurationCache.RemoveScope(Database, Scope);
}
protected void RemoveItem(string Key)
{
ConfigurationCache.RemoveScopeKey(Database, this.Scope, Key);
ConfigurationCache.RemoveScopeKey(Database, Scope, Key);
}
[Obsolete("Types are automatically serialized/deserialized if required, use Set<T>(T Value) instead.")]
protected void SetAsJson<T>(T Value, [CallerMemberName] string Key = null)
{
this.Set(Value, Key);
Set(Value, Key);
}
[Obsolete("Types are automatically serialized/deserialized if required, use Get<T>(T Default) instead.")]
protected T GetFromJson<T>(T Default, [CallerMemberName] string Key = null)
{
return this.Get(Default, Key);
return Get(Default, Key);
}
[Obsolete("Types are automatically serialized/deserialized if required, use Set<T>(T Value) instead.")]
protected void SetAsEnum<T>(T Value, [CallerMemberName] string Key = null)
{
this.Set(Value, Key);
Set(Value, Key);
}
[Obsolete("Types are automatically serialized/deserialized if required, use Set<T>(T Value) instead.")]
protected T GetFromEnum<T>(T Default, [CallerMemberName] string Key = null)
{
return this.Get(Default, Key);
return Get(Default, Key);
}
}
}
@@ -13,7 +13,7 @@ namespace Disco.Data.Configuration.Modules
{
get
{
var v = this.Get(1);
var v = Get(1);
if (v > 0)
return v;
else
@@ -24,21 +24,21 @@ namespace Disco.Data.Configuration.Modules
if (value < 1)
throw new ArgumentOutOfRangeException("value", "Expected >= 1");
this.Set(value);
Set(value);
}
}
public int DefaultAddDeviceOfflineDeviceProfileId
{
get
{
return this.Get(0);
return Get(0);
}
set
{
if (value < 0)
throw new ArgumentOutOfRangeException("value", "Expected >= 0");
this.Set(value);
Set(value);
}
}
+2 -2
View File
@@ -11,7 +11,7 @@ namespace Disco.Data.Repository
public DiscoDataContext()
{
this._Configuration = new Lazy<Configuration.SystemConfiguration>(() => new Configuration.SystemConfiguration(this));
_Configuration = new Lazy<Configuration.SystemConfiguration>(() => new Configuration.SystemConfiguration(this));
}
public virtual DbSet<ConfigurationItem> ConfigurationItems { get; set; }
@@ -60,7 +60,7 @@ namespace Disco.Data.Repository
{
get
{
return this._Configuration.Value;
return _Configuration.Value;
}
}
@@ -55,8 +55,8 @@ namespace Disco.Data.Repository
public DiscoDatabaseConnectionFactory(IDbConnectionFactory Default)
{
this.DefaultConnectionFactory = Default;
this.SqlCeConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");
DefaultConnectionFactory = Default;
SqlCeConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");
}
public DbConnection CreateConnection(string nameOrConnectionString)
+2 -2
View File
@@ -73,9 +73,9 @@ namespace Disco.Models.Repository
public override string ToString()
{
if (DeviceModel != null)
return string.Format("{0} - {1}", this.DeviceModel, this.SerialNumber);
return string.Format("{0} - {1}", DeviceModel, SerialNumber);
else
return this.SerialNumber;
return SerialNumber;
}
[NotMapped]
@@ -53,11 +53,11 @@ namespace Disco.Models.Repository
public override string ToString()
{
if (string.IsNullOrWhiteSpace(this.Name))
if (string.IsNullOrWhiteSpace(Name))
{
return string.Format("{0}: {1}", this.Id, this.PurchaseDate.ToLongDateString());
return string.Format("{0}: {1}", Id, PurchaseDate.ToLongDateString());
}
return this.Name;
return Name;
}
}
}
@@ -48,11 +48,11 @@ namespace Disco.Models.Repository
public override string ToString()
{
if (string.IsNullOrEmpty(this.ShortName))
if (string.IsNullOrEmpty(ShortName))
{
return this.Name;
return Name;
}
return string.Format("{0} ({1})", this.Name, this.ShortName);
return string.Format("{0} ({1})", Name, ShortName);
}
[StringLength(200)]
+2 -2
View File
@@ -79,9 +79,9 @@ namespace Disco.Models.Repository
#region Helper Members
public decimal JobComponentsTotalCost()
{
if (this.JobComponents != null)
if (JobComponents != null)
{
return this.JobComponents.Sum(jc => jc.Cost);
return JobComponents.Sum(jc => jc.Cost);
}
return decimal.Zero;
}
+1 -1
View File
@@ -30,7 +30,7 @@ namespace Disco.Models.Repository
public override string ToString()
{
return this.Description;
return Description;
}
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ namespace Disco.Models.Repository
public override string ToString()
{
return this.Description;
return Description;
}
public static class JobTypeIds
@@ -28,7 +28,7 @@ namespace Disco.Models.Repository
public override string ToString()
{
return this.Name;
return Name;
}
}
}
@@ -31,7 +31,7 @@ namespace Disco.Models.Repository
public override string ToString()
{
return this.Name;
return Name;
}
}
}
+11 -11
View File
@@ -73,32 +73,32 @@ namespace Disco.Models.Repository
{
var changed = false;
if (!this.UserId.Equals(u.UserId, StringComparison.OrdinalIgnoreCase))
if (!UserId.Equals(u.UserId, StringComparison.OrdinalIgnoreCase))
throw new ArgumentException("User Id's do not match", nameof(u));
if (this.Surname != u.Surname)
if (Surname != u.Surname)
{
this.Surname = u.Surname;
Surname = u.Surname;
changed = true;
}
if (this.GivenName != u.GivenName)
if (GivenName != u.GivenName)
{
this.GivenName = u.GivenName;
GivenName = u.GivenName;
changed = true;
}
if (this.DisplayName != u.DisplayName)
if (DisplayName != u.DisplayName)
{
this.DisplayName = u.DisplayName;
DisplayName = u.DisplayName;
changed = true;
}
if (this.EmailAddress != u.EmailAddress)
if (EmailAddress != u.EmailAddress)
{
this.EmailAddress = u.EmailAddress;
EmailAddress = u.EmailAddress;
changed = true;
}
if (this.PhoneNumber != u.PhoneNumber)
if (PhoneNumber != u.PhoneNumber)
{
this.PhoneNumber = u.PhoneNumber;
PhoneNumber = u.PhoneNumber;
changed = true;
}
@@ -13,24 +13,24 @@ namespace Disco.Models.Services.Documents
public DocumentState(int SequenceNumber)
{
this.SequenceNumber = SequenceNumber;
this.FieldCache = new Hashtable();
this.ScopeCache = new Hashtable();
this.DocumentCache = new Hashtable();
FieldCache = new Hashtable();
ScopeCache = new Hashtable();
DocumentCache = new Hashtable();
}
public void FlushFieldCache()
{
FlushDictionary(this.FieldCache);
FlushDictionary(FieldCache);
}
public void FlushScopeCache()
{
FlushFieldCache();
FlushDictionary(this.ScopeCache);
FlushDictionary(ScopeCache);
}
public void FlushDocumentCache()
{
FlushScopeCache();
FlushDictionary(this.DocumentCache);
FlushDictionary(DocumentCache);
}
private static void FlushDictionary(Hashtable d)
{
@@ -13,12 +13,12 @@ namespace Disco.Models.Services.Jobs.JobLists
{
get
{
return this.JobId.ToString();
return JobId.ToString();
}
set
{
base.Id = value;
this.JobId = int.Parse(value);
JobId = int.Parse(value);
}
}
#pragma warning restore 618
@@ -11,12 +11,12 @@ namespace Disco.Models.Services.Searching
public DeviceSearchResultItem()
{
this.LazyScoreValue = new Lazy<string[]>(BuildScoreValues, false);
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 Description { get { return string.Format("{0} ({1})", Id, ComputerName); } }
public string[] ScoreValues { get { return LazyScoreValue.Value; } }
public string AssetNumber { get; set; }
@@ -46,23 +46,23 @@ namespace Disco.Models.Services.Searching
private string[] BuildScoreValues()
{
if (this.AssignedUserId == null)
if (AssignedUserId == null)
{
return new string[] {
this.Id,
this.AssetNumber,
this.ComputerName
Id,
AssetNumber,
ComputerName
};
}
else
{
return new string[] {
this.Id,
this.AssetNumber,
this.ComputerName,
this.AssignedUserId.Substring(this.AssignedUserId.IndexOf('\\') + 1),
this.AssignedUserId,
this.AssignedUserDisplayName
Id,
AssetNumber,
ComputerName,
AssignedUserId.Substring(AssignedUserId.IndexOf('\\') + 1),
AssignedUserId,
AssignedUserDisplayName
};
}
}
@@ -9,12 +9,12 @@ namespace Disco.Models.Services.Searching
public JobSearchResultItem()
{
this.LazyScoreValue = new Lazy<string[]>(BuildScoreValues, false);
LazyScoreValue = new Lazy<string[]>(BuildScoreValues, false);
}
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 Description { get { return string.Format("{0} ({1}; {2})", Id, UserId, DeviceSerialNumber); } }
public string[] ScoreValues { get { return LazyScoreValue.Value; } }
public string DeviceSerialNumber { get; set; }
@@ -25,21 +25,21 @@ namespace Disco.Models.Services.Searching
private string[] BuildScoreValues()
{
if (this.UserId == null)
if (UserId == null)
{
return new string[] {
this.Id,
this.DeviceSerialNumber
Id,
DeviceSerialNumber
};
}
else
{
return new string[] {
this.Id,
this.UserId.Substring(this.UserId.IndexOf('\\') + 1),
this.UserId,
this.UserDisplayName,
this.DeviceSerialNumber
Id,
UserId.Substring(UserId.IndexOf('\\') + 1),
UserId,
UserDisplayName,
DeviceSerialNumber
};
}
}
@@ -11,13 +11,13 @@ namespace Disco.Models.Services.Searching
public UserSearchResultItem()
{
this.LazyScoreValue = new Lazy<string[]>(BuildScoreValues, false);
LazyScoreValue = new Lazy<string[]>(BuildScoreValues, false);
}
public string Id { get; set; }
public string FriendlyId { get; set; }
public string Type { get { return type; } }
public string Description { get { return string.Format("{0} ({1})", this.DisplayName, this.Id); } }
public string Description { get { return string.Format("{0} ({1})", DisplayName, Id); } }
public string[] ScoreValues { get { return LazyScoreValue.Value; } }
public string DisplayName { get; set; }
@@ -34,9 +34,9 @@ namespace Disco.Models.Services.Searching
private string[] BuildScoreValues()
{
return new string[] {
this.Id.Substring(this.Id.IndexOf('\\') + 1),
this.Id,
this.DisplayName
Id.Substring(Id.IndexOf('\\') + 1),
Id,
DisplayName
};
}
}
@@ -28,7 +28,7 @@ namespace Disco.Web.Extensions
protected override void WriteFile(HttpResponseBase response)
{
response.OutputStream.Write(this.FileBuffer, Start, Length);
response.OutputStream.Write(FileBuffer, Start, Length);
}
}
}
@@ -14,10 +14,10 @@ namespace Disco.Web.Areas.API.Models.Job
public _DateChangeModel SetDateTime(DateTime? date)
{
this.DateTimeFriendly = date.FromNow(null);
this.DateTimeISO8601 = date.ToISO8601();
this.DateTimeUnixEpoc = date.ToUnixEpoc() ?? -1;
this.DateTimeFull = date.ToFullDateTime(null);
DateTimeFriendly = date.FromNow(null);
DateTimeISO8601 = date.ToISO8601();
DateTimeUnixEpoc = date.ToUnixEpoc() ?? -1;
DateTimeFull = date.ToFullDateTime(null);
return this;
}
@@ -43,7 +43,7 @@ namespace Disco.Web.Areas.Config.Controllers
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleShowModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleShowModel>(ControllerContext, m);
return View(MVC.Config.AuthorizationRole.Views.Show, m);
}
@@ -66,7 +66,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleIndexModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleIndexModel>(ControllerContext, m);
return View(m);
}
@@ -81,7 +81,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleCreateModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleCreateModel>(ControllerContext, m);
return View(m);
}
@@ -106,7 +106,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleCreateModel>(this.ControllerContext, model);
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleCreateModel>(ControllerContext, model);
return View(model);
}
@@ -65,7 +65,7 @@ namespace Disco.Web.Areas.Config.Controllers
m.BulkGenerateDocumentTemplates = Database.DocumentTemplates.Where(t => !t.IsHidden).ToList();
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceBatchShowModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDeviceBatchShowModel>(ControllerContext, m);
return View(MVC.Config.DeviceBatch.Views.Show, m);
}
@@ -74,7 +74,7 @@ namespace Disco.Web.Areas.Config.Controllers
var m = Models.DeviceBatch.IndexModel.Build(Database);
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceBatchIndexModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDeviceBatchIndexModel>(ControllerContext, m);
return View(m);
}
@@ -90,7 +90,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceBatchCreateModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDeviceBatchCreateModel>(ControllerContext, m);
return View(m);
}
@@ -115,7 +115,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceBatchCreateModel>(this.ControllerContext, model);
UIExtensions.ExecuteExtensions<ConfigDeviceBatchCreateModel>(ControllerContext, model);
return View(model);
}
@@ -126,7 +126,7 @@ namespace Disco.Web.Areas.Config.Controllers
var m = new Models.DeviceBatch.TimelineModel();
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceBatchTimelineModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDeviceBatchTimelineModel>(ControllerContext, m);
return View();
}
@@ -49,7 +49,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceFlagShowModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDeviceFlagShowModel>(ControllerContext, m);
return View(MVC.Config.DeviceFlag.Views.Show, m);
}
@@ -70,7 +70,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceFlagIndexModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDeviceFlagIndexModel>(ControllerContext, m);
return View(m);
}
@@ -90,7 +90,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceFlagCreateModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDeviceFlagCreateModel>(ControllerContext, m);
return View(m);
}
@@ -115,7 +115,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceFlagCreateModel>(this.ControllerContext, model);
UIExtensions.ExecuteExtensions<ConfigDeviceFlagCreateModel>(ControllerContext, model);
return View(model);
}
@@ -91,7 +91,7 @@ namespace Disco.Web.Areas.Config.Controllers
m.BulkGenerateDocumentTemplates = Database.DocumentTemplates.Where(t => !t.IsHidden).ToList();
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceProfileShowModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDeviceProfileShowModel>(ControllerContext, m);
return View(MVC.Config.DeviceProfile.Views.Show, m);
}
@@ -100,7 +100,7 @@ namespace Disco.Web.Areas.Config.Controllers
var m = Models.DeviceProfile.IndexModel.Build(Database);
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceProfileIndexModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDeviceProfileIndexModel>(ControllerContext, m);
return View(m);
}
@@ -121,7 +121,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceProfileCreateModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDeviceProfileCreateModel>(ControllerContext, m);
return View(m);
}
@@ -148,7 +148,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceProfileCreateModel>(this.ControllerContext, model);
UIExtensions.ExecuteExtensions<ConfigDeviceProfileCreateModel>(ControllerContext, model);
return View(model);
}
@@ -166,7 +166,7 @@ namespace Disco.Web.Areas.Config.Controllers
m.DeviceProfilesAndNone.Insert(0, new DeviceProfile() { Id = 0, Name = "<No Default>" });
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceProfileDefaultsModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDeviceProfileDefaultsModel>(ControllerContext, m);
return View(m);
}
@@ -43,7 +43,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateIndexModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateIndexModel>(ControllerContext, m);
return View(m);
}
@@ -72,7 +72,7 @@ namespace Disco.Web.Areas.Config.Controllers
m.BulkGenerateDownloadFilename = bulkGenerateFilename;
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateShowModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateShowModel>(ControllerContext, m);
return View(MVC.Config.DocumentTemplate.Views.Show, m);
}
@@ -99,7 +99,7 @@ namespace Disco.Web.Areas.Config.Controllers
m.DocumentTemplatesSelected = m.Package.GetDocumentTemplates(m.DocumentTemplates);
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateShowPackageModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateShowPackageModel>(ControllerContext, m);
return View(MVC.Config.DocumentTemplate.Views.ShowPackage, m);
}
@@ -110,7 +110,7 @@ namespace Disco.Web.Areas.Config.Controllers
var m = new ImportStatusModel();
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateImportStatusModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateImportStatusModel>(ControllerContext, m);
return View();
}
@@ -124,7 +124,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateUndetectedPagesModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateUndetectedPagesModel>(ControllerContext, m);
return View(m);
}
@@ -136,7 +136,7 @@ namespace Disco.Web.Areas.Config.Controllers
m.UpdateModel(Database);
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateCreateModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateCreateModel>(ControllerContext, m);
return View(m);
}
@@ -174,7 +174,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateCreateModel>(this.ControllerContext, model);
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateCreateModel>(ControllerContext, model);
return View(model);
}
@@ -185,7 +185,7 @@ namespace Disco.Web.Areas.Config.Controllers
var m = new CreatePackageModel();
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateCreatePackageModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateCreatePackageModel>(ControllerContext, m);
return View(m);
}
@@ -210,7 +210,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateCreatePackageModel>(this.ControllerContext, model);
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateCreatePackageModel>(ControllerContext, model);
return View(model);
}
@@ -19,7 +19,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigEnrolmentIndexModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigEnrolmentIndexModel>(ControllerContext, m);
return View(m);
}
@@ -34,7 +34,7 @@ namespace Disco.Web.Areas.Config.Controllers
m.DeviceBatches = Database.DeviceBatches.ToList();
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigEnrolmentStatusModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigEnrolmentStatusModel>(ControllerContext, m);
return View(m);
}
@@ -26,7 +26,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigJobPreferencesIndexModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigJobPreferencesIndexModel>(ControllerContext, m);
return View(m);
}
@@ -55,7 +55,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigJobQueueShowModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigJobQueueShowModel>(ControllerContext, m);
return View(MVC.Config.JobQueue.Views.Show, m);
}
@@ -71,7 +71,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigJobQueueIndexModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigJobQueueIndexModel>(ControllerContext, m);
return View(m);
}
@@ -92,7 +92,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigJobQueueCreateModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigJobQueueCreateModel>(ControllerContext, m);
return View(m);
}
@@ -117,7 +117,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigJobQueueCreateModel>(this.ControllerContext, model);
UIExtensions.ExecuteExtensions<ConfigJobQueueCreateModel>(ControllerContext, model);
return View(model);
}
@@ -29,7 +29,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigLoggingIndexModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigLoggingIndexModel>(ControllerContext, m);
return View(m);
}
@@ -46,7 +46,7 @@ namespace Disco.Web.Areas.Config.Controllers
var m = new Models.Shared.TaskStatusModel() { SessionId = taskStatus.SessionId };
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigSharedTaskStatusModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigSharedTaskStatusModel>(ControllerContext, m);
return View(m);
}
@@ -22,7 +22,7 @@ namespace Disco.Web.Areas.Config.Controllers
viewModel.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses.OrderBy(a => a.Name).ToList();
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigOrganisationIndexModel>(this.ControllerContext, viewModel);
UIExtensions.ExecuteExtensions<ConfigOrganisationIndexModel>(ControllerContext, viewModel);
return View(viewModel);
}
@@ -50,7 +50,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigUserFlagShowModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigUserFlagShowModel>(ControllerContext, m);
return View(MVC.Config.UserFlag.Views.Show, m);
}
@@ -71,7 +71,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigUserFlagIndexModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigUserFlagIndexModel>(ControllerContext, m);
return View(m);
}
@@ -91,7 +91,7 @@ namespace Disco.Web.Areas.Config.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigUserFlagCreateModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigUserFlagCreateModel>(ControllerContext, m);
return View(m);
}
@@ -116,7 +116,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigUserFlagCreateModel>(this.ControllerContext, model);
UIExtensions.ExecuteExtensions<ConfigUserFlagCreateModel>(ControllerContext, model);
return View(model);
}
@@ -18,7 +18,7 @@ namespace Disco.Web.Areas.Config.Models.AuthorizationRole
{
get
{
var rootNode = FancyTreeNode.FromClaimNavigatorItem(this.ClaimNavigator, false);
var rootNode = FancyTreeNode.FromClaimNavigatorItem(ClaimNavigator, false);
rootNode.expanded = true;
return new FancyTreeNode[] {
@@ -22,15 +22,15 @@ namespace Disco.Web.Areas.Config.Models.DeviceProfile
{
get
{
if (string.IsNullOrEmpty(this.DeviceProfile.OrganisationalUnit))
if (string.IsNullOrEmpty(DeviceProfile.OrganisationalUnit))
{
var domain = ActiveDirectory.Context.PrimaryDomain;
return domain.FriendlyDistinguishedNamePath(domain.DefaultComputerContainer);
}
else
{
var domain = ActiveDirectory.Context.GetDomainFromDistinguishedName(this.DeviceProfile.OrganisationalUnit);
return domain.FriendlyDistinguishedNamePath(this.DeviceProfile.OrganisationalUnit);
var domain = ActiveDirectory.Context.GetDomainFromDistinguishedName(DeviceProfile.OrganisationalUnit);
return domain.FriendlyDistinguishedNamePath(DeviceProfile.OrganisationalUnit);
}
}
}
@@ -49,9 +49,9 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
public void UpdateModel(DiscoDataContext Database)
{
if (this.JobTypes == null)
if (JobTypes == null)
JobTypes = Database.JobTypes.ToList();
if (this.JobSubTypes == null)
if (JobSubTypes == null)
JobSubTypes = Database.JobSubTypes.ToList();
}
@@ -43,20 +43,20 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
public void UpdateModel(DiscoDataContext Database)
{
switch (this.DocumentTemplate.Scope)
switch (DocumentTemplate.Scope)
{
case Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Device:
this.StoredInstanceCount = Database.DeviceAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
StoredInstanceCount = Database.DeviceAttachments.Count(a => a.DocumentTemplateId == DocumentTemplate.Id);
break;
case Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Job:
this.StoredInstanceCount = Database.JobAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
StoredInstanceCount = Database.JobAttachments.Count(a => a.DocumentTemplateId == DocumentTemplate.Id);
break;
case Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.User:
this.StoredInstanceCount = Database.UserAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
StoredInstanceCount = Database.UserAttachments.Count(a => a.DocumentTemplateId == DocumentTemplate.Id);
break;
}
if (this.JobTypes == null)
if (JobTypes == null)
JobTypes = Database.JobTypes.Include("JobSubTypes").ToList();
UserFlags = Database.UserFlags.ToList();
@@ -18,7 +18,7 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
list.Add(new SelectListItem() { Selected = false, Value = "--DEVICE", Text = "<Generic Device Document>" });
list.Add(new SelectListItem() { Selected = true, Value = "--JOB", Text = "<Generic Job Document>" });
list.Add(new SelectListItem() { Selected = false, Value = "--USER", Text = "<Generic User Document>" });
list.AddRange(this.DocumentTemplates.ToSelectListItems());
list.AddRange(DocumentTemplates.ToSelectListItems());
return list;
}
}
@@ -67,7 +67,7 @@ namespace Disco.Web.Areas.Config.Models.JobPreferences
new KeyValuePair<int, string>(56, "8 Weeks")
};
var current = this.LongRunningJobDaysThreshold;
var current = LongRunningJobDaysThreshold;
if (!options.Any(o => o.Key == current))
{
options.Add(new KeyValuePair<int, string>(current, string.Format("{0} Days", current)));
@@ -103,7 +103,7 @@ namespace Disco.Web.Areas.Config.Models.JobPreferences
new KeyValuePair<int, string>(60 * 24 * 7 * 8, "8 weeks")
};
var current = this.StaleJobMinutesThreshold;
var current = StaleJobMinutesThreshold;
if (!options.Any(o => o.Key == current))
{
options.Add(new KeyValuePair<int, string>(current, string.Format("{0} Minutes", current)));
@@ -11,10 +11,10 @@ namespace Disco.Web.Areas.Config.Models.Plugins
public PluginConfigurationViewModel(PluginConfigurationHandler.PluginConfigurationHandlerGetResponse response)
{
this.Manifest = response.Manifest;
Manifest = response.Manifest;
this.PluginViewType = response.ViewType;
this.PluginViewModel = response.Model;
PluginViewType = response.ViewType;
PluginViewModel = response.Model;
}
}
}
@@ -49,28 +49,28 @@ namespace Disco.Web.Areas.Config.Models.SystemConfig
{
get
{
return this.DatabaseConnectionString.Value.DataSource;
return DatabaseConnectionString.Value.DataSource;
}
}
public string DatabaseName
{
get
{
return this.DatabaseConnectionString.Value.InitialCatalog;
return DatabaseConnectionString.Value.InitialCatalog;
}
}
public string DatabaseAuthentication
{
get
{
return this.DatabaseConnectionString.Value.IntegratedSecurity ? "Integrated Authentication" : "SQL Authentication";
return DatabaseConnectionString.Value.IntegratedSecurity ? "Integrated Authentication" : "SQL Authentication";
}
}
public string DatabaseSqlAuthUsername
{
get
{
return this.DatabaseConnectionString.Value.IntegratedSecurity ? null : this.DatabaseConnectionString.Value.UserID;
return DatabaseConnectionString.Value.IntegratedSecurity ? null : DatabaseConnectionString.Value.UserID;
}
}
#endregion
@@ -21,27 +21,27 @@ namespace Disco.Web.Areas.Public.Models.UserHeldDevices
{
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)
UserId = UserId,
UserDisplayName = UserDisplayName,
ReadyForReturn = ReadyForReturn,
WaitingForUserAction = WaitingForUserAction,
DeviceProfileId = DeviceProfileId,
DeviceAddress = (DeviceAddressId.HasValue ? Database.DiscoConfiguration.OrganisationAddresses.GetAddress(DeviceAddressId.Value)?.ShortName : string.Empty)
};
var n = DateTime.Now;
if (!this.ReadyForReturn && this.EstimatedReturnTime.HasValue && this.EstimatedReturnTime.Value > n)
if (!ReadyForReturn && EstimatedReturnTime.HasValue && EstimatedReturnTime.Value > n)
{
uhdm.EstimatedReturnTime = this.EstimatedReturnTime.FromNow();
uhdm.EstimatedReturnTime = EstimatedReturnTime.FromNow();
}
if (this.ReadyForReturn)
if (ReadyForReturn)
{
uhdm.ReadyForReturnSince = this.ReadyForReturnSince.FromNow();
uhdm.IsAlert = (this.ReadyForReturnSince.Value < DateTime.Now.AddDays(-3));
uhdm.ReadyForReturnSince = ReadyForReturnSince.FromNow();
uhdm.IsAlert = (ReadyForReturnSince.Value < DateTime.Now.AddDays(-3));
}
if (this.WaitingForUserAction)
if (WaitingForUserAction)
{
uhdm.WaitingForUserActionSince = this.WaitingForUserActionSince.FromNow();
uhdm.IsAlert = (this.WaitingForUserActionSince.Value < n.AddDays(-6));
uhdm.WaitingForUserActionSince = WaitingForUserActionSince.FromNow();
uhdm.IsAlert = (WaitingForUserActionSince.Value < n.AddDays(-6));
}
return uhdm;
}
+6 -6
View File
@@ -29,7 +29,7 @@ namespace Disco.Web.Controllers
Models.Device.IndexModel m = new Models.Device.IndexModel();
// UI Extensions
UIExtensions.ExecuteExtensions<DeviceIndexModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<DeviceIndexModel>(ControllerContext, m);
return View();
}
@@ -57,7 +57,7 @@ namespace Disco.Web.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<DeviceAddOfflineModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<DeviceAddOfflineModel>(ControllerContext, m);
return View(m);
}
@@ -162,7 +162,7 @@ namespace Disco.Web.Controllers
m.CompletedImportSessionContext = Areas.API.Controllers.DeviceController.Import_RetrieveContext(Id, Remove: true);
// UI Extensions
UIExtensions.ExecuteExtensions<DeviceImportModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<DeviceImportModel>(ControllerContext, m);
return View(m);
}
@@ -184,7 +184,7 @@ namespace Disco.Web.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<DeviceImportHeadersModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<DeviceImportHeadersModel>(ControllerContext, m);
return View(m);
}
@@ -210,7 +210,7 @@ namespace Disco.Web.Controllers
};
// UI Extensions
UIExtensions.ExecuteExtensions<DeviceImportReviewModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<DeviceImportReviewModel>(ControllerContext, m);
return View(m);
}
@@ -328,7 +328,7 @@ namespace Disco.Web.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<DeviceShowModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<DeviceShowModel>(ControllerContext, m);
return View(m);
}
+19 -19
View File
@@ -54,7 +54,7 @@ namespace Disco.Web.Controllers
m.PendingEnrolments = WindowsDeviceEnrolment.GetPendingEnrolments();
// UI Extensions
UIExtensions.ExecuteExtensions<JobIndexModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobIndexModel>(ControllerContext, m);
return View(m);
}
@@ -73,7 +73,7 @@ namespace Disco.Web.Controllers
m.JobTable = ManagedJobList.OpenJobsTable(q => q.Where(j => j.ActiveJobQueues.Any(jqj => jqj.QueueId == queueToken.JobQueue.Id)));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -85,7 +85,7 @@ namespace Disco.Web.Controllers
m.JobTable = ManagedJobList.OpenJobsTable(q => q.OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -98,7 +98,7 @@ namespace Disco.Web.Controllers
m.JobTable = ManagedJobList.OpenJobsTable(ManagedJobList.AwaitingTechnicianActionFilter);
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -114,7 +114,7 @@ namespace Disco.Web.Controllers
.OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -130,7 +130,7 @@ namespace Disco.Web.Controllers
).OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -148,7 +148,7 @@ namespace Disco.Web.Controllers
));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -162,7 +162,7 @@ namespace Disco.Web.Controllers
).OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -176,7 +176,7 @@ namespace Disco.Web.Controllers
).OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -190,7 +190,7 @@ namespace Disco.Web.Controllers
).OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -204,7 +204,7 @@ namespace Disco.Web.Controllers
).OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -221,7 +221,7 @@ namespace Disco.Web.Controllers
).OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -241,7 +241,7 @@ namespace Disco.Web.Controllers
m.JobTable.Fill(Database, Disco.Services.Searching.Search.BuildJobTableModel(Database).Where(j => j.ClosedDate > closedThreshold).OrderBy(j => j.Id), true);
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -257,7 +257,7 @@ namespace Disco.Web.Controllers
m.JobTable.ShowType = false;
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -271,7 +271,7 @@ namespace Disco.Web.Controllers
m.JobTable = ManagedJobList.OpenJobsTable(q => q.Where(j => j.OpenedDate < longRunningThreshold).OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -287,7 +287,7 @@ namespace Disco.Web.Controllers
m.JobTable.ShowDates = false;
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobListModel>(ControllerContext, m);
return View(Views.List, m);
}
@@ -393,7 +393,7 @@ namespace Disco.Web.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<JobShowModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobShowModel>(ControllerContext, m);
return View(m);
}
@@ -414,7 +414,7 @@ namespace Disco.Web.Controllers
m.RegenerateCommentsOnTypeChange = isTypeDynamic;
// UI Extensions
UIExtensions.ExecuteExtensions<JobCreateModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobCreateModel>(ControllerContext, m);
return View(m);
}
@@ -426,7 +426,7 @@ namespace Disco.Web.Controllers
if (!ModelState.IsValid)
{
// UI Extensions
UIExtensions.ExecuteExtensions<JobCreateModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobCreateModel>(ControllerContext, m);
return View(m);
}
+1 -1
View File
@@ -269,7 +269,7 @@ namespace Disco.Web.Controllers
}
// UI Extensions
UIExtensions.ExecuteExtensions<SearchQueryModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<SearchQueryModel>(ControllerContext, m);
return View(m);
}
+1 -1
View File
@@ -18,7 +18,7 @@ namespace Disco.Web.Models.Device
public int StatisticImportRecords
{
get { return this.StatisticNewRecords + StatisticModifiedRecords; }
get { return StatisticNewRecords + StatisticModifiedRecords; }
}
public IEnumerable<Tuple<DeviceImportFieldTypes, string>> HeaderTypes { get; set; }
@@ -11,9 +11,9 @@ namespace Disco.Web.Models.InitialConfig
public DatabaseModel()
{
// Set Defaults
this.Server = "(local)";
this.DatabaseName = "Disco";
this.AuthMethod = "SSPI";
Server = "(local)";
DatabaseName = "Disco";
AuthMethod = "SSPI";
}
public static DatabaseModel FromConnectionString(string ConnectionString)
@@ -51,11 +51,11 @@ namespace Disco.Web.Models.InitialConfig
{
var csb = new SqlConnectionStringBuilder()
{
DataSource = this.Server,
InitialCatalog = this.DatabaseName,
IntegratedSecurity = (this.AuthMethod.Equals("SSPI", StringComparison.OrdinalIgnoreCase)),
UserID = (this.AuthMethod.Equals("SQL", StringComparison.OrdinalIgnoreCase)) ? this.Auth_SQL_Username : string.Empty,
Password = (this.AuthMethod.Equals("SQL", StringComparison.OrdinalIgnoreCase)) ? this.Auth_SQL_Password : string.Empty,
DataSource = Server,
InitialCatalog = DatabaseName,
IntegratedSecurity = (AuthMethod.Equals("SSPI", StringComparison.OrdinalIgnoreCase)),
UserID = (AuthMethod.Equals("SQL", StringComparison.OrdinalIgnoreCase)) ? Auth_SQL_Username : string.Empty,
Password = (AuthMethod.Equals("SQL", StringComparison.OrdinalIgnoreCase)) ? Auth_SQL_Password : string.Empty,
ApplicationName = "Disco ICT WebApp",
MultipleActiveResultSets = true,
Pooling = true
@@ -21,10 +21,10 @@ namespace Disco.Web.Models.InitialConfig
{
if (!string.IsNullOrWhiteSpace(FileStoreLocation))
{
var branches = this.FileStoreLocation.ToUpper().Split(Path.DirectorySeparatorChar);
var branchesCase = this.FileStoreLocation.Split(Path.DirectorySeparatorChar);
var branches = FileStoreLocation.ToUpper().Split(Path.DirectorySeparatorChar);
var branchesCase = FileStoreLocation.Split(Path.DirectorySeparatorChar);
FileStoreDirectoryModel branchModel;
FileStoreDirectoryModel branchParent = this.DirectoryModel;
FileStoreDirectoryModel branchParent = DirectoryModel;
for (int i = 0; i < branches.Length; i++)
{
var branch = branches[i];
@@ -154,10 +154,10 @@ namespace Disco.Web.Models.InitialConfig
internal void ExpandSubDirectories()
{
if (this.SubDirectories == null)
if (SubDirectories == null)
{
this.SubDirectories = new Dictionary<string, FileStoreDirectoryModel>();
if (!this.IsNew)
SubDirectories = new Dictionary<string, FileStoreDirectoryModel>();
if (!IsNew)
{
var dirInfo = new DirectoryInfo(Path);
if (dirInfo.Exists)
@@ -167,13 +167,13 @@ namespace Disco.Web.Models.InitialConfig
if (((subDir.Attributes & FileAttributes.System) != FileAttributes.System) &&
((subDir.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden))
{
this.SubDirectories.Add(subDir.Name.ToUpper(), FileStoreDirectoryModel.FromInfo(subDir));
SubDirectories.Add(subDir.Name.ToUpper(), FileStoreDirectoryModel.FromInfo(subDir));
}
}
}
else
{
this.IsNew = true;
IsNew = true;
}
}
}
@@ -15,7 +15,7 @@ namespace Disco.Web.Models.InitialConfig
{
if (_OrganisationNameCache != null)
{
this.OrganisationName = _OrganisationNameCache;
OrganisationName = _OrganisationNameCache;
return true;
}
@@ -23,8 +23,8 @@ namespace Disco.Web.Models.InitialConfig
if (whoAmIResult != null && !string.IsNullOrWhiteSpace(whoAmIResult.Item2))
{
this.OrganisationName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(whoAmIResult.Item2);
_OrganisationNameCache = this.OrganisationName;
OrganisationName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(whoAmIResult.Item2);
_OrganisationNameCache = OrganisationName;
return true;
}
+20 -20
View File
@@ -42,24 +42,24 @@ namespace Disco.Web.Models.Job
public void UpdateModel(DiscoDataContext Database, AuthorizationToken Authorization)
{
if (this.JobTypes == null)
this.JobTypes = Database.JobTypes.Include("JobSubTypes.JobQueues").FilterCreatableTypePermissions(Authorization).ToList();
if (JobTypes == null)
JobTypes = Database.JobTypes.Include("JobSubTypes.JobQueues").FilterCreatableTypePermissions(Authorization).ToList();
if (!string.IsNullOrEmpty(DeviceSerialNumber))
{
this.Device = Database.Devices.Include("DeviceModel").Where(d => d.SerialNumber == DeviceSerialNumber).FirstOrDefault();
if (this.Device == null)
Device = Database.Devices.Include("DeviceModel").Where(d => d.SerialNumber == DeviceSerialNumber).FirstOrDefault();
if (Device == null)
{
throw new ArgumentException("Invalid Device Serial Number Specified", "DeviceSerialNumber");
}
if (string.IsNullOrEmpty(this.UserId) && !string.IsNullOrEmpty(this.Device.AssignedUserId))
if (string.IsNullOrEmpty(UserId) && !string.IsNullOrEmpty(Device.AssignedUserId))
{
this.UserId = this.Device.AssignedUserId;
UserId = Device.AssignedUserId;
}
if (string.IsNullOrEmpty(this.Type))
this.Type = this.JobTypes.Any(jt => jt.Id == Disco.Models.Repository.JobType.JobTypeIds.HWar) ? Disco.Models.Repository.JobType.JobTypeIds.HWar : this.JobTypes.First().Id;
if (string.IsNullOrEmpty(Type))
Type = JobTypes.Any(jt => jt.Id == Disco.Models.Repository.JobType.JobTypeIds.HWar) ? Disco.Models.Repository.JobType.JobTypeIds.HWar : JobTypes.First().Id;
if (string.IsNullOrEmpty(this.UserId))
if (string.IsNullOrEmpty(UserId))
{
// No User - Remove User Types
foreach (var jobType in JobTypes.ToArray())
@@ -94,20 +94,20 @@ namespace Disco.Web.Models.Job
}
// Set Default Job Type for Users
if (string.IsNullOrEmpty(this.Type))
this.Type = this.JobTypes.Any(jt => jt.Id == Disco.Models.Repository.JobType.JobTypeIds.SApp) ? Disco.Models.Repository.JobType.JobTypeIds.SApp : this.JobTypes.First().Id;
if (string.IsNullOrEmpty(Type))
Type = JobTypes.Any(jt => jt.Id == Disco.Models.Repository.JobType.JobTypeIds.SApp) ? Disco.Models.Repository.JobType.JobTypeIds.SApp : JobTypes.First().Id;
}
if (!string.IsNullOrEmpty(UserId))
{
this.User = Database.Users.Find(UserId);
if (this.User == null)
User = Database.Users.Find(UserId);
if (User == null)
{
throw new ArgumentException("Invalid User Id Specified", "UserId");
}
if (string.IsNullOrEmpty(this.Type))
this.Type = Disco.Models.Repository.JobType.JobTypeIds.SApp;
if (string.IsNullOrEmpty(Type))
Type = Disco.Models.Repository.JobType.JobTypeIds.SApp;
}
if (this.User == null && this.Device == null)
if (User == null && Device == null)
{
throw new InvalidOperationException("A Job must reference a Device and/or a User");
}
@@ -118,9 +118,9 @@ namespace Disco.Web.Models.Job
{
get
{
if (!string.IsNullOrEmpty(this.Type))
if (!string.IsNullOrEmpty(Type))
{
return this.JobTypes.FirstOrDefault(m => m.Id == this.Type);
return JobTypes.FirstOrDefault(m => m.Id == Type);
}
return null;
}
@@ -131,8 +131,8 @@ namespace Disco.Web.Models.Job
{
if (SubTypes != null)
{
var subTypes = this.SubTypes;
return this.JobTypes.SelectMany(jt => jt.JobSubTypes).Where(m => subTypes.Contains(String.Format("{0}_{1}", m.JobTypeId, m.Id))).ToList();
var subTypes = SubTypes;
return JobTypes.SelectMany(jt => jt.JobSubTypes).Where(m => subTypes.Contains(String.Format("{0}_{1}", m.JobTypeId, m.Id))).ToList();
}
return null;
}
+7 -7
View File
@@ -50,11 +50,11 @@ namespace Disco.Web.Models.Job
public Dictionary<string, string> ProviderProperties()
{
Dictionary<string, string> p = default(Dictionary<string, string>);
if (!string.IsNullOrEmpty(this.ProviderPropertiesJson))
if (!string.IsNullOrEmpty(ProviderPropertiesJson))
{
try
{
p = JsonConvert.DeserializeObject<Dictionary<string, string>>(this.ProviderPropertiesJson);
p = JsonConvert.DeserializeObject<Dictionary<string, string>>(ProviderPropertiesJson);
}
catch (Exception)
{
@@ -98,7 +98,7 @@ namespace Disco.Web.Models.Job
}
// Update TechUser's Details [#12]
this.TechUser = UserService.GetUser(UserService.CurrentUserId, Database, true);
TechUser = UserService.GetUser(UserService.CurrentUserId, Database, true);
RepairProviders = Plugins.GetPluginFeatures(typeof(RepairProviderFeature));
@@ -113,16 +113,16 @@ namespace Disco.Web.Models.Job
if (!string.IsNullOrEmpty(RepairProviderId) && RepairProviderId != "MANUAL")
RepairProvider = Plugins.GetPluginFeature(RepairProviderId, typeof(RepairProviderFeature));
this.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses.OrderBy(a => a.Name).ToList();
OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses.OrderBy(a => a.Name).ToList();
if (!IsPostBack && !this.OrganisationAddressId.HasValue)
if (!IsPostBack && !OrganisationAddressId.HasValue)
{
OrganisationAddressId = Job.Device.DeviceProfile.DefaultOrganisationAddress;
if (!OrganisationAddressId.HasValue && OrganisationAddresses.Count == 1)
OrganisationAddressId = OrganisationAddresses[0].Id;
}
if (this.OrganisationAddressId.HasValue)
this.OrganisationAddress = this.OrganisationAddresses.FirstOrDefault(oa => oa.Id == this.OrganisationAddressId.Value);
if (OrganisationAddressId.HasValue)
OrganisationAddress = OrganisationAddresses.FirstOrDefault(oa => oa.Id == OrganisationAddressId.Value);
if (!string.IsNullOrEmpty(RepairDescription))
RepairDescription = RepairDescription.Trim();
+7 -7
View File
@@ -51,11 +51,11 @@ namespace Disco.Web.Models.Job
public Dictionary<string, string> ProviderProperties()
{
Dictionary<string, string> p = default(Dictionary<string, string>);
if (!string.IsNullOrEmpty(this.ProviderPropertiesJson))
if (!string.IsNullOrEmpty(ProviderPropertiesJson))
{
try
{
p = JsonConvert.DeserializeObject<Dictionary<string, string>>(this.ProviderPropertiesJson);
p = JsonConvert.DeserializeObject<Dictionary<string, string>>(ProviderPropertiesJson);
}
catch (Exception)
{
@@ -98,7 +98,7 @@ namespace Disco.Web.Models.Job
}
// Update TechUser's Details [#12]
this.TechUser = UserService.GetUser(UserService.CurrentUserId, Database, true);
TechUser = UserService.GetUser(UserService.CurrentUserId, Database, true);
WarrantyProviders = Plugins.GetPluginFeatures(typeof(WarrantyProviderFeature));
@@ -113,16 +113,16 @@ namespace Disco.Web.Models.Job
if (!string.IsNullOrEmpty(WarrantyProviderId) && WarrantyProviderId != "MANUAL")
WarrantyProvider = Plugins.GetPluginFeature(WarrantyProviderId, typeof(WarrantyProviderFeature));
this.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses.OrderBy(a => a.Name).ToList();
OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses.OrderBy(a => a.Name).ToList();
if (!IsPostBack && !this.OrganisationAddressId.HasValue)
if (!IsPostBack && !OrganisationAddressId.HasValue)
{
OrganisationAddressId = Job.Device.DeviceProfile.DefaultOrganisationAddress;
if (!OrganisationAddressId.HasValue && OrganisationAddresses.Count == 1)
OrganisationAddressId = OrganisationAddresses[0].Id;
}
if (this.OrganisationAddressId.HasValue)
this.OrganisationAddress = this.OrganisationAddresses.FirstOrDefault(oa => oa.Id == this.OrganisationAddressId.Value);
if (OrganisationAddressId.HasValue)
OrganisationAddress = OrganisationAddresses.FirstOrDefault(oa => oa.Id == OrganisationAddressId.Value);
if (!string.IsNullOrEmpty(FaultDescription))
FaultDescription = FaultDescription.Trim();