using Disco.Data.Repository; using Disco.Models.Services.Devices.Exporting; using Disco.Models.Services.Jobs; using Disco.Models.Services.Jobs.Exporting; using System; using System.Collections.Generic; namespace Disco.Data.Configuration.Modules { public class JobPreferencesConfiguration : ConfigurationBase { public JobPreferencesConfiguration(DiscoDataContext Database) : base(Database) { } public override string Scope { get { return "JobPreferences"; } } /// /// Number of days a job is open before it is considered 'Long Running' /// public int LongRunningJobDaysThreshold { get { return Get(7); } set { if (value < 0) throw new ArgumentOutOfRangeException("value", "The Long Running Job Days Threshold cannot be less than zero"); Set(value); } } /// /// Number of minutes since the last recorded action is performed on a job before it is considered 'Stale' /// public int StaleJobMinutesThreshold { get { return Get(60 * 24 * 2); } // Default to 48 Hours (2 days) set { if (value < 0) throw new ArgumentOutOfRangeException("value", "The Stale Job Minutes Threshold cannot be less than zero"); Set(value); } } public bool LodgmentIncludeAllAttachmentsByDefault { get { return Get(false); } set { Set(value); } } /// /// Theme used in noticeboards by default. /// /// public string DefaultNoticeboardTheme { get { return Get("default"); } set { if (string.IsNullOrWhiteSpace(value)) throw new ArgumentNullException("DefaultNoticeboardTheme"); Set(value); } } public LocationModes LocationMode { get { return Get(LocationModes.Unrestricted); } set { Set(value); } } public List LocationList { get { return Get(new List()); } set { Set(value); } } public string OnCreateExpression { get { return Get(null); } set { Set(value); } } public string OnDeviceReadyForReturnExpression { get { return Get(null); } set { Set(value); } } public string OnCloseExpression { get { return Get(null); } set { Set(value); } } public JobExportOptions LastExportOptions { get { return this.Get(JobExportOptions.DefaultOptions()); } set { this.Set(value); this.LastExportDate = DateTime.Now; } } public DateTime? LastExportDate { get { return this.Get(null); } set { this.Set(value); } } } }