Exemplo n.º 1
0
        public static List <relation> GetRelationArray(int level, string type) //得到不同level不同type的模块对应的关系数组
        {
            List <string>   modulesName   = ModulesOperator.ReadModulesForDiffLevelAndType(level, type);
            RelationData    relation      = RelationOperator.GetRelationInfoForDiffModList(modulesName);
            List <relation> relationArray = new List <relation>();

            for (int i = 0; i < relation.Tables[RelationData.RELATION_TABLE].Rows.Count; i++)
            {
                relation relationOne = new relation();
                relationOne.sourceName   = relation.Tables[RelationData.RELATION_TABLE].Rows[i][RelationData.SOURCENAME_FIELD].ToString();
                relationOne.targetName   = relation.Tables[RelationData.RELATION_TABLE].Rows[i][RelationData.TARGETNAME_FIELD].ToString();
                relationOne.bidirection  = relation.Tables[RelationData.RELATION_TABLE].Rows[i][RelationData.BIDIRECTION_FIELD].ToString();
                relationOne.relationName = relation.Tables[RelationData.RELATION_TABLE].Rows[i][RelationData.NAME_FIELD].ToString();
                relationOne.comment      = relation.Tables[RelationData.RELATION_TABLE].Rows[i][RelationData.COMMENT_FIELD].ToString();
                if (relation.Tables[RelationData.RELATION_TABLE].Rows[i][RelationData.SHOW_FIELD].ToString() == "1")
                {
                    relationOne.show = 1;
                }
                else
                {
                    relationOne.show = 0;
                }
                relationArray.Add(relationOne);
            }
            return(relationArray);
        }
Exemplo n.º 2
0
        public static List <ModulesList> CountModuleLevelAndType(int level, string type)
        {
            List <string>      modulesName = ReadModulesForDiffLevelAndType(level, type);
            RelationData       relation    = RelationOperator.GetRelationInfoForDiffModList(modulesName);//Type为3
            List <ModulesList> modules     = new List <ModulesList>();

            for (int i = 0; i < modulesName.Count; i++)
            {
                ModulesList module = new ModulesList();
                DataRow[]   rl     = relation.Tables[RelationData.RELATION_TABLE].Select(RelationData.SOURCENAME_FIELD + " = '" + modulesName[i] + "' or " + RelationData.TARGETNAME_FIELD + "='" + modulesName[i] + "'");
                module.name  = modulesName[i];
                module.count = rl.Length;
                modules.Add(module);
            }
            return(modules);
        }