/// <summary>
        /// Pass null if you want to add a new ruleslist
        /// </summary>
        /// <param name="toUse"></param>
        public frmApexRulesEdit(apex_rules_rulelist toUse)
        {
            InitializeComponent();

            if (toUse == null)
            {
                _formARR = new apex_rules_rulelist();
            }
            else
            {
                _formARR = toUse;
                LoadRules();
            }
        }
Beispiel #2
0
        internal apex_rules_rulelist GetApplicableRule()
        {
            apex_rules_rulelist toReturn = new apex_rules_rulelist();

            List <apex_rules_rulelist> allRules = toReturn.GetAllRules(false);

            toReturn = null;
            foreach (apex_rules_rulelist checkRule in allRules)
            {
                if (checkRule.Applies(this))
                {
                    // return first applicable rule
                    toReturn = checkRule;
                    break;
                }
            }
            return(toReturn);
        }
        internal List <apex_rules_rulelist> GetAllRules(bool forceRefresh)
        {
            if ((allRules == null) || (forceRefresh))
            {
                apex_rules_rulelist arr = new apex_rules_rulelist();
                allRules = new List <apex_rules_rulelist>();
                DataTable allData = arr.GetAllData("priority");

                foreach (DataRow aRow in allData.Rows)
                {
                    arr = new apex_rules_rulelist();
                    arr.Load(aRow);

                    allRules.Add(arr);
                }
            }

            return(allRules);
        }