private void btOk_Click(object sender, EventArgs e) { if (listDiagram.SelectedItems.Count == 0) { MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } m_SelDiagram = (CDiagram)listDiagram.SelectedItems[0].Tag; DialogResult = DialogResult.OK; }
private void tbtOpen_Click(object sender, EventArgs e) { if (listDiagram.SelectedItems.Count == 0) { MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } CDiagram Diagram = (CDiagram)listDiagram.SelectedItems[0].Tag; DesignerForm frm2 = new DesignerForm(); frm2.m_Diagram = Diagram; frm2.Show(); }
public void LoadList() { listDiagram.Items.Clear(); List <CBaseObject> lstDiagram = Program.Ctx.DiagramMgr.GetList(); foreach (CBaseObject obj in lstDiagram) { CDiagram diagram = (CDiagram)obj; ListViewItem item = new ListViewItem(); item.Text = diagram.Name; item.Tag = diagram; listDiagram.Items.Add(item); } }
private void tbtEdit_Click(object sender, EventArgs e) { if (listDiagram.SelectedItems.Count == 0) { MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } CDiagram Diagram = (CDiagram)listDiagram.SelectedItems[0].Tag; DiagramInfoForm frm = new DiagramInfoForm(); frm.m_Diagram = Diagram; if (frm.ShowDialog() != DialogResult.OK) { return; } listDiagram.SelectedItems[0].Text = frm.m_Diagram.Name; }
private void btOK_Click(object sender, EventArgs e) { string sName = txtName.Text.Trim(); if (sName == "") { MessageBox.Show("名称不能空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (m_Diagram == null) { if (Program.Ctx.DiagramMgr.FindByName(sName) != null) { MessageBox.Show("关系图已经存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } m_Diagram = new CDiagram(); m_Diagram.Name = sName; m_Diagram.DType = DiagramType.Normal; m_Diagram.Ctx = Program.Ctx; if (!Program.Ctx.DiagramMgr.AddNew(m_Diagram)) { MessageBox.Show("新建失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } } else { if (Program.Ctx.DiagramMgr.FindByName(sName) != m_Diagram) { MessageBox.Show("关系图已经存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } m_Diagram.Name = sName; if (!Program.Ctx.DiagramMgr.Update(m_Diagram)) { MessageBox.Show("修改失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } } DialogResult = DialogResult.OK; }
private void tbtDel_Click(object sender, EventArgs e) { if (listDiagram.SelectedItems.Count == 0) { MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("是否确认删除?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } CDiagram Diagram = (CDiagram)listDiagram.SelectedItems[0].Tag; if (!Program.Ctx.DiagramMgr.Delete(Diagram, true)) { MessageBox.Show("删除失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } listDiagram.Items.Remove(listDiagram.SelectedItems[0]); }
private void treeLeft_AfterSelect(object sender, TreeViewEventArgs e) { TreeNodeTag tag = (TreeNodeTag)e.Node.Tag; if (tag == null) { return; } if (tag.NodeType == TreeNodeType.TableRoot) { tablePanel.Dock = DockStyle.Fill; tablePanel.Visible = true; tablePanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.DiagramRoot) { diagramPanel.Dock = DockStyle.Fill; diagramPanel.Visible = true; diagramPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.UserRoot) { TreeNodeTag ptag = (TreeNodeTag)e.Node.Parent.Tag; CCompany Company = (CCompany)ptag.Data; userPanel.Company = Company; userPanel.Dock = DockStyle.Fill; userPanel.Visible = true; userPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.OrgRoot) { TreeNodeTag ptag = (TreeNodeTag)e.Node.Parent.Tag; CCompany Company = (CCompany)ptag.Data; orgPanel.Company = Company; orgPanel.Dock = DockStyle.Fill; orgPanel.Visible = true; orgPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.RoleRoot) { TreeNodeTag ptag = (TreeNodeTag)e.Node.Parent.Tag; CCompany Company = (CCompany)ptag.Data; rolePanel.Company = Company; rolePanel.Dock = DockStyle.Fill; rolePanel.Visible = true; rolePanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.AccessRoot) { TreeNodeTag ptag = (TreeNodeTag)e.Node.Parent.Tag; CCompany Company = (CCompany)ptag.Data; accessPanel.Company = Company; accessPanel.Dock = DockStyle.Fill; accessPanel.Visible = true; accessPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.WindowCatalogRoot) { windowPanel.Catalog = null; windowPanel.Dock = DockStyle.Fill; windowPanel.Visible = true; windowPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.WindowCatalog) { CWindowCatalog catalog = (CWindowCatalog)tag.Data; windowPanel.Catalog = catalog; windowPanel.Dock = DockStyle.Fill; windowPanel.Visible = true; windowPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.ViewCatalogRoot) { viewPanel.Catalog = null; viewPanel.Dock = DockStyle.Fill; viewPanel.Visible = true; viewPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.ViewCatalog) { CViewCatalog catalog = (CViewCatalog)tag.Data; viewPanel.Catalog = catalog; viewPanel.Dock = DockStyle.Fill; viewPanel.Visible = true; viewPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.FormCatalogRoot) { formPanel.Catalog = null; formPanel.Dock = DockStyle.Fill; formPanel.Visible = true; formPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.FormCatalog) { CFormCatalog catalog = (CFormCatalog)tag.Data; formPanel.Catalog = catalog; formPanel.Dock = DockStyle.Fill; formPanel.Visible = true; formPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.SubSystemRoot) { subSystemPanel.Dock = DockStyle.Fill; subSystemPanel.Visible = true; subSystemPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.SubDiagram) { TreeNode pNode = e.Node.Parent; TreeNodeTag tagP = (TreeNodeTag)pNode.Tag; CSystem system = (CSystem)tagP.Data; if (system.FW_Diagram_id == Guid.Empty) { SelDiagramForm frm = new SelDiagramForm(); if (frm.ShowDialog() != DialogResult.OK) { return; } system.FW_Diagram_id = frm.m_SelDiagram.Id; if (!Program.Ctx.SystemMgr.Update(system)) { MessageBox.Show("修改失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } DesignerForm frm2 = new DesignerForm(); frm2.m_Diagram = frm.m_SelDiagram; frm2.Show(this); } else { CDiagram diagram = (CDiagram)Program.Ctx.DiagramMgr.Find(system.FW_Diagram_id); if (diagram == null) { SelDiagramForm frm = new SelDiagramForm(); if (frm.ShowDialog() != DialogResult.OK) { return; } system.FW_Diagram_id = frm.m_SelDiagram.Id; if (!Program.Ctx.SystemMgr.Update(system)) { MessageBox.Show("修改失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } DesignerForm frm2 = new DesignerForm(); frm2.m_Diagram = frm.m_SelDiagram; frm2.Show(this); } else { DesignerForm frm2 = new DesignerForm(); frm2.m_Diagram = diagram; frm2.Show(this); } } } else if (tag.NodeType == TreeNodeType.WindowCatalog) { } else if (tag.NodeType == TreeNodeType.ReportCompany) { TreeNodeTag ptag = (TreeNodeTag)e.Node.Tag; CCompany Company = (CCompany)ptag.Data; reportPanel.Company = Company; reportPanel.Catalog = null; reportPanel.Dock = DockStyle.Fill; reportPanel.Visible = true; reportPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.ReportCatalog) { CCompany Company = null; TreeNode p = e.Node.Parent; while (p != null) { TreeNodeTag ptag = (TreeNodeTag)p.Tag; if (ptag.NodeType == TreeNodeType.ReportCompany) { Company = (CCompany)ptag.Data; break; } p = p.Parent; } reportPanel.Company = Company; CReportCatalog catalog = (CReportCatalog)tag.Data; reportPanel.Catalog = catalog; reportPanel.Dock = DockStyle.Fill; reportPanel.Visible = true; reportPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.WorkflowCompany) { TreeNodeTag ptag = (TreeNodeTag)e.Node.Tag; CCompany Company = (CCompany)ptag.Data; workflowDefPanel.Company = Company; workflowDefPanel.Catalog = null; workflowDefPanel.Dock = DockStyle.Fill; workflowDefPanel.Visible = true; workflowDefPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.WorkflowCatalog) { CCompany Company = null; TreeNode p = e.Node.Parent; while (p != null) { TreeNodeTag ptag = (TreeNodeTag)p.Tag; if (ptag.NodeType == TreeNodeType.WorkflowCompany) { Company = (CCompany)ptag.Data; break; } p = p.Parent; } workflowDefPanel.Company = Company; CWorkflowCatalog catalog = (CWorkflowCatalog)tag.Data; workflowDefPanel.Catalog = catalog; workflowDefPanel.Dock = DockStyle.Fill; workflowDefPanel.Visible = true; workflowDefPanel.BringToFront(); } else if (tag.NodeType == TreeNodeType.MenuRoot) { menuPanel.Dock = DockStyle.Fill; menuPanel.Visible = true; menuPanel.BringToFront(); } }