Example #1
0
        /// <summary>
        /// Loads the rules tree.
        /// </summary>
        public void LoadRulesTree()
        {
            this.treeListRule.BeginUnboundLoad();
            this.treeListRule.BeginUpdate();
            this.treeListRule.ClearNodes();
            try
            {
                if (m_CurrTemplateRules == null)
                {
                    m_CurrTemplateRules = new TemplateRules(CurrentSchemaId);
                }
                RulesDt = m_CurrTemplateRules.CurrentSchemaRulesDt;
                m_TempScheamRules = m_CurrTemplateRules.CurrentSchemaRules;
                bool NodeChecked = false;

                //����һ������
                if (TreeShowType == RuleTreeShowType.ViewRulesAndSelection)
                {
                    //����һ������
                    if (RulesSelection == null)
                    {
                        SchemaRuleEx[] ex = new SchemaRuleEx[m_TempScheamRules.Count];
                        m_CurrTemplateRules.CurrentSchemaRules.CopyTo(ex, 0);
                        RulesSelection = new List<SchemaRuleEx>();
                        RulesSelection.AddRange(ex);
                    }
                }
                //���Ӹ��ڵ�
                int count = m_CurrTemplateRules.CalculateRulesCount(m_CurrTemplateRules.ClassifyRules);
                TreeListNode rootNode = treeListRule.AppendNode(new object[] { string.Format("{0} ({1})", CurrentTaskName, count), 0, "0", count }, null);
                //rootNode.StateImageIndex = 0;

                if (RulesSelection != null)
                {
                    SetRulesHistoryState(Convert.ToInt32(rootNode["ruleBM"]), RulesSelection);
                }
                //GetRulesHistoryState(rootNode["RuleName"].ToString(), ref NodeChecked);

                rootNode.Checked = RulesSelection == null ? treeListRule.OptionsView.ShowCheckBoxes : NodeChecked;

                //SetRulesHistoryState(rootNode["RuleName"].ToString(), rootNode.Checked);

                //����һ���������ڵ�
                AppendTreeNodes(m_CurrTemplateRules.ClassifyRules, rootNode);
            }
            catch
            {
            }
            finally
            {
                treeListRule.Columns[0].Width = 280;
                //treeListRule.BestFitColumns();
                this.treeListRule.EndUpdate();
                this.treeListRule.EndUnboundLoad();
                this.treeListRule.ExpandAll();
            }
        }
Example #2
0
        private void init()
        {
            m_CurrentSchemaRules = new List<SchemaRuleEx>();
            try
            {
                GetRuleClassify();

                if (m_ruleDt == null || m_ruleDt.Rows.Count == 0)
                {
                    return;
                }

                SchemaRuleEx ruleEx = null;
                //实例化ruleDt
                GenerateRulesTable();

                foreach (DataRow dr in m_ruleDt.Rows)
                {
                    try
                    {
                        ruleEx = new SchemaRuleEx();
                        DataRow row = CurrentSchemaRulesDt.NewRow();

                        string chkTypeName = dr["ChkTypeName"].ToString();
                        string strTemplateId = dr["TempInstID"].ToString();
                        ruleEx.SchemaId = m_strSchemaId;

                        ruleEx.bIsCatalogTopo = Convert.ToBoolean(dr["IsCatalogTopo"]);
                        ruleEx.ChkTypeName = chkTypeName;
                        //ruleEx.CreateTime = Convert.ToDateTime(dr["CreateTime"]);
                        ruleEx.RuleTmpletType = (RuleTempletType)dr["TempletType"];
                        //ruleEx.strPerson = dr["Person"].ToString();
                        ruleEx.FeaClassName = dr["SourceLayer"].ToString();
                        ruleEx.strLogicalDesc = dr["LogicalDesc"].ToString();
                        ruleEx.strRemark = dr["Remark"].ToString();
                        ruleEx.TemplateName = dr["TempletName"].ToString();

                        ruleEx.ThridClassificationBM = GetParentId(thirdLevelRules, chkTypeName) == -1 ? -1 : GetParentId(thirdLevelRules, chkTypeName);
                        if (ruleEx.ThridClassificationBM > -1)
                        {
                            int ibm = Convert.ToInt32(ruleEx.ThridClassificationBM.ToString().Substring(0, 2));
                            ruleEx.SecondeClassificationBM = ibm;
                            string secondeBm = ruleEx.SecondeClassificationBM.ToString();
                            ibm = Convert.ToInt32(ruleEx.ThridClassificationBM.ToString().Substring(0, 1));
                            ruleEx.FirstClassificationBM = ibm;
                        }
                        else
                        {
                            ruleEx.SecondeClassificationBM = GetParentId(secondLevelRules, chkTypeName) == -1 ? -1 : GetParentId(secondLevelRules, chkTypeName);
                            int ibm =(ruleEx.SecondeClassificationBM==-1)?-1:Convert.ToInt32(ruleEx.SecondeClassificationBM.ToString().Substring(0, 1));
                            ruleEx.FirstClassificationBM = ibm;
                        }
                        ruleEx.TempInstID = strTemplateId;
                        string str = strTemplateId.Replace("M", "R");
                        ruleEx.Weights = GetRulesWeights(str);

                        //**************************************
                        row[0] = strTemplateId;
                        row[1] = chkTypeName;
                        //**************************************
                        ruleEx.arrayRuleParas = GetTemplateRuleParas(strTemplateId, row);
                        ruleEx.ruleDllInfo = GetRuleDllInfo(ruleEx.arrayRuleParas[0].nSerialID);
                        m_CurrentSchemaRules.Add(ruleEx);
                        row[2] = dr["TempletName"].ToString();
                        CurrentSchemaRulesDt.Rows.Add(row);
                    }
                    catch (Exception exp)
                    {
                        Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());
                        continue;
                    }
                }
            }
            catch (Exception exp)
            {
                Hy.Common.Utility.Log.OperationalLogManager.AppendMessage(exp.ToString());

            }
            finally
            {
                if (m_ruleDt != null)
                {
                    m_ruleDt.Dispose();
                    m_ruleDt = null;
                }
            }
        }