using Disco.Models.UI.Config.JobPreferences; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace Disco.Web.Areas.Config.Models.JobPreferences { public class IndexModel : ConfigJobPreferencesIndexModel { public int LongRunningJobDaysThreshold { get; set; } public List> LongRunningJobDaysThresholdOptions() { var options = new List>() { new KeyValuePair(1, "1 Day"), new KeyValuePair(2, "2 Days"), new KeyValuePair(3, "3 Days"), new KeyValuePair(4, "4 Days"), new KeyValuePair(5, "5 Days"), new KeyValuePair(6, "6 Days"), new KeyValuePair(7, "1 Week"), new KeyValuePair(14, "2 Weeks"), new KeyValuePair(21, "3 Weeks"), new KeyValuePair(28, "4 Weeks"), new KeyValuePair(35, "5 Weeks"), new KeyValuePair(42, "6 Weeks"), new KeyValuePair(49, "7 Weeks"), new KeyValuePair(56, "8 Weeks") }; var current = this.LongRunningJobDaysThreshold; if (!options.Any(o => o.Key == current)) { options.Add(new KeyValuePair(current, string.Format("{0} Days", current))); options = options.OrderBy(o => o.Key).ToList(); } return options; } } }