//新增 void _barbtnInsert_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { this.Cursor = Cursors.WaitCursor; if (treeListData.FocusedNode == null) { ControlsHelper.ShowWarningMessage("提醒", "请点击新增部门的上级部门"); } else { int id = int.Parse(treeListData.FocusedNode["ID"].ToString()); FrmDepartmentEdit frm = new FrmDepartmentEdit(DBOperateType.Insert, null, id); if (frm.ShowDialog() == DialogResult.OK) { BindList(); ControlsHelper.ShowAlertMessage(this.ParentForm, "新增", "新增成功"); } } this.Cursor = Cursors.Default; }
//修改 void _barbtnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { this.Cursor = Cursors.WaitCursor; if (treeListData.FocusedNode == null) { ControlsHelper.ShowWarningMessage("提醒", "请点击修改的部门"); } else { int id = int.Parse(treeListData.FocusedNode["ID"].ToString()); CoDepartment dept = dataSource.Find(obj => obj.ID == id); FrmDepartmentEdit frm = new FrmDepartmentEdit(DBOperateType.Update, dept, 0); if (frm.ShowDialog() == DialogResult.OK) { BindList(); treeListData.ExpandAll(); ControlsHelper.ShowAlertMessage(this.ParentForm, "修改", "修改成功"); } } this.Cursor = Cursors.Default; }