Feature #4: Pre-defined/Restricted Locations
Configurable list and location suggestions. Ability to restrict locations. Shows 'occupied' locations.
This commit is contained in:
@@ -86,5 +86,22 @@ namespace Disco.Data.Configuration
|
||||
return JsonConvert.DeserializeObject<ValueType>(jsonValue);
|
||||
}
|
||||
|
||||
protected void SetAsEnum<EnumType>(EnumType Value, [CallerMemberName] string Key = null)
|
||||
{
|
||||
if (Value == null)
|
||||
this.Set<string>(null, Key);
|
||||
else
|
||||
this.Set(Value.ToString(), Key);
|
||||
}
|
||||
protected EnumType GetFromEnum<EnumType>(EnumType Default, [CallerMemberName] string Key = null)
|
||||
{
|
||||
var stringValue = this.Get<string>(null, Key);
|
||||
|
||||
if (stringValue == null)
|
||||
return Default;
|
||||
else
|
||||
return (EnumType)Enum.Parse(typeof(EnumType), stringValue);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Disco.Models.BI.Job;
|
||||
|
||||
namespace Disco.Data.Configuration.Modules
|
||||
{
|
||||
@@ -42,5 +43,17 @@ namespace Disco.Data.Configuration.Modules
|
||||
Set(value);
|
||||
}
|
||||
}
|
||||
|
||||
public LocationModes LocationMode
|
||||
{
|
||||
get { return GetFromEnum<LocationModes>(LocationModes.Unrestricted); }
|
||||
set { SetAsEnum(value); }
|
||||
}
|
||||
|
||||
public List<string> LocationList
|
||||
{
|
||||
get { return GetFromJson<List<string>>(new List<string>()); }
|
||||
set { SetAsJson(value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user