protected override ProductRule CreateEntity()
        {
            //属性
            _entity = new ProductRule()
            {
                Name        = _data.GetAttribute("name"),
                Description = _data.GetAttribute("description"),
                Template    = _data.GetAttribute("template"),
                Export      = _data.GetAttribute("export")
            };
            _entity.ShrinkSheet = ParseUtil.ParseBoolean(_data.GetAttribute("shrinkSheet"), false);
            string tmpStr = _data.GetAttribute("shrinkExSheets");

            _entity.ShrinkExSheets = string.IsNullOrEmpty(tmpStr) ? new string[0] : tmpStr.Split(',');

            //子结点:DataList
            //_entity.AddSources(parseDataList(_validator.QuerySubNodes("DataSource/DataList", _data)));
            //子结点:DataTable
            //_entity.AddSources(parseSource(_validator.QuerySubNodes("DataSource/TableSource", _data)));
            //子结点:Sheet
            //_entity.AddSheets(parseSheet(_validator.QuerySubNodes("Sheets/*", _data)));
            _entity.AddSources(parseSubElement <DataListElement, ListSource>(_validator.QuerySubNodes("DataSource/DataList", _data)));
            _entity.AddSources(parseSubElement <SourceElement, Source>(_validator.QuerySubNodes("DataSource/TableSource", _data)));
            _entity.AddSheets(parseSubElement <SheetElement, Sheet>(_validator.QuerySubNodes("Sheets/*", _data)));
            return(_entity);
        }
Example #2
0
        protected override ExportConfig CreateEntity()
        {
            _entity = new ExportConfig();
            XmlNodeList nodes = _validator.QuerySubNodes("//ExportProduct");

            foreach (XmlElement node in nodes)
            {
                ProductRuleElement ruleElement = new ProductRuleElement(node, this);
                _entity.ProductTypes.Add(ruleElement.Entity);
                _productRuleDict.Add(ruleElement.Entity.Name, ruleElement);
            }
            return(_entity);
        }