Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/27/12 21:27:49 (13 years ago)
Author:
ascheibe
Message:

#1648 worked on user and group selection views

Location:
branches/ClientUserManagement/HeuristicLab.Services.Access/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs

    r7380 r7426  
    397397      }
    398398
     399      if (accessUserGuids.Count() != ids.Count()) {
     400        throw new Exception("Couldn't find one or more users for the given user ids.");
     401      }
     402
    399403      return accessUserGuids.Select(x => BuildUserDto(x));
     404    }
     405
     406    public IEnumerable<DT.LightweightUser> GetLightweightUsers(IEnumerable<Guid> ids) {
     407      List<Guid> accessUserGuids = null;
     408
     409      using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) {
     410        var query = from u in context.UserGroupBases.OfType<DA.User>()
     411                    where ids.Contains(u.Id)
     412                    select u.Id;
     413        accessUserGuids = query.ToList();
     414      }
     415
     416      if (accessUserGuids.Count() != ids.Count()) {
     417        throw new Exception("Couldn't find one or more users for the given user ids.");
     418      }
     419
     420      return accessUserGuids.Select(x => BuildLightweightUserDto(x));
    400421    }
    401422
     
    589610    #endregion
    590611
     612    #region UserGroupBase
     613    public IEnumerable<DT.UserGroupBase> GetAllLeightweightUsersAndGroups() {
     614      List<DA.UserGroupBase> dbUserGroupsBases = new List<DA.UserGroupBase>();
     615      List<DT.UserGroupBase> result = new List<DT.UserGroupBase>();
     616
     617      using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) {
     618        var query = from u in context.UserGroupBases
     619                    select u;
     620        dbUserGroupsBases = query.ToList();
     621      }
     622
     623      foreach (var ugb in dbUserGroupsBases) {
     624        if (ugb.GetType() == typeof(DA.User)) {
     625          var user = BuildLightweightUserDto(ugb.Id);
     626          result.Add(user);
     627        } else if (ugb.GetType() == typeof(DA.UserGroup)) {
     628          var group = Convert.ToDto(ugb as DA.UserGroup);
     629          result.Add(group);
     630        }
     631      }
     632      return result;
     633    }
     634
     635    public IEnumerable<DT.UserGroupBase> GetLeightweightUsersAndGroups(IEnumerable<Guid> ids) {
     636      List<DA.UserGroupBase> dbUserGroupsBases = new List<DA.UserGroupBase>();
     637      List<DT.UserGroupBase> result = new List<DT.UserGroupBase>();
     638
     639      using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) {
     640        var query = from u in context.UserGroupBases
     641                    where ids.Contains(u.Id)
     642                    select u;
     643        dbUserGroupsBases = query.ToList();
     644      }
     645
     646      foreach (var ugb in dbUserGroupsBases) {
     647        if (ugb.GetType() == typeof(DA.User)) {
     648          var user = BuildLightweightUserDto(ugb.Id);
     649          result.Add(user);
     650        } else if (ugb.GetType() == typeof(DA.UserGroup)) {
     651          var group = Convert.ToDto(ugb as DA.UserGroup);
     652          result.Add(group);
     653        }
     654      }
     655      return result;
     656    }
     657    #endregion
     658
    591659    #region Roles
    592660    public IEnumerable<DT.Role> GetRoles() {
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/IAccessService.cs

    r7367 r7426  
    112112
    113113    [OperationContract]
     114    IEnumerable<LightweightUser> GetLightweightUsers(IEnumerable<Guid> ids);
     115
     116    [OperationContract]
    114117    IEnumerable<User> GetAllUsers();
    115118
     
    165168    [OperationContract]
    166169    IEnumerable<UserGroupBase> GetUsersAndGroups();
     170
     171    [OperationContract]
     172    IEnumerable<UserGroupBase> GetAllLeightweightUsersAndGroups();
     173
     174    [OperationContract]
     175    IEnumerable<UserGroupBase> GetLeightweightUsersAndGroups(IEnumerable<Guid> ids);
    167176    #endregion
    168177
Note: See TracChangeset for help on using the changeset viewer.