/// <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);
        }
Exemple #2
0
 public static StatesNVL GetNameValueList()
 {
     if (_list == null)
     {
         _list = DataPortal.Fetch <StatesNVL>();
     }
     return(_list);
 }
Exemple #3
0
        public Form1()
        {
            InitializeComponent();

            var root = Root.NewEditableRoot();

            statesNVLBindingSource.DataSource  = StatesNVL.GetNameValueList();
            countryNVLBindingSource.DataSource = CountryNVL.GetNameValueList();
            rootBindingSource.DataSource       = root;
        }
Exemple #4
0
        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;
        }
Exemple #5
0
 public static void InvalidateCache()
 {
     _list = null;
 }