- Timestamp:
- 06/01/12 12:48:54 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs
r7936 r7945 139 139 140 140 public void UpdateClient(DT.Client client) { 141 AddClient(client); 141 string country = string.Empty; 142 143 OperationContext opContext = OperationContext.Current; 144 145 if (opContext != null) { 146 MessageProperties properties = opContext.IncomingMessageProperties; 147 RemoteEndpointMessageProperty endpoint = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty; 148 string ipAdr = endpoint.Address; 149 country = GeoIPLookupService.Instance.GetCountryName(ipAdr); 150 } 151 152 using (DA.AccessServiceDataContext context = new DA.AccessServiceDataContext()) { 153 var query = from c in context.Resources.OfType<DA.Client>() 154 where c.Id == client.Id 155 select c; 156 157 if (query.Count() > 0) { 158 var entity = query.First(); 159 160 if (country != string.Empty) { 161 var countryQuery = from c in context.GetTable<DA.Country>() 162 where c.Name == country 163 select c; 164 if (countryQuery.Count() > 0) { 165 entity.CountryId = countryQuery.First().Id; 166 } 167 } 168 169 entity.Name = client.Name; 170 entity.Description = client.Description; 171 entity.HeuristicLabVersion = client.HeuristicLabVersion; 172 entity.Timestamp = DateTime.Now; 173 174 context.SubmitChanges(); 175 } 176 } 142 177 } 143 178
Note: See TracChangeset
for help on using the changeset viewer.