qol: simplify calls

This commit is contained in:
Gary Sharp
2025-07-20 15:20:22 +10:00
parent 1add4ee0f5
commit 9656c15c4b
61 changed files with 214 additions and 214 deletions
+2 -2
View File
@@ -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
@@ -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;
+1 -1
View File
@@ -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))
+1 -1
View File
@@ -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);
}
+4 -4
View File
@@ -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);
+1 -1
View File
@@ -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])
{
@@ -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)
@@ -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;
}
+15 -15
View File
@@ -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)
{
+2 -2
View File
@@ -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();
}
@@ -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))
{
@@ -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
{
@@ -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();
+3 -3
View File
@@ -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;
}
@@ -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,
@@ -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);
}
@@ -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);
}
@@ -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))
{
@@ -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))
{
@@ -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))
{
@@ -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))
{
@@ -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);
}
+14 -14
View File
@@ -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
@@ -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))
{
@@ -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))
{
@@ -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)
{
+4 -4
View File
@@ -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;
}
/// <summary>
@@ -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()
@@ -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))
@@ -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;
}
@@ -74,7 +74,7 @@ namespace Disco.Services.Interop.ActiveDirectory
return domain.GetAvailableDomainController().RetrieveADUserAccount(User.UserId, AdditionalProperties);
}
public static IEnumerable<ADUserAccount> SearchADUserAccounts(string Term, bool Quick, int? ResultLimit = ActiveDirectory.DefaultSearchResultLimit, params string[] AdditionalProperties)
public static IEnumerable<ADUserAccount> 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<ADGroup> SearchADGroups(string Term, int? ResultLimit = ActiveDirectory.DefaultSearchResultLimit, params string[] AdditionalProperties)
public static IEnumerable<ADGroup> 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;
@@ -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");
+1 -1
View File
@@ -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 =>
@@ -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;
@@ -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));
@@ -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;
}
@@ -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;
@@ -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);
}
}
@@ -32,7 +32,7 @@ namespace Disco.Services.Jobs.Noticeboards
});
NoticeboardUpdatesHub.HubContext.Clients
.Group(HeldDevicesForUsers.Name)
.Group(Name)
.updateHeldDeviceForUser(updates);
}
}
+1 -1
View File
@@ -48,7 +48,7 @@ namespace Disco.Services.Logging
{
var query = BuildQuery(context, logFile.Item2, results.Count);
IEnumerable<LogEvent> 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;
@@ -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<LogEventType> LoadEventTypes()
@@ -33,7 +33,7 @@ namespace Disco.Services.Plugins.Features.UIExtension
public static void ExecuteExtensions<UIModel>(ControllerContext context, UIModel model) where UIModel : BaseUIModel
{
var uiExts = UIExtensions.GetRegisteredExtensions<UIModel>();
var uiExts = GetRegisteredExtensions<UIModel>();
Queue<UIExtensionResult> uiExtResults = new Queue<UIExtensionResult>();
foreach (var uiExt in uiExts)
{
+3 -3
View File
@@ -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<string, string>(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())
+2 -2
View File
@@ -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
+5 -5
View File
@@ -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<ScheduledTaskCleanup>()
.WithIdentity("ScheduledTaskCleanupJob", ScheduledTasks.SchedulerGroupName + "_System")
.WithIdentity("ScheduledTaskCleanupJob", SchedulerGroupName + "_System")
.Build();
_TaskScheduler.ScheduleJob(job, trigger);
@@ -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))
{
@@ -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))
{
+2 -2
View File
@@ -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);
}
}
+1 -1
View File
@@ -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)
+16 -16
View File
@@ -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();
}
}
}
@@ -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<BulkGenerateUserModel>(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<BulkGenerateUserModel>();
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<BulkGenerateUserModel>();
@@ -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<BulkGenerateUserModel>();
@@ -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<BulkGenerateUserModel>();
@@ -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<BulkGenerateUserModel>();
@@ -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<BulkGenerateUserModel>();
@@ -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");
}
@@ -43,7 +43,7 @@ namespace Disco.Web.Areas.Config.Models.SystemConfig
#region Database Connection
private Lazy<SqlConnectionStringBuilder> DatabaseConnectionString = new Lazy<SqlConnectionStringBuilder>(() =>
{
return new SqlConnectionStringBuilder(Disco.Data.Repository.DiscoDatabaseConnectionFactory.DiscoDataContextConnectionString);
return new SqlConnectionStringBuilder(Data.Repository.DiscoDatabaseConnectionFactory.DiscoDataContextConnectionString);
});
public string DatabaseServer
{
@@ -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<HeldDeviceItem>().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<HeldDeviceItem>().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<HeldDeviceItem>().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);
}
+1 -1
View File
@@ -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))
@@ -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)
{
+1 -1
View File
@@ -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<JobListModel>(ControllerContext, m);
+3 -3
View File
@@ -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)
@@ -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;
@@ -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));
}
}
}
+1 -1
View File
@@ -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<int> PublishAttachmentIds { get; set; }
[Required]
+1 -1
View File
@@ -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<int> PublishAttachmentIds { get; set; }
[Required]