예제 #1
0
        void menu_modifyReport_Click(object sender, EventArgs e)
        {
            string strError = "";

            if (this.listView_reports.SelectedItems.Count == 0)
            {
                strError = "尚未选定要修改的事项";
                goto ERROR1;
            }

            ListViewItem item = this.listView_reports.SelectedItems[0];

            ReportApplyForm dlg = new ReportApplyForm();

            MainForm.SetControlFont(dlg, this.Font, false);
            dlg.MainForm          = this.MainForm;
            dlg.ReportForm        = this.ReportForm;
            dlg.LibraryCode       = ReportForm.GetOriginLibraryCode(this.comboBox_general_libraryCode.Text);
            dlg.CfgFileDir        = Path.Combine(this.MainForm.UserDir, "report_def"); //  Path.Combine(this.MainForm.UserDir, "report_def");
            dlg.ReportName        = ListViewUtil.GetItemText(item, COLUMN_REPORT_NAME);
            dlg.Freguency         = ListViewUtil.GetItemText(item, COLUMN_REPORT_FREQ);
            dlg.ReportType        = ListViewUtil.GetItemText(item, COLUMN_REPORT_TYPE);
            dlg.ReportCfgFileName = ListViewUtil.GetItemText(item, COLUMN_REPORT_CFGFILE);
            dlg.NameTable         = ListViewUtil.GetItemText(item, COLUMN_REPORT_NAMETABLE);

            this.MainForm.AppInfo.LinkFormState(dlg, "ReportApplyForm_state");
            dlg.UiState = this.MainForm.AppInfo.GetString("libraryreportconfig_form", "reportapplyform_ui_state", "");
            dlg.ShowDialog(this);
            this.MainForm.AppInfo.SetString("libraryreportconfig_form", "reportapplyform_ui_state", dlg.UiState);
            this.MainForm.AppInfo.UnlinkFormState(dlg);

            if (dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            ListViewUtil.ChangeItemText(item, COLUMN_REPORT_NAME, dlg.ReportName);
            ListViewUtil.ChangeItemText(item, COLUMN_REPORT_FREQ, dlg.Freguency);
            ListViewUtil.ChangeItemText(item, COLUMN_REPORT_TYPE, dlg.ReportType);
            ListViewUtil.ChangeItemText(item, COLUMN_REPORT_CFGFILE, dlg.ReportCfgFileName);
            ListViewUtil.ChangeItemText(item, COLUMN_REPORT_NAMETABLE, dlg.NameTable);

            this.Changed = true;
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
예제 #2
0
        // 将对话框中的数据保存到 XML 结构中
        public void SetData(XmlNode nodeLibrary)
        {
            if (nodeLibrary == null)
            {
                return;
            }

            DomUtil.SetAttr(nodeLibrary, "code", ReportForm.GetOriginLibraryCode(this.comboBox_general_libraryCode.Text));
            // DomUtil.SetAttr(nodeLibrary, "table_102_departments", this.textBox_102_departments.Text.Replace("\r\n", ","));

            XmlNode node_reports = nodeLibrary.SelectSingleNode("reports");

            if (node_reports == null)
            {
                node_reports = nodeLibrary.OwnerDocument.CreateElement("reports");
                nodeLibrary.AppendChild(node_reports);
            }
            else
            {
                node_reports.RemoveAll();
            }

            foreach (ListViewItem item in this.listView_reports.Items)
            {
                string strName      = ListViewUtil.GetItemText(item, COLUMN_REPORT_NAME);
                string strFreq      = ListViewUtil.GetItemText(item, COLUMN_REPORT_FREQ);
                string strType      = ListViewUtil.GetItemText(item, COLUMN_REPORT_TYPE);
                string strCfgFile   = ListViewUtil.GetItemText(item, COLUMN_REPORT_CFGFILE);
                string strNameTable = ListViewUtil.GetItemText(item, COLUMN_REPORT_NAMETABLE);

                XmlNode node_report = nodeLibrary.OwnerDocument.CreateElement("report");
                node_reports.AppendChild(node_report);
                DomUtil.SetAttr(node_report, "name", strName);
                DomUtil.SetAttr(node_report, "frequency", strFreq);
                DomUtil.SetAttr(node_report, "type", strType);
                DomUtil.SetAttr(node_report, "cfgFile", strCfgFile);
                DomUtil.SetAttr(node_report, "nameTable", strNameTable);
            }

            DomUtil.SetAttr(nodeLibrary, "htmlTemplate", this.comboBox_style_htmlTemplate.Text);
        }