Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/19/12 21:15:33 (12 years ago)
Author:
ascheibe
Message:

#1648 added CRUD operations for user groups in ui

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/AccessAdministrationClient.cs

    r7635 r7637  
    6767      ExecuteActionAsync(RefreshUserGroups, exceptionCallback);
    6868    }
     69    #endregion
     70
     71    #region Store
     72    public void StoreUsers() {
     73      foreach (User u in users) {
     74        if (u.Modified) {
     75          if (u.Id == Guid.Empty) {
     76            CallAccessService(s => u.Id = s.AddUser(u).Id);
     77          } else {
     78            CallAccessService(s => s.UpdateUser(u));
     79          }
     80          u.SetUnmodified();
     81        }
     82      }
     83    }
     84
     85    public void StoreUsersAsync(Action<Exception> exceptionCallback) {
     86      ExecuteActionAsync(StoreUsers, exceptionCallback);
     87    }
     88
     89    public void StoreUserGroups() {
     90      foreach (UserGroup g in Groups) {
     91        if (g.Modified) {
     92          if (g.Id == Guid.Empty) {
     93            CallAccessService(s => g.Id = s.AddUserGroup(g));
     94          } else {
     95            CallAccessService(s => s.UpdateUserGroup(g));
     96          }
     97          g.SetUnmodified();
     98        }
     99      }
     100    }
     101
     102    public void StoreUserGroupsAsync(Action<Exception> exceptionCallback) {
     103      ExecuteActionAsync(StoreUserGroups, exceptionCallback);
     104    }
     105
     106    //i don't think such a generic method is a good idea
     107    /*public static void Store(IAccessItem item) {
     108     
     109    } */
     110    #endregion
     111
     112    #region Delete
     113    public void DeleteUser(User u) {
     114      CallAccessService(s => s.DeleteUser(u));
     115    }
     116
     117    public void DeleteUserAsync(User u, Action<Exception> exceptionCallback) {
     118      Action deleteUserAction = new Action(delegate { DeleteUser(u); });
     119      ExecuteActionAsync(deleteUserAction, exceptionCallback);
     120    }
     121
     122    public void DeleteUserGroup(UserGroup u) {
     123      CallAccessService(s => s.DeleteUserGroup(u));
     124    }
     125
     126    public void DeleteUserGroupAsync(UserGroup u, Action<Exception> exceptionCallback) {
     127      Action deleteUserGroupAction = new Action(delegate { DeleteUserGroup(u); });
     128      ExecuteActionAsync(deleteUserGroupAction, exceptionCallback);
     129    }
     130    #endregion
    69131
    70132    public void ExecuteActionAsync(Action action, Action<Exception> exceptionCallback) {
     
    86148        if (ex != null) exceptionCallback(ex);
    87149      }, null);
    88     }
    89     #endregion
    90 
    91     public static void Store(IAccessItem item) {
    92       //TODO: storing
    93150    }
    94151
Note: See TracChangeset for help on using the changeset viewer.