Free cookie consent management tool by TermsFeed Policy Generator

Changeset 842 for trunk/sources


Ignore:
Timestamp:
11/27/08 17:05:05 (16 years ago)
Author:
msteinbi
Message:

Login implemented with db (#399)

Location:
trunk/sources
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Contracts/BusinessObjects/Client.cs

    r795 r842  
    2828namespace HeuristicLab.Hive.Contracts.BusinessObjects {
    2929
    30   public enum State { idle, calculating };
     30  public enum State { idle, calculating, offline };
    3131
    3232  [DataContract]
  • trunk/sources/HeuristicLab.Hive.Contracts/Interfaces/IUserRoleManager.cs

    r796 r842  
    1515    List<User> GetAllUsers();
    1616    [OperationContract]
     17    void AddNewUser(User user);
     18    [OperationContract]
    1719    List<UserGroup> GetAllUserGroups();
    1820  }
  • trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs

    r838 r842  
    77using HeuristicLab.Hive.Contracts;
    88using HeuristicLab.Core;
     9using HeuristicLab.Hive.Server.Core.InternalInterfaces.DataAccess;
     10using System.Resources;
     11using System.Reflection;
    912
    1013namespace HeuristicLab.Hive.Server.Core {
     
    1720    int nrOfJobs = 1;
    1821
     22    IClientAdapter clientAdapter;
     23    ResourceManager rm;
     24
    1925    public ClientCommunicator() {
     26      clientAdapter = ServiceLocator.GetClientAdapter();
     27      rm = new ResourceManager("HiveServerMessages.resx", Assembly.GetExecutingAssembly());
     28
    2029      jobs = new LinkedList<long>();
    2130      for (long i = 0; i < nrOfJobs; i++) {
     
    2736
    2837    public Response Login(ClientInfo clientInfo) {
    29       if (clients == null)
    30         clients = new List<ClientInfo>();
    31 
    32       clients.Add(clientInfo);
    33 
    3438      Response response = new Response();
    3539      response.Success = true;
    36       response.StatusMessage = "Client with GUID " + clientInfo.ClientId + " successuflly logged in";
     40
     41      ICollection<ClientInfo> allClients = clientAdapter.GetAllClients();
     42      foreach (ClientInfo client in allClients) {
     43        if (client.ClientId.Equals(clientInfo.ClientId)) {
     44          if (client.State != State.offline) {
     45            response.Success = false;
     46            response.StatusMessage = rm.GetString("UserAllreadyOnline");
     47            break;
     48          } else
     49            break; // searching for clients can be stopped, because it was found and it's state is offline
     50        }
     51      }
     52
     53      if (response.Success) {
     54        clientAdapter.UpdateClient(clientInfo);
     55        response.Success = true;
     56        response.StatusMessage = rm.GetString("LoginSuccess");
     57      }
    3758
    3859      return response;
  • trunk/sources/HeuristicLab.Hive.Server.Core/HeuristicLab.Hive.Server.Core.csproj

    r837 r842  
    5454    <Compile Include="DbTestApp.cs" />
    5555    <Compile Include="HiveServerCorePlugin.cs" />
     56    <Compile Include="HiveServerMessages.Designer.cs">
     57      <AutoGen>True</AutoGen>
     58      <DesignTime>True</DesignTime>
     59      <DependentUpon>HiveServerMessages.resx</DependentUpon>
     60    </Compile>
    5661    <Compile Include="InternalInterfaces\DataAccess\IClientAdapter.cs" />
    5762    <Compile Include="InternalInterfaces\DataAccess\IResourceAdapter.cs" />
     
    6065    <Compile Include="ServerConsoleFacade.cs" />
    6166    <Compile Include="ServiceLocator.cs" />
     67    <Compile Include="Settings.cs" />
    6268    <Compile Include="UserRoleManager.cs" />
    6369  </ItemGroup>
    6470  <ItemGroup>
     71    <None Include="app.config" />
    6572    <None Include="HeuristicLab.snk" />
    6673    <None Include="Properties\AssemblyInfo.frame" />
     
    8087    </ProjectReference>
    8188  </ItemGroup>
     89  <ItemGroup>
     90    <EmbeddedResource Include="HiveServerMessages.resx">
     91      <Generator>ResXFileCodeGenerator</Generator>
     92      <LastGenOutput>HiveServerMessages.Designer.cs</LastGenOutput>
     93    </EmbeddedResource>
     94  </ItemGroup>
    8295  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    8396  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • trunk/sources/HeuristicLab.Hive.Server.Core/ServerConsoleFacade.cs

    r821 r842  
    4242    }
    4343
     44    public void AddNewUser(User user) {
     45      userRoleManager.AddNewUser(user);
     46    }
     47
    4448    public List<HeuristicLab.Hive.Contracts.BusinessObjects.UserGroup> GetAllUserGroups() {
    4549      return userRoleManager.GetAllUserGroups();
  • trunk/sources/HeuristicLab.Hive.Server.Core/UserRoleManager.cs

    r820 r842  
    3030    }
    3131
     32    public void AddNewUser(User user) {
     33
     34    }
     35
    3236    public List<UserGroup> GetAllUserGroups() {
    3337      return userGroups;
Note: See TracChangeset for help on using the changeset viewer.