Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6927


Ignore:
Timestamp:
10/13/11 21:05:21 (13 years ago)
Author:
ascheibe
Message:

#1648 added GeoIP support to access webservice

Location:
branches/ClientUserManagement
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/ClientUserManagement/HeuristicLab.GeoIP/1.12/HeuristicLab.GeoIP.csproj

    r6826 r6927  
    4949    <Compile Include="Country.cs" />
    5050    <Compile Include="DatabaseInfo.cs" />
     51    <Compile Include="GeoIPLookupService.cs" />
    5152    <Compile Include="Location.cs" />
    5253    <Compile Include="LookupService.cs" />
     
    5455    <Compile Include="Region.cs" />
    5556    <Compile Include="RegionName.cs" />
    56     <None Include="GeoIP201109.dat" />
     57    <Compile Include="Settings.Designer.cs">
     58      <AutoGen>True</AutoGen>
     59      <DesignTimeSharedInput>True</DesignTimeSharedInput>
     60      <DependentUpon>Settings.settings</DependentUpon>
     61    </Compile>
     62    <None Include="app.config" />
     63    <None Include="GeoIP201109.dat">
     64      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     65    </None>
    5766    <None Include="Properties\AssemblyInfo.frame" />
     67    <None Include="Settings.settings">
     68      <Generator>SettingsSingleFileGenerator</Generator>
     69      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
     70    </None>
    5871  </ItemGroup>
    5972  <ItemGroup>
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs

    r6858 r6927  
    2424using System.Linq;
    2525using System.ServiceModel;
     26using System.ServiceModel.Channels;
    2627using System.Web.Security;
     28using HeuristicLab.GeoIP;
    2729using DA = HeuristicLab.Services.Access.DataAccess;
    2830using DT = HeuristicLab.Services.Access.DataTransfer;
     
    7779
    7880    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
    7992      using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) {
    8093        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
    81105        context.Resources.InsertOnSubmit(entity);
    82106        context.SubmitChanges();
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/HeuristicLab.Services.Access-3.3.csproj

    r6852 r6927  
    8484  </ItemGroup>
    8585  <ItemGroup>
     86    <ProjectReference Include="..\..\HeuristicLab.GeoIP\1.12\HeuristicLab.GeoIP.csproj">
     87      <Project>{BE9B0229-9150-49A4-AEA6-BB58E055992F}</Project>
     88      <Name>HeuristicLab.GeoIP</Name>
     89    </ProjectReference>
    8690    <ProjectReference Include="..\..\HeuristicLab.Services.Access.DataAccess\3.3\HeuristicLab.Services.Access.DataAccess-3.3.csproj">
    8791      <Project>{0F652437-998A-4EAB-8BF1-444B5FE8CE97}</Project>
Note: See TracChangeset for help on using the changeset viewer.