/// <summary> /// Look up State and set the state name /// </summary> /// <param name="context">Rule context object.</param> protected override void Execute(RuleContext context) { var stateId = (string)context.InputPropertyValues[PrimaryProperty]; var state = StatesNVL.GetNameValueList().Where(p => p.Key == stateId).FirstOrDefault(); context.AddOutValue(StateName, state == null ? "Unknown state" : state.Value); }
public static StatesNVL GetNameValueList() { if (_list == null) { _list = DataPortal.Fetch <StatesNVL>(); } return(_list); }
public Form1() { InitializeComponent(); var root = Root.NewEditableRoot(); statesNVLBindingSource.DataSource = StatesNVL.GetNameValueList(); countryNVLBindingSource.DataSource = CountryNVL.GetNameValueList(); rootBindingSource.DataSource = root; }
public static void BeginGetNameValueList(EventHandler <DataPortalResult <StatesNVL> > callback) { if (_list != null) { callback(null, new DataPortalResult <StatesNVL>(_list, null, null)); return; } var portal = new DataPortal <StatesNVL>(); portal.FetchCompleted += (o, e) => { if (e.Error == null) { _list = e.Object; } callback(o, e); }; portal.BeginFetch(); return; }
public static void InvalidateCache() { _list = null; }