コード例 #1
0
 /// <summary>
 /// 新增报表
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MenuAddReport_Click(object sender, EventArgs e)
 {
     if (TvReport.SelectedNode.Tag != null)
     {
         if (TvReport.SelectedNode.Tag.GetType() == typeof(Reportdat))
         {
             MessageBox.Show("报表下边不能添加报表");
             return;
         }
         HIS.Report_BLL.OpReportMaster _master = (OpReportMaster)TvReport.SelectedNode.Tag;
         if (_master.REPORTMASTER_ID == -1)
         {
             MessageBox.Show("不能直接在根结点下增加报表,请先增加类型");
             return;
         }
         FrmAddReport report = new FrmAddReport(_master.REPORTMASTER_ID);
         report.ShowDialog();
         if (report.ReportName != "" && report.ProcessName != "")
         {
             _currentReport                 = new Reportdat();
             _currentReport.NAME            = report.ReportName;
             _currentReport.PROCEDURES      = report.ProcessName;
             _currentReport.REMARK          = report.Remark;
             _currentReport.REPORTMASTER_ID = _master.REPORTMASTER_ID;
             _currentReport.addReport();
             loadReportdata();
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// 修改报表
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MenuUpdate_Click(object sender, EventArgs e)
 {
     if (TvReport.SelectedNode.Tag != null)
     {
         if (TvReport.SelectedNode.Tag.GetType() == typeof(OpReportMaster))
         {
             OpReportMaster _master = (OpReportMaster)TvReport.SelectedNode.Tag;
             if (_master.REPORTMASTER_ID == -1)
             {
                 return;
             }
             FrmAddReportType frmtype = new FrmAddReportType();
             frmtype.Text           = "修改类型名";
             frmtype.reportTypeName = _master.NAME;
             frmtype.ShowDialog();
             if (frmtype.reportTypeName != "")
             {
                 _master.NAME = frmtype.reportTypeName;
                 _master.Update();
                 loadReportdata();
             }
         }
         else
         {
             Reportdat    _report   = (Reportdat)TvReport.SelectedNode.Tag;
             FrmAddReport frmreport = new FrmAddReport(_report.REPORTMASTER_ID);
             frmreport.Text        = "修改报表";
             frmreport.ReportName  = _report.NAME;
             frmreport.ProcessName = _report.PROCEDURES;
             frmreport.Remark      = _report.REMARK;
             frmreport.ShowDialog();
             if (frmreport.ReportName != "" && frmreport.ProcessName != "")
             {
                 if (_report.NAME.Trim() != frmreport.ReportName.Trim())
                 {
                     string filepath = System.Windows.Forms.Application.StartupPath + "\\report\\newreport\\";
                     if (System.IO.File.Exists(filepath + _report.NAME.Trim() + ".grf"))
                     {
                         try
                         {
                             System.IO.File.Copy(filepath + _report.NAME.Trim() + ".grf", filepath + frmreport.ReportName.Trim() + ".grf", true);
                             System.IO.File.Delete(filepath + _report.NAME.Trim() + ".grf");
                         }
                         catch
                         {
                             MessageBox.Show("请先关闭文件再修改文件名!");
                             return;
                         }
                     }
                 }
                 _report.NAME       = frmreport.ReportName;
                 _report.PROCEDURES = frmreport.ProcessName;
                 _report.REMARK     = frmreport.Remark;
                 _report.update();
                 loadReportdata();
             }
         }
     }
 }