Пример #1
0
        private GSearchResultCube FormatResultRule(GSearchResultCube result)
        {
            bool   isErrored = false;
            string info      = new SqlClientManager(ConnectionString, IdpeKeyTypes.ConnectionStringSqlCe)
                               .ExecuteQuery("select name, rulesettype from idpedatasource ds inner join idperuledatasource rds on rds.datasourceid = ds.id where ruleid = " + result.ReferenceId
                                             , ref isErrored);

            if ((info == "NULL") || (string.IsNullOrEmpty(info)))
            {
                result.DataSource = "0-General";
                result.Where      = "Master";
            }
            else
            {
                info = info.Replace("NULL", string.Empty);
                result.DataSource = info.Split("|".ToCharArray())[0];
                string strRuleType = info.Split("|".ToCharArray())[1];

                int ruleType = 0;
                if (int.TryParse(strRuleType, out ruleType))
                {
                    RuleSetTypes ruleSetTypes = (RuleSetTypes)ruleType;
                    result.Param1 = ruleSetTypes.ToString();
                    result.Where  = "Rule - " + ruleSetTypes.ToString();
                }
                else
                {
                    result.Where = "Unknown";
                }
            }

            result.Value = string.Empty;
            return(result);
        }
Пример #2
0
        private void BindData()
        {
            Manager   manager = new Manager();
            DataTable table   = manager.GetRuleDependencies(RuleId);

            this.Text = "Rule Dependencies - " + manager.GetRule(RuleId).Name;

            lvwDataSources.Items.Clear();
            foreach (DataRow row in table.Rows)
            {
                string dataSourceName = row[1].ToString();
                if (!string.IsNullOrEmpty(txtSearch.Text))
                {
                    if (!(dataSourceName.ToLower().Contains(txtSearch.Text.ToLower())))
                    {
                        continue;
                    }
                }

                ListViewItem item        = new ListViewItem(dataSourceName);
                RuleSetTypes ruleSetType = (RuleSetTypes)int.Parse(row[2].ToString());

                item.SubItems.Add(ruleSetType.ToString());
                item.Tag = row[0].ToString();
                lvwDataSources.Items.Add(item);
            }
        }
Пример #3
0
        void ExportRuleNames(List <IdpeRule> allRules, RuleSetTypes ruleSetType)
        {
            List <IdpeRule> rules = allRules.Where(r => r.RuleSetType == (int)ruleSetType).ToList();

            foreach (IdpeRule rule in rules)
            {
                RuleNames.Add(string.Format("{0}({1}):{2}", ruleSetType.ToString().PadRight(12), rule.Priority, rule.Name));
            }
        }