Exemplo n.º 1
0
        private void AddTemplateRuleToTree(TreeList treList, string ruleName, TreeListNode parentNode)
        {
            if (RulesDt == null || RulesDt.Rows.Count == 0)
            {
                return;
            }

            DataRow[] drs = RulesDt.Select(string.Format("ChkTypeName='{0}'", ruleName));
            if (drs == null || drs.Length == 0)
            {
                return;
            }
            foreach (DataRow dr in drs)
            {
                treList.AppendNode(new object[] { dr["ChkTypeName"], 1 }, parentNode);
            }
            return;
        }
Exemplo n.º 2
0
        private object  GetSubRulesSource(TreeListNode node)
        {
            TreeList tempList = null;

            if (node.Level == 0)
            {
                tempList = new TreeList();
                TreeListColumn col = tempList.Columns.Add();
                col.Caption   = "规则分类";
                col.Name      = "TypeName";
                col.FieldName = "TypeName";
                col.Visible   = true;
                col.OptionsColumn.AllowEdit = false;

                col           = tempList.Columns.Add();
                col.Caption   = "规则个数";
                col.Name      = "RuleCount";
                col.FieldName = "RuleCount";
                col.Visible   = true;
                col.OptionsColumn.AllowEdit = false;

                TreeListNode rootNode = tempList.AppendNode(new object[] { "root", "0" }, null);
                //rootNode.StateImageIndex = 0;
                AppendTreeNodes(tempList, m_CurrTemplateRules.ClassifyRules, rootNode);
                return(rootNode);
            }
            else if (node.HasChildren)
            {
                tempList = new TreeList();
                TreeListColumn col = tempList.Columns.Add();
                col.Caption   = "规则分类";
                col.Name      = "TypeName";
                col.FieldName = "TypeName";
                col.Visible   = true;
                col.OptionsColumn.AllowEdit = false;

                col           = tempList.Columns.Add();
                col.Caption   = "规则个数";
                col.Name      = "RuleCount";
                col.FieldName = "RuleCount";
                col.Visible   = true;
                col.OptionsColumn.AllowEdit = false;
                //增加一级、二级节点
                AppendTreeNodes(tempList, m_CurrTemplateRules.ClassifyRules, null, node["RuleName"].ToString());
                return(tempList.Nodes.FirstNode);
            }
            else
            {
                if (RulesDt == null || RulesDt.Rows.Count == 0)
                {
                    return(null);
                }

                DataRow[] drs = RulesDt.Select(string.Format("ChkTypeName='{0}'", node["RuleName"]));
                if (drs == null || drs.Length == 0)
                {
                    return(null);
                }

                DataTable tempTable = new DataTable();
                tempTable = drs[0].Table.Clone();
                foreach (DataRow dr in drs)
                {
                    tempTable.ImportRow(dr);
                }
                return(tempTable);
            }
        }