From 9656c15c4b82b76f03a322921482ed90e67eb1a0 Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Sun, 20 Jul 2025 15:20:22 +1000 Subject: [PATCH] qol: simplify calls --- Disco.Client/ErrorReporting.cs | 4 +- .../Extensions/ClientServicesExtensions.cs | 2 +- Disco.Client/Extensions/EnrolExtensions.cs | 2 +- Disco.Client/Presentation.cs | 2 +- Disco.Client/Program.cs | 8 +-- Disco.ClientBootstrapper/BootstrapperLoop.cs | 2 +- .../Interop/InstallInterop.cs | 14 ++--- .../Interop/NetworkInterop.cs | 4 +- .../Interop/WIMInterop.cs | 30 +++++------ Disco.ClientBootstrapper/Program.cs | 4 +- .../Configuration/ConfigurationCache.cs | 8 +-- .../Configuration/SystemConfiguration.cs | 8 +-- .../Authorization/Roles/RoleCache.cs | 4 +- Disco.Services/DataStore.cs | 6 +-- .../Devices/Enrolment/EnrolmentLog.cs | 6 +-- .../Importing/CsvDeviceImportDataReader.cs | 8 +-- .../Importing/XlsxDeviceImportDataReader.cs | 8 +-- .../DeviceBatchAssignedUsersManagedGroup.cs | 2 +- .../DeviceBatchDevicesManagedGroup.cs | 2 +- .../DeviceProfileAssignedUsersManagedGroup.cs | 2 +- .../DeviceProfileDevicesManagedGroup.cs | 2 +- .../Documents/AttachmentImport/ImportPage.cs | 2 +- Disco.Services/Documents/DocumentsLog.cs | 28 +++++----- .../DocumentTemplateDevicesManagedGroup.cs | 2 +- .../DocumentTemplateUsersManagedGroup.cs | 2 +- .../Expressions/Extensions/ImageExt.cs | 6 +-- Disco.Services/Extensions/UIHelpers.cs | 8 +-- .../ActiveDirectory/ADDomainController.cs | 2 +- .../ActiveDirectory/ADMachineAccount.cs | 4 +- .../ActiveDirectory/ActiveDirectory.cs | 8 +-- .../DiscoServices/ActivationService.cs | 2 +- Disco.Services/Interop/DiscoServices/Jobs.cs | 2 +- .../DiscoServices/LicenseValidationTask.cs | 2 +- .../Interop/DiscoServices/PluginLibrary.cs | 2 +- .../Interop/DiscoServices/UpdateQuery.cs | 4 +- Disco.Services/Interop/VicEduDept/VicSmart.cs | 2 +- .../Jobs/Noticeboards/HeldDevices.cs | 4 +- .../Jobs/Noticeboards/HeldDevicesForUsers.cs | 2 +- Disco.Services/Logging/ReadLogContext.cs | 2 +- .../CertificateProviderLog.cs | 52 +++++++++---------- .../Features/UIExtension/UIExtensions.cs | 2 +- Disco.Services/Plugins/PluginManifest.cs | 6 +-- Disco.Services/Plugins/Plugins.cs | 4 +- Disco.Services/Tasks/ScheduledTasks.cs | 10 ++-- .../UserFlagUserDevicesManagedGroup.cs | 2 +- .../UserFlags/UserFlagUsersManagedGroup.cs | 2 +- Disco.Services/Users/UserService.cs | 4 +- Disco.Services/Web/HelperExtensions.cs | 2 +- Disco.Web/App_Start/AppConfig.cs | 32 ++++++------ .../Controllers/DocumentTemplateController.cs | 44 ++++++++-------- .../Areas/API/Controllers/SystemController.cs | 10 ++-- .../Config/Models/SystemConfig/IndexModel.cs | 2 +- .../Controllers/UserHeldDevicesController.cs | 12 ++--- Disco.Web/Controllers/DeviceController.cs | 2 +- .../Controllers/InitialConfigController.cs | 6 +-- Disco.Web/Controllers/JobController.cs | 2 +- Disco.Web/Global.asax.cs | 6 +-- .../Models/InitialConfig/CompleteModel.cs | 6 +-- .../Models/InitialConfig/FileStoreModel.cs | 6 +-- Disco.Web/Models/Job/LogRepairModel.cs | 2 +- Disco.Web/Models/Job/LogWarrantyModel.cs | 2 +- 61 files changed, 214 insertions(+), 214 deletions(-) diff --git a/Disco.Client/ErrorReporting.cs b/Disco.Client/ErrorReporting.cs index 813f267d..d99076be 100644 --- a/Disco.Client/ErrorReporting.cs +++ b/Disco.Client/ErrorReporting.cs @@ -85,7 +85,7 @@ namespace Disco.Client string reportJson = JsonConvert.SerializeObject(report); string reportResponse; - HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(ServicePathTemplate); + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(ServicePathTemplate); request.UserAgent = $"Disco-Client/{Assembly.GetExecutingAssembly().GetName().Version.ToString(3)}"; request.ContentType = "application/json"; request.Method = WebRequestMethods.Http.Post; @@ -105,7 +105,7 @@ namespace Disco.Client } } - System.Diagnostics.Debug.WriteLine("Error Report Logged to Server; Response: {0}", reportResponse); + Debug.WriteLine("Error Report Logged to Server; Response: {0}", reportResponse); } #endregion diff --git a/Disco.Client/Extensions/ClientServicesExtensions.cs b/Disco.Client/Extensions/ClientServicesExtensions.cs index bd4e8ffc..708cac7f 100644 --- a/Disco.Client/Extensions/ClientServicesExtensions.cs +++ b/Disco.Client/Extensions/ClientServicesExtensions.cs @@ -26,7 +26,7 @@ namespace Disco.Client.Extensions else serviceUrl = string.Format(ServicePathUnauthenticatedTemplate, Service.Feature); - HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(serviceUrl); + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(serviceUrl); request.UserAgent = $"Disco-Client/{Assembly.GetExecutingAssembly().GetName().Version.ToString(3)}"; request.ContentType = "application/json"; request.Method = WebRequestMethods.Http.Post; diff --git a/Disco.Client/Extensions/EnrolExtensions.cs b/Disco.Client/Extensions/EnrolExtensions.cs index 946c8517..9b642840 100644 --- a/Disco.Client/Extensions/EnrolExtensions.cs +++ b/Disco.Client/Extensions/EnrolExtensions.cs @@ -133,7 +133,7 @@ namespace Disco.Client.Extensions Presentation.UpdateStatus("Enrolling Device", $"Configuring the device owner:\r\n{enrolResponse.AssignedUserDescription} ({enrolResponse.AssignedUserDomain}\\{enrolResponse.AssignedUserUsername})", true, -1, 3000); if (enrolResponse.AssignedUserIsLocalAdmin) - Interop.LocalAuthentication.AddLocalGroupMembership("Administrators", enrolResponse.AssignedUserSID, enrolResponse.AssignedUserUsername, enrolResponse.AssignedUserDomain); + LocalAuthentication.AddLocalGroupMembership("Administrators", enrolResponse.AssignedUserSID, enrolResponse.AssignedUserUsername, enrolResponse.AssignedUserDomain); // Make Windows think this user was the last to logon using (RegistryKey regWinlogon = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", true)) diff --git a/Disco.Client/Presentation.cs b/Disco.Client/Presentation.cs index 7b121492..211ece31 100644 --- a/Disco.Client/Presentation.cs +++ b/Disco.Client/Presentation.cs @@ -20,7 +20,7 @@ namespace Disco.Client } public static void UpdateStatus(string SubHeading, string Message, bool ShowProgress, int Progress, int TryDelay) { - Presentation.UpdateStatus(SubHeading, Message, ShowProgress, Progress); + UpdateStatus(SubHeading, Message, ShowProgress, Progress); if (TryDelay > 0) Presentation.TryDelay(TryDelay); } diff --git a/Disco.Client/Program.cs b/Disco.Client/Program.cs index 807d3efb..50839971 100644 --- a/Disco.Client/Program.cs +++ b/Disco.Client/Program.cs @@ -35,14 +35,14 @@ namespace Disco.Client Presentation.WriteBanner(); // WhoAmI Phase - keepProcessing = Program.WhoAmI(); + keepProcessing = WhoAmI(); // Enrol Phase if (keepProcessing) - keepProcessing = Program.Enrol(); + keepProcessing = Enrol(); // End conversation with Bootstrapper - Presentation.WriteFooter(Program.RebootRequired, Program.AllowUninstall, !keepProcessing); + Presentation.WriteFooter(RebootRequired, AllowUninstall, !keepProcessing); } public static void SetupEnvironment() @@ -128,7 +128,7 @@ namespace Disco.Client { // Send Request Presentation.UpdateStatus("Enrolling Device", "Sending the enrolment request to the server.", true, -1); - response = request.Post(Program.IsAuthenticated); + response = request.Post(IsAuthenticated); // Process Response Presentation.UpdateStatus("Enrolling Device", "Processing the enrolment response from the server.", true, -1); diff --git a/Disco.ClientBootstrapper/BootstrapperLoop.cs b/Disco.ClientBootstrapper/BootstrapperLoop.cs index 79a4ab7d..9edcf8be 100644 --- a/Disco.ClientBootstrapper/BootstrapperLoop.cs +++ b/Disco.ClientBootstrapper/BootstrapperLoop.cs @@ -232,7 +232,7 @@ namespace Disco.ClientBootstrapper { if (!string.IsNullOrWhiteSpace(e.Data)) { - System.Diagnostics.Debug.WriteLine($"OUTPUT: {e.Data}"); + Debug.WriteLine($"OUTPUT: {e.Data}"); var data = e.Data.Substring(1).Split(new char[] { ',' }); switch (e.Data[0]) { diff --git a/Disco.ClientBootstrapper/Interop/InstallInterop.cs b/Disco.ClientBootstrapper/Interop/InstallInterop.cs index 3f180022..fdeaed51 100644 --- a/Disco.ClientBootstrapper/Interop/InstallInterop.cs +++ b/Disco.ClientBootstrapper/Interop/InstallInterop.cs @@ -248,9 +248,9 @@ namespace Disco.ClientBootstrapper.Interop Program.Status.UpdateStatus(null, "Mounting WIM", $"Mounting WIM Image to '{wimMountPath}'"); Program.SleepThread(500, false); m_MessageCallback = new WIMInterop.WindowsImageContainer.NativeMethods.MessageCallback(WimImageEventMessagePump); - Interop.WIMInterop.WindowsImageContainer.NativeMethods.RegisterCallback(m_MessageCallback); + WIMInterop.WindowsImageContainer.NativeMethods.RegisterCallback(m_MessageCallback); - Interop.WIMInterop.WindowsImageContainer.NativeMethods.MountImage(wimMountPath, InstallLocation, wimImageIndex, wimTempMountPath); + WIMInterop.WindowsImageContainer.NativeMethods.MountImage(wimMountPath, InstallLocation, wimImageIndex, wimTempMountPath); // Load Local Machine Registry var wimHivePath = Path.Combine(wimMountPath, "Windows\\System32\\config\\SOFTWARE"); @@ -283,11 +283,11 @@ namespace Disco.ClientBootstrapper.Interop // Unmount WIM Program.Status.UpdateStatus(null, "Unmounting WIM", $"Unmounting WIM Image at '{wimMountPath}'"); Program.SleepThread(500, false); - Interop.WIMInterop.WindowsImageContainer.NativeMethods.DismountImage(wimMountPath, InstallLocation, wimImageIndex, wimCommitChanges); + WIMInterop.WindowsImageContainer.NativeMethods.DismountImage(wimMountPath, InstallLocation, wimImageIndex, wimCommitChanges); if (m_MessageCallback != null) { - Interop.WIMInterop.WindowsImageContainer.NativeMethods.UnregisterMessageCallback(m_MessageCallback); + WIMInterop.WindowsImageContainer.NativeMethods.UnregisterMessageCallback(m_MessageCallback); m_MessageCallback = null; } @@ -321,7 +321,7 @@ namespace Disco.ClientBootstrapper.Interop IntPtr UserData ) { - uint status = (uint)Interop.WIMInterop.WindowsImageContainer.NativeMethods.WIMMessage.WIM_MSG_SUCCESS; + uint status = (uint)WIMInterop.WindowsImageContainer.NativeMethods.WIMMessage.WIM_MSG_SUCCESS; WIMInterop.DefaultImageEventArgs eventArgs = new WIMInterop.DefaultImageEventArgs(wParam, lParam, UserData); //System.Diagnostics.Debug.WriteLine(MessageId); @@ -329,8 +329,8 @@ namespace Disco.ClientBootstrapper.Interop switch ((WIMInterop.WindowsImageContainer.ImageEventMessage)MessageId) { - case Interop.WIMInterop.WindowsImageContainer.ImageEventMessage.Progress: - case Interop.WIMInterop.WindowsImageContainer.ImageEventMessage.MountCleanupProgress: + case WIMInterop.WindowsImageContainer.ImageEventMessage.Progress: + case WIMInterop.WindowsImageContainer.ImageEventMessage.MountCleanupProgress: var timeRemainingMil = eventArgs.LeftParameter.ToInt32(); string timeRemainingMessage; if (timeRemainingMil > 0) diff --git a/Disco.ClientBootstrapper/Interop/NetworkInterop.cs b/Disco.ClientBootstrapper/Interop/NetworkInterop.cs index 5d2290ce..fc5aab1e 100644 --- a/Disco.ClientBootstrapper/Interop/NetworkInterop.cs +++ b/Disco.ClientBootstrapper/Interop/NetworkInterop.cs @@ -224,7 +224,7 @@ namespace Disco.ClientBootstrapper.Interop finally { if (wlanHandle != IntPtr.Zero) - NetworkInterop.WlanCloseHandle(wlanHandle, IntPtr.Zero); + WlanCloseHandle(wlanHandle, IntPtr.Zero); } } @@ -277,7 +277,7 @@ namespace Disco.ClientBootstrapper.Interop WlanGetProfileList(WlanHandle, ref pInterfaceGuid, new IntPtr(), ref ppProfileList); WLAN_PROFILE_INFO_LIST wlanProfileInfoList = new WLAN_PROFILE_INFO_LIST(ppProfileList); - NetworkInterop.WlanFreeMemory(ppProfileList); + WlanFreeMemory(ppProfileList); return wlanProfileInfoList; } diff --git a/Disco.ClientBootstrapper/Interop/WIMInterop.cs b/Disco.ClientBootstrapper/Interop/WIMInterop.cs index affd691b..ebdabefe 100644 --- a/Disco.ClientBootstrapper/Interop/WIMInterop.cs +++ b/Disco.ClientBootstrapper/Interop/WIMInterop.cs @@ -163,7 +163,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop //Set the temporary path so that we can write to an image. This //cannot be %TEMP% as it does not exist on Windows PE // - string tempDirectory = System.Environment.GetEnvironmentVariable("systemdrive"); + string tempDirectory = Environment.GetEnvironmentVariable("systemdrive"); NativeMethods.SetTemporaryPath(m_ImageContainerHandle, tempDirectory); } @@ -596,7 +596,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop //Mount the image // m_MountedPath = pathToMountTo; - NativeMethods.MountImage(pathToMountTo, m_ParentWindowsImageFilePath, m_Index, System.IO.Path.GetTempPath()); + NativeMethods.MountImage(pathToMountTo, m_ParentWindowsImageFilePath, m_Index, Path.GetTempPath()); m_Mounted = true; } @@ -684,7 +684,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop IntPtr windowsImageHandle = IntPtr.Zero; int rc = -1; - windowsImageHandle = NativeMethods.WimCreateFile(imageFile, access, mode, 0, 0, out _); + windowsImageHandle = WimCreateFile(imageFile, access, mode, 0, 0, out _); rc = Marshal.GetLastWin32Error(); if (windowsImageHandle == IntPtr.Zero) { @@ -721,7 +721,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop void CloseHandle(IntPtr handle) { - bool status = NativeMethods.WimCloseHandle(handle); + bool status = WimCloseHandle(handle); int rc = Marshal.GetLastWin32Error(); if (status == false) { @@ -757,7 +757,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop void SetTemporaryPath(IntPtr handle, string temporaryPath) { - bool status = NativeMethods.WimSetTemporaryPath(handle, temporaryPath); + bool status = WimSetTemporaryPath(handle, temporaryPath); int rc = Marshal.GetLastWin32Error(); if (status == false) { @@ -794,7 +794,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop { //Load the image data based on the .wim handle // - IntPtr hWim = NativeMethods.WimLoadImage(handle, (uint)imageIndex); + IntPtr hWim = WimLoadImage(handle, (uint)imageIndex); int rc = Marshal.GetLastWin32Error(); if (hWim == IntPtr.Zero) { @@ -832,7 +832,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop IntPtr CaptureImage(IntPtr handle, string path) { - IntPtr hImage = NativeMethods.WimCaptureImage(handle, path, 0); + IntPtr hImage = WimCaptureImage(handle, path, 0); int rc = Marshal.GetLastWin32Error(); if (hImage == IntPtr.Zero) { @@ -873,7 +873,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop int GetImageCount(IntPtr windowsImageHandle) { - int count = NativeMethods.WimGetImageCount(windowsImageHandle); + int count = WimGetImageCount(windowsImageHandle); int rc = Marshal.GetLastWin32Error(); if (count == -1) { @@ -971,7 +971,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop try { - status = NativeMethods.WimMountImage(mountPath, + status = WimMountImage(mountPath, windowsImageFileName, (uint)imageIndex, temporaryPath); @@ -1022,7 +1022,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop // //Call WimApplyImage always with the Index flag for performance reasons. // - bool status = NativeMethods.WimApplyImage(imageHandle, applicationPath, NativeMethods.WIM_FLAG_INDEX); + bool status = WimApplyImage(imageHandle, applicationPath, WIM_FLAG_INDEX); int rc = Marshal.GetLastWin32Error(); if (status == false) { @@ -1062,7 +1062,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop IntPtr info = IntPtr.Zero, sizeOfInfo = IntPtr.Zero; bool status; - status = NativeMethods.WimGetImageInformation(handle, out info, out _); + status = WimGetImageInformation(handle, out info, out _); int rc = Marshal.GetLastWin32Error(); if (status == false) @@ -1112,7 +1112,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop IntPtr xmlBuffer = Marshal.AllocHGlobal(byteBufferSize); Marshal.Copy(byteBuffer, 0, xmlBuffer, byteBufferSize); - bool status = NativeMethods.WimSetImageInformation(handle, xmlBuffer, (uint)byteBufferSize); + bool status = WimSetImageInformation(handle, xmlBuffer, (uint)byteBufferSize); int rc = Marshal.GetLastWin32Error(); if (status == false) { @@ -1153,7 +1153,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop try { - status = NativeMethods.WimUnmountImage(mountPath, wimdowsImageFileName, (uint)imageIndex, commitChanges); + status = WimUnmountImage(mountPath, wimdowsImageFileName, (uint)imageIndex, commitChanges); rc = Marshal.GetLastWin32Error(); } catch (System.StackOverflowException ex) @@ -1221,7 +1221,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop void RegisterCallback(MessageCallback callback) { - NativeMethods.WimRegisterMessageCallback(IntPtr.Zero, callback, IntPtr.Zero); + WimRegisterMessageCallback(IntPtr.Zero, callback, IntPtr.Zero); int rc = Marshal.GetLastWin32Error(); if (rc != 0) { @@ -1253,7 +1253,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop void UnregisterMessageCallback(MessageCallback registeredCallback) { - bool status = NativeMethods.WimUnregisterMessageCallback(IntPtr.Zero, registeredCallback); + bool status = WimUnregisterMessageCallback(IntPtr.Zero, registeredCallback); _ = Marshal.GetLastWin32Error(); if (status != true) { diff --git a/Disco.ClientBootstrapper/Program.cs b/Disco.ClientBootstrapper/Program.cs index 4ab0def5..76ec367c 100644 --- a/Disco.ClientBootstrapper/Program.cs +++ b/Disco.ClientBootstrapper/Program.cs @@ -153,11 +153,11 @@ namespace Disco.ClientBootstrapper { if (BootstrapperLoop.LoopThread != null) { - if (BootstrapperLoop.LoopThread.ThreadState == System.Threading.ThreadState.WaitSleepJoin) + if (BootstrapperLoop.LoopThread.ThreadState == ThreadState.WaitSleepJoin) { BootstrapperLoop.LoopThread.Interrupt(); } - if (BootstrapperLoop.LoopThread.ThreadState == System.Threading.ThreadState.Running) + if (BootstrapperLoop.LoopThread.ThreadState == ThreadState.Running) { BootstrapperLoop.LoopThread.Abort(); } diff --git a/Disco.Data/Configuration/ConfigurationCache.cs b/Disco.Data/Configuration/ConfigurationCache.cs index 44f12180..9b920b34 100644 --- a/Disco.Data/Configuration/ConfigurationCache.cs +++ b/Disco.Data/Configuration/ConfigurationCache.cs @@ -22,11 +22,11 @@ namespace Disco.Data.Configuration private static ConfigurationCacheType Cache(DiscoDataContext Database) { - if (ConfigurationCache.cacheStore == null) + if (cacheStore == null) { lock (configChangeLock) { - if (ConfigurationCache.cacheStore == null) + if (cacheStore == null) { if (Database == null) throw new InvalidOperationException("The Configuration must be loaded at least once before a Cache-Only Configuration Context is used"); @@ -46,7 +46,7 @@ namespace Disco.Data.Configuration } } - return ConfigurationCache.cacheStore; + return cacheStore; } private static ConfigurationCacheItemType CacheGetItem(DiscoDataContext Database, string Scope, string Key) @@ -160,7 +160,7 @@ namespace Disco.Data.Configuration } private static ConfigurationCacheItemType SetItemTypeValue(ConfigurationCacheItemType ExistingItem, object Value) { - var cache = ConfigurationCache.cacheStore; + var cache = cacheStore; if (cache.TryGetValue(ExistingItem.Item1.Scope, out var scopeCache)) { diff --git a/Disco.Data/Configuration/SystemConfiguration.cs b/Disco.Data/Configuration/SystemConfiguration.cs index fdff44b1..da41f840 100644 --- a/Disco.Data/Configuration/SystemConfiguration.cs +++ b/Disco.Data/Configuration/SystemConfiguration.cs @@ -113,7 +113,7 @@ namespace Disco.Data.Configuration { get { - return System.IO.Path.Combine(DataStoreLocation, "OrganisationLogo.png"); + return Path.Combine(DataStoreLocation, "OrganisationLogo.png"); } } public string OrganisationLogoHash @@ -135,15 +135,15 @@ namespace Disco.Data.Configuration if (File.Exists(path)) return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); else - return new MemoryStream(Disco.Data.Properties.Resources.EmptyLogo); + return new MemoryStream(Properties.Resources.EmptyLogo); } set { string organisationLogoPath = OrganisationLogoPath; if (value == null) { - if (System.IO.File.Exists(organisationLogoPath)) - System.IO.File.Delete(organisationLogoPath); + if (File.Exists(organisationLogoPath)) + File.Delete(organisationLogoPath); } else { diff --git a/Disco.Services/Authorization/Roles/RoleCache.cs b/Disco.Services/Authorization/Roles/RoleCache.cs index f8777fa3..48a60607 100644 --- a/Disco.Services/Authorization/Roles/RoleCache.cs +++ b/Disco.Services/Authorization/Roles/RoleCache.cs @@ -199,7 +199,7 @@ namespace Disco.Services.Authorization.Roles claims.User.ShowDetails = true; } - role.ClaimsJson = Newtonsoft.Json.JsonConvert.SerializeObject(claims); + role.ClaimsJson = JsonConvert.SerializeObject(claims); } Database.SaveChanges(); @@ -217,7 +217,7 @@ namespace Disco.Services.Authorization.Roles claims.Job.Properties.NonWarrantyProperties.RepairProviderDetails = true; } - role.ClaimsJson = Newtonsoft.Json.JsonConvert.SerializeObject(claims); + role.ClaimsJson = JsonConvert.SerializeObject(claims); } Database.SaveChanges(); diff --git a/Disco.Services/DataStore.cs b/Disco.Services/DataStore.cs index d1dd0f6d..35a56f58 100644 --- a/Disco.Services/DataStore.cs +++ b/Disco.Services/DataStore.cs @@ -19,9 +19,9 @@ namespace Disco.Services if (SubSubLocationTimestamp.HasValue) SubSubLocation = SubSubLocationTimestamp.Value.ToString(@"yyyy\\MM"); - string storeDirectory = System.IO.Path.Combine(DiscoConfiguration.DataStoreLocation, SubLocation, SubSubLocation); - if (!System.IO.Directory.Exists(storeDirectory)) - System.IO.Directory.CreateDirectory(storeDirectory); + string storeDirectory = Path.Combine(DiscoConfiguration.DataStoreLocation, SubLocation, SubSubLocation); + if (!Directory.Exists(storeDirectory)) + Directory.CreateDirectory(storeDirectory); return storeDirectory; } diff --git a/Disco.Services/Devices/Enrolment/EnrolmentLog.cs b/Disco.Services/Devices/Enrolment/EnrolmentLog.cs index 72aa80d6..0dd735da 100644 --- a/Disco.Services/Devices/Enrolment/EnrolmentLog.cs +++ b/Disco.Services/Devices/Enrolment/EnrolmentLog.cs @@ -70,7 +70,7 @@ namespace Disco.Services.Devices.Enrolment } private static void Log(EventTypeIds EventTypeId, params object[] Args) { - EnrolmentLog.Current.Log((int)EventTypeId, Args); + Current.Log((int)EventTypeId, Args); } public static void LogSessionStarting(string SessionId, string HostId, EnrolmentTypes EnrolmentType) { @@ -147,11 +147,11 @@ namespace Disco.Services.Devices.Enrolment } public static void LogSessionDeviceInfo(string SessionId, MacEnrol Request) { - EnrolmentLog.LogSessionDeviceInfo(SessionId, Request.DeviceSerialNumber, Request.DeviceUUID, Request.DeviceComputerName, Request.DeviceLanMacAddress, Request.DeviceWlanMacAddress, Request.DeviceManufacturer, Request.DeviceModel, Request.DeviceModelType); + LogSessionDeviceInfo(SessionId, Request.DeviceSerialNumber, Request.DeviceUUID, Request.DeviceComputerName, Request.DeviceLanMacAddress, Request.DeviceWlanMacAddress, Request.DeviceManufacturer, Request.DeviceModel, Request.DeviceModelType); } public static void LogSessionDeviceInfo(string SessionId, Enrol Request) { - EnrolmentLog.LogSessionDeviceInfo( + LogSessionDeviceInfo( SessionId, Request.SerialNumber, Request.Hardware.UUID, diff --git a/Disco.Services/Devices/Importing/CsvDeviceImportDataReader.cs b/Disco.Services/Devices/Importing/CsvDeviceImportDataReader.cs index bc4ec8a1..040c748a 100644 --- a/Disco.Services/Devices/Importing/CsvDeviceImportDataReader.cs +++ b/Disco.Services/Devices/Importing/CsvDeviceImportDataReader.cs @@ -53,7 +53,7 @@ namespace Disco.Services.Devices.Importing public string GetString(int ColumnIndex) { if (currentRow == null) - throw new InvalidOperationException($"{nameof(CsvDeviceImportDataReader.Read)} must be called before retrieving values"); + throw new InvalidOperationException($"{nameof(Read)} must be called before retrieving values"); var value = currentRow[ColumnIndex]; @@ -71,7 +71,7 @@ namespace Disco.Services.Devices.Importing public bool TryGetNullableInt(int ColumnIndex, out int? value) { if (currentRow == null) - throw new InvalidOperationException($"{nameof(CsvDeviceImportDataReader.Read)} must be called before retrieving values"); + throw new InvalidOperationException($"{nameof(Read)} must be called before retrieving values"); return TryGetNullableInt(currentRow[ColumnIndex], out value); } @@ -79,7 +79,7 @@ namespace Disco.Services.Devices.Importing public bool TryGetNullableBool(int ColumnIndex, out bool? value) { if (currentRow == null) - throw new InvalidOperationException($"{nameof(CsvDeviceImportDataReader.Read)} must be called before retrieving values"); + throw new InvalidOperationException($"{nameof(Read)} must be called before retrieving values"); return TryGetNullableBool(currentRow[ColumnIndex], out value); } @@ -87,7 +87,7 @@ namespace Disco.Services.Devices.Importing public bool TryGetNullableDateTime(int ColumnIndex, out DateTime? value) { if (currentRow == null) - throw new InvalidOperationException($"{nameof(CsvDeviceImportDataReader.Read)} must be called before retrieving values"); + throw new InvalidOperationException($"{nameof(Read)} must be called before retrieving values"); return TryGetNullableDateTime(currentRow[ColumnIndex], out value); } diff --git a/Disco.Services/Devices/Importing/XlsxDeviceImportDataReader.cs b/Disco.Services/Devices/Importing/XlsxDeviceImportDataReader.cs index 6107d983..7d113969 100644 --- a/Disco.Services/Devices/Importing/XlsxDeviceImportDataReader.cs +++ b/Disco.Services/Devices/Importing/XlsxDeviceImportDataReader.cs @@ -53,7 +53,7 @@ namespace Disco.Services.Devices.Importing public string GetString(int ColumnIndex) { if (currentRow == null) - throw new InvalidOperationException($"{nameof(XlsxDeviceImportDataReader.Read)} must be called before retrieving values"); + throw new InvalidOperationException($"{nameof(Read)} must be called before retrieving values"); var cell = currentRow[ColumnIndex]; @@ -71,7 +71,7 @@ namespace Disco.Services.Devices.Importing public bool TryGetNullableInt(int ColumnIndex, out int? value) { if (currentRow == null) - throw new InvalidOperationException($"{nameof(XlsxDeviceImportDataReader.Read)} must be called before retrieving values"); + throw new InvalidOperationException($"{nameof(Read)} must be called before retrieving values"); return TryGetNullableInt(currentRow[ColumnIndex], out value); } @@ -79,7 +79,7 @@ namespace Disco.Services.Devices.Importing public bool TryGetNullableBool(int ColumnIndex, out bool? value) { if (currentRow == null) - throw new InvalidOperationException($"{nameof(XlsxDeviceImportDataReader.Read)} must be called before retrieving values"); + throw new InvalidOperationException($"{nameof(Read)} must be called before retrieving values"); return TryGetNullableBool(currentRow[ColumnIndex], out value); } @@ -87,7 +87,7 @@ namespace Disco.Services.Devices.Importing public bool TryGetNullableDateTime(int ColumnIndex, out DateTime? value) { if (currentRow == null) - throw new InvalidOperationException($"{nameof(XlsxDeviceImportDataReader.Read)} must be called before retrieving values"); + throw new InvalidOperationException($"{nameof(Read)} must be called before retrieving values"); return TryGetNullableDateTime(currentRow[ColumnIndex], out value); } diff --git a/Disco.Services/Devices/ManagedGroups/DeviceBatchAssignedUsersManagedGroup.cs b/Disco.Services/Devices/ManagedGroups/DeviceBatchAssignedUsersManagedGroup.cs index 00f94a1c..6e8bb0e8 100644 --- a/Disco.Services/Devices/ManagedGroups/DeviceBatchAssignedUsersManagedGroup.cs +++ b/Disco.Services/Devices/ManagedGroups/DeviceBatchAssignedUsersManagedGroup.cs @@ -98,7 +98,7 @@ namespace Disco.Services.Devices.ManagedGroups if (!string.IsNullOrEmpty(DeviceBatch.AssignedUsersLinkedGroup)) { - var config = ADManagedGroup.ConfigurationFromJson(DeviceBatch.AssignedUsersLinkedGroup); + var config = ConfigurationFromJson(DeviceBatch.AssignedUsersLinkedGroup); if (config != null && !string.IsNullOrWhiteSpace(config.GroupId)) { diff --git a/Disco.Services/Devices/ManagedGroups/DeviceBatchDevicesManagedGroup.cs b/Disco.Services/Devices/ManagedGroups/DeviceBatchDevicesManagedGroup.cs index 88cf9ad9..a964099f 100644 --- a/Disco.Services/Devices/ManagedGroups/DeviceBatchDevicesManagedGroup.cs +++ b/Disco.Services/Devices/ManagedGroups/DeviceBatchDevicesManagedGroup.cs @@ -96,7 +96,7 @@ namespace Disco.Services.Devices.ManagedGroups if (!string.IsNullOrEmpty(DeviceBatch.DevicesLinkedGroup)) { - var config = ADManagedGroup.ConfigurationFromJson(DeviceBatch.DevicesLinkedGroup); + var config = ConfigurationFromJson(DeviceBatch.DevicesLinkedGroup); if (config != null && !string.IsNullOrWhiteSpace(config.GroupId)) { diff --git a/Disco.Services/Devices/ManagedGroups/DeviceProfileAssignedUsersManagedGroup.cs b/Disco.Services/Devices/ManagedGroups/DeviceProfileAssignedUsersManagedGroup.cs index ee70b331..f0afa8a2 100644 --- a/Disco.Services/Devices/ManagedGroups/DeviceProfileAssignedUsersManagedGroup.cs +++ b/Disco.Services/Devices/ManagedGroups/DeviceProfileAssignedUsersManagedGroup.cs @@ -98,7 +98,7 @@ namespace Disco.Services.Devices.ManagedGroups if (!string.IsNullOrEmpty(DeviceProfile.AssignedUsersLinkedGroup)) { - var config = ADManagedGroup.ConfigurationFromJson(DeviceProfile.AssignedUsersLinkedGroup); + var config = ConfigurationFromJson(DeviceProfile.AssignedUsersLinkedGroup); if (config != null && !string.IsNullOrWhiteSpace(config.GroupId)) { diff --git a/Disco.Services/Devices/ManagedGroups/DeviceProfileDevicesManagedGroup.cs b/Disco.Services/Devices/ManagedGroups/DeviceProfileDevicesManagedGroup.cs index d087ea1e..1e460db7 100644 --- a/Disco.Services/Devices/ManagedGroups/DeviceProfileDevicesManagedGroup.cs +++ b/Disco.Services/Devices/ManagedGroups/DeviceProfileDevicesManagedGroup.cs @@ -97,7 +97,7 @@ namespace Disco.Services.Devices.ManagedGroups if (!string.IsNullOrEmpty(DeviceProfile.DevicesLinkedGroup)) { - var config = ADManagedGroup.ConfigurationFromJson(DeviceProfile.DevicesLinkedGroup); + var config = ConfigurationFromJson(DeviceProfile.DevicesLinkedGroup); if (config != null && !string.IsNullOrWhiteSpace(config.GroupId)) { diff --git a/Disco.Services/Documents/AttachmentImport/ImportPage.cs b/Disco.Services/Documents/AttachmentImport/ImportPage.cs index 7fa36222..ee0ff50d 100644 --- a/Disco.Services/Documents/AttachmentImport/ImportPage.cs +++ b/Disco.Services/Documents/AttachmentImport/ImportPage.cs @@ -270,7 +270,7 @@ namespace Disco.Services.Documents.AttachmentImport } // Add PDF Icon overlay - using (Image mimeTypeIcon = Disco.Services.Properties.Resources.MimeType_pdf16) + using (Image mimeTypeIcon = Properties.Resources.MimeType_pdf16) { thumbnail.EmbedIconOverlay(mimeTypeIcon); } diff --git a/Disco.Services/Documents/DocumentsLog.cs b/Disco.Services/Documents/DocumentsLog.cs index cbc9b77e..91df20f6 100644 --- a/Disco.Services/Documents/DocumentsLog.cs +++ b/Disco.Services/Documents/DocumentsLog.cs @@ -62,11 +62,11 @@ namespace Disco.Services.Documents } private static void Log(EventTypeIds EventTypeId, params object[] Args) { - DocumentsLog.Current.Log((int)EventTypeId, Args); + Current.Log((int)EventTypeId, Args); } public static void LogImportStarting(string SessionId, string DocumentName) { - DocumentsLog.Log(DocumentsLog.EventTypeIds.ImportStarting, new object[] + Log(EventTypeIds.ImportStarting, new object[] { SessionId, DocumentName @@ -74,7 +74,7 @@ namespace Disco.Services.Documents } public static void LogImportProgress(string SessionId, int? Progress, string Status) { - DocumentsLog.Log(DocumentsLog.EventTypeIds.ImportProgress, new object[] + Log(EventTypeIds.ImportProgress, new object[] { SessionId, Progress, @@ -83,14 +83,14 @@ namespace Disco.Services.Documents } public static void LogImportFinished(string SessionId) { - DocumentsLog.Log(DocumentsLog.EventTypeIds.ImportFinished, new object[] + Log(EventTypeIds.ImportFinished, new object[] { SessionId }); } public static void LogImportWarning(string SessionId, string Message) { - DocumentsLog.Log(DocumentsLog.EventTypeIds.ImportWarning, new object[] + Log(EventTypeIds.ImportWarning, new object[] { SessionId, Message @@ -98,7 +98,7 @@ namespace Disco.Services.Documents } public static void LogImportError(string SessionId, string Message) { - DocumentsLog.Log(DocumentsLog.EventTypeIds.ImportError, new object[] + Log(EventTypeIds.ImportError, new object[] { SessionId, Message @@ -106,7 +106,7 @@ namespace Disco.Services.Documents } public static void LogImportAttachmentExpressionEvaluated(DocumentTemplate template, IAttachmentTarget target, IAttachment attachment, string Result) { - DocumentsLog.Log(DocumentsLog.EventTypeIds.ImportAttachmentExpressionEvaluated, new object[] + Log(EventTypeIds.ImportAttachmentExpressionEvaluated, new object[] { template.Id, target.AttachmentReferenceId, @@ -116,7 +116,7 @@ namespace Disco.Services.Documents } public static void LogImportPageStarting(string SessionId, int PageNumber) { - DocumentsLog.Log(DocumentsLog.EventTypeIds.ImportPageStarting, new object[] + Log(EventTypeIds.ImportPageStarting, new object[] { SessionId, PageNumber @@ -124,7 +124,7 @@ namespace Disco.Services.Documents } public static void LogImportPageImageUpdate(string SessionId, int PageNumber) { - DocumentsLog.Log(DocumentsLog.EventTypeIds.ImportPageImageUpdate, new object[] + Log(EventTypeIds.ImportPageImageUpdate, new object[] { SessionId, PageNumber @@ -132,7 +132,7 @@ namespace Disco.Services.Documents } public static void LogImportPageProgress(string SessionId, int PageNumber, int? Progress, string Status) { - DocumentsLog.Log(DocumentsLog.EventTypeIds.ImportPageProgress, new object[] + Log(EventTypeIds.ImportPageProgress, new object[] { SessionId, PageNumber, @@ -142,7 +142,7 @@ namespace Disco.Services.Documents } public static void LogImportPageDetected(string SessionId, int PageNumber, string DocumentTypeId, string DocumentTypeName, string TargetType, string AssignedId, string AssignedName) { - DocumentsLog.Log(DocumentsLog.EventTypeIds.ImportPageDetected, new object[] + Log(EventTypeIds.ImportPageDetected, new object[] { SessionId, PageNumber, @@ -155,7 +155,7 @@ namespace Disco.Services.Documents } public static void LogImportPageUndetected(string SessionId, int PageNumber) { - DocumentsLog.Log(DocumentsLog.EventTypeIds.ImportPageUndetected, new object[] + Log(EventTypeIds.ImportPageUndetected, new object[] { SessionId, PageNumber @@ -163,7 +163,7 @@ namespace Disco.Services.Documents } public static void LogImportPageError(string SessionId, int PageNumber, string Message) { - DocumentsLog.Log(DocumentsLog.EventTypeIds.ImportPageError, new object[] + Log(EventTypeIds.ImportPageError, new object[] { SessionId, PageNumber, @@ -172,7 +172,7 @@ namespace Disco.Services.Documents } public static void LogImportPageUndetectedStored(string SessionId, int PageNumber) { - DocumentsLog.Log(DocumentsLog.EventTypeIds.ImportPageUndetectedStored, new object[] + Log(EventTypeIds.ImportPageUndetectedStored, new object[] { SessionId, PageNumber diff --git a/Disco.Services/Documents/ManagedGroups/DocumentTemplateDevicesManagedGroup.cs b/Disco.Services/Documents/ManagedGroups/DocumentTemplateDevicesManagedGroup.cs index ada15101..bc2849a3 100644 --- a/Disco.Services/Documents/ManagedGroups/DocumentTemplateDevicesManagedGroup.cs +++ b/Disco.Services/Documents/ManagedGroups/DocumentTemplateDevicesManagedGroup.cs @@ -129,7 +129,7 @@ namespace Disco.Services.Documents.ManagedGroups if (!string.IsNullOrEmpty(Template.DevicesLinkedGroup)) { - var config = ADManagedGroup.ConfigurationFromJson(Template.DevicesLinkedGroup); + var config = ConfigurationFromJson(Template.DevicesLinkedGroup); if (config != null && !string.IsNullOrWhiteSpace(config.GroupId)) { diff --git a/Disco.Services/Documents/ManagedGroups/DocumentTemplateUsersManagedGroup.cs b/Disco.Services/Documents/ManagedGroups/DocumentTemplateUsersManagedGroup.cs index 5784647b..a74a6938 100644 --- a/Disco.Services/Documents/ManagedGroups/DocumentTemplateUsersManagedGroup.cs +++ b/Disco.Services/Documents/ManagedGroups/DocumentTemplateUsersManagedGroup.cs @@ -124,7 +124,7 @@ namespace Disco.Services.Documents.ManagedGroups if (!string.IsNullOrEmpty(Template.UsersLinkedGroup)) { - var config = ADManagedGroup.ConfigurationFromJson(Template.UsersLinkedGroup); + var config = ConfigurationFromJson(Template.UsersLinkedGroup); if (config != null && !string.IsNullOrWhiteSpace(config.GroupId)) { diff --git a/Disco.Services/Expressions/Extensions/ImageExt.cs b/Disco.Services/Expressions/Extensions/ImageExt.cs index ae0ebf37..0f5f8146 100644 --- a/Disco.Services/Expressions/Extensions/ImageExt.cs +++ b/Disco.Services/Expressions/Extensions/ImageExt.cs @@ -19,7 +19,7 @@ namespace Disco.Services.Expressions.Extensions { var configCache = new Data.Configuration.SystemConfiguration(null); string DataStoreLocation = configCache.DataStoreLocation; - string AbsoluteFilePath = System.IO.Path.Combine(DataStoreLocation, RelativeFilePath); + string AbsoluteFilePath = Path.Combine(DataStoreLocation, RelativeFilePath); return new FileImageExpressionResult(AbsoluteFilePath); } public static FileImageExpressionResult JobAttachmentFirstImage(Job Job, DiscoDataContext Database) @@ -94,14 +94,14 @@ namespace Disco.Services.Expressions.Extensions if (ImageStream == null) throw new ArgumentNullException("ImageStream"); - return new BitmapImageExpressionResult(Bitmap.FromStream(ImageStream)); + return new BitmapImageExpressionResult(Image.FromStream(ImageStream)); } public static BitmapImageExpressionResult ImageFromByteArray(byte[] ImageByteArray) { if (ImageByteArray == null) throw new ArgumentNullException("ImageByteArray"); - return new BitmapImageExpressionResult(Bitmap.FromStream(new MemoryStream(ImageByteArray))); + return new BitmapImageExpressionResult(Image.FromStream(new MemoryStream(ImageByteArray))); } public static BitmapImageExpressionResult DeviceModelImage(DeviceModel DeviceModel) { diff --git a/Disco.Services/Extensions/UIHelpers.cs b/Disco.Services/Extensions/UIHelpers.cs index c4dea2a7..784c9e07 100644 --- a/Disco.Services/Extensions/UIHelpers.cs +++ b/Disco.Services/Extensions/UIHelpers.cs @@ -36,11 +36,11 @@ namespace Disco.Services.Extensions var rnd = new Random(); if (Except != null) { - var availableIcons = UIHelpers.Icons.Select(i => i.Key).Except(Except).ToList(); + var availableIcons = Icons.Select(i => i.Key).Except(Except).ToList(); if (availableIcons.Count > 0) return availableIcons[rnd.Next(availableIcons.Count - 1)]; } - return UIHelpers.Icons[rnd.Next(UIHelpers.Icons.Count - 1)].Key; + return Icons[rnd.Next(Icons.Count - 1)].Key; } /// @@ -59,11 +59,11 @@ namespace Disco.Services.Extensions var rnd = new Random(); if (Except != null) { - var availableColours = UIHelpers.ThemeColours.Select(i => i.Key).Except(Except).ToList(); + var availableColours = ThemeColours.Select(i => i.Key).Except(Except).ToList(); if (availableColours.Count > 0) return availableColours[rnd.Next(availableColours.Count - 1)]; } - return UIHelpers.ThemeColours[rnd.Next(UIHelpers.ThemeColours.Count - 1)].Key; + return ThemeColours[rnd.Next(ThemeColours.Count - 1)].Key; } static UIHelpers() diff --git a/Disco.Services/Interop/ActiveDirectory/ADDomainController.cs b/Disco.Services/Interop/ActiveDirectory/ADDomainController.cs index 7db827f7..f735a313 100644 --- a/Disco.Services/Interop/ActiveDirectory/ADDomainController.cs +++ b/Disco.Services/Interop/ActiveDirectory/ADDomainController.cs @@ -414,7 +414,7 @@ namespace Disco.Services.Interop.ActiveDirectory if (System.IO.File.Exists(tempFileName)) { - DJoinResult = System.Convert.ToBase64String(System.IO.File.ReadAllBytes(tempFileName)); + DJoinResult = Convert.ToBase64String(System.IO.File.ReadAllBytes(tempFileName)); System.IO.File.Delete(tempFileName); } if (string.IsNullOrWhiteSpace(DJoinResult)) diff --git a/Disco.Services/Interop/ActiveDirectory/ADMachineAccount.cs b/Disco.Services/Interop/ActiveDirectory/ADMachineAccount.cs index bb7c543a..225f87f6 100644 --- a/Disco.Services/Interop/ActiveDirectory/ADMachineAccount.cs +++ b/Disco.Services/Interop/ActiveDirectory/ADMachineAccount.cs @@ -388,7 +388,7 @@ namespace Disco.Services.Interop.ActiveDirectory netbootGUID = NetbootGUIDFromMACAddress(MACAddress); } - if (netbootGUID != System.Guid.Empty && netbootGUID != NetbootGUID) + if (netbootGUID != Guid.Empty && netbootGUID != NetbootGUID) { SetNetbootGUID(WritableDomainController, netbootGUID); return true; @@ -418,7 +418,7 @@ namespace Disco.Services.Interop.ActiveDirectory } else { - NetbootGUIDFromMACAddress = System.Guid.Empty; + NetbootGUIDFromMACAddress = Guid.Empty; } return NetbootGUIDFromMACAddress; } diff --git a/Disco.Services/Interop/ActiveDirectory/ActiveDirectory.cs b/Disco.Services/Interop/ActiveDirectory/ActiveDirectory.cs index 0390d410..20aab88f 100644 --- a/Disco.Services/Interop/ActiveDirectory/ActiveDirectory.cs +++ b/Disco.Services/Interop/ActiveDirectory/ActiveDirectory.cs @@ -74,7 +74,7 @@ namespace Disco.Services.Interop.ActiveDirectory return domain.GetAvailableDomainController().RetrieveADUserAccount(User.UserId, AdditionalProperties); } - public static IEnumerable SearchADUserAccounts(string Term, bool Quick, int? ResultLimit = ActiveDirectory.DefaultSearchResultLimit, params string[] AdditionalProperties) + public static IEnumerable SearchADUserAccounts(string Term, bool Quick, int? ResultLimit = DefaultSearchResultLimit, params string[] AdditionalProperties) { if (string.IsNullOrWhiteSpace(Term)) throw new ArgumentNullException("Term"); @@ -133,7 +133,7 @@ namespace Disco.Services.Interop.ActiveDirectory return domain.GetAvailableDomainController().RetrieveADGroupWithSecurityIdentifier(SecurityIdentifier, AdditionalProperties); } - public static IEnumerable SearchADGroups(string Term, int? ResultLimit = ActiveDirectory.DefaultSearchResultLimit, params string[] AdditionalProperties) + public static IEnumerable SearchADGroups(string Term, int? ResultLimit = DefaultSearchResultLimit, params string[] AdditionalProperties) { if (string.IsNullOrWhiteSpace(Term)) throw new ArgumentNullException("Term"); @@ -279,7 +279,7 @@ namespace Disco.Services.Interop.ActiveDirectory else { AccountUsername = AccountId.Substring(slashIndex + 1); - return ActiveDirectory.Context.TryGetDomainByNetBiosName(AccountId.Substring(0, slashIndex), out Domain); + return Context.TryGetDomainByNetBiosName(AccountId.Substring(0, slashIndex), out Domain); } } @@ -291,7 +291,7 @@ namespace Disco.Services.Interop.ActiveDirectory { var slashIndex = AccountId.IndexOf('\\'); - if (slashIndex > 0 && AccountId.Substring(0, slashIndex).Equals(ActiveDirectory.Context.PrimaryDomain.NetBiosName, StringComparison.OrdinalIgnoreCase)) + if (slashIndex > 0 && AccountId.Substring(0, slashIndex).Equals(Context.PrimaryDomain.NetBiosName, StringComparison.OrdinalIgnoreCase)) return AccountId.Substring(slashIndex + 1); else return AccountId; diff --git a/Disco.Services/Interop/DiscoServices/ActivationService.cs b/Disco.Services/Interop/DiscoServices/ActivationService.cs index 40f69399..f96277aa 100644 --- a/Disco.Services/Interop/DiscoServices/ActivationService.cs +++ b/Disco.Services/Interop/DiscoServices/ActivationService.cs @@ -82,7 +82,7 @@ namespace Disco.Services.Interop.DiscoServices }; var requestJson = JsonConvert.SerializeObject(body); - using (var request = new ByteArrayContent(System.Text.Encoding.UTF8.GetBytes(requestJson))) + using (var request = new ByteArrayContent(Encoding.UTF8.GetBytes(requestJson))) { request.Headers.ContentType = new MediaTypeHeaderValue("application/json"); diff --git a/Disco.Services/Interop/DiscoServices/Jobs.cs b/Disco.Services/Interop/DiscoServices/Jobs.cs index 80761937..70633a40 100644 --- a/Disco.Services/Interop/DiscoServices/Jobs.cs +++ b/Disco.Services/Interop/DiscoServices/Jobs.cs @@ -46,7 +46,7 @@ namespace Disco.Services.Interop.DiscoServices { Attachments .Select(a => new { Attachment = a, Filename = AttachmentFilenameRetriever(a, Database) }) - .Where(a => System.IO.File.Exists(a.Filename)) + .Where(a => File.Exists(a.Filename)) .Select((a, i) => new { Attachment = a.Attachment, Filename = a.Filename, Index = i }) .ToList() .ForEach(a => diff --git a/Disco.Services/Interop/DiscoServices/LicenseValidationTask.cs b/Disco.Services/Interop/DiscoServices/LicenseValidationTask.cs index 0abb8ef2..f6eb1ed6 100644 --- a/Disco.Services/Interop/DiscoServices/LicenseValidationTask.cs +++ b/Disco.Services/Interop/DiscoServices/LicenseValidationTask.cs @@ -104,7 +104,7 @@ namespace Disco.Services.Interop.DiscoServices var appVersion = typeof(LicenseValidationTask).Assembly.GetName().Version.ToString(4); var updateUrl = $"{DiscoServiceHelpers.ServicesUrl}API/License/V1"; - HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(updateUrl); + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(updateUrl); // Fix for Proxy Servers which don't support KeepAlive request.KeepAlive = false; diff --git a/Disco.Services/Interop/DiscoServices/PluginLibrary.cs b/Disco.Services/Interop/DiscoServices/PluginLibrary.cs index 13d08848..be40143c 100644 --- a/Disco.Services/Interop/DiscoServices/PluginLibrary.cs +++ b/Disco.Services/Interop/DiscoServices/PluginLibrary.cs @@ -105,7 +105,7 @@ namespace Disco.Services.Interop.DiscoServices var manifestJson = JsonConvert.SerializeObject(result, Formatting.Indented); - var manifestFile = PluginLibrary.ManifestFilename(Database); + var manifestFile = ManifestFilename(Database); if (!Directory.Exists(Path.GetDirectoryName(manifestFile))) Directory.CreateDirectory(Path.GetDirectoryName(manifestFile)); diff --git a/Disco.Services/Interop/DiscoServices/UpdateQuery.cs b/Disco.Services/Interop/DiscoServices/UpdateQuery.cs index e3222ca5..2477e318 100644 --- a/Disco.Services/Interop/DiscoServices/UpdateQuery.cs +++ b/Disco.Services/Interop/DiscoServices/UpdateQuery.cs @@ -69,7 +69,7 @@ namespace Disco.Services.Interop.DiscoServices var discoVersion = CurrentDiscoVersionFormatted(); - HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(UpdateUrl()); + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(UpdateUrl()); // Fix for Proxy Servers which don't support KeepAlive request.KeepAlive = false; @@ -223,7 +223,7 @@ namespace Disco.Services.Interop.DiscoServices }).ToList(); } - m.InstalledPlugins = Disco.Services.Plugins.Plugins.GetPlugins().Select(manifest => new StatisticString() { Key = manifest.Id, Value = manifest.VersionFormatted }).ToList(); + m.InstalledPlugins = Plugins.Plugins.GetPlugins().Select(manifest => new StatisticString() { Key = manifest.Id, Value = manifest.VersionFormatted }).ToList(); return m; } diff --git a/Disco.Services/Interop/VicEduDept/VicSmart.cs b/Disco.Services/Interop/VicEduDept/VicSmart.cs index a53289e3..7c27ab16 100644 --- a/Disco.Services/Interop/VicEduDept/VicSmart.cs +++ b/Disco.Services/Interop/VicEduDept/VicSmart.cs @@ -50,7 +50,7 @@ namespace Disco.Services.Interop.VicEduDept { var DiscoBIVersion = UpdateQuery.CurrentDiscoVersionFormatted(); - HttpWebRequest wReq = (HttpWebRequest)HttpWebRequest.Create("http://broadband.doe.wan/ipsearch/showresult.php"); + HttpWebRequest wReq = (HttpWebRequest)WebRequest.Create("http://broadband.doe.wan/ipsearch/showresult.php"); // Fix for Proxy Servers which don't support KeepAlive wReq.KeepAlive = false; diff --git a/Disco.Services/Jobs/Noticeboards/HeldDevices.cs b/Disco.Services/Jobs/Noticeboards/HeldDevices.cs index 5769096e..27d92f3e 100644 --- a/Disco.Services/Jobs/Noticeboards/HeldDevices.cs +++ b/Disco.Services/Jobs/Noticeboards/HeldDevices.cs @@ -178,7 +178,7 @@ namespace Disco.Services.Jobs.Noticeboards // Notify Held Devices - HeldDevices.BroadcastUpdates(Database, deviceSerialNumbers); + BroadcastUpdates(Database, deviceSerialNumbers); // Notify Held Devices for Users HeldDevicesForUsers.BroadcastUpdates(Database, userIds); @@ -203,7 +203,7 @@ namespace Disco.Services.Jobs.Noticeboards }); NoticeboardUpdatesHub.HubContext.Clients - .Group(HeldDevices.Name) + .Group(Name) .updateHeldDevice(updates); } } diff --git a/Disco.Services/Jobs/Noticeboards/HeldDevicesForUsers.cs b/Disco.Services/Jobs/Noticeboards/HeldDevicesForUsers.cs index 0c9989e7..11afac66 100644 --- a/Disco.Services/Jobs/Noticeboards/HeldDevicesForUsers.cs +++ b/Disco.Services/Jobs/Noticeboards/HeldDevicesForUsers.cs @@ -32,7 +32,7 @@ namespace Disco.Services.Jobs.Noticeboards }); NoticeboardUpdatesHub.HubContext.Clients - .Group(HeldDevicesForUsers.Name) + .Group(Name) .updateHeldDeviceForUser(updates); } } diff --git a/Disco.Services/Logging/ReadLogContext.cs b/Disco.Services/Logging/ReadLogContext.cs index bb224d47..7992771a 100644 --- a/Disco.Services/Logging/ReadLogContext.cs +++ b/Disco.Services/Logging/ReadLogContext.cs @@ -48,7 +48,7 @@ namespace Disco.Services.Logging { var query = BuildQuery(context, logFile.Item2, results.Count); IEnumerable queryResults = query; // Run the Query - results.AddRange(queryResults.Select(le => Models.LogLiveEvent.Create(logModules[le.ModuleId], logModules[le.ModuleId].EventTypes[le.EventTypeId], le.Timestamp, le.Arguments))); + results.AddRange(queryResults.Select(le => LogLiveEvent.Create(logModules[le.ModuleId], logModules[le.ModuleId].EventTypes[le.EventTypeId], le.Timestamp, le.Arguments))); } if (Take.HasValue && Take.Value < results.Count) break; diff --git a/Disco.Services/Plugins/Features/CertificateProvider/CertificateProviderLog.cs b/Disco.Services/Plugins/Features/CertificateProvider/CertificateProviderLog.cs index 5eece643..d2ebbfd7 100644 --- a/Disco.Services/Plugins/Features/CertificateProvider/CertificateProviderLog.cs +++ b/Disco.Services/Plugins/Features/CertificateProvider/CertificateProviderLog.cs @@ -39,7 +39,7 @@ namespace Disco.Services.Plugins.Features.CertificateProvider { get { - return CertificateProvidersLog._IsCertificateRetrievalProcessing; + return _IsCertificateRetrievalProcessing; } } public override string ModuleDescription @@ -69,11 +69,11 @@ namespace Disco.Services.Plugins.Features.CertificateProvider } private static void Log(EventTypeIds EventTypeId, params object[] Args) { - CertificateProvidersLog.Current.Log((int)EventTypeId, Args); + Current.Log((int)EventTypeId, Args); } public static void LogRetrievalStarting(int CertificateCount, int CertificateIdFrom, int CertificateIdTo) { - CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalStarting, new object[] + Log(EventTypeIds.RetrievalStarting, new object[] { CertificateCount, CertificateIdFrom, @@ -82,61 +82,61 @@ namespace Disco.Services.Plugins.Features.CertificateProvider } public static void LogRetrievalFinished() { - CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalFinished, new object[0]); + Log(EventTypeIds.RetrievalFinished, new object[0]); } public static void LogRetrievalWarning(string Message) { - CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalWarning, new object[] + Log(EventTypeIds.RetrievalWarning, new object[] { Message }); } public static void LogRetrievalError(string Message) { - CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalError, new object[] + Log(EventTypeIds.RetrievalError, new object[] { Message }); } public static void LogRetrievalCertificateStarting(string CertificateId) { - CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalCertificateStarting, CertificateId); + Log(EventTypeIds.RetrievalCertificateStarting, CertificateId); } public static void LogRetrievalCertificateFinished(string CertificateId) { - CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalCertificateFinished, CertificateId); + Log(EventTypeIds.RetrievalCertificateFinished, CertificateId); } public static void LogRetrievalCertificateWarning(string CertificateId, string Message) { - CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalCertificateWarning, CertificateId, Message); + Log(EventTypeIds.RetrievalCertificateWarning, CertificateId, Message); } public static void LogRetrievalCertificateError(string CertificateId, string Message) { - CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalCertificateError, CertificateId, Message); + Log(EventTypeIds.RetrievalCertificateError, CertificateId, Message); } public static void LogAllocated(string CertificateId, string DeviceSerialNumber) { - CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.Allocated, CertificateId, DeviceSerialNumber); + Log(EventTypeIds.Allocated, CertificateId, DeviceSerialNumber); } public static void LogAllocationFailed(string DeviceSerialNumber) { - CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.AllocationFailed, DeviceSerialNumber); + Log(EventTypeIds.AllocationFailed, DeviceSerialNumber); } public static void LogDisabledCertificate(DeviceCertificate Certificate, string Reason) { - CertificateProvidersLog.Log(EventTypeIds.DisabledCertificate, Certificate.Name, Certificate.Id, Reason); + Log(EventTypeIds.DisabledCertificate, Certificate.Name, Certificate.Id, Reason); } public static void LogEnabledCertificate(DeviceCertificate Certificate, string Reason) { - CertificateProvidersLog.Log(EventTypeIds.EnabledCertificate, Certificate.Name, Certificate.Id, Reason); + Log(EventTypeIds.EnabledCertificate, Certificate.Name, Certificate.Id, Reason); } public static void LogDeletedCertificate(DeviceCertificate Certificate, string Reason) { - CertificateProvidersLog.Log(EventTypeIds.DeletedCertificate, Certificate.Name, Certificate.Id, Reason); + Log(EventTypeIds.DeletedCertificate, Certificate.Name, Certificate.Id, Reason); } public static void LogUpdatedCertificate(DeviceCertificate Certificate, string Reason) { - CertificateProvidersLog.Log(EventTypeIds.UpdatedCertificate, Certificate.Name, Certificate.Id, Reason); + Log(EventTypeIds.UpdatedCertificate, Certificate.Name, Certificate.Id, Reason); } public static void LogCertificateRetrievalProgress(bool? IsProcessing, int? Progress, string Status) @@ -144,32 +144,32 @@ namespace Disco.Services.Plugins.Features.CertificateProvider bool flag = IsProcessing.HasValue; if (flag) { - CertificateProvidersLog._IsCertificateRetrievalProcessing = IsProcessing.Value; + _IsCertificateRetrievalProcessing = IsProcessing.Value; } - flag = CertificateProvidersLog._IsCertificateRetrievalProcessing; + flag = _IsCertificateRetrievalProcessing; if (flag) { bool flag2 = Status != null; if (flag2) { - CertificateProvidersLog._CertificateRetrievalStatus = Status; + _CertificateRetrievalStatus = Status; } flag2 = Progress.HasValue; if (flag2) { - CertificateProvidersLog._CertificateRetrievalProgress = Progress.Value; + _CertificateRetrievalProgress = Progress.Value; } } else { - CertificateProvidersLog._CertificateRetrievalStatus = null; - CertificateProvidersLog._CertificateRetrievalProgress = 0; + _CertificateRetrievalStatus = null; + _CertificateRetrievalProgress = 0; } - CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalProgress, new object[] + Log(EventTypeIds.RetrievalProgress, new object[] { - CertificateProvidersLog._IsCertificateRetrievalProcessing, - CertificateProvidersLog._CertificateRetrievalProgress, - CertificateProvidersLog._CertificateRetrievalStatus + _IsCertificateRetrievalProcessing, + _CertificateRetrievalProgress, + _CertificateRetrievalStatus }); } protected override System.Collections.Generic.List LoadEventTypes() diff --git a/Disco.Services/Plugins/Features/UIExtension/UIExtensions.cs b/Disco.Services/Plugins/Features/UIExtension/UIExtensions.cs index e2d3d442..5df4841f 100644 --- a/Disco.Services/Plugins/Features/UIExtension/UIExtensions.cs +++ b/Disco.Services/Plugins/Features/UIExtension/UIExtensions.cs @@ -33,7 +33,7 @@ namespace Disco.Services.Plugins.Features.UIExtension public static void ExecuteExtensions(ControllerContext context, UIModel model) where UIModel : BaseUIModel { - var uiExts = UIExtensions.GetRegisteredExtensions(); + var uiExts = GetRegisteredExtensions(); Queue uiExtResults = new Queue(); foreach (var uiExt in uiExts) { diff --git a/Disco.Services/Plugins/PluginManifest.cs b/Disco.Services/Plugins/PluginManifest.cs index bc769891..3c239bdc 100644 --- a/Disco.Services/Plugins/PluginManifest.cs +++ b/Disco.Services/Plugins/PluginManifest.cs @@ -516,7 +516,7 @@ namespace Disco.Services.Plugins if (WebResourceHashes.TryGetValue(resourceKey, out var resourceHash)) { #if DEBUG - var fileDateCheck = System.IO.File.GetLastWriteTime(resourcePath); + var fileDateCheck = File.GetLastWriteTime(resourcePath); if (fileDateCheck == resourceHash.Item2) #endif return new Tuple(resourcePath, resourceHash.Item1); @@ -525,8 +525,8 @@ namespace Disco.Services.Plugins if (!File.Exists(resourcePath)) throw new FileNotFoundException($"Resource [{Resource}] not found", resourcePath); - var fileDate = System.IO.File.GetLastWriteTime(resourcePath); - var fileBytes = System.IO.File.ReadAllBytes(resourcePath); + var fileDate = File.GetLastWriteTime(resourcePath); + var fileBytes = File.ReadAllBytes(resourcePath); if (fileBytes.Length > 0) { using (SHA256 sha = SHA256.Create()) diff --git a/Disco.Services/Plugins/Plugins.cs b/Disco.Services/Plugins/Plugins.cs index 43efc4e6..4300ed38 100644 --- a/Disco.Services/Plugins/Plugins.cs +++ b/Disco.Services/Plugins/Plugins.cs @@ -41,7 +41,7 @@ namespace Disco.Services.Plugins _PluginManifests[Manifest.Id] = Manifest; // Reinitialize Plugin Host Environment - Plugins.ReinitializePluginHostEnvironment(); + ReinitializePluginHostEnvironment(); } } @@ -335,7 +335,7 @@ namespace Disco.Services.Plugins catch (UnauthorizedAccessException ex) { lastAccessException = ex; } if (removeRetryTime < DateTime.Now) throw lastAccessException; - System.Threading.Thread.Sleep(2000); + Thread.Sleep(2000); } // Check for Data Removal diff --git a/Disco.Services/Tasks/ScheduledTasks.cs b/Disco.Services/Tasks/ScheduledTasks.cs index 8963b2d1..715e61a7 100644 --- a/Disco.Services/Tasks/ScheduledTasks.cs +++ b/Disco.Services/Tasks/ScheduledTasks.cs @@ -194,18 +194,18 @@ namespace Disco.Services.Tasks { public void Execute(IJobExecutionContext context) { - lock (ScheduledTasks._RunningTasksLock) + lock (_RunningTasksLock) { // Lifetime = 5mins var expiredTime = DateTime.Now.AddMinutes(-1); - var expiredTasks = ScheduledTasks._RunningTasks.Where( + var expiredTasks = _RunningTasks.Where( t => !t.IsRunning && !t.NextScheduledTimestamp.HasValue && t.FinishedTimestamp < expiredTime ).ToArray(); foreach (var expiredTask in expiredTasks) - ScheduledTasks._RunningTasks.Remove(expiredTask); + _RunningTasks.Remove(expiredTask); } } public static void Schedule(IScheduler TaskScheduler) @@ -219,11 +219,11 @@ namespace Disco.Services.Tasks ITrigger trigger = TriggerBuilder.Create() .StartAt(startAt) .WithSchedule(SimpleScheduleBuilder.RepeatMinutelyForever(10)) - .WithIdentity("ScheduledTaskCleanupTrigger", ScheduledTasks.SchedulerGroupName + "_System") + .WithIdentity("ScheduledTaskCleanupTrigger", SchedulerGroupName + "_System") .Build(); IJobDetail job = JobBuilder.Create() - .WithIdentity("ScheduledTaskCleanupJob", ScheduledTasks.SchedulerGroupName + "_System") + .WithIdentity("ScheduledTaskCleanupJob", SchedulerGroupName + "_System") .Build(); _TaskScheduler.ScheduleJob(job, trigger); diff --git a/Disco.Services/Users/UserFlags/UserFlagUserDevicesManagedGroup.cs b/Disco.Services/Users/UserFlags/UserFlagUserDevicesManagedGroup.cs index 6949b604..f329475b 100644 --- a/Disco.Services/Users/UserFlags/UserFlagUserDevicesManagedGroup.cs +++ b/Disco.Services/Users/UserFlags/UserFlagUserDevicesManagedGroup.cs @@ -79,7 +79,7 @@ namespace Disco.Services.Users.UserFlags if (!string.IsNullOrEmpty(UserFlag.UserDevicesLinkedGroup)) { - var config = ADManagedGroup.ConfigurationFromJson(UserFlag.UserDevicesLinkedGroup); + var config = ConfigurationFromJson(UserFlag.UserDevicesLinkedGroup); if (config != null && !string.IsNullOrWhiteSpace(config.GroupId)) { diff --git a/Disco.Services/Users/UserFlags/UserFlagUsersManagedGroup.cs b/Disco.Services/Users/UserFlags/UserFlagUsersManagedGroup.cs index d19c6322..ee09efc5 100644 --- a/Disco.Services/Users/UserFlags/UserFlagUsersManagedGroup.cs +++ b/Disco.Services/Users/UserFlags/UserFlagUsersManagedGroup.cs @@ -79,7 +79,7 @@ namespace Disco.Services.Users.UserFlags if (!string.IsNullOrEmpty(UserFlag.UsersLinkedGroup)) { - var config = ADManagedGroup.ConfigurationFromJson(UserFlag.UsersLinkedGroup); + var config = ConfigurationFromJson(UserFlag.UsersLinkedGroup); if (config != null && !string.IsNullOrWhiteSpace(config.GroupId)) { diff --git a/Disco.Services/Users/UserService.cs b/Disco.Services/Users/UserService.cs index 6a995ec7..bbe5520a 100644 --- a/Disco.Services/Users/UserService.cs +++ b/Disco.Services/Users/UserService.cs @@ -20,7 +20,7 @@ namespace Disco.Services.Users public static void Initialize(DiscoDataContext Database) { - Authorization.Roles.RoleCache.Initialize(Database); + RoleCache.Initialize(Database); } public static string CurrentUserId @@ -221,7 +221,7 @@ namespace Disco.Services.Users else Database.Users.Add(adU); Database.SaveChanges(); - UserService.InvalidateCachedUser(adU.UserId); + InvalidateCachedUser(adU.UserId); } } diff --git a/Disco.Services/Web/HelperExtensions.cs b/Disco.Services/Web/HelperExtensions.cs index 21f3adc5..c8c45e21 100644 --- a/Disco.Services/Web/HelperExtensions.cs +++ b/Disco.Services/Web/HelperExtensions.cs @@ -59,7 +59,7 @@ namespace Disco.Services.Web } else { - Disco.Services.Logging.SystemLog.LogException("Global Application Exception Caught", Exception); + Logging.SystemLog.LogException("Global Application Exception Caught", Exception); } } catch (Exception) diff --git a/Disco.Web/App_Start/AppConfig.cs b/Disco.Web/App_Start/AppConfig.cs index 62438c1f..16ac9102 100644 --- a/Disco.Web/App_Start/AppConfig.cs +++ b/Disco.Web/App_Start/AppConfig.cs @@ -14,14 +14,14 @@ namespace Disco.Web // Modified Connection Factory System.Data.Entity.Database.DefaultConnectionFactory = new DiscoDatabaseConnectionFactory(System.Data.Entity.Database.DefaultConnectionFactory); - if (Disco.Data.Repository.DiscoDatabaseConnectionFactory.DiscoDataContextConnectionString == null) + if (DiscoDatabaseConnectionFactory.DiscoDataContextConnectionString == null) { // Database Connection String not configured - Trigger 'Install' return false; } // Migrate Database - Disco.Data.Migrations.DiscoDataMigrator.MigrateLatest(true); + Data.Migrations.DiscoDataMigrator.MigrateLatest(true); return true; } @@ -29,7 +29,7 @@ namespace Disco.Web public static void InitalizeCoreEnvironment(DiscoDataContext Database) { // Initialize Logging - Disco.Services.Logging.LogContext.Initalize(Database, DiscoApplication.SchedulerFactory); + Services.Logging.LogContext.Initalize(Database, DiscoApplication.SchedulerFactory); // Load Organisation Name DiscoApplication.DeploymentId = Database.DiscoConfiguration.DeploymentId; @@ -37,7 +37,7 @@ namespace Disco.Web DiscoApplication.MultiSiteMode = Database.DiscoConfiguration.MultiSiteMode; // Initialize Active Directory Interop - Disco.Services.Interop.ActiveDirectory.ActiveDirectory.Initialize(Database); + Services.Interop.ActiveDirectory.ActiveDirectory.Initialize(Database); // Setup Global Proxy DiscoApplication.SetGlobalProxy(Database.DiscoConfiguration.ProxyAddress, @@ -46,7 +46,7 @@ namespace Disco.Web Database.DiscoConfiguration.ProxyPassword); // Initialize User Service Interop - Disco.Services.Users.UserService.Initialize(Database); + Services.Users.UserService.Initialize(Database); } public static void InitalizeNormalEnvironment(DiscoDataContext Database) @@ -54,25 +54,25 @@ namespace Disco.Web InitalizeCoreEnvironment(Database); // Initialize Expressions - Disco.Services.Expressions.Extensions.ImageResultImplementations.QrCodeImageExpressionResult.CCITTG4EncoderCompressDelegate = Disco.BI.Interop.Pdf.Utilities.GetCCITTG4EncoderCompressDelegate(); - Disco.Services.Expressions.Expression.InitializeExpressions(); + Services.Expressions.Extensions.ImageResultImplementations.QrCodeImageExpressionResult.CCITTG4EncoderCompressDelegate = BI.Interop.Pdf.Utilities.GetCCITTG4EncoderCompressDelegate(); + Services.Expressions.Expression.InitializeExpressions(); // Initialize Job Queues - Disco.Services.Jobs.JobQueues.JobQueueService.Initialize(Database); + Services.Jobs.JobQueues.JobQueueService.Initialize(Database); // Initialize Flags - Disco.Services.Users.UserFlags.UserFlagService.Initialize(Database); - Disco.Services.Devices.DeviceFlags.DeviceFlagService.Initialize(Database); + Services.Users.UserFlags.UserFlagService.Initialize(Database); + Services.Devices.DeviceFlags.DeviceFlagService.Initialize(Database); // Initialize Satellite Managed Groups (which don't belong to any other component) - Disco.Services.Devices.ManagedGroups.DeviceManagedGroups.Initialize(Database); - Disco.Services.Documents.ManagedGroups.DocumentTemplateManagedGroups.Initialize(Database); + Services.Devices.ManagedGroups.DeviceManagedGroups.Initialize(Database); + Services.Documents.ManagedGroups.DocumentTemplateManagedGroups.Initialize(Database); // Initialize Plugins - Disco.Services.Plugins.Plugins.InitalizePlugins(Database); + Services.Plugins.Plugins.InitalizePlugins(Database); // Initialize Scheduled Tasks - Disco.Services.Tasks.ScheduledTasks.InitializeScheduledTasks(Database, DiscoApplication.SchedulerFactory, true); + Services.Tasks.ScheduledTasks.InitializeScheduledTasks(Database, DiscoApplication.SchedulerFactory, true); // Schedule Immediate Check for Update (if never updated, or last updated over 2 days ago) if (Database.DiscoConfiguration.UpdateLastCheckResponse == null || @@ -98,7 +98,7 @@ namespace Disco.Web InitalizeCoreEnvironment(Database); // Initialize Scheduled Tasks - Disco.Services.Tasks.ScheduledTasks.InitializeScheduledTasks(Database, DiscoApplication.SchedulerFactory, false); + Services.Tasks.ScheduledTasks.InitializeScheduledTasks(Database, DiscoApplication.SchedulerFactory, false); // Import MAC Address Migration if (PreviousVersion != null && PreviousVersion < new Version(1, 2, 910, 0)) @@ -128,7 +128,7 @@ namespace Disco.Web } } - Disco.Services.Logging.SystemLog.LogUninitialized(); + Services.Logging.SystemLog.LogUninitialized(); } } } \ No newline at end of file diff --git a/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs b/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs index af5fcb91..10ed502a 100644 --- a/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs +++ b/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs @@ -496,7 +496,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult ImporterThumbnail(string SessionId, int PageNumber) { var dataStoreSessionPagesCacheLocation = DataStore.CreateLocation(Database, "Cache\\DocumentDropBox_SessionPages"); - var filename = System.IO.Path.Combine(dataStoreSessionPagesCacheLocation, $"{SessionId}-{PageNumber}"); + var filename = Path.Combine(dataStoreSessionPagesCacheLocation, $"{SessionId}-{PageNumber}"); if (System.IO.File.Exists(filename)) return File(filename, "image/png"); else @@ -510,7 +510,7 @@ namespace Disco.Web.Areas.API.Controllers var undetectedDirectory = new DirectoryInfo(undetectedLocation); var m = undetectedDirectory.GetFiles("*.pdf").Select(f => new ImporterUndetectedFilesModel() { - Id = System.IO.Path.GetFileNameWithoutExtension(f.Name), + Id = Path.GetFileNameWithoutExtension(f.Name), Timestamp = f.CreationTime.ToFullDateTime(), TimestampUnixEpoc = f.CreationTime.ToUnixEpoc() }).ToArray(); @@ -556,13 +556,13 @@ namespace Disco.Web.Areas.API.Controllers switch (searchScope) { case DocumentTemplate.DocumentTemplateScopes.Device: - results = Disco.Services.Searching.Search.SearchDevices(Database, term, limitCount).Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray(); + results = Disco.Services.Searching.Search.SearchDevices(Database, term, limitCount).Select(sr => ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray(); break; case DocumentTemplate.DocumentTemplateScopes.Job: - results = Disco.Services.Searching.Search.SearchJobsTable(Database, term, limitCount, false).Items.Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray(); + results = Disco.Services.Searching.Search.SearchJobsTable(Database, term, limitCount, false).Items.Select(sr => ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray(); break; case DocumentTemplate.DocumentTemplateScopes.User: - results = Disco.Services.Searching.Search.SearchUsers(Database, term, false, limitCount).Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray(); + results = Disco.Services.Searching.Search.SearchUsers(Database, term, false, limitCount).Select(sr => ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray(); break; default: results = null; @@ -584,7 +584,7 @@ namespace Disco.Web.Areas.API.Controllers var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned"); if (Source.HasValue && Source.Value) { - var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".pdf")); + var filename = Path.Combine(undetectedLocation, string.Concat(id, ".pdf")); if (System.IO.File.Exists(filename)) return File(filename, DocumentTemplate.PdfMimeType); else @@ -594,7 +594,7 @@ namespace Disco.Web.Areas.API.Controllers { if (Thumbnail.HasValue && Thumbnail.Value) { - var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png")); + var filename = Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png")); if (System.IO.File.Exists(filename)) return File(filename, "image/png"); else @@ -602,7 +602,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".jpg")); + var filename = Path.Combine(undetectedLocation, string.Concat(id, ".jpg")); if (System.IO.File.Exists(filename)) return File(filename, "image/jpeg"); else @@ -617,7 +617,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult ImporterUndetectedAssign(string id, string DocumentTemplateId, string DataId) { var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned"); - var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".pdf")); + var filename = Path.Combine(undetectedLocation, string.Concat(id, ".pdf")); var identifier = DocumentUniqueIdentifier.Create(Database, DocumentTemplateId, DataId, UserService.CurrentUser.UserId, DateTime.Now, 0); if (Disco.Services.Documents.AttachmentImport.Importer.ImportPdfAttachment(identifier, Database, filename) != null) @@ -626,10 +626,10 @@ namespace Disco.Web.Areas.API.Controllers System.IO.File.Delete(filename); // Delete Thumbnail/Preview - var thumbnailFilename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png")); + var thumbnailFilename = Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png")); if (System.IO.File.Exists(thumbnailFilename)) System.IO.File.Delete(thumbnailFilename); - var previewFilename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".jpg")); + var previewFilename = Path.Combine(undetectedLocation, string.Concat(id, ".jpg")); if (System.IO.File.Exists(previewFilename)) System.IO.File.Delete(previewFilename); @@ -645,17 +645,17 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult ImporterUndetectedDelete(string id) { var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned"); - var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".pdf")); + var filename = Path.Combine(undetectedLocation, string.Concat(id, ".pdf")); if (System.IO.File.Exists(filename)) { // Delete File System.IO.File.Delete(filename); // Delete Thumbnail/Preview - var thumbnailFilename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png")); + var thumbnailFilename = Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png")); if (System.IO.File.Exists(thumbnailFilename)) System.IO.File.Delete(thumbnailFilename); - var previewFilename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".jpg")); + var previewFilename = Path.Combine(undetectedLocation, string.Concat(id, ".jpg")); if (System.IO.File.Exists(previewFilename)) System.IO.File.Delete(previewFilename); @@ -820,7 +820,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateAddUsers(string userIds) { if (string.IsNullOrWhiteSpace(userIds)) - return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest); + return new HttpStatusCodeResult(HttpStatusCode.BadRequest); var dataIds = userIds.Split(new string[] { Environment.NewLine, ",", ";" }, StringSplitOptions.RemoveEmptyEntries).Select(d => d.Trim()).Where(d => !string.IsNullOrEmpty(d)).ToList(); var results = new List(dataIds.Count); @@ -893,7 +893,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateAddGroupMembers(string groupId) { if (string.IsNullOrWhiteSpace(groupId)) - return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest); + return new HttpStatusCodeResult(HttpStatusCode.BadRequest); var results = new List(); var accountId = ActiveDirectory.ParseDomainAccountId(groupId); @@ -954,7 +954,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateAddUserFlag(int flagId) { if (flagId <= 0) - return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest); + return new HttpStatusCodeResult(HttpStatusCode.BadRequest); var results = new List(); @@ -1008,7 +1008,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateAddDeviceProfile(int deviceProfileId) { if (deviceProfileId <= 0) - return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest); + return new HttpStatusCodeResult(HttpStatusCode.BadRequest); var results = new List(); @@ -1062,7 +1062,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateAddDeviceBatch(int deviceBatchId) { if (deviceBatchId <= 0) - return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest); + return new HttpStatusCodeResult(HttpStatusCode.BadRequest); var results = new List(); @@ -1116,7 +1116,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateAddDocumentAttachment(string documentTemplateId, DateTime? threshold) { if (string.IsNullOrWhiteSpace(documentTemplateId)) - return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest); + return new HttpStatusCodeResult(HttpStatusCode.BadRequest); var results = new List(); @@ -1229,7 +1229,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateGetUserDetailValues(string key) { if (string.IsNullOrWhiteSpace(key)) - return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest); + return new HttpStatusCodeResult(HttpStatusCode.BadRequest); var results = Database.UserDetails.Where(d => d.Scope == "Details" && d.Key == key).Select(d => d.Value).Distinct().ToList(); @@ -1241,7 +1241,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateAddUserDetail(string key, string value) { if (string.IsNullOrWhiteSpace(key)) - return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest); + return new HttpStatusCodeResult(HttpStatusCode.BadRequest); var results = new List(); diff --git a/Disco.Web/Areas/API/Controllers/SystemController.cs b/Disco.Web/Areas/API/Controllers/SystemController.cs index b7d9b93a..463218f3 100644 --- a/Disco.Web/Areas/API/Controllers/SystemController.cs +++ b/Disco.Web/Areas/API/Controllers/SystemController.cs @@ -21,7 +21,7 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorize(Claims.Config.System.Show)] public virtual ActionResult UpdateLastNetworkLogonDates() { - var taskStatus = Disco.Services.Interop.ActiveDirectory.ADNetworkLogonDatesUpdateTask.ScheduleImmediately(); + var taskStatus = ADNetworkLogonDatesUpdateTask.ScheduleImmediately(); return RedirectToAction(MVC.Config.Logging.TaskStatus(taskStatus.SessionId)); } @@ -37,7 +37,7 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorize(Claims.DiscoAdminAccount)] public virtual ActionResult UpdateADDeviceDescriptions() { - var ts = Disco.Services.Interop.ActiveDirectory.ADDeviceDescriptionUpdateTask.ScheduleImmediately(); + var ts = ADDeviceDescriptionUpdateTask.ScheduleImmediately(); ts.SetFinishedUrl(Url.Action(MVC.Config.SystemConfig.Index())); return RedirectToAction(MVC.Config.Logging.TaskStatus(ts.SessionId)); } @@ -56,7 +56,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - var ts = Disco.Services.Interop.DiscoServices.LicenseValidationTask.ScheduleNow(license); + var ts = LicenseValidationTask.ScheduleNow(license); ts.SetFinishedUrl(Url.Action(MVC.Config.SystemConfig.Index())); return RedirectToAction(MVC.Config.Logging.TaskStatus(ts.SessionId)); } @@ -65,7 +65,7 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorize(Claims.Config.System.Show)] public virtual ActionResult UpdateCheck() { - var ts = Disco.Services.Interop.DiscoServices.UpdateQueryTask.ScheduleNow(); + var ts = UpdateQueryTask.ScheduleNow(); ts.SetFinishedUrl(Url.Action(MVC.Config.SystemConfig.Index())); return RedirectToAction(MVC.Config.Logging.TaskStatus(ts.SessionId)); } @@ -111,7 +111,7 @@ namespace Disco.Web.Areas.API.Controllers using (Stream logoStream = Database.DiscoConfiguration.OrganisationLogo) { - using (Image logoBitmap = Bitmap.FromStream(logoStream)) + using (Image logoBitmap = Image.FromStream(logoStream)) { return File(logoBitmap.ResizeImage(Width, Height).SavePng(), "image/png"); } diff --git a/Disco.Web/Areas/Config/Models/SystemConfig/IndexModel.cs b/Disco.Web/Areas/Config/Models/SystemConfig/IndexModel.cs index 2252b0db..687f60e9 100644 --- a/Disco.Web/Areas/Config/Models/SystemConfig/IndexModel.cs +++ b/Disco.Web/Areas/Config/Models/SystemConfig/IndexModel.cs @@ -43,7 +43,7 @@ namespace Disco.Web.Areas.Config.Models.SystemConfig #region Database Connection private Lazy DatabaseConnectionString = new Lazy(() => { - return new SqlConnectionStringBuilder(Disco.Data.Repository.DiscoDatabaseConnectionFactory.DiscoDataContextConnectionString); + return new SqlConnectionStringBuilder(Data.Repository.DiscoDatabaseConnectionFactory.DiscoDataContextConnectionString); }); public string DatabaseServer { diff --git a/Disco.Web/Areas/Public/Controllers/UserHeldDevicesController.cs b/Disco.Web/Areas/Public/Controllers/UserHeldDevicesController.cs index 6e4b7f1d..0b457128 100644 --- a/Disco.Web/Areas/Public/Controllers/UserHeldDevicesController.cs +++ b/Disco.Web/Areas/Public/Controllers/UserHeldDevicesController.cs @@ -29,28 +29,28 @@ namespace Disco.Web.Areas.Public.Controllers query = query.Where(j => j.Device.DeviceProfile.DefaultOrganisationAddress == null || !addressIds.Contains(j.Device.DeviceProfile.DefaultOrganisationAddress)); } - var m = Disco.Services.Jobs.Noticeboards.HeldDevicesForUsers.GetHeldDevicesForUsers(query); + var m = HeldDevicesForUsers.GetHeldDevicesForUsers(query); return View(m); } public virtual ActionResult ReadyForReturnXml() { - var readyForReturn = Disco.Services.Jobs.Noticeboards.HeldDevicesForUsers.GetHeldDevicesForUsers(Database) + var readyForReturn = HeldDevicesForUsers.GetHeldDevicesForUsers(Database) .Where(j => j.ReadyForReturn && !j.WaitingForUserAction).Cast().ToArray(); return new Extensions.XmlResult(readyForReturn); } public virtual ActionResult WaitingForUserActionXml() { - var userHeldDevices = Disco.Services.Jobs.Noticeboards.HeldDevicesForUsers.GetHeldDevicesForUsers(Database) + var userHeldDevices = HeldDevicesForUsers.GetHeldDevicesForUsers(Database) .Where(j => j.WaitingForUserAction).Cast().ToArray(); return new Extensions.XmlResult(userHeldDevices); } public virtual ActionResult UserHeldDevicesXml() { - var userHeldDevices = Disco.Services.Jobs.Noticeboards.HeldDevicesForUsers.GetHeldDevicesForUsers(Database) + var userHeldDevices = HeldDevicesForUsers.GetHeldDevicesForUsers(Database) .Where(j => !j.ReadyForReturn && !j.WaitingForUserAction).Cast().ToArray(); return new Extensions.XmlResult(userHeldDevices); @@ -68,13 +68,13 @@ namespace Disco.Web.Areas.Public.Controllers public virtual ActionResult UserHeldDevice(string id) { - var m = Disco.Services.Jobs.Noticeboards.HeldDevicesForUsers.GetHeldDeviceForUsers(Database, id); + var m = HeldDevicesForUsers.GetHeldDeviceForUsers(Database, id); return Json(m, JsonRequestBehavior.AllowGet); } public virtual ActionResult UserHeldDevices() { - var m = Disco.Services.Jobs.Noticeboards.HeldDevicesForUsers.GetHeldDevicesForUsers(Database); + var m = HeldDevicesForUsers.GetHeldDevicesForUsers(Database); return Json(m, JsonRequestBehavior.AllowGet); } diff --git a/Disco.Web/Controllers/DeviceController.cs b/Disco.Web/Controllers/DeviceController.cs index 25a2ab28..09a6de94 100644 --- a/Disco.Web/Controllers/DeviceController.cs +++ b/Disco.Web/Controllers/DeviceController.cs @@ -288,7 +288,7 @@ namespace Disco.Web.Controllers HideClosedJobs = true, EnablePaging = false }; - m.Jobs.Fill(Database, Disco.Services.Searching.Search.BuildJobTableModel(Database).Where(j => j.DeviceSerialNumber == m.Device.SerialNumber).OrderByDescending(j => j.Id), true); + m.Jobs.Fill(Database, Services.Searching.Search.BuildJobTableModel(Database).Where(j => j.DeviceSerialNumber == m.Device.SerialNumber).OrderByDescending(j => j.Id), true); } if (Authorization.Has(Claims.Device.ShowCertificates)) diff --git a/Disco.Web/Controllers/InitialConfigController.cs b/Disco.Web/Controllers/InitialConfigController.cs index d57e9e02..dcbd43c6 100644 --- a/Disco.Web/Controllers/InitialConfigController.cs +++ b/Disco.Web/Controllers/InitialConfigController.cs @@ -107,7 +107,7 @@ namespace Disco.Web.Controllers #region Database public virtual ActionResult Database() { - var cs = Disco.Data.Repository.DiscoDatabaseConnectionFactory.DiscoDataContextConnectionString; + var cs = DiscoDatabaseConnectionFactory.DiscoDataContextConnectionString; DatabaseModel m; @@ -128,11 +128,11 @@ namespace Disco.Web.Controllers // Try Creating/Migrating connectionString.ConnectTimeout = 5; - Disco.Data.Repository.DiscoDatabaseConnectionFactory.SetDiscoDataContextConnectionString(connectionString.ToString(), false); + DiscoDatabaseConnectionFactory.SetDiscoDataContextConnectionString(connectionString.ToString(), false); try { - Disco.Data.Migrations.DiscoDataMigrator.MigrateLatest(true); + Data.Migrations.DiscoDataMigrator.MigrateLatest(true); } catch (Exception ex) { diff --git a/Disco.Web/Controllers/JobController.cs b/Disco.Web/Controllers/JobController.cs index 87f52b05..e063b0a5 100644 --- a/Disco.Web/Controllers/JobController.cs +++ b/Disco.Web/Controllers/JobController.cs @@ -238,7 +238,7 @@ namespace Disco.Web.Controllers closedThreshold = closedThreshold.AddDays(-2); if (dateTimeNow.DayOfWeek == DayOfWeek.Tuesday) closedThreshold = closedThreshold.AddDays(-1); - m.JobTable.Fill(Database, Disco.Services.Searching.Search.BuildJobTableModel(Database).Where(j => j.ClosedDate > closedThreshold).OrderBy(j => j.Id), true); + m.JobTable.Fill(Database, Services.Searching.Search.BuildJobTableModel(Database).Where(j => j.ClosedDate > closedThreshold).OrderBy(j => j.Id), true); // UI Extensions UIExtensions.ExecuteExtensions(ControllerContext, m); diff --git a/Disco.Web/Global.asax.cs b/Disco.Web/Global.asax.cs index dac7d3b2..97d58d5a 100644 --- a/Disco.Web/Global.asax.cs +++ b/Disco.Web/Global.asax.cs @@ -16,8 +16,8 @@ namespace Disco.Web { public DiscoApplication() { - base.BeginRequest += new EventHandler(DiscoApplication_BeginRequest); - base.Error += new EventHandler(DiscoApplication_Error); + BeginRequest += new EventHandler(DiscoApplication_BeginRequest); + Error += new EventHandler(DiscoApplication_Error); } protected void Application_Start() @@ -45,7 +45,7 @@ namespace Disco.Web bool.TryParse(ConfigurationManager.AppSettings["DiscoIgnoreVersionUpdate"], out ignoreVersionUpdate); // Only Update if Plugins are installed if (!ignoreVersionUpdate) - ignoreVersionUpdate = (Disco.Services.Plugins.UpdatePluginTask.OfflineInstalledPlugins(database).Count == 0); + ignoreVersionUpdate = (Services.Plugins.UpdatePluginTask.OfflineInstalledPlugins(database).Count == 0); } if (!isVersionUpdate || ignoreVersionUpdate) diff --git a/Disco.Web/Models/InitialConfig/CompleteModel.cs b/Disco.Web/Models/InitialConfig/CompleteModel.cs index 1dc54a2d..fce2c3ff 100644 --- a/Disco.Web/Models/InitialConfig/CompleteModel.cs +++ b/Disco.Web/Models/InitialConfig/CompleteModel.cs @@ -36,8 +36,8 @@ namespace Disco.Web.Models.InitialConfig try { // Make Connection String Persistent - Disco.Data.Repository.DiscoDatabaseConnectionFactory.SetDiscoDataContextConnectionString( - Disco.Data.Repository.DiscoDatabaseConnectionFactory.DiscoDataContextConnectionString, true); + Data.Repository.DiscoDatabaseConnectionFactory.SetDiscoDataContextConnectionString( + Data.Repository.DiscoDatabaseConnectionFactory.DiscoDataContextConnectionString, true); RegistryDatabaseResult = null; } catch (Exception ex) @@ -52,7 +52,7 @@ namespace Disco.Web.Models.InitialConfig Dns.GetHostEntry("discoict.com.au"); try { - HttpWebRequest wReq = (HttpWebRequest)HttpWebRequest.Create("https://discoict.com.au/"); + HttpWebRequest wReq = (HttpWebRequest)WebRequest.Create("https://discoict.com.au/"); // Added: 2013-02-08 G# // Fix for Proxy Servers which dont support KeepAlive wReq.KeepAlive = false; diff --git a/Disco.Web/Models/InitialConfig/FileStoreModel.cs b/Disco.Web/Models/InitialConfig/FileStoreModel.cs index 0818f338..64fd5807 100644 --- a/Disco.Web/Models/InitialConfig/FileStoreModel.cs +++ b/Disco.Web/Models/InitialConfig/FileStoreModel.cs @@ -9,7 +9,7 @@ namespace Disco.Web.Models.InitialConfig { public FileStoreModel() { - DirectoryModel = FileStoreModel.FileStoreDirectoryModel.DirectoryRoots(); + DirectoryModel = FileStoreDirectoryModel.DirectoryRoots(); } [Required(), CustomValidation(typeof(FileStoreModel), "DirectoryPermissionRequired")] @@ -145,7 +145,7 @@ namespace Disco.Web.Models.InitialConfig foreach (var driveInfo in DriveInfo.GetDrives()) { if (driveInfo.DriveType == DriveType.Fixed) - root.SubDirectories.Add(driveInfo.Name.Substring(0, 2).ToUpper(), FileStoreDirectoryModel.FromInfo(driveInfo)); + root.SubDirectories.Add(driveInfo.Name.Substring(0, 2).ToUpper(), FromInfo(driveInfo)); } return root; @@ -166,7 +166,7 @@ namespace Disco.Web.Models.InitialConfig if (((subDir.Attributes & FileAttributes.System) != FileAttributes.System) && ((subDir.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)) { - SubDirectories.Add(subDir.Name.ToUpper(), FileStoreDirectoryModel.FromInfo(subDir)); + SubDirectories.Add(subDir.Name.ToUpper(), FromInfo(subDir)); } } } diff --git a/Disco.Web/Models/Job/LogRepairModel.cs b/Disco.Web/Models/Job/LogRepairModel.cs index bace70a9..aaa57e02 100644 --- a/Disco.Web/Models/Job/LogRepairModel.cs +++ b/Disco.Web/Models/Job/LogRepairModel.cs @@ -29,7 +29,7 @@ namespace Disco.Web.Models.Job public int? OrganisationAddressId { get; set; } [Required(ErrorMessage = "Please specify a Repair Provider")] public string RepairProviderId { get; set; } - [Required(ErrorMessage = "A fault description is required"), DataType(System.ComponentModel.DataAnnotations.DataType.MultilineText)] + [Required(ErrorMessage = "A fault description is required"), DataType(DataType.MultilineText)] public string RepairDescription { get; set; } public List PublishAttachmentIds { get; set; } [Required] diff --git a/Disco.Web/Models/Job/LogWarrantyModel.cs b/Disco.Web/Models/Job/LogWarrantyModel.cs index 6eca7ff4..ee28cb99 100644 --- a/Disco.Web/Models/Job/LogWarrantyModel.cs +++ b/Disco.Web/Models/Job/LogWarrantyModel.cs @@ -29,7 +29,7 @@ namespace Disco.Web.Models.Job public int? OrganisationAddressId { get; set; } [Required(ErrorMessage = "Please specify a Warranty Provider")] public string WarrantyProviderId { get; set; } - [Required(ErrorMessage = "A fault description is required"), DataType(System.ComponentModel.DataAnnotations.DataType.MultilineText)] + [Required(ErrorMessage = "A fault description is required"), DataType(DataType.MultilineText)] public string FaultDescription { get; set; } public List PublishAttachmentIds { get; set; } [Required]