//新增 void _barbtnInsert_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { this.Cursor = Cursors.WaitCursor; if (treeListData.FocusedNode == null) { ControlsHelper.ShowWarningMessage("提醒", "请点击新增菜单的上级或同级菜单"); } else { string code = treeListData.FocusedNode.ParentNode == null ? treeListData.FocusedNode["Code"].ToString() : treeListData.FocusedNode.ParentNode["Code"].ToString(); FrmFunctionEdit frmFunction = new FrmFunctionEdit(DBOperateType.Insert, null, code); if (frmFunction.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 { string code = treeListData.FocusedNode["Code"].ToString(); SysFunction function = dataSource.Find(obj => obj.Code == code); FrmFunctionEdit frmFunction = new FrmFunctionEdit(DBOperateType.Update, function, null); if (frmFunction.ShowDialog() == DialogResult.OK) { BindList(); treeListData.ExpandAll(); ControlsHelper.ShowAlertMessage(this.ParentForm, "修改", "修改成功"); } } this.Cursor = Cursors.Default; }