- Timestamp:
- 10/13/11 21:05:21 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs
r6858 r6927 24 24 using System.Linq; 25 25 using System.ServiceModel; 26 using System.ServiceModel.Channels; 26 27 using System.Web.Security; 28 using HeuristicLab.GeoIP; 27 29 using DA = HeuristicLab.Services.Access.DataAccess; 28 30 using DT = HeuristicLab.Services.Access.DataTransfer; … … 77 79 78 80 public Guid AddClient(DT.Client client) { 81 string country = string.Empty; 82 83 OperationContext opContext = OperationContext.Current; 84 85 if (opContext != null) { 86 MessageProperties properties = opContext.IncomingMessageProperties; 87 RemoteEndpointMessageProperty endpoint = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty; 88 string ipAdr = endpoint.Address; 89 country = GeoIPLookupService.Instance.GetCountryName(ipAdr); 90 } 91 79 92 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 80 93 DA.Client entity = Convert.ToEntity(client); 94 95 if (country != string.Empty) { 96 var query = from c in context.GetTable<DA.Country>() 97 where c.Name == country 98 select c; 99 100 if (query.Count() > 0) { 101 entity.CountryId = query.First().Id; 102 } 103 } 104 81 105 context.Resources.InsertOnSubmit(entity); 82 106 context.SubmitChanges();
Note: See TracChangeset
for help on using the changeset viewer.