diff --git a/Disco.Data/Configuration/ConfigurationCache.cs b/Disco.Data/Configuration/ConfigurationCache.cs index 9b920b34..71496abe 100644 --- a/Disco.Data/Configuration/ConfigurationCache.cs +++ b/Disco.Data/Configuration/ConfigurationCache.cs @@ -282,7 +282,7 @@ namespace Disco.Data.Configuration Type valueType = typeof(T); string stringValue; - if (comparer.Equals(Value, default(T))) + if (comparer.Equals(Value, default)) { stringValue = null; } diff --git a/Disco.Services/Devices/DeviceExtensions.cs b/Disco.Services/Devices/DeviceExtensions.cs index 12a2f163..2842b116 100644 --- a/Disco.Services/Devices/DeviceExtensions.cs +++ b/Disco.Services/Devices/DeviceExtensions.cs @@ -86,12 +86,12 @@ namespace Disco.Services // Batch - DeviceBatch db = default(DeviceBatch); + var db = default(DeviceBatch); if (d.DeviceBatchId.HasValue) db = Database.DeviceBatches.Find(d.DeviceBatchId.Value); // Default Device Model - DeviceModel dm = default(DeviceModel); + var dm = default(DeviceModel); if (db != null && db.DefaultDeviceModelId.HasValue) dm = Database.DeviceModels.Find(db.DefaultDeviceModelId); // From Batch else @@ -158,7 +158,7 @@ namespace Disco.Services public static DeviceUserAssignment AssignDevice(this Device d, DiscoDataContext Database, User u) { - DeviceUserAssignment newDua = default(DeviceUserAssignment); + DeviceUserAssignment newDua = default; // Mark existing assignments as Unassigned foreach (var dua in Database.DeviceUserAssignments.Where(m => m.DeviceSerialNumber == d.SerialNumber && !m.UnassignedDate.HasValue)) diff --git a/Disco.Services/Expressions/Expression.cs b/Disco.Services/Expressions/Expression.cs index 2cd87d5e..c0112f21 100644 --- a/Disco.Services/Expressions/Expression.cs +++ b/Disco.Services/Expressions/Expression.cs @@ -45,7 +45,7 @@ namespace Disco.Services.Expressions public T EvaluateFirst(object ExpressionContext, IDictionary Variables) { - T result = default(T); + T result = default; if (Count > 0) { try diff --git a/Disco.Services/Expressions/Extensions/DeviceExt.cs b/Disco.Services/Expressions/Extensions/DeviceExt.cs index 83f6ec3a..d53ba7d3 100644 --- a/Disco.Services/Expressions/Extensions/DeviceExt.cs +++ b/Disco.Services/Expressions/Extensions/DeviceExt.cs @@ -28,7 +28,7 @@ namespace Disco.Services.Expressions.Extensions { var objectValue = GetActiveDirectoryObjectValue(Device, PropertyName, Index); if (objectValue == null) - return default(int); + return default; else { int intValue; diff --git a/Disco.Services/Expressions/Extensions/UserExt.cs b/Disco.Services/Expressions/Extensions/UserExt.cs index f0090bf0..87dca999 100644 --- a/Disco.Services/Expressions/Extensions/UserExt.cs +++ b/Disco.Services/Expressions/Extensions/UserExt.cs @@ -32,7 +32,7 @@ namespace Disco.Services.Expressions.Extensions { var objectValue = GetActiveDirectoryObjectValue(User, PropertyName, Index); if (objectValue == null) - return default(int); + return default; else { int intValue; diff --git a/Disco.Services/Interop/ActiveDirectory/ADNetworkLogonDatesUpdateTask.cs b/Disco.Services/Interop/ActiveDirectory/ADNetworkLogonDatesUpdateTask.cs index 10cfe0b9..79a74b70 100644 --- a/Disco.Services/Interop/ActiveDirectory/ADNetworkLogonDatesUpdateTask.cs +++ b/Disco.Services/Interop/ActiveDirectory/ADNetworkLogonDatesUpdateTask.cs @@ -76,13 +76,10 @@ namespace Disco.Services.Interop.ActiveDirectory if (result != null) { - long lastLogonValue = default(long); - long lastLogonTimestampValue = default(long); + var lastLogonValue = result.Value("lastLogon"); + var lastLogonTimestampValue = result.Value("lastLogonTimestamp"); - lastLogonValue = result.Value("lastLogon"); - lastLogonTimestampValue = result.Value("lastLogonTimestamp"); - - long highedValue = Math.Max(lastLogonValue, lastLogonTimestampValue); + var highedValue = Math.Max(lastLogonValue, lastLogonTimestampValue); if (highedValue > 0) return (DateTime?)new DateTime((DateTime.FromFileTime(highedValue).Ticks / 10000000L) * 10000000L); @@ -151,8 +148,8 @@ namespace Disco.Services.Interop.ActiveDirectory { var samAccountName = result.Value("sAMAccountName"); - long lastLogonValue = default(long); - long lastLogonTimestampValue = default(long); + long lastLogonValue = default; + long lastLogonTimestampValue = default; lastLogonValue = result.Value("lastLogon"); lastLogonTimestampValue = result.Value("lastLogonTimestamp"); diff --git a/Disco.Services/Searching/Search.cs b/Disco.Services/Searching/Search.cs index 3254668a..91327f36 100644 --- a/Disco.Services/Searching/Search.cs +++ b/Disco.Services/Searching/Search.cs @@ -17,15 +17,14 @@ namespace Disco.Services.Searching #region Jobs public static List SearchJobs(DiscoDataContext Database, string Term, int? LimitCount = ActiveDirectory.DefaultSearchResultLimit) { - - IQueryable query = default(IQueryable); + var query = (IQueryable)Database.Jobs; string userIdTerm = Term.Contains('\\') ? Term : ActiveDirectory.ParseDomainAccountId(Term); if (int.TryParse(Term, out var termInt)) { // Term is a Number (int) - query = Database.Jobs.Where(j => + query = query.Where(j => j.Id == termInt || j.Device.SerialNumber.Contains(Term) || j.Device.AssetNumber.Contains(Term) || @@ -34,7 +33,7 @@ namespace Disco.Services.Searching } else { - query = Database.Jobs.Where(j => + query = query.Where(j => j.Device.SerialNumber.Contains(Term) || j.Device.AssetNumber.Contains(Term) || j.User.UserId == userIdTerm || diff --git a/Disco.Web.Extensions/BIModelExtensions/OrganisationAddressExtensions.cs b/Disco.Web.Extensions/BIModelExtensions/OrganisationAddressExtensions.cs index 0abd15c1..2fdf964f 100644 --- a/Disco.Web.Extensions/BIModelExtensions/OrganisationAddressExtensions.cs +++ b/Disco.Web.Extensions/BIModelExtensions/OrganisationAddressExtensions.cs @@ -10,7 +10,7 @@ namespace Disco.Web.Extensions { public static List ToSelectListItems(this IEnumerable organisationAddressess, OrganisationAddress SelectedItem) { - int? selectedId = default(int?); + var selectedId = default(int?); if (SelectedItem != null) selectedId = SelectedItem.Id; diff --git a/Disco.Web.Extensions/BIModelExtensions/PluginExtensions.cs b/Disco.Web.Extensions/BIModelExtensions/PluginExtensions.cs index 336bde25..d2c6895a 100644 --- a/Disco.Web.Extensions/BIModelExtensions/PluginExtensions.cs +++ b/Disco.Web.Extensions/BIModelExtensions/PluginExtensions.cs @@ -59,7 +59,7 @@ namespace Disco.Web.Extensions public static List ToSelectListItems(this IEnumerable PluginFeatureDefinitions, PluginManifest SelectedItem) { - string selectedId = default(string); + var selectedId = default(string); if (SelectedItem != null) selectedId = SelectedItem.Id; diff --git a/Disco.Web.Extensions/DataModelExtension/JobSubTypeExtensions.cs b/Disco.Web.Extensions/DataModelExtension/JobSubTypeExtensions.cs index 9994875e..ecba4a27 100644 --- a/Disco.Web.Extensions/DataModelExtension/JobSubTypeExtensions.cs +++ b/Disco.Web.Extensions/DataModelExtension/JobSubTypeExtensions.cs @@ -9,7 +9,7 @@ namespace Disco.Web.Extensions { public static List ToSelectListItems(this IEnumerable jobSubTypes, IEnumerable SelectedItems, bool IncludeQueueIcons = false) { - List selectedIds = default(List); + var selectedIds = default(List); if (SelectedItems != null) selectedIds = SelectedItems.Select(i => $"{i.JobTypeId}_{i.Id}").ToList(); diff --git a/Disco.Web.Extensions/DataModelExtension/JobTypeExtensions.cs b/Disco.Web.Extensions/DataModelExtension/JobTypeExtensions.cs index 54039777..b9313c9b 100644 --- a/Disco.Web.Extensions/DataModelExtension/JobTypeExtensions.cs +++ b/Disco.Web.Extensions/DataModelExtension/JobTypeExtensions.cs @@ -9,7 +9,7 @@ namespace Disco.Web.Extensions { public static List ToSelectListItems(this IEnumerable jobTypes, JobType SelectedItem) { - string selectedId = default(string); + var selectedId = default(string); if (SelectedItem != null) selectedId = SelectedItem.Id; @@ -27,7 +27,7 @@ namespace Disco.Web.Extensions public static List ToSelectListItems(this IEnumerable jobTypes, IEnumerable SelectedItems) { - List selectedIds = default(List); + var selectedIds = default(List); if (SelectedItems != null) selectedIds = SelectedItems.Select(i => i.Id).ToList(); diff --git a/Disco.Web/Models/Job/LogRepairModel.cs b/Disco.Web/Models/Job/LogRepairModel.cs index aaa57e02..ec45789c 100644 --- a/Disco.Web/Models/Job/LogRepairModel.cs +++ b/Disco.Web/Models/Job/LogRepairModel.cs @@ -49,7 +49,7 @@ namespace Disco.Web.Models.Job public string ProviderPropertiesJson { get; set; } public Dictionary ProviderProperties() { - Dictionary p = default(Dictionary); + var p = default(Dictionary); if (!string.IsNullOrEmpty(ProviderPropertiesJson)) { try diff --git a/Disco.Web/Models/Job/LogWarrantyModel.cs b/Disco.Web/Models/Job/LogWarrantyModel.cs index ee28cb99..aa3e2a85 100644 --- a/Disco.Web/Models/Job/LogWarrantyModel.cs +++ b/Disco.Web/Models/Job/LogWarrantyModel.cs @@ -50,7 +50,7 @@ namespace Disco.Web.Models.Job public string ProviderPropertiesJson { get; set; } public Dictionary ProviderProperties() { - Dictionary p = default(Dictionary); + var p = default(Dictionary); if (!string.IsNullOrEmpty(ProviderPropertiesJson)) { try