public void ConfigRolePrivilegeEx() { GetAllRoles(); GetPrivileges(); string roleID = ""; string UserID = CurOrgInfo.OrgID;//在新增微会员时,默认会以微会员ID为UserId,会员编码为Account添加一个会员账户,所以在这里设置角色时,就通过会员ID获得会员账户ID ErrType err = _businessService.ReadUserRole(_loginID, UserID, ref roleID); if (err.Err == ERR.SUCCESS && !string.IsNullOrEmpty(roleID)) { CurentRoleInfo = RoleList.Where(p => p.RoleID == roleID).FirstOrDefault(); } RolePrivilegesConfigWindow window = new RolePrivilegesConfigWindow() { Owner = Application.Current.MainWindow, DataContext = this, }; window.DataGridSelectionChangedEvent += (e, v) => { GetRolePrivileges(); }; if (window.ShowDialog() == true) { if (string.IsNullOrEmpty(roleID)) { err = _businessService.AddUserRole(_loginID, CurentRoleInfo.RoleID, UserID); } else { err = _businessService.UpdateUserRole(_loginID, CurentRoleInfo.RoleID, UserID); } if (err.Err != ERR.SUCCESS) MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <summary> /// 给账户配置角色及权限 /// </summary> /// <param name="selectAccount"></param> public void ConfigRolePrivilege(ClientAccount selectAccount) { GetAllRoles(); GetPrivileges(); string roleID = ""; ErrType err = _businessService.ReadUserRole(_loginID, selectAccount.AccInfo.UserID, ref roleID); if (err.Err == ERR.SUCCESS && !string.IsNullOrEmpty(roleID)) { CurentRoleInfo = RoleList.Where(p => p.RoleID == roleID).FirstOrDefault(); } RolePrivilegesConfigWindow window = new RolePrivilegesConfigWindow() { Owner = Application.Current.MainWindow, DataContext = this, }; window.DataGridSelectionChangedEvent += (e, v) => { GetRolePrivileges(); }; if (window.ShowDialog() == true) { if (string.IsNullOrEmpty(roleID)) { err = _businessService.AddUserRole(_loginID, CurentRoleInfo.RoleID, selectAccount.AccInfo.UserID); } else { err = _businessService.UpdateUserRole(_loginID, CurentRoleInfo.RoleID, selectAccount.AccInfo.UserID); } if (err.Err != ERR.SUCCESS) MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Error); } }