Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7945 for branches


Ignore:
Timestamp:
06/01/12 12:48:54 (12 years ago)
Author:
ascheibe
Message:

#1648 fixed updating of client information

Location:
branches/ClientUserManagement
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/ClientInformation.cs

    r7553 r7945  
    7676      try {
    7777        AccessClient.CallAccessService(x => clientInfo = x.GetClient(clientId));
    78         if (clientInfo != null)
     78        if (clientInfo != null) {
    7979          clientExists = true;
     80          if (clientInfo.HeuristicLabVersion != ClientInformationUtils.GetHLVersion()) {
     81            clientInfo.HeuristicLabVersion = ClientInformationUtils.GetHLVersion();
     82            AccessClient.CallAccessService(x => x.UpdateClient(clientInfo));
     83          }
     84        }
    8085        errorOccured = false;
    8186        occuredException = null;
  • branches/ClientUserManagement/HeuristicLab.Services.Access.DataAccess/3.3/AccessService.dbml

    r7619 r7945  
    11<?xml version="1.0" encoding="utf-8"?><Database Name="HeuristicLab.ClientManagement" Class="AccessServiceDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
    2   <Connection Mode="AppSettings" ConnectionString="Data Source=.;Initial Catalog=HeuristicLab.ClientManagement;Integrated Security=True" SettingsObjectName="HeuristicLab.Services.Access.DataAccess.Properties.Settings" SettingsPropertyName="HeuristicLab_ClientManagementConnectionString" Provider="System.Data.SqlClient" />
     2  <Connection Mode="AppSettings" ConnectionString="Data Source=.;Initial Catalog=HeuristicLab.AccessService;Integrated Security=True" SettingsObjectName="HeuristicLab.Services.Access.DataAccess.Properties.Settings" SettingsPropertyName="HeuristicLab_ClientManagementConnectionString" Provider="System.Data.SqlClient" />
    33  <Table Name="dbo.Resource" Member="Resources">
    44    <Type Name="Resource" InheritanceCode="Resource" IsInheritanceDefault="true">
    55      <Column Name="Id" AutoSync="OnInsert" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    66      <Column Name="Name" Type="System.String" DbType="NVarChar(MAX) NOT NULL" CanBeNull="false" />
    7       <Column Name="Description" Type="System.String" DbType="NVarChar(MAX)" CanBeNull="false" />
     7      <Column Name="Description" Type="System.String" DbType="NVarChar(MAX)" CanBeNull="true" />
    88      <Column Name="Type" Type="System.String" DbType="NVarChar(MAX) NOT NULL" CanBeNull="false" IsDiscriminator="true" />
    99      <Association Name="Resource_ResourceResourceGroup" Member="ResourceResourceGroupsChilds" Storage="_ResourceResourceGroups" ThisKey="Id" OtherKey="ResourceGroupId" Type="ResourceResourceGroup" />
     
    1212      <Association Name="Resource_ResourcePlugin" Member="ResourcePlugins" ThisKey="Id" OtherKey="ResourceId" Type="ResourcePlugin" />
    1313      <Type Name="Client" InheritanceCode="Client">
    14         <Column Name="HeuristicLabVersion" Type="System.String" DbType="NVarChar(MAX)" CanBeNull="false" />
     14        <Column Name="HeuristicLabVersion" Type="System.String" DbType="NVarChar(MAX)" CanBeNull="true" />
    1515        <Column Name="MemorySize" Type="System.Int32" DbType="Int" CanBeNull="true" />
    1616        <Column Name="Timestamp" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
  • branches/ClientUserManagement/HeuristicLab.Services.Access.DataAccess/3.3/AccessService.dbml.layout

    r7619 r7945  
    4747      </nodes>
    4848    </inheritanceConnector>
    49     <inheritanceConnector edgePoints="[(5.625 : 2.07859537760417); (5.625 : 2.26); (5.79166666666667 : 2.26 : JumpStart); (5.98958333333333 : 2.26 : JumpEnd); (7 : 2.26); (7 : 2.5)]" fixedFrom="NotFixed" fixedTo="NotFixed" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62">
     49    <inheritanceConnector edgePoints="[(5.625 : 2.07859537760417); (5.625 : 2.26); (7 : 2.26); (7 : 2.5)]" fixedFrom="NotFixed" fixedTo="NotFixed" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62">
    5050      <nodes>
    5151        <classShapeMoniker Id="20c6e07e-aa12-43dc-87d6-dae5bf173da4" />
     
    179179      </nodes>
    180180    </associationConnector>
    181     <associationConnector edgePoints="[(2.5 : 2.72199625651042); (3.75 : 2.72199625651042)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     181    <associationConnector edgePoints="[(2.5 : 2.72199625651042); (2.79166666666667 : 2.72199625651042 : JumpStart); (2.95833333333333 : 2.72199625651042 : JumpEnd); (3.75 : 2.72199625651042)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    182182      <AssociationMoniker Name="/AccessServiceDataContext/OperatingSystem/OperatingSystem_Client" />
    183183      <nodes>
  • branches/ClientUserManagement/HeuristicLab.Services.Access.DataAccess/3.3/AccessService.designer.cs

    r7619 r7945  
    33// <auto-generated>
    44//     This code was generated by a tool.
    5 //     Runtime Version:4.0.30319.530
     5//     Runtime Version:4.0.30319.544
    66//
    77//     Changes to this file may cause incorrect behavior and will be lost if
     
    284284    }
    285285   
    286     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Description", DbType="NVarChar(MAX)", CanBeNull=false)]
     286    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Description", DbType="NVarChar(MAX)")]
    287287    public string Description
    288288    {
     
    511511    }
    512512   
    513     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HeuristicLabVersion", DbType="NVarChar(MAX)", CanBeNull=false)]
     513    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HeuristicLabVersion", DbType="NVarChar(MAX)")]
    514514    public string HeuristicLabVersion
    515515    {
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs

    r7936 r7945  
    139139
    140140    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      }
    142177    }
    143178
Note: See TracChangeset for help on using the changeset viewer.