qol: simplify accessors

This commit is contained in:
Gary Sharp
2025-07-20 11:24:04 +10:00
parent 3aeb9374a9
commit b4e54c9edf
61 changed files with 132 additions and 132 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ namespace Disco.BI.Interop.Pdf
public static Stream JoinPdfs(bool InsertBlankPages, List<Stream> Pdfs) public static Stream JoinPdfs(bool InsertBlankPages, List<Stream> Pdfs)
{ {
if (Pdfs.Count == 0) if (Pdfs.Count == 0)
throw new System.ArgumentNullException(nameof(Pdfs)); throw new ArgumentNullException(nameof(Pdfs));
// Only One PDF - Possible Reference Bug v's Memory/Speed (Returning Param Memory Stream) // Only One PDF - Possible Reference Bug v's Memory/Speed (Returning Param Memory Stream)
if (Pdfs.Count == 1) if (Pdfs.Count == 1)
+1 -1
View File
@@ -4,6 +4,6 @@ namespace Disco.ClientBootstrapper
{ {
interface IStatus interface IStatus
{ {
void UpdateStatus(string Heading, string SubHeading, string Message, Nullable<bool> ShowProgress = null, Nullable<int> Progress = null); void UpdateStatus(string Heading, string SubHeading, string Message, bool? ShowProgress = null, int? Progress = null);
} }
} }
@@ -198,7 +198,7 @@ namespace Disco.ClientBootstrapper.Interop
// Mount WIM // Mount WIM
int wimImageIndex = 0; int wimImageIndex = 0;
using (var wim = new Interop.WIMInterop.WindowsImageContainer(InstallLocation, WIMInterop.WindowsImageContainer.CreateFileMode.OpenExisting, WIMInterop.WindowsImageContainer.CreateFileAccess.Write)) using (var wim = new WIMInterop.WindowsImageContainer(InstallLocation, WIMInterop.WindowsImageContainer.CreateFileMode.OpenExisting, WIMInterop.WindowsImageContainer.CreateFileAccess.Write))
{ {
if (WimImageId == null) if (WimImageId == null)
WimImageId = "1"; WimImageId = "1";
@@ -241,13 +241,13 @@ namespace Disco.ClientBootstrapper.Interop
Directory.CreateDirectory(wimTempMountPath); Directory.CreateDirectory(wimTempMountPath);
bool wimCommitChanges = true; bool wimCommitChanges = true;
Interop.WIMInterop.WindowsImageContainer.NativeMethods.MessageCallback m_MessageCallback = null; WIMInterop.WindowsImageContainer.NativeMethods.MessageCallback m_MessageCallback = null;
try try
{ {
// Mount WIM // Mount WIM
Program.Status.UpdateStatus(null, "Mounting WIM", string.Format("Mounting WIM Image to '{0}'", wimMountPath)); Program.Status.UpdateStatus(null, "Mounting WIM", string.Format("Mounting WIM Image to '{0}'", wimMountPath));
Program.SleepThread(500, false); Program.SleepThread(500, false);
m_MessageCallback = new Interop.WIMInterop.WindowsImageContainer.NativeMethods.MessageCallback(WimImageEventMessagePump); m_MessageCallback = new WIMInterop.WindowsImageContainer.NativeMethods.MessageCallback(WimImageEventMessagePump);
Interop.WIMInterop.WindowsImageContainer.NativeMethods.RegisterCallback(m_MessageCallback); Interop.WIMInterop.WindowsImageContainer.NativeMethods.RegisterCallback(m_MessageCallback);
Interop.WIMInterop.WindowsImageContainer.NativeMethods.MountImage(wimMountPath, InstallLocation, wimImageIndex, wimTempMountPath); Interop.WIMInterop.WindowsImageContainer.NativeMethods.MountImage(wimMountPath, InstallLocation, wimImageIndex, wimTempMountPath);
@@ -256,7 +256,7 @@ namespace Disco.ClientBootstrapper.Interop
var wimHivePath = Path.Combine(wimMountPath, "Windows\\System32\\config\\SOFTWARE"); var wimHivePath = Path.Combine(wimMountPath, "Windows\\System32\\config\\SOFTWARE");
Program.Status.UpdateStatus(null, "Mounting Offline Registry Hive", string.Format("Mounting Offline Registry Hive at '{0}'", wimHivePath)); Program.Status.UpdateStatus(null, "Mounting Offline Registry Hive", string.Format("Mounting Offline Registry Hive at '{0}'", wimHivePath));
Program.SleepThread(500, false); Program.SleepThread(500, false);
using (var wimReg = new Interop.RegistryInterop(RegistryInterop.RegistryHives.HKEY_LOCAL_MACHINE, "DiscoClientBootstrapperWimHive", wimHivePath)) using (var wimReg = new RegistryInterop(RegistryInterop.RegistryHives.HKEY_LOCAL_MACHINE, "DiscoClientBootstrapperWimHive", wimHivePath))
{ {
using (RegistryKey rootRegistryLocation = Registry.LocalMachine.OpenSubKey("DiscoClientBootstrapperWimHive", true)) using (RegistryKey rootRegistryLocation = Registry.LocalMachine.OpenSubKey("DiscoClientBootstrapperWimHive", true))
{ {
@@ -322,11 +322,11 @@ namespace Disco.ClientBootstrapper.Interop
) )
{ {
uint status = (uint)Interop.WIMInterop.WindowsImageContainer.NativeMethods.WIMMessage.WIM_MSG_SUCCESS; uint status = (uint)Interop.WIMInterop.WindowsImageContainer.NativeMethods.WIMMessage.WIM_MSG_SUCCESS;
Interop.WIMInterop.DefaultImageEventArgs eventArgs = new Interop.WIMInterop.DefaultImageEventArgs(wParam, lParam, UserData); WIMInterop.DefaultImageEventArgs eventArgs = new WIMInterop.DefaultImageEventArgs(wParam, lParam, UserData);
//System.Diagnostics.Debug.WriteLine(MessageId); //System.Diagnostics.Debug.WriteLine(MessageId);
switch ((Interop.WIMInterop.WindowsImageContainer.ImageEventMessage)MessageId) switch ((WIMInterop.WindowsImageContainer.ImageEventMessage)MessageId)
{ {
case Interop.WIMInterop.WindowsImageContainer.ImageEventMessage.Progress: case Interop.WIMInterop.WindowsImageContainer.ImageEventMessage.Progress:
@@ -59,7 +59,7 @@ namespace Disco.Data.Repository
this.SqlCeConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0"); this.SqlCeConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");
} }
public System.Data.Common.DbConnection CreateConnection(string nameOrConnectionString) public DbConnection CreateConnection(string nameOrConnectionString)
{ {
if (nameOrConnectionString == "Disco.Data.Repository.DiscoDataContext") if (nameOrConnectionString == "Disco.Data.Repository.DiscoDataContext")
{ {
@@ -37,7 +37,7 @@ namespace Disco.Models.Services.Jobs.JobLists
public string StatusDescription { get; set; } public string StatusDescription { get; set; }
public string StatusId { get; set; } public string StatusId { get; set; }
public string DeviceHeldLocation { get; set; } public string DeviceHeldLocation { get; set; }
public Disco.Models.Repository.Job.UserManagementFlags? Flags { get; set; } public Repository.Job.UserManagementFlags? Flags { get; set; }
public DateTime LastActivityDate { get; set; } public DateTime LastActivityDate { get; set; }
} }
} }
@@ -2,6 +2,6 @@
{ {
public interface ConfigAuthorizationRoleCreateModel : BaseUIModel public interface ConfigAuthorizationRoleCreateModel : BaseUIModel
{ {
Models.Repository.AuthorizationRole AuthorizationRole { get; set; } Repository.AuthorizationRole AuthorizationRole { get; set; }
} }
} }
@@ -2,6 +2,6 @@
{ {
public interface ConfigDeviceBatchCreateModel : BaseUIModel public interface ConfigDeviceBatchCreateModel : BaseUIModel
{ {
Models.Repository.DeviceBatch DeviceBatch { get; set; } Repository.DeviceBatch DeviceBatch { get; set; }
} }
} }
@@ -2,7 +2,7 @@
{ {
public interface ConfigDeviceBatchShowModelMembership : BaseUIModel public interface ConfigDeviceBatchShowModelMembership : BaseUIModel
{ {
Disco.Models.Repository.DeviceModel DeviceModel { get; set; } Repository.DeviceModel DeviceModel { get; set; }
int DeviceCount { get; set; } int DeviceCount { get; set; }
int DeviceDecommissionedCount { get; set; } int DeviceDecommissionedCount { get; set; }
} }
@@ -5,8 +5,8 @@ namespace Disco.Models.UI.Config.DeviceModel
public interface ConfigDeviceModelComponentsModel : BaseUIModel public interface ConfigDeviceModelComponentsModel : BaseUIModel
{ {
int? DeviceModelId { get; set; } int? DeviceModelId { get; set; }
List<Disco.Models.Repository.DeviceComponent> DeviceComponents { get; set; } List<Repository.DeviceComponent> DeviceComponents { get; set; }
List<Disco.Models.Repository.JobSubType> JobSubTypes { get; set; } List<Repository.JobSubType> JobSubTypes { get; set; }
} }
} }
@@ -4,7 +4,7 @@ namespace Disco.Models.UI.Config.DeviceModel
{ {
public interface ConfigDeviceModelShowModel : BaseUIModel, ConfigSharedDeviceGroupDocumentTemplateBulkGenerate public interface ConfigDeviceModelShowModel : BaseUIModel, ConfigSharedDeviceGroupDocumentTemplateBulkGenerate
{ {
Disco.Models.Repository.DeviceModel DeviceModel { get; set; } Repository.DeviceModel DeviceModel { get; set; }
ConfigDeviceModelComponentsModel DeviceComponentsModel { get; set; } ConfigDeviceModelComponentsModel DeviceComponentsModel { get; set; }
@@ -2,6 +2,6 @@
{ {
public interface ConfigDeviceProfileCreateModel : BaseUIModel public interface ConfigDeviceProfileCreateModel : BaseUIModel
{ {
Models.Repository.DeviceProfile DeviceProfile { get; set; } Repository.DeviceProfile DeviceProfile { get; set; }
} }
} }
@@ -4,8 +4,8 @@ namespace Disco.Models.UI.Config.DeviceProfile
{ {
public interface ConfigDeviceProfileDefaultsModel : BaseUIModel public interface ConfigDeviceProfileDefaultsModel : BaseUIModel
{ {
List<Disco.Models.Repository.DeviceProfile> DeviceProfiles { get; set; } List<Repository.DeviceProfile> DeviceProfiles { get; set; }
List<Disco.Models.Repository.DeviceProfile> DeviceProfilesAndNone { get; set; } List<Repository.DeviceProfile> DeviceProfilesAndNone { get; set; }
int Default { get; set; } int Default { get; set; }
int DefaultAddDeviceOffline { get; set; } int DefaultAddDeviceOffline { get; set; }
} }
@@ -8,7 +8,7 @@
int? Address { get; set; } int? Address { get; set; }
string AddressName { get; set; } string AddressName { get; set; }
string Description { get; set; } string Description { get; set; }
Models.Repository.DeviceProfile.DistributionTypes DistributionType { get; set; } Repository.DeviceProfile.DistributionTypes DistributionType { get; set; }
int DeviceCount { get; set; } int DeviceCount { get; set; }
int DeviceDecommissionedCount { get; set; } int DeviceDecommissionedCount { get; set; }
@@ -4,6 +4,6 @@ namespace Disco.Models.UI.Config.DocumentTemplate
{ {
public interface ConfigDocumentTemplateUndetectedPagesModel : BaseUIModel public interface ConfigDocumentTemplateUndetectedPagesModel : BaseUIModel
{ {
List<Disco.Models.Repository.DocumentTemplate> DocumentTemplates { get; set; } List<Repository.DocumentTemplate> DocumentTemplates { get; set; }
} }
} }
@@ -13,7 +13,7 @@ namespace Disco.Models.UI.Config.JobQueue
IEnumerable<KeyValuePair<string, string>> Icons { get; set; } IEnumerable<KeyValuePair<string, string>> Icons { get; set; }
IEnumerable<KeyValuePair<string, string>> ThemeColours { get; set; } IEnumerable<KeyValuePair<string, string>> ThemeColours { get; set; }
List<Disco.Models.Repository.JobType> JobTypes { get; set; } List<Repository.JobType> JobTypes { get; set; }
bool CanDelete { get; set; } bool CanDelete { get; set; }
} }
@@ -4,9 +4,9 @@ namespace Disco.Models.UI.Device
{ {
public interface DeviceAddOfflineModel : BaseUIModel public interface DeviceAddOfflineModel : BaseUIModel
{ {
Disco.Models.Repository.Device Device { get; set; } Repository.Device Device { get; set; }
List<Disco.Models.Repository.DeviceProfile> DeviceProfiles { get; set; } List<Repository.DeviceProfile> DeviceProfiles { get; set; }
List<Disco.Models.Repository.DeviceBatch> DeviceBatches { get; set; } List<Repository.DeviceBatch> DeviceBatches { get; set; }
int DefaultDeviceProfileId { get; set; } int DefaultDeviceProfileId { get; set; }
} }
} }
+4 -4
View File
@@ -10,18 +10,18 @@ namespace Disco.Models.UI.Device
{ {
Repository.Device Device { get; set; } Repository.Device Device { get; set; }
List<Repository.DeviceProfile> DeviceProfiles { get; set; } List<DeviceProfile> DeviceProfiles { get; set; }
HashSet<int> DecommissionedDeviceProfileIds { get; set; } HashSet<int> DecommissionedDeviceProfileIds { get; set; }
OrganisationAddress DeviceProfileDefaultOrganisationAddress { get; set; } OrganisationAddress DeviceProfileDefaultOrganisationAddress { get; set; }
List<Repository.DeviceBatch> DeviceBatches { get; set; } List<DeviceBatch> DeviceBatches { get; set; }
HashSet<int> DecommissionedDeviceBatchIds { get; set; } HashSet<int> DecommissionedDeviceBatchIds { get; set; }
JobTableModel Jobs { get; set; } JobTableModel Jobs { get; set; }
List<Repository.DeviceCertificate> Certificates { get; set; } List<DeviceCertificate> Certificates { get; set; }
List<Repository.DocumentTemplate> DocumentTemplates { get; set; } List<DocumentTemplate> DocumentTemplates { get; set; }
List<DocumentTemplatePackage> DocumentTemplatePackages { get; set; } List<DocumentTemplatePackage> DocumentTemplatePackages { get; set; }
List<DeviceFlag> AvailableDeviceFlags { get; set; } List<DeviceFlag> AvailableDeviceFlags { get; set; }
+3 -3
View File
@@ -21,8 +21,8 @@ namespace Disco.Models.UI.Job
int? QuickLogTaskTimeMinutes { get; set; } int? QuickLogTaskTimeMinutes { get; set; }
int? QuickLogTaskTimeMinutesOther { get; set; } int? QuickLogTaskTimeMinutesOther { get; set; }
Disco.Models.Repository.Device Device { get; set; } Repository.Device Device { get; set; }
Disco.Models.Repository.User User { get; set; } Repository.User User { get; set; }
List<Disco.Models.Repository.JobType> JobTypes { get; set; } List<Repository.JobType> JobTypes { get; set; }
} }
} }
+1 -1
View File
@@ -8,7 +8,7 @@ namespace Disco.Models.UI.User
{ {
public interface UserShowModel : BaseUIModel public interface UserShowModel : BaseUIModel
{ {
Disco.Models.Repository.User User { get; set; } Repository.User User { get; set; }
JobTableModel Jobs { get; set; } JobTableModel Jobs { get; set; }
List<DocumentTemplate> DocumentTemplates { get; set; } List<DocumentTemplate> DocumentTemplates { get; set; }
List<DocumentTemplatePackage> DocumentTemplatePackages { get; set; } List<DocumentTemplatePackage> DocumentTemplatePackages { get; set; }
@@ -34,7 +34,7 @@ namespace Disco.Services.Authorization
Current.Log((int)EventTypeId, Args); Current.Log((int)EventTypeId, Args);
} }
protected override List<Logging.Models.LogEventType> LoadEventTypes() protected override List<LogEventType> LoadEventTypes()
{ {
List<LogEventType> eventTypes = new List<LogEventType>() { List<LogEventType> eventTypes = new List<LogEventType>() {
new LogEventType() { new LogEventType() {
@@ -68,17 +68,17 @@ namespace Disco.Services.Authorization
/// <summary> /// <summary>
/// Checks if token contains at least one of the claims requested. /// Checks if token contains at least one of the claims requested.
/// </summary> /// </summary>
/// <param name="ClaimKeys">Claim Keys from <see cref="Disco.Services.Authorization.Claims"/></param> /// <param name="ClaimKeys">Claim Keys from <see cref="Claims"/></param>
/// <returns>true if the token satisfies the claim request, otherwise false.</returns> /// <returns>true if the token satisfies the claim request, otherwise false.</returns>
public bool HasAny(params string[] ClaimKeys) public bool HasAny(params string[] ClaimKeys)
{ {
return HasAny((IEnumerable<string>)ClaimKeys); return HasAny((IEnumerable<string>)ClaimKeys);
} }
/// <summary> /// <summary>
/// Checks if token contains at least one of the claims requested. /// Checks if token contains at least one of the claims requested.
/// </summary> /// </summary>
/// <param name="ClaimKeys">Claim Keys from <see cref="Disco.Services.Authorization.Claims"/></param> /// <param name="ClaimKeys">Claim Keys from <see cref="Claims"/></param>
/// <returns>true if the token satisfies the claim request, otherwise false.</returns> /// <returns>true if the token satisfies the claim request, otherwise false.</returns>
public bool HasAny(IEnumerable<string> ClaimKeys) public bool HasAny(IEnumerable<string> ClaimKeys)
{ {
@@ -88,7 +88,7 @@ namespace Disco.Services.Authorization
/// <summary> /// <summary>
/// Checks if token contains all the claims requested. /// Checks if token contains all the claims requested.
/// </summary> /// </summary>
/// <param name="ClaimKeys">Claim Keys from <see cref="Disco.Services.Authorization.Claims"/></param> /// <param name="ClaimKeys">Claim Keys from <see cref="Claims"/></param>
/// <returns>true if the token satisfies the claim request, otherwise false.</returns> /// <returns>true if the token satisfies the claim request, otherwise false.</returns>
public bool HasAll(params string[] ClaimKeys) public bool HasAll(params string[] ClaimKeys)
{ {
@@ -97,7 +97,7 @@ namespace Disco.Services.Authorization
/// <summary> /// <summary>
/// Checks if token contains all the claims requested. /// Checks if token contains all the claims requested.
/// </summary> /// </summary>
/// <param name="ClaimKeys">Claim Keys from <see cref="Disco.Services.Authorization.Claims"/></param> /// <param name="ClaimKeys">Claim Keys from <see cref="Claims"/></param>
/// <returns>true if the token satisfies the claim request, otherwise false.</returns> /// <returns>true if the token satisfies the claim request, otherwise false.</returns>
public bool HasAll(IEnumerable<string> ClaimKeys) public bool HasAll(IEnumerable<string> ClaimKeys)
{ {
@@ -107,7 +107,7 @@ namespace Disco.Services.Authorization
/// <summary> /// <summary>
/// Checks if token contains the claim requested. /// Checks if token contains the claim requested.
/// </summary> /// </summary>
/// <param name="ClaimKey">Claim Key from <see cref="Disco.Services.Authorization.Claims"/></param> /// <param name="ClaimKey">Claim Key from <see cref="Claims"/></param>
/// <returns>true if the token satisfies the claim request, otherwise false.</returns> /// <returns>true if the token satisfies the claim request, otherwise false.</returns>
public bool Has(string ClaimKey) public bool Has(string ClaimKey)
{ {
@@ -127,9 +127,9 @@ namespace Disco.Services.Authorization
} }
/// <summary> /// <summary>
/// Validates the token contains the claim required. An <see cref="Disco.Services.Authorization.AccessDeniedException"/> is thrown if the requirements are not met. /// Validates the token contains the claim required. An <see cref="AccessDeniedException"/> is thrown if the requirements are not met.
/// </summary> /// </summary>
/// <param name="ClaimKey">Claim Key from <see cref="Disco.Services.Authorization.Claims"/></param> /// <param name="ClaimKey">Claim Key from <see cref="Claims"/></param>
public void Require(string ClaimKey) public void Require(string ClaimKey)
{ {
if (!Has(ClaimKey)) if (!Has(ClaimKey))
@@ -137,19 +137,19 @@ namespace Disco.Services.Authorization
} }
/// <summary> /// <summary>
/// Validates the token contains all the claims required. An <see cref="Disco.Services.Authorization.AccessDeniedException"/> is thrown if the requirements are not met. /// Validates the token contains all the claims required. An <see cref="AccessDeniedException"/> is thrown if the requirements are not met.
/// </summary> /// </summary>
/// <param name="ClaimKeys">Claim Keys from <see cref="Disco.Services.Authorization.Claims"/></param> /// <param name="ClaimKeys">Claim Keys from <see cref="Claims"/></param>
public void RequireAll(params string[] ClaimKeys) public void RequireAll(params string[] ClaimKeys)
{ {
if (!HasAll(ClaimKeys)) if (!HasAll(ClaimKeys))
throw new AccessDeniedException(BuildRequireAllMessage(ClaimKeys), GetRequireResource()); throw new AccessDeniedException(BuildRequireAllMessage(ClaimKeys), GetRequireResource());
} }
/// <summary> /// <summary>
/// Validates the token contains at least one of the claims required. An <see cref="Disco.Services.Authorization.AccessDeniedException"/> is thrown if the requirements are not met. /// Validates the token contains at least one of the claims required. An <see cref="AccessDeniedException"/> is thrown if the requirements are not met.
/// </summary> /// </summary>
/// <param name="ClaimKeys">Claim Keys from <see cref="Disco.Services.Authorization.Claims"/></param> /// <param name="ClaimKeys">Claim Keys from <see cref="Claims"/></param>
public void RequireAny(params string[] ClaimKeys) public void RequireAny(params string[] ClaimKeys)
{ {
if (!HasAny(ClaimKeys)) if (!HasAny(ClaimKeys))
@@ -8,7 +8,7 @@ namespace Disco.Services.Authorization
{ {
public class ClaimNavigatorItem : IClaimNavigatorItem public class ClaimNavigatorItem : IClaimNavigatorItem
{ {
private Func<Roles.RoleClaims, bool> accessor { get; set; } private Func<RoleClaims, bool> accessor { get; set; }
public string Key { get; private set; } public string Key { get; private set; }
public string Name { get; private set; } public string Name { get; private set; }
@@ -51,7 +51,7 @@ namespace Disco.Services
public static string ImageFilePath(this DeviceModel deviceModel) public static string ImageFilePath(this DeviceModel deviceModel)
{ {
var configCache = new Disco.Data.Configuration.SystemConfiguration(null); var configCache = new Data.Configuration.SystemConfiguration(null);
var deviceModelImagesDataStore = DataStore.CreateLocation(configCache, "DeviceModelImages"); var deviceModelImagesDataStore = DataStore.CreateLocation(configCache, "DeviceModelImages");
@@ -68,7 +68,7 @@ namespace Disco.Services.Devices.Enrolment
public EnrolmentLog() public EnrolmentLog()
{ {
} }
private static void Log(EnrolmentLog.EventTypeIds EventTypeId, params object[] Args) private static void Log(EventTypeIds EventTypeId, params object[] Args)
{ {
EnrolmentLog.Current.Log((int)EventTypeId, Args); EnrolmentLog.Current.Log((int)EventTypeId, Args);
} }
@@ -143,7 +143,7 @@ namespace Disco.Services.Devices.Enrolment
EnrolmentLog.LogSessionFinished(sessionId); EnrolmentLog.LogSessionFinished(sessionId);
MacSecureEnrol = response; MacSecureEnrol = response;
} }
catch (System.Exception ex) catch (Exception ex)
{ {
EnrolmentLog.LogSessionError(sessionId, ex); EnrolmentLog.LogSessionError(sessionId, ex);
throw ex; throw ex;
+1 -1
View File
@@ -60,7 +60,7 @@ namespace Disco.Services.Documents
return "Documents"; return "Documents";
} }
} }
private static void Log(DocumentsLog.EventTypeIds EventTypeId, params object[] Args) private static void Log(EventTypeIds EventTypeId, params object[] Args)
{ {
DocumentsLog.Current.Log((int)EventTypeId, Args); DocumentsLog.Current.Log((int)EventTypeId, Args);
} }
@@ -17,7 +17,7 @@ namespace Disco.Services.Expressions.Extensions
} }
public static FileImageExpressionResult ImageFromDataStoreFile(string RelativeFilePath) public static FileImageExpressionResult ImageFromDataStoreFile(string RelativeFilePath)
{ {
var configCache = new Disco.Data.Configuration.SystemConfiguration(null); var configCache = new Data.Configuration.SystemConfiguration(null);
string DataStoreLocation = configCache.DataStoreLocation; string DataStoreLocation = configCache.DataStoreLocation;
string AbsoluteFilePath = System.IO.Path.Combine(DataStoreLocation, RelativeFilePath); string AbsoluteFilePath = System.IO.Path.Combine(DataStoreLocation, RelativeFilePath);
return new FileImageExpressionResult(AbsoluteFilePath); return new FileImageExpressionResult(AbsoluteFilePath);
+4 -4
View File
@@ -21,14 +21,14 @@ namespace Disco.Services.Extensions
public static ReadOnlyCollection<KeyValuePair<string, string>> NoticeboardThemes { get; private set; } public static ReadOnlyCollection<KeyValuePair<string, string>> NoticeboardThemes { get; private set; }
/// <summary> /// <summary>
/// Returns a randomly selected Icon using <see cref="System.Random"/>. /// Returns a randomly selected Icon using <see cref="Random"/>.
/// </summary> /// </summary>
public static string RandomIcon() public static string RandomIcon()
{ {
return RandomIcon(null); return RandomIcon(null);
} }
/// <summary> /// <summary>
/// Returns a randomly selected Icon using <see cref="System.Random"/>. /// Returns a randomly selected Icon using <see cref="Random"/>.
/// </summary> /// </summary>
/// <param name="Except">A list of Icons which will be ignored (if all are excluded, a random one will be returned)</param> /// <param name="Except">A list of Icons which will be ignored (if all are excluded, a random one will be returned)</param>
public static string RandomIcon(IEnumerable<string> Except) public static string RandomIcon(IEnumerable<string> Except)
@@ -44,14 +44,14 @@ namespace Disco.Services.Extensions
} }
/// <summary> /// <summary>
/// Returns a randomly selected Theme Colour using <see cref="System.Random"/>. /// Returns a randomly selected Theme Colour using <see cref="Random"/>.
/// </summary> /// </summary>
public static string RandomThemeColour() public static string RandomThemeColour()
{ {
return RandomThemeColour(null); return RandomThemeColour(null);
} }
/// <summary> /// <summary>
/// Returns a randomly selected Theme Colour using <see cref="System.Random"/>. /// Returns a randomly selected Theme Colour using <see cref="Random"/>.
/// </summary> /// </summary>
/// <param name="Except">A list of Theme Colours which will be ignored (if all are excluded, a random one will be returned)</param> /// <param name="Except">A list of Theme Colours which will be ignored (if all are excluded, a random one will be returned)</param>
public static string RandomThemeColour(IEnumerable<string> Except) public static string RandomThemeColour(IEnumerable<string> Except)
@@ -104,12 +104,12 @@ namespace Disco.Services.Interop.ActiveDirectory
var domain = Context.GetDomainFromId(Id); var domain = Context.GetDomainFromId(Id);
return domain.GetAvailableDomainController().RetrieveADMachineAccount(Id, AdditionalProperties); return domain.GetAvailableDomainController().RetrieveADMachineAccount(Id, AdditionalProperties);
} }
public static ADMachineAccount RetrieveADMachineAccount(string Id, System.Guid? NetbootGUID, params string[] AdditionalProperties) public static ADMachineAccount RetrieveADMachineAccount(string Id, Guid? NetbootGUID, params string[] AdditionalProperties)
{ {
var domain = Context.GetDomainFromId(Id); var domain = Context.GetDomainFromId(Id);
return domain.GetAvailableDomainController().RetrieveADMachineAccount(Id, NetbootGUID, AdditionalProperties); return domain.GetAvailableDomainController().RetrieveADMachineAccount(Id, NetbootGUID, AdditionalProperties);
} }
public static ADMachineAccount RetrieveADMachineAccount(string Id, System.Guid? UUIDNetbootGUID, System.Guid? MacAddressNetbootGUID, params string[] AdditionalProperties) public static ADMachineAccount RetrieveADMachineAccount(string Id, Guid? UUIDNetbootGUID, Guid? MacAddressNetbootGUID, params string[] AdditionalProperties)
{ {
var domain = Context.GetDomainFromId(Id); var domain = Context.GetDomainFromId(Id);
return domain.GetAvailableDomainController().RetrieveADMachineAccount(Id, UUIDNetbootGUID, MacAddressNetbootGUID, AdditionalProperties); return domain.GetAvailableDomainController().RetrieveADMachineAccount(Id, UUIDNetbootGUID, MacAddressNetbootGUID, AdditionalProperties);
@@ -19,7 +19,7 @@ namespace Disco.Services.Logging.Models
public string FormattedTimestamp { get; set; } public string FormattedTimestamp { get; set; }
public bool UseDisplay { get; set; } public bool UseDisplay { get; set; }
public static LogLiveEvent Create(LogBase logModule, Models.LogEventType eventType, DateTime Timestamp, string jsonArguments) public static LogLiveEvent Create(LogBase logModule, LogEventType eventType, DateTime Timestamp, string jsonArguments)
{ {
object[] Arguments = null; object[] Arguments = null;
if (jsonArguments != null) if (jsonArguments != null)
@@ -29,9 +29,9 @@ namespace Disco.Services.Logging.Models
return Create(logModule, eventType, Timestamp, Arguments); return Create(logModule, eventType, Timestamp, Arguments);
} }
public static LogLiveEvent Create(LogBase logModule, Models.LogEventType eventType, DateTime Timestamp, params object[] Arguments) public static LogLiveEvent Create(LogBase logModule, LogEventType eventType, DateTime Timestamp, params object[] Arguments)
{ {
return new Models.LogLiveEvent() return new LogLiveEvent()
{ {
ModuleId = logModule.ModuleId, ModuleId = logModule.ModuleId,
ModuleName = logModule.ModuleName, ModuleName = logModule.ModuleName,
@@ -8,7 +8,7 @@ namespace Disco.Services.Logging.Persistance
static LogPersistContext() static LogPersistContext()
{ {
Database.SetInitializer<LogPersistContext>(new LogPersistContextInitializer()); Database.SetInitializer(new LogPersistContextInitializer());
} }
public DbSet<Models.LogModule> Modules { get; set; } public DbSet<Models.LogModule> Modules { get; set; }
+2 -2
View File
@@ -28,9 +28,9 @@ namespace Disco.Services.Logging
return true; return true;
} }
public List<Models.LogLiveEvent> Query(DiscoDataContext Database) public List<LogLiveEvent> Query(DiscoDataContext Database)
{ {
List<Models.LogLiveEvent> results = new List<LogLiveEvent>(); List<LogLiveEvent> results = new List<LogLiveEvent>();
// Validate Options // Validate Options
Validate(); Validate();
@@ -67,7 +67,7 @@ namespace Disco.Services.Plugins.Features.CertificateProvider
public CertificateProvidersLog() public CertificateProvidersLog()
{ {
} }
private static void Log(CertificateProvidersLog.EventTypeIds EventTypeId, params object[] Args) private static void Log(EventTypeIds EventTypeId, params object[] Args)
{ {
CertificateProvidersLog.Current.Log((int)EventTypeId, Args); CertificateProvidersLog.Current.Log((int)EventTypeId, Args);
} }
@@ -12,7 +12,7 @@ namespace Disco.Services.Plugins.Features.RepairProvider
public abstract class RepairProviderFeature : PluginFeature public abstract class RepairProviderFeature : PluginFeature
{ {
/// <summary> /// <summary>
/// The repairer identifier. Used to link this provider to any <see cref="Disco.Models.Repository.RepairerName"/>. This identifier is used to automatically set the RepairerName when a job is submitted using this plugin. /// The repairer identifier. Used to link this provider to any <see cref="Models.Repository.RepairerName"/>. This identifier is used to automatically set the RepairerName when a job is submitted using this plugin.
/// </summary> /// </summary>
public abstract string ProviderId { get; } public abstract string ProviderId { get; }
@@ -45,7 +45,7 @@ namespace Disco.Services.Plugins.Features.RepairProvider
/// <summary> /// <summary>
/// Called when the plugin should submit the job to the external party. /// Called when the plugin should submit the job to the external party.
/// </summary> /// </summary>
/// <returns>A reference number/identifier from the external party which is stored in <see cref="Disco.Models.Repository.RepairerReference"/></returns> /// <returns>A reference number/identifier from the external party which is stored in <see cref="Models.Repository.RepairerReference"/></returns>
public abstract string SubmitJob(DiscoDataContext Database, Job Job, OrganisationAddress Address, User TechUser, string RepairDescription, Dictionary<string, string> ProviderProperties); public abstract string SubmitJob(DiscoDataContext Database, Job Job, OrganisationAddress Address, User TechUser, string RepairDescription, Dictionary<string, string> ProviderProperties);
#endregion #endregion
@@ -19,7 +19,7 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
model = Model; model = Model;
} }
public override void ExecuteResult<T>(System.Web.Mvc.WebViewPage<T> page) public override void ExecuteResult<T>(WebViewPage<T> page)
{ {
WebViewPage partialView = Activator.CreateInstance(viewType) as WebViewPage; WebViewPage partialView = Activator.CreateInstance(viewType) as WebViewPage;
if (partialView == null) if (partialView == null)
+4 -4
View File
@@ -16,15 +16,15 @@ namespace Disco.Services.Plugins
#region Model Binding from Controller #region Model Binding from Controller
public static bool TryUpdateModel<TModel>(this Controller controller, TModel model) where TModel : class public static bool TryUpdateModel<TModel>(this Controller controller, TModel model) where TModel : class
{ {
return controller.TryUpdateModel<TModel>(model, null, controller.ValueProvider); return controller.TryUpdateModel(model, null, controller.ValueProvider);
} }
public static bool TryUpdateModel<TModel>(this Controller controller, TModel model, IValueProvider valueProvider) where TModel : class public static bool TryUpdateModel<TModel>(this Controller controller, TModel model, IValueProvider valueProvider) where TModel : class
{ {
return controller.TryUpdateModel<TModel>(model, null, valueProvider); return controller.TryUpdateModel(model, null, valueProvider);
} }
public static bool TryUpdateModel<TModel>(this Controller controller, TModel model, string prefix) where TModel : class public static bool TryUpdateModel<TModel>(this Controller controller, TModel model, string prefix) where TModel : class
{ {
return controller.TryUpdateModel<TModel>(model, prefix, controller.ValueProvider); return controller.TryUpdateModel(model, prefix, controller.ValueProvider);
} }
public static bool TryUpdateModel<TModel>(this Controller controller, TModel model, string prefix, IValueProvider valueProvider) where TModel : class public static bool TryUpdateModel<TModel>(this Controller controller, TModel model, string prefix, IValueProvider valueProvider) where TModel : class
{ {
@@ -250,7 +250,7 @@ namespace Disco.Services.Plugins
private static MvcForm FormHelper<T>(this WebViewPage<T> ViewPage, string formAction, FormMethod method, IDictionary<string, object> htmlAttributes) private static MvcForm FormHelper<T>(this WebViewPage<T> ViewPage, string formAction, FormMethod method, IDictionary<string, object> htmlAttributes)
{ {
TagBuilder builder = new TagBuilder("form"); TagBuilder builder = new TagBuilder("form");
builder.MergeAttributes<string, object>(htmlAttributes); builder.MergeAttributes(htmlAttributes);
builder.MergeAttribute("action", formAction); builder.MergeAttribute("action", formAction);
builder.MergeAttribute("method", HtmlHelper.GetFormMethodString(method), true); builder.MergeAttribute("method", HtmlHelper.GetFormMethodString(method), true);
bool flag = ViewPage.ViewContext.ClientValidationEnabled && !ViewPage.ViewContext.UnobtrusiveJavaScriptEnabled; bool flag = ViewPage.ViewContext.ClientValidationEnabled && !ViewPage.ViewContext.UnobtrusiveJavaScriptEnabled;
+1 -1
View File
@@ -2,7 +2,7 @@
namespace Disco.Services.Plugins namespace Disco.Services.Plugins
{ {
public abstract class PluginWebViewPage<T> : Disco.Services.Web.WebViewPage<T> public abstract class PluginWebViewPage<T> : Web.WebViewPage<T>
{ {
private Lazy<WebPageHelper<T>> _plugin; private Lazy<WebPageHelper<T>> _plugin;
+3 -3
View File
@@ -176,10 +176,10 @@ namespace Disco.Services.Plugins
Log(WarningOrMessage, LogData); Log(WarningOrMessage, LogData);
} }
protected override List<Logging.Models.LogEventType> LoadEventTypes() protected override List<LogEventType> LoadEventTypes()
{ {
return new System.Collections.Generic.List<LogEventType> return new List<LogEventType>
{ {
new LogEventType new LogEventType
{ {
Id = (int)EventTypeIds.InitializingPlugins, Id = (int)EventTypeIds.InitializingPlugins,
+1 -1
View File
@@ -77,7 +77,7 @@ namespace Disco.Services.Plugins
public HtmlString PartialCompiled<ViewType>(object Model) where ViewType : WebViewPage public HtmlString PartialCompiled<ViewType>(object Model) where ViewType : WebViewPage
{ {
using (System.IO.StringWriter writer = new StringWriter(CultureInfo.CurrentCulture)) using (StringWriter writer = new StringWriter(CultureInfo.CurrentCulture))
{ {
RenderPartialCompiled<ViewType>(writer, Model); RenderPartialCompiled<ViewType>(writer, Model);
+1 -1
View File
@@ -80,7 +80,7 @@ namespace Disco.Services.Tasks
#endregion #endregion
#region Events #region Events
public delegate void UpdatedEvent(ScheduledTaskStatus sender, KeyValuePair<string, object>[] ChangedProperties); public delegate void UpdatedEvent(ScheduledTaskStatus sender, ChangedItem[] ChangedProperties);
public delegate void CancelingEvent(ScheduledTaskStatus sender); public delegate void CancelingEvent(ScheduledTaskStatus sender);
public event UpdatedEvent Updated; public event UpdatedEvent Updated;
public event CancelingEvent Canceling; public event CancelingEvent Canceling;
+3 -3
View File
@@ -124,10 +124,10 @@ namespace Disco.Services.Tasks
Log(EventTypeIds.ScheduledTasksWarning, ScheduledTaskName, SessionId, Message); Log(EventTypeIds.ScheduledTasksWarning, ScheduledTaskName, SessionId, Message);
} }
protected override List<Logging.Models.LogEventType> LoadEventTypes() protected override List<LogEventType> LoadEventTypes()
{ {
return new System.Collections.Generic.List<LogEventType> return new List<LogEventType>
{ {
new LogEventType new LogEventType
{ {
Id = (int)EventTypeIds.InitializingScheduledTasks, Id = (int)EventTypeIds.InitializingScheduledTasks,
@@ -15,7 +15,7 @@ namespace Disco.Web.Areas.API.Controllers
[HttpPost] [HttpPost]
public virtual ActionResult TestCallback(CallbackModel model) public virtual ActionResult TestCallback(CallbackModel model)
{ {
return this.PrecompiledPartialView<API.Views.Activation._ActivateCallback>(model); return this.PrecompiledPartialView<Views.Activation._ActivateCallback>(model);
} }
[HttpPost, ValidateAntiForgeryToken] [HttpPost, ValidateAntiForgeryToken]
@@ -208,7 +208,7 @@ namespace Disco.Web.Areas.API.Controllers
#region Actions #region Actions
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false) public virtual ActionResult Delete(int id, bool? redirect = false)
{ {
try try
{ {
@@ -513,7 +513,7 @@ namespace Disco.Web.Areas.API.Controllers
#region Actions #region Actions
[DiscoAuthorize(Claims.Config.DeviceBatch.Delete)] [DiscoAuthorize(Claims.Config.DeviceBatch.Delete)]
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false) public virtual ActionResult Delete(int id, bool? redirect = false)
{ {
try try
{ {
@@ -247,7 +247,7 @@ namespace Disco.Web.Areas.API.Controllers
ComputerNameTemplate = ComputerNameTemplate, ComputerNameTemplate = ComputerNameTemplate,
}; };
TestComputerNameTemplateModel.TestComputerNameTemplateResultModel evaluateDevice(Disco.Models.Repository.Device device) TestComputerNameTemplateModel.TestComputerNameTemplateResultModel evaluateDevice(Device device)
{ {
var evaluatorVariables = Expression.StandardVariables(null, Database, UserService.CurrentUser, DateTime.Now, null, device); var evaluatorVariables = Expression.StandardVariables(null, Database, UserService.CurrentUser, DateTime.Now, null, device);
var deviceResult = new TestComputerNameTemplateModel.TestComputerNameTemplateResultModel() var deviceResult = new TestComputerNameTemplateModel.TestComputerNameTemplateResultModel()
@@ -509,8 +509,8 @@ namespace Disco.Web.Areas.API.Controllers
public virtual ActionResult ImporterUndetectedFiles() public virtual ActionResult ImporterUndetectedFiles()
{ {
var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned"); var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned");
var undetectedDirectory = new System.IO.DirectoryInfo(undetectedLocation); var undetectedDirectory = new DirectoryInfo(undetectedLocation);
var m = undetectedDirectory.GetFiles("*.pdf").Select(f => new Models.DocumentTemplate.ImporterUndetectedFilesModel() var m = undetectedDirectory.GetFiles("*.pdf").Select(f => new ImporterUndetectedFilesModel()
{ {
Id = System.IO.Path.GetFileNameWithoutExtension(f.Name), Id = System.IO.Path.GetFileNameWithoutExtension(f.Name),
Timestamp = f.CreationTime.ToFullDateTime(), Timestamp = f.CreationTime.ToFullDateTime(),
@@ -554,7 +554,7 @@ namespace Disco.Web.Areas.API.Controllers
} }
if (searchScope != null) if (searchScope != null)
{ {
Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel[] results; ImporterUndetectedDataIdLookupModel[] results;
switch (searchScope) switch (searchScope)
{ {
case DocumentTemplate.DocumentTemplateScopes.Device: case DocumentTemplate.DocumentTemplateScopes.Device:
@@ -236,7 +236,7 @@ namespace Disco.Web.Areas.API.Controllers
private void UpdateScope(DocumentTemplatePackage Package, string Scope) private void UpdateScope(DocumentTemplatePackage Package, string Scope)
{ {
AttachmentTypes scope; AttachmentTypes scope;
if (!Enum.TryParse<AttachmentTypes>(Scope, true, out scope)) if (!Enum.TryParse(Scope, true, out scope))
throw new ArgumentException("Invalid Scope", nameof(Scope)); throw new ArgumentException("Invalid Scope", nameof(Scope));
if (Package.Scope != scope) if (Package.Scope != scope)
@@ -20,7 +20,7 @@ namespace Disco.Web.Areas.API.Controllers
const string pDefaultSLAExpiry = "defaultslaexpiry"; const string pDefaultSLAExpiry = "defaultslaexpiry";
[DiscoAuthorize(Claims.Config.JobQueue.Configure)] [DiscoAuthorize(Claims.Config.JobQueue.Configure)]
public virtual ActionResult Update(int id, string key, string value = null, Nullable<bool> redirect = null) public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
{ {
Authorization.Require(Claims.Config.JobQueue.Configure); Authorization.Require(Claims.Config.JobQueue.Configure);
@@ -77,37 +77,37 @@ namespace Disco.Web.Areas.API.Controllers
#region Update Shortcut Methods #region Update Shortcut Methods
[DiscoAuthorize(Claims.Config.JobQueue.Configure)] [DiscoAuthorize(Claims.Config.JobQueue.Configure)]
public virtual ActionResult UpdateName(int id, string QueueName = null, Nullable<bool> redirect = null) public virtual ActionResult UpdateName(int id, string QueueName = null, bool? redirect = null)
{ {
return Update(id, pName, QueueName, redirect); return Update(id, pName, QueueName, redirect);
} }
[DiscoAuthorize(Claims.Config.JobQueue.Configure)] [DiscoAuthorize(Claims.Config.JobQueue.Configure)]
public virtual ActionResult UpdateDescription(int id, string Description = null, Nullable<bool> redirect = null) public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
{ {
return Update(id, pDescription, Description, redirect); return Update(id, pDescription, Description, redirect);
} }
[DiscoAuthorize(Claims.Config.JobQueue.Configure)] [DiscoAuthorize(Claims.Config.JobQueue.Configure)]
public virtual ActionResult UpdatePriority(int id, string Priority = null, Nullable<bool> redirect = null) public virtual ActionResult UpdatePriority(int id, string Priority = null, bool? redirect = null)
{ {
return Update(id, pPriority, Priority, redirect); return Update(id, pPriority, Priority, redirect);
} }
[DiscoAuthorize(Claims.Config.JobQueue.Configure)] [DiscoAuthorize(Claims.Config.JobQueue.Configure)]
public virtual ActionResult UpdateDefaultSLAExpiry(int id, string DefaultSLAExpiry = null, Nullable<bool> redirect = null) public virtual ActionResult UpdateDefaultSLAExpiry(int id, string DefaultSLAExpiry = null, bool? redirect = null)
{ {
return Update(id, pDefaultSLAExpiry, DefaultSLAExpiry, redirect); return Update(id, pDefaultSLAExpiry, DefaultSLAExpiry, redirect);
} }
[DiscoAuthorize(Claims.Config.JobQueue.Configure)] [DiscoAuthorize(Claims.Config.JobQueue.Configure)]
public virtual ActionResult UpdateIcon(int id, string Icon = null, Nullable<bool> redirect = null) public virtual ActionResult UpdateIcon(int id, string Icon = null, bool? redirect = null)
{ {
return Update(id, pIcon, Icon, redirect); return Update(id, pIcon, Icon, redirect);
} }
[DiscoAuthorize(Claims.Config.JobQueue.Configure)] [DiscoAuthorize(Claims.Config.JobQueue.Configure)]
public virtual ActionResult UpdateIconColour(int id, string IconColour = null, Nullable<bool> redirect = null) public virtual ActionResult UpdateIconColour(int id, string IconColour = null, bool? redirect = null)
{ {
return Update(id, pIconColour, IconColour, redirect); return Update(id, pIconColour, IconColour, redirect);
} }
@@ -249,7 +249,7 @@ namespace Disco.Web.Areas.API.Controllers
{ {
JobQueuePriority priority; JobQueuePriority priority;
if (!Enum.TryParse<JobQueuePriority>(Priority, out priority)) if (!Enum.TryParse(Priority, out priority))
throw new ArgumentException("Invalid Priority Value", "Priority"); throw new ArgumentException("Invalid Priority Value", "Priority");
jobQueue.Priority = priority; jobQueue.Priority = priority;
@@ -312,7 +312,7 @@ namespace Disco.Web.Areas.API.Controllers
} }
} }
private void UpdateJobSubTypes(Disco.Models.Repository.JobQueue jobQueue, List<string> JobSubTypes) private void UpdateJobSubTypes(JobQueue jobQueue, List<string> JobSubTypes)
{ {
Database.Configuration.LazyLoadingEnabled = true; Database.Configuration.LazyLoadingEnabled = true;
@@ -326,7 +326,7 @@ namespace Disco.Web.Areas.API.Controllers
// Add New // Add New
if (JobSubTypes != null && JobSubTypes.Count > 0) if (JobSubTypes != null && JobSubTypes.Count > 0)
{ {
var subTypes = new List<Disco.Models.Repository.JobSubType>(); var subTypes = new List<JobSubType>();
foreach (var stId in JobSubTypes) foreach (var stId in JobSubTypes)
{ {
var typeId = stId.Substring(0, stId.IndexOf("_")); var typeId = stId.Substring(0, stId.IndexOf("_"));
@@ -342,7 +342,7 @@ namespace Disco.Web.Areas.API.Controllers
#region Actions #region Actions
[DiscoAuthorize(Claims.Config.JobQueue.Delete)] [DiscoAuthorize(Claims.Config.JobQueue.Delete)]
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false) public virtual ActionResult Delete(int id, bool? redirect = false)
{ {
try try
{ {
@@ -16,7 +16,7 @@ namespace Disco.Web.Areas.API.Controllers
const string pSla = "sla"; const string pSla = "sla";
const string pPriority = "priority"; const string pPriority = "priority";
public virtual ActionResult Update(int id, string key, string value = null, Nullable<bool> redirect = null) public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
{ {
try try
{ {
@@ -65,28 +65,28 @@ namespace Disco.Web.Areas.API.Controllers
#region Update Shortcut Methods #region Update Shortcut Methods
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyComments, Claims.Job.Properties.JobQueueProperties.EditOwnComments)] [DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyComments, Claims.Job.Properties.JobQueueProperties.EditOwnComments)]
public virtual ActionResult UpdateAddedComment(int id, string AddedComment = null, Nullable<bool> redirect = null) public virtual ActionResult UpdateAddedComment(int id, string AddedComment = null, bool? redirect = null)
{ {
return Update(id, pAddedComment, AddedComment, redirect); return Update(id, pAddedComment, AddedComment, redirect);
} }
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyComments, Claims.Job.Properties.JobQueueProperties.EditOwnComments)] [DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyComments, Claims.Job.Properties.JobQueueProperties.EditOwnComments)]
public virtual ActionResult UpdateRemovedComment(int id, string RemovedComment = null, Nullable<bool> redirect = null) public virtual ActionResult UpdateRemovedComment(int id, string RemovedComment = null, bool? redirect = null)
{ {
return Update(id, pRemovedComment, RemovedComment, redirect); return Update(id, pRemovedComment, RemovedComment, redirect);
} }
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnySLA, Claims.Job.Properties.JobQueueProperties.EditOwnSLA)] [DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnySLA, Claims.Job.Properties.JobQueueProperties.EditOwnSLA)]
public virtual ActionResult UpdateSla(int id, string SLA = null, Nullable<bool> redirect = null) public virtual ActionResult UpdateSla(int id, string SLA = null, bool? redirect = null)
{ {
return Update(id, pSla, SLA, redirect); return Update(id, pSla, SLA, redirect);
} }
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyPriority, Claims.Job.Properties.JobQueueProperties.EditOwnPriority)] [DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyPriority, Claims.Job.Properties.JobQueueProperties.EditOwnPriority)]
public virtual ActionResult UpdatePriority(int id, string Priority = null, Nullable<bool> redirect = null) public virtual ActionResult UpdatePriority(int id, string Priority = null, bool? redirect = null)
{ {
return Update(id, pPriority, Priority, redirect); return Update(id, pPriority, Priority, redirect);
} }
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnySLA, Claims.Job.Properties.JobQueueProperties.EditOwnSLA, [DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnySLA, Claims.Job.Properties.JobQueueProperties.EditOwnSLA,
Claims.Job.Properties.JobQueueProperties.EditAnyPriority, Claims.Job.Properties.JobQueueProperties.EditOwnPriority)] Claims.Job.Properties.JobQueueProperties.EditAnyPriority, Claims.Job.Properties.JobQueueProperties.EditOwnPriority)]
public virtual ActionResult UpdateSlaAndPriority(int id, string Sla = null, string Priority = null, Nullable<bool> redirect = null) public virtual ActionResult UpdateSlaAndPriority(int id, string Sla = null, string Priority = null, bool? redirect = null)
{ {
try try
{ {
@@ -166,7 +166,7 @@ namespace Disco.Web.Areas.API.Controllers
JobQueuePriority priority; JobQueuePriority priority;
if (!Enum.TryParse<JobQueuePriority>(Priority, out priority)) if (!Enum.TryParse(Priority, out priority))
throw new ArgumentException("Invalid Priority Value", "Priority"); throw new ArgumentException("Invalid Priority Value", "Priority");
jobQueueJob.OnEditPriority(priority); jobQueueJob.OnEditPriority(priority);
@@ -24,7 +24,7 @@ namespace Disco.Web.Areas.API.Controllers
const string pOnUnassignmentExpression = "onunassignmentexpression"; const string pOnUnassignmentExpression = "onunassignmentexpression";
[DiscoAuthorize(Claims.Config.UserFlag.Configure)] [DiscoAuthorize(Claims.Config.UserFlag.Configure)]
public virtual ActionResult Update(int id, string key, string value = null, Nullable<bool> redirect = null) public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
{ {
Authorization.Require(Claims.Config.UserFlag.Configure); Authorization.Require(Claims.Config.UserFlag.Configure);
@@ -81,25 +81,25 @@ namespace Disco.Web.Areas.API.Controllers
#region Update Shortcut Methods #region Update Shortcut Methods
[DiscoAuthorize(Claims.Config.UserFlag.Configure)] [DiscoAuthorize(Claims.Config.UserFlag.Configure)]
public virtual ActionResult UpdateName(int id, string FlagName = null, Nullable<bool> redirect = null) public virtual ActionResult UpdateName(int id, string FlagName = null, bool? redirect = null)
{ {
return Update(id, pName, FlagName, redirect); return Update(id, pName, FlagName, redirect);
} }
[DiscoAuthorize(Claims.Config.UserFlag.Configure)] [DiscoAuthorize(Claims.Config.UserFlag.Configure)]
public virtual ActionResult UpdateDescription(int id, string Description = null, Nullable<bool> redirect = null) public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
{ {
return Update(id, pDescription, Description, redirect); return Update(id, pDescription, Description, redirect);
} }
[DiscoAuthorize(Claims.Config.UserFlag.Configure)] [DiscoAuthorize(Claims.Config.UserFlag.Configure)]
public virtual ActionResult UpdateIcon(int id, string Icon = null, Nullable<bool> redirect = null) public virtual ActionResult UpdateIcon(int id, string Icon = null, bool? redirect = null)
{ {
return Update(id, pIcon, Icon, redirect); return Update(id, pIcon, Icon, redirect);
} }
[DiscoAuthorize(Claims.Config.UserFlag.Configure)] [DiscoAuthorize(Claims.Config.UserFlag.Configure)]
public virtual ActionResult UpdateIconColour(int id, string IconColour = null, Nullable<bool> redirect = null) public virtual ActionResult UpdateIconColour(int id, string IconColour = null, bool? redirect = null)
{ {
return Update(id, pIconColour, IconColour, redirect); return Update(id, pIconColour, IconColour, redirect);
} }
@@ -349,7 +349,7 @@ namespace Disco.Web.Areas.API.Controllers
#region Actions #region Actions
[DiscoAuthorizeAll(Claims.Config.UserFlag.Configure, Claims.Config.UserFlag.Delete)] [DiscoAuthorizeAll(Claims.Config.UserFlag.Configure, Claims.Config.UserFlag.Delete)]
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false) public virtual ActionResult Delete(int id, bool? redirect = false)
{ {
try try
{ {
@@ -56,7 +56,7 @@ namespace Disco.Web.Areas.Config.Controllers
else else
{ {
// List Index // List Index
var m = new Models.DeviceFlag.IndexModel() var m = new IndexModel()
{ {
DeviceFlags = Database.DeviceFlags DeviceFlags = Database.DeviceFlags
.Select(uf => new .Select(uf => new
@@ -73,14 +73,14 @@ namespace Disco.Web.Areas.Config.Controllers
m.CertificateAuthorityProviders = Plugins.GetPluginFeatures(typeof(CertificateAuthorityProviderFeature)); m.CertificateAuthorityProviders = Plugins.GetPluginFeatures(typeof(CertificateAuthorityProviderFeature));
m.WirelessProfileProviders = Plugins.GetPluginFeatures(typeof(WirelessProfileProviderFeature)); m.WirelessProfileProviders = Plugins.GetPluginFeatures(typeof(WirelessProfileProviderFeature));
var DistributionValues = Enum.GetValues(typeof(Disco.Models.Repository.DeviceProfile.DistributionTypes)); var DistributionValues = Enum.GetValues(typeof(DeviceProfile.DistributionTypes));
m.DeviceProfileDistributionTypes = new List<SelectListItem>(); m.DeviceProfileDistributionTypes = new List<SelectListItem>();
foreach (int value in DistributionValues) foreach (int value in DistributionValues)
{ {
m.DeviceProfileDistributionTypes.Add(new SelectListItem() m.DeviceProfileDistributionTypes.Add(new SelectListItem()
{ {
Value = value.ToString(), Value = value.ToString(),
Text = Enum.GetName(typeof(Disco.Models.Repository.DeviceProfile.DistributionTypes), value), Text = Enum.GetName(typeof(DeviceProfile.DistributionTypes), value),
Selected = ((int)m.DeviceProfile.DistributionType == value) Selected = ((int)m.DeviceProfile.DistributionType == value)
}); });
} }
@@ -163,7 +163,7 @@ namespace Disco.Web.Areas.Config.Controllers
DefaultAddDeviceOffline = Database.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId DefaultAddDeviceOffline = Database.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId
}; };
m.DeviceProfilesAndNone = m.DeviceProfiles.ToList(); m.DeviceProfilesAndNone = m.DeviceProfiles.ToList();
m.DeviceProfilesAndNone.Insert(0, new Disco.Models.Repository.DeviceProfile() { Id = 0, Name = "<No Default>" }); m.DeviceProfilesAndNone.Insert(0, new DeviceProfile() { Id = 0, Name = "<No Default>" });
// UI Extensions // UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceProfileDefaultsModel>(this.ControllerContext, m); UIExtensions.ExecuteExtensions<ConfigDeviceProfileDefaultsModel>(this.ControllerContext, m);
@@ -83,7 +83,7 @@ namespace Disco.Web.Areas.Config.Controllers
// Default Queue // Default Queue
var m = new Models.JobQueue.CreateModel() var m = new Models.JobQueue.CreateModel()
{ {
JobQueue = new Disco.Models.Repository.JobQueue() JobQueue = new JobQueue()
{ {
Icon = JobQueueService.RandomUnusedIcon(), Icon = JobQueueService.RandomUnusedIcon(),
IconColour = JobQueueService.RandomUnusedThemeColour(), IconColour = JobQueueService.RandomUnusedThemeColour(),
@@ -14,7 +14,7 @@ namespace Disco.Web.Areas.Config.Controllers
[DiscoAuthorize(Claims.Config.Plugin.Show), HttpGet] [DiscoAuthorize(Claims.Config.Plugin.Show), HttpGet]
public virtual ActionResult Index() public virtual ActionResult Index()
{ {
Models.Plugins.IndexViewModel vm = new Models.Plugins.IndexViewModel() IndexViewModel vm = new IndexViewModel()
{ {
PluginManifests = Plugins.GetPlugins(), PluginManifests = Plugins.GetPlugins(),
PluginLibrary = PluginLibrary.LoadManifest(Database) PluginLibrary = PluginLibrary.LoadManifest(Database)
@@ -80,7 +80,7 @@ namespace Disco.Web.Areas.Config.Controllers
} }
else else
{ {
var model = new Models.Plugins.InstallModel() var model = new InstallModel()
{ {
Library = library Library = library
}; };
@@ -26,7 +26,7 @@ namespace Disco.Web.Areas.Config.Controllers
{ {
// Show // Show
var m = Database.UserFlags.Where(f => f.Id == id.Value).Select(f => var m = Database.UserFlags.Where(f => f.Id == id.Value).Select(f =>
new Models.UserFlag.ShowModel() new ShowModel()
{ {
UserFlag = f, UserFlag = f,
CurrentAssignmentCount = f.UserFlagAssignments.Count(a => !a.RemovedDate.HasValue), CurrentAssignmentCount = f.UserFlagAssignments.Count(a => !a.RemovedDate.HasValue),
@@ -57,7 +57,7 @@ namespace Disco.Web.Areas.Config.Controllers
else else
{ {
// List Index // List Index
var m = new Models.UserFlag.IndexModel() var m = new IndexModel()
{ {
UserFlags = Database.UserFlags UserFlags = Database.UserFlags
.Select(uf => new .Select(uf => new
@@ -81,7 +81,7 @@ namespace Disco.Web.Areas.Config.Controllers
public virtual ActionResult Create() public virtual ActionResult Create()
{ {
// Default Queue // Default Queue
var m = new Models.UserFlag.CreateModel() var m = new CreateModel()
{ {
UserFlag = new UserFlag() UserFlag = new UserFlag()
{ {
@@ -97,7 +97,7 @@ namespace Disco.Web.Areas.Config.Controllers
} }
[DiscoAuthorizeAll(Claims.Config.UserFlag.Create, Claims.Config.UserFlag.Configure), HttpPost] [DiscoAuthorizeAll(Claims.Config.UserFlag.Create, Claims.Config.UserFlag.Configure), HttpPost]
public virtual ActionResult Create(Models.UserFlag.CreateModel model) public virtual ActionResult Create(CreateModel model)
{ {
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
@@ -3,7 +3,7 @@
public class EditorModel public class EditorModel
{ {
public string Expression { get; set; } public string Expression { get; set; }
public Disco.Web.Areas.API.Models.Expressions.ValidateExpressionModel ExpressionException { get; set; } public API.Models.Expressions.ValidateExpressionModel ExpressionException { get; set; }
public string TestScope { get; set; } public string TestScope { get; set; }
public string TestScopeDataType { get; set; } public string TestScopeDataType { get; set; }
public string TestScopeDataId { get; set; } public string TestScopeDataId { get; set; }
+2 -2
View File
@@ -15,7 +15,7 @@ namespace Disco.Web
public static HtmlHelper GetPageHelper(this System.Web.WebPages.Html.HtmlHelper html) public static HtmlHelper GetPageHelper(this System.Web.WebPages.Html.HtmlHelper html)
{ {
return ((System.Web.Mvc.WebViewPage)WebPageContext.Current.Page).Html; return ((WebViewPage)WebPageContext.Current.Page).Html;
} }
#region T4MVC Disco Extensions #region T4MVC Disco Extensions
@@ -66,7 +66,7 @@ namespace Disco.Web
} }
public static MvcHtmlString OrganisationLogoUrl(this UrlHelper urlHelper, int Width = 256, int Height = 256) public static MvcHtmlString OrganisationLogoUrl(this UrlHelper urlHelper, int Width = 256, int Height = 256)
{ {
var config = new Disco.Data.Configuration.SystemConfiguration(null); var config = new Data.Configuration.SystemConfiguration(null);
return new MvcHtmlString(urlHelper.Action(MVC.API.System.OrganisationLogo(Width, Height, config.OrganisationLogoHash))); return new MvcHtmlString(urlHelper.Action(MVC.API.System.OrganisationLogo(Width, Height, config.OrganisationLogoHash)));
} }
#endregion #endregion
@@ -22,7 +22,7 @@ namespace Disco.Web.Controllers
} }
[NonAction] [NonAction]
public virtual System.Web.Mvc.ActionResult Show(string id) public virtual ActionResult Show(string id)
{ {
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Show); var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Show);
+1 -1
View File
@@ -183,7 +183,7 @@ namespace Disco.Web
} }
#endregion #endregion
#region Dropbox Monitor #region Dropbox Monitor
public static Disco.Services.Documents.AttachmentImport.ImportDirectoryMonitor DocumentDropBoxMonitor { get; set; } public static Services.Documents.AttachmentImport.ImportDirectoryMonitor DocumentDropBoxMonitor { get; set; }
#endregion #endregion
#region Global Error Logging #region Global Error Logging
void DiscoApplication_Error(object sender, EventArgs e) void DiscoApplication_Error(object sender, EventArgs e)
+1 -1
View File
@@ -26,7 +26,7 @@ namespace Disco.Web.Models.Job
[Required] [Required]
public int JobId { get; set; } public int JobId { get; set; }
[Required(ErrorMessage = "Please specify a Repair Address")] [Required(ErrorMessage = "Please specify a Repair Address")]
public Nullable<int> OrganisationAddressId { get; set; } public int? OrganisationAddressId { get; set; }
[Required(ErrorMessage = "Please specify a Repair Provider")] [Required(ErrorMessage = "Please specify a Repair Provider")]
public string RepairProviderId { get; set; } 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(System.ComponentModel.DataAnnotations.DataType.MultilineText)]
+1 -1
View File
@@ -26,7 +26,7 @@ namespace Disco.Web.Models.Job
[Required] [Required]
public int JobId { get; set; } public int JobId { get; set; }
[Required(ErrorMessage = "Please specify a Repair Address")] [Required(ErrorMessage = "Please specify a Repair Address")]
public Nullable<int> OrganisationAddressId { get; set; } public int? OrganisationAddressId { get; set; }
[Required(ErrorMessage = "Please specify a Warranty Provider")] [Required(ErrorMessage = "Please specify a Warranty Provider")]
public string WarrantyProviderId { get; set; } 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(System.ComponentModel.DataAnnotations.DataType.MultilineText)]