private void tsbAddChildren_Click(object sender, EventArgs e) { Department _Parent = this.tvClassify.SelectedNode.Tag as Department; Department _Classify = this.m_Application.ClassifyTypes.GetClassifyType(typeof(Department)).CreateClassify(_Parent) as Department; _Classify.OrdinalNumber = _Parent.Children.Count + 1; DepartmentManageForm _DepartmentManageForm = new DepartmentManageForm(_Classify, false); if (_DepartmentManageForm.ShowDialog(this) == DialogResult.OK) { try { _DepartmentManageForm.Classify.Save(); TreeNode tn = new TreeNode(); this.FillClassifyNode(_DepartmentManageForm.Classify, tn); this.tvClassify.SelectedNode.Nodes.Add(tn); this.tvClassify.SelectedNode.Expand(); } catch (Exception ex) { MessageBox.Show(ex.Message, "部门", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void tsbUpdate_Click(object sender, EventArgs e) { Department _Classify = this.tvClassify.SelectedNode.Tag as Department; DepartmentManageForm _DepartmentManageForm = new DepartmentManageForm(_Classify, true); if (_DepartmentManageForm.ShowDialog(this) == DialogResult.OK) { try { _DepartmentManageForm.Classify.Save(); this.FillClassifyNode(_DepartmentManageForm.Classify, this.tvClassify.SelectedNode); } catch (Exception ex) { MessageBox.Show(ex.Message, "部门", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }