void win_SubmitEvent(AddGroupAccount obj) { try { ClientAccount c = new ClientAccount(); ErrType rst = _businessService.AddUserToUserGroups(obj.Account, CurUserGroup.UserGroupId, _loginID, ref c); if (rst.Err != ERR.SUCCESS) { MessageBox.Show(rst.ErrMsg); } else { MessageBox.Show("用户添加到组成功"); GroupAccounts.Add(c); obj.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void AddGroupAccountEx() { if (CurUserGroup == null) { MessageBox.Show("还没有分组,请先添加分组?", "提示", MessageBoxButton.OK, MessageBoxImage.Question); return; } AddGroupAccount win = new AddGroupAccount() { DataContext = CurUserGroup }; win.SubmitEvent += new Action<AddGroupAccount>(win_SubmitEvent); win.ShowDialog(); }