/// <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(); } } }
private void SearchSubNode(TreeNode node, List <RightRelation> relations, string groupid, string hisworkid) { foreach (TreeNode nd in node.Nodes) { if (nd.Tag.GetType() == typeof(OpReportMaster)) { SearchSubNode(nd, relations, groupid, hisworkid); } else { if (nd.Checked) { Reportdat dat = (Reportdat)nd.Tag; RightRelation relation = new RightRelation(); relation.groupid = groupid; relation.reportid = dat.REPORT_ID.ToString(); relation.hisworkid = hisworkid; if (cbIsGlobal.Checked) { relation.isGlobal = 1; } else { relation.isGlobal = 0; } relations.Add(relation); } } } }
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(); } }
/// <summary> /// 删除报表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuDelete_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; } if (_master.IsHasChildReport()) { MessageBox.Show("要先删除类型下的报表"); return; } else { _master.Delete(); } } else { Reportdat _report = (Reportdat)TvReport.SelectedNode.Tag; _report.Delete(); } MessageBox.Show("删除成功"); loadReportdata(); } }
private static bool AddShowSubNode(TreeNode ParentNode, DataTable groupid) { OpReportMaster master = (OpReportMaster)ParentNode.Tag; ReportProcess _reportProcess = new ReportProcess(); System.Data.DataTable _listreport = _reportProcess.getReportList(groupid, master.REPORTMASTER_ID); if (_listreport == null || _listreport.Rows.Count < 1) { return(false); } TreeNode node = new TreeNode(); DataRow[] drows = _listreport.Select(""); foreach (DataRow dr in drows) { Reportdat mould = new Reportdat(); mould.NAME = dr["NAME"].ToString(); mould.PROCEDURES = dr["PROCEDURES"].ToString(); mould.REMARK = dr["REMARK"].ToString(); mould.REPORT_ID = int.Parse(dr["REPORT_ID"].ToString()); mould.Isglobal = int.Parse(dr["isglobal"].ToString()); node = new TreeNode(mould.NAME, 15, 13); node.Tag = mould; ParentNode.Nodes.Add(node); } return(true); }
/// <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(); } } } }
/// <summary> /// 加载窗体 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmReport_Load(object sender, EventArgs e) { _currentReport = new Reportdat(); _currentParam = new Paramater(); _reportProcess = new ReportProcess(); _Paramprocess = new ParamProcess(); loadReportdata(); }
private void FrmReportShow_Load(object sender, EventArgs e) { _currentReport = new Reportdat(); _currentParam = new Paramater(); _reportProcess = new ReportProcess(); _Paramprocess = new ParamProcess(); loadReportdata(); Reportparamter = _Paramprocess.Getparalist_all(_currentGroupId); }
private void TvReport_ItemDrag(object sender, ItemDragEventArgs e) { if (TvReport.SelectedNode != null && TvReport.SelectedNode.Tag != null) { if (TvReport.SelectedNode.Tag.GetType() == typeof(OpReportMaster)) { return; } Reportdat _report = (Reportdat)TvReport.SelectedNode.Tag; DoDragDrop(_report, DragDropEffects.Move); } }
private void TvReport_AfterSelect(object sender, TreeViewEventArgs e) { if (TvReport.SelectedNode.Tag.GetType() == typeof(OpReportMaster)) { return; } _currentReport = (Reportdat)TvReport.SelectedNode.Tag; if (_currentReport.REPORT_ID < 0) { return; } panel6.Controls.Clear(); }
/// <summary> /// 选择报表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TvReport_AfterSelect(object sender, TreeViewEventArgs e) { if (TvReport.SelectedNode.Tag.GetType() == typeof(OpReportMaster)) { return; } //TvReport.ExpandAll(); _currentReport = (Reportdat)TvReport.SelectedNode.Tag; if (_currentReport.REPORT_ID < 0) { return; } Proceduers opprodedure = new Proceduers(); dgvInParam.DataSource = null; panel12.Controls.Clear(); _procedureParams = opprodedure.GetProcedureParameters(_currentReport.PROCEDURES.Trim()); LoadParam(); }
private static void AddSubNode(TreeNode ParentNode) { OpReportMaster master = (OpReportMaster)ParentNode.Tag; ReportProcess _reportProcess = new ReportProcess(); List <HIS.Model.BASE_REPORT> _listreport = _reportProcess.GetReportList(master.REPORTMASTER_ID); for (int j = 0; j < _listreport.Count; j++) { TreeNode node = new TreeNode(); node.Text = _listreport[j].NAME; node.ImageIndex = 15; Reportdat order = new Reportdat(); order.NAME = _listreport[j].NAME; order.REPORT_ID = _listreport[j].REPORT_ID; order.REPORTMASTER_ID = _listreport[j].REPORTMASTER_ID; order.PROCEDURES = _listreport[j].PROCEDURES; order.REMARK = _listreport[j].REMARK; node.Tag = order; ParentNode.Nodes.Add(node); } }
private void btnSave_Click(object sender, EventArgs e) { string groupId = this.lstGroup.SelectedItems[0].Tag.ToString(); reportPermissionBLL reportBll = new reportPermissionBLL(); try { List <RightRelation> relations = new List <RightRelation>(); RightRelation relation; foreach (TreeNode node in TvReport.Nodes) { if (node.Tag.GetType() == typeof(OpReportMaster)) { SearchSubNode(node, relations, groupId); } else { if (node.Checked) { Reportdat dat = (Reportdat)node.Tag; relation = new RightRelation(); relation.groupid = groupId; relation.reportid = dat.REPORT_ID.ToString(); relations.Add(relation); } } } reportBll.AllocRight(relations, Convert.ToInt32(groupId)); MessageBox.Show("权限分配成功!"); } catch (Exception err) { MessageBox.Show("权限分配失败,原因:" + err.Message); } finally { btnRefresh_Click(null, null); } }
private void btnAlloc_Click(object sender, EventArgs e) { int cnt1 = 0; foreach (TreeNode ptn in tvGroup.Nodes) { foreach (TreeNode ctn in ptn.Nodes) { if (ctn.Checked) { cnt1 += 1; } } } if (cnt1 == 0) { MessageBox.Show("请在要分配的用户组前打‘√’"); return; } try { List <RightRelation> relations = new List <RightRelation>(); RightRelation relation; foreach (TreeNode ptn in tvGroup.Nodes) //顶层节点 { foreach (TreeNode ctn in ptn.Nodes) //角色组节点 { if (ctn.Checked) { foreach (TreeNode node in lvReport.Nodes) { if (node.Tag.GetType() == typeof(OpReportMaster)) { SearchSubNode(node, relations, ctn.Tag.ToString(), ptn.Tag.ToString()); } else { if (node.Checked) { Reportdat dat = (Reportdat)node.Tag; relation = new RightRelation(); relation.groupid = ctn.Tag.ToString(); relation.reportid = dat.REPORT_ID.ToString();// lvi.ImageIndex.ToString(); relation.hisworkid = ptn.Tag.ToString(); if (cbIsGlobal.Checked) { relation.isGlobal = 1; } else { relation.isGlobal = 0; } relations.Add(relation); } } } } } } if (relations.Count == 0) { MessageBox.Show("请在要分配的报表模板前打‘√’"); return; } // reportBll.AllocRight(relations); MessageBox.Show("权限分配成功!"); } catch (Exception err) { MessageBox.Show("权限分配失败,原因:" + err.Message); } finally { Load_ReportRelation(); } }