private void 除工序ToolStripMenuItem_Click(object sender, EventArgs e) { var pProc = SelectedProcRow?.ListObject as Process; var step = _activeStepRow?.ListObject as Step; if (_bllStep.DeleteModel <Process, ProcessStep>(step, pProc)) { MsgBoxLib.ShowInformationOk("操作成功"); RefreshStep(); } else { MsgBoxLib.ShowStop("操作失败"); } }
private void 除工艺ToolStripMenuItem_Click(object sender, EventArgs e) { var pProj = SelectedNode?.Tag as Project; var proc = _activeProcRow?.ListObject as Process; if (_bll.DeleteProcess(proc, pProj)) { MsgBoxLib.ShowInformationOk("操作成功"); RefreshProc(); } else { MsgBoxLib.ShowStop("操作失败"); } }
private void 编辑工序ToolStripMenuItem_Click(object sender, EventArgs e) { var form = new StepMgtAddEdit("编辑工序", _activeStepRow?.ListObject as Step); if (form.ShowDialog(this) == DialogResult.OK) { if (_bllStep.UpdateModel(form.TransModel)) { MsgBoxLib.ShowInformationOk("操作成功!"); //将父类加入List,表示需要从数据库中更新子类数据 //if (pProj != null) _bll.ParentsToBeUpdated.AddFirst(pProj.Code); RefreshStep(); } else { MsgBoxLib.ShowStop("操作失败"); } } }
private void 新增工序ToolStripMenuItem_Click(object sender, EventArgs e) { var pProc = SelectedProcRow?.ListObject as Process; var form = new StepMgtAddEdit("新增工序"); if (form.ShowDialog(this) == DialogResult.OK) { if (_bllStep.AddModel(form.TransModel, pProc)) { MsgBoxLib.ShowInformationOk("操作成功!"); //将父类加入List,表示需要从数据库中更新子类数据 if (pProc != null) { _bll.ParentsToBeUpdated.AddFirst(pProc.Code); } RefreshStep(); } else { MsgBoxLib.ShowStop("操作失败"); } } }
private void 新增工艺ToolStripMenuItem_Click(object sender, EventArgs e) { var pProj = SelectedNode?.Tag as Project; var form = new ProcessMgtAddEdit("新增工艺"); if (form.ShowDialog(this) == DialogResult.OK) { if (_bll.AddModel(form.TransModel, pProj)) { MsgBoxLib.ShowInformationOk("操作成功!"); //将父类加入List,表示需要从数据库中更新子类数据 if (pProj != null) { _bll.ParentsToBeUpdated.AddFirst(pProj.Code); } RefreshProc(); //TODO:待验证 } else { MsgBoxLib.ShowStop("操作失败"); } } }
private void toolBarManager_ToolClick(object sender, ToolClickEventArgs e) { var pProj = SelectedNode?.Parent?.Tag as Project; ProjectMgtAddEdit form; switch (e.Tool.Key) { case "Refresh": default: RefreshData(); break; case "Add": form = new ProjectMgtAddEdit("新增项目"); if (form.ShowDialog(this) == DialogResult.OK) { if (_bll.AddProject(form.TransModel, pProj)) { MsgBoxLib.ShowInformationOk("操作成功!"); //将父类加入List,表示需要从数据库中更新子类数据 if (pProj != null) { _projectsNeedRefresh.AddFirst(pProj.Code); } } else { MsgBoxLib.ShowStop("操作失败"); } } goto default; case "Edit": form = new ProjectMgtAddEdit("编辑项目", SelectedNode?.Tag as Project); if (form.ShowDialog(this) == DialogResult.OK) { if (_bll.UpdateModel(form.TransModel, pProj)) { MsgBoxLib.ShowInformationOk("操作成功!"); //将父类加入List,表示需要从数据库中更新子类数据 if (pProj != null) { _projectsNeedRefresh.AddFirst(pProj.Code); } } else { MsgBoxLib.ShowStop("操作失败"); } } goto default; case "Delete": if (SelectedNode?.Tag is Project proj) { if (_bll.DeleteModel <Project, ProjectProject>(proj, pProj)) { MsgBoxLib.ShowInformationOk("操作成功"); //将父类加入List,表示需要从数据库中更新子类数据 if (pProj != null) { _projectsNeedRefresh.AddFirst(pProj.Code); } } else { MsgBoxLib.ShowStop("操作失败"); } } else { MsgBoxLib.ShowWarning("请先选择要删除的项目"); } goto default; case "AddChild": //TODO:还未想出解决方案 goto default; } }