public void FillList(ListView list) { list.Items.Clear(); if (this.CfgDom == null || this.CfgDom.DocumentElement == null) { return; } XmlNodeList nodes = this.CfgDom.DocumentElement.SelectNodes("library"); foreach (XmlNode node in nodes) { string strCode = DomUtil.GetAttr(node, "code"); strCode = ReportForm.GetDisplayLibraryCode(strCode); ListViewItem item = new ListViewItem(); ListViewUtil.ChangeItemText(item, 0, strCode); list.Items.Add(item); } if (list.Items.Count > 0) { list.Items[0].Selected = true; } }
const int COLUMN_REPORT_NAMETABLE = 4; // 名字表 public void LoadData(XmlNode nodeLibrary) { if (nodeLibrary == null) { return; } this.comboBox_general_libraryCode.Text = ReportForm.GetDisplayLibraryCode(DomUtil.GetAttr(nodeLibrary, "code")); // this.textBox_102_departments.Text = DomUtil.GetAttr(nodeLibrary, "table_102_departments").Replace(",", "\r\n"); this.listView_reports.Items.Clear(); XmlNodeList nodes = nodeLibrary.SelectNodes("reports/report"); if (nodes.Count > 0) { foreach (XmlNode node in nodes) { string strName = DomUtil.GetAttr(node, "name"); string strFreq = DomUtil.GetAttr(node, "frequency"); string strType = DomUtil.GetAttr(node, "type"); string strCfgFile = DomUtil.GetAttr(node, "cfgFile"); string strNameTable = DomUtil.GetAttr(node, "nameTable"); ListViewItem item = new ListViewItem(); ListViewUtil.ChangeItemText(item, COLUMN_REPORT_NAME, strName); ListViewUtil.ChangeItemText(item, COLUMN_REPORT_FREQ, strFreq); ListViewUtil.ChangeItemText(item, COLUMN_REPORT_TYPE, strType); ListViewUtil.ChangeItemText(item, COLUMN_REPORT_CFGFILE, strCfgFile); ListViewUtil.ChangeItemText(item, COLUMN_REPORT_NAMETABLE, strNameTable); this.listView_reports.Items.Add(item); } } this.comboBox_style_htmlTemplate.Text = DomUtil.GetAttr(nodeLibrary, "htmlTemplate"); this.Changed = false; }