Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/29/12 17:41:18 (12 years ago)
Author:
ascheibe
Message:

#1648 added client registration ui

File:
1 edited

Legend:

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

    r7436 r7536  
    6464                    where c.Id == id
    6565                    select c;
    66 
    67         return Convert.ToDto(query.FirstOrDefault());
     66        if (query.Count() > 0) {
     67          return Convert.ToDto(query.FirstOrDefault());
     68        } else {
     69          return null;
     70        }
    6871      }
    6972    }
     
    8689    }
    8790
    88     public Guid AddClient(DT.Client client) {
     91    public void AddClient(DT.Client client) {
    8992      string country = string.Empty;
    9093
     
    105108                      where c.Name == country
    106109                      select c;
    107 
    108110          if (query.Count() > 0) {
    109111            entity.CountryId = query.First().Id;
     
    111113        }
    112114
     115        if (entity.OperatingSystem != null) {
     116          string osversion = entity.OperatingSystem.Name;
     117          var query = from os in context.GetTable<DA.OperatingSystem>()
     118                      where os.Name == osversion
     119                      select os;
     120          if (query.Count() > 0) {
     121            entity.OperatingSystem = query.First();
     122          }
     123        }
     124
     125        if (entity.ClientType != null) {
     126          string cType = entity.ClientType.Name;
     127          var query = from t in context.GetTable<DA.ClientType>()
     128                      where t.Name == cType
     129                      select t;
     130          if (query.Count() > 0) {
     131            entity.ClientType = query.First();
     132          }
     133        }
     134
    113135        context.Resources.InsertOnSubmit(entity);
    114136        context.SubmitChanges();
    115         return entity.Id;
    116137      }
    117138    }
     
    162183    public Guid AddClientGroup(DT.ClientGroup group) {
    163184      using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) {
     185        if (group.Id == Guid.Empty)
     186          group.Id = Guid.NewGuid();
     187
    164188        var entity = Convert.ToEntity(group);
    165189        context.Resources.InsertOnSubmit(entity);
Note: See TracChangeset for help on using the changeset viewer.