예제 #1
0
        private void TvReport_DragDrop(object sender, DragEventArgs e)
        {
            //取源节点信息 获得进行"Drag"操作中拖动的字符串
            TreeNode  sourceNode = this.TvReport.SelectedNode;
            Reportdat _report    = (Reportdat)sourceNode.Tag;

            Point m_Position = new Point();

            m_Position.X = e.X;
            m_Position.Y = e.Y;
            m_Position   = TvReport.PointToClient(m_Position);
            TreeNode CurrentNode = this.TvReport.GetNodeAt(m_Position);

            if (CurrentNode != null)//判断你点的是不是一个节点...
            {
                if (CurrentNode.Tag.GetType() == typeof(OpReportMaster) && ((OpReportMaster)CurrentNode.Tag).REPORTMASTER_ID != -1)
                {
                    _report.REPORTMASTER_ID = ((OpReportMaster)CurrentNode.Tag).REPORTMASTER_ID;
                }
                else
                {
                    _report.REPORTMASTER_ID = ((Reportdat)CurrentNode.Tag).REPORTMASTER_ID;
                }
                _report.update();
                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();
             }
         }
     }
 }