Esempio n. 1
0
        /// <summary>
        /// 获取ViewCss隐射关系config
        /// </summary>
        /// <returns></returns>
        public static List <ViewCSSMappingInfo> BuildViewCssMappingList()
        {
            if (!File.Exists(VIEW_CSS_MAPPING_PATH))
            {
                throw new FileNotFoundException(string.Format("未找到配置文件:{0}!", VIEW_CSS_MAPPING_PATH));
            }
            List <ViewCSSMappingInfo> returnList = new List <ViewCSSMappingInfo>();
            XmlHelper xmlHelper = new XmlHelper();

            xmlHelper.LoadXml(VIEW_CSS_MAPPING_PATH);
            var getList = xmlHelper.GetElements("Mapping");

            if (null != getList && getList.Count > 0)
            {
                getList.ForEach(m =>
                {
                    ViewCSSMappingInfo newInfo = new ViewCSSMappingInfo();
                    var getGroupList           = xmlHelper.GetElements(xmlHelper.GetElement(m, "CssGroups"), "Group");
                    if (null != getGroupList && getGroupList.Count > 0)
                    {
                        getGroupList.ForEach(g =>
                        {
                            newInfo.CSSGroupNameList.Add(g.Value.Trim());
                        });
                    }
                    var getViewNameList = xmlHelper.GetElements(xmlHelper.GetElement(m, "ViewList"), "View");
                    if (null != getViewNameList && getViewNameList.Count > 0)
                    {
                        getViewNameList.ForEach(v =>
                        {
                            newInfo.ViewNameList.Add(v.Value.Trim());
                        });
                    }
                    returnList.Add(newInfo);
                });
            }
            return(returnList);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取ViewCss隐射关系config
        /// </summary>
        /// <returns></returns>
        public static List<ViewCSSMappingInfo> BuildViewCssMappingList()
        {
            if (!File.Exists(VIEW_CSS_MAPPING_PATH))
            {
                throw new FileNotFoundException(string.Format("未找到配置文件:{0}!", VIEW_CSS_MAPPING_PATH));
            }
            List<ViewCSSMappingInfo> returnList = new List<ViewCSSMappingInfo>();
            XmlHelper xmlHelper = new XmlHelper();
            xmlHelper.LoadXml(VIEW_CSS_MAPPING_PATH);
            var getList = xmlHelper.GetElements("Mapping");
            if (null != getList && getList.Count > 0)
            {
                getList.ForEach(m =>
                {
                    ViewCSSMappingInfo newInfo = new ViewCSSMappingInfo();
                    var getGroupList = xmlHelper.GetElements(xmlHelper.GetElement(m, "CssGroups"), "Group");
                    if (null != getGroupList && getGroupList.Count > 0)
                    {
                        getGroupList.ForEach(g =>
                        {
                            newInfo.CSSGroupNameList.Add(g.Value.Trim());
                        });
                    }
                    var getViewNameList = xmlHelper.GetElements(xmlHelper.GetElement(m, "ViewList"), "View");
                    if (null != getViewNameList && getViewNameList.Count > 0)
                    {
                        getViewNameList.ForEach(v =>
                        {
                            newInfo.ViewNameList.Add(v.Value.Trim());
                        });
                    }
                    returnList.Add(newInfo);

                });
            }
            return returnList;
        }