Changeset 7536


Ignore:
Timestamp:
02/29/12 17:41:18 (7 years ago)
Author:
ascheibe
Message:

#1648 added client registration ui

Location:
branches/ClientUserManagement
Files:
6 added
15 edited

Legend:

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

    r7436 r7536  
    4848    public void Refresh() {
    4949      usersAndGroups = new ItemList<UserGroupBase>();
    50       usersAndGroups.AddRange(CallRunCreationService<ItemList<UserGroupBase>>(s => new ItemList<UserGroupBase>(s.GetAllLeightweightUsersAndGroups())));
     50      usersAndGroups.AddRange(CallAccessService<ItemList<UserGroupBase>>(s => new ItemList<UserGroupBase>(s.GetAllLeightweightUsersAndGroups())));
    5151    }
    5252    public void RefreshAsync(Action<Exception> exceptionCallback) {
     
    108108
    109109    #region Helpers
    110     public static void CallRunCreationService(Action<IAccessService> call) {
     110    public static void CallAccessService(Action<IAccessService> call) {
    111111      AccessServiceClient client = ClientFactory.CreateClient<AccessServiceClient, IAccessService>();
    112112      try {
     
    122122      }
    123123    }
    124     public static T CallRunCreationService<T>(Func<IAccessService, T> call) {
     124    public static T CallAccessService<T>(Func<IAccessService, T> call) {
    125125      AccessServiceClient client = ClientFactory.CreateClient<AccessServiceClient, IAccessService>();
    126126      try {
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/ClientInformation.cs

    r7534 r7536  
    6161
    6262      try {
    63         AccessClient.CallRunCreationService(x => clientInfo = x.GetClient(clientId));
     63        AccessClient.CallAccessService(x => clientInfo = x.GetClient(clientId));
    6464        if (clientInfo != null)
    6565          clientExists = true;
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/ClientInformationUtils.cs

    r7534 r7536  
    2121
    2222using System;
     23using System.Diagnostics;
    2324using System.Management;
     25using System.Reflection;
    2426using HeuristicLab.Algorithms.Benchmarks;
    2527using HeuristicLab.Data;
     
    2830namespace HeuristicLab.Clients.Access {
    2931  public static class ClientInformationUtils {
     32
     33    public static Client CollectClientInformation() {
     34      Client client = new Client();
     35      OperatingSystem os = new OperatingSystem();
     36      ClientType cType = new ClientType();
     37      cType.Name = "HLClient";
     38
     39      client.Id = GetUniqueMachineId();
     40      client.HeuristicLabVersion = GetHLVersion();
     41      client.Name = GetMachineName();
     42      client.MemorySize = GetPhysicalMemory().GetValueOrDefault();
     43      client.NumberOfCores = GetNumberOfCores();
     44      os.Name = GetOperatingSystem();
     45      client.OperatingSystem = os;
     46      client.ProcessorType = GetCpuInfo();
     47      client.ClientType = cType;
     48      //client.ClientConfiguration = GetClientConfiguration();
     49      client.Timestamp = DateTime.Now;
     50      client.PerformanceValue = RunBenchmark();
     51
     52      return client;
     53    }
     54
     55    public static string GetClientConfiguration() {
     56      //TODO: does it make sense to send the client configuration to the server? for what do we need this?
     57      return string.Empty;
     58    }
     59
     60    public static string GetHLVersion() {
     61      FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
     62      return versionInfo.FileVersion;
     63    }
    3064
    3165    public static int GetNumberOfCores() {
     
    67101    /// returns CPU frequence of the machine in Mhz
    68102    /// </summary>
    69     public static int? GetCpuSpeed() {
    70       return (int)GetWMIValue("Win32_Processor", "MaxClockSpeed");
     103    public static string GetCpuInfo() {
     104      string name = GetWMIString("Win32_Processor", "Name");
     105      string manufacturer = GetWMIString("Win32_Processor", "Manufacturer");
     106      return manufacturer + " " + name;
    71107    }
    72108
     
    153189    }
    154190
     191    private static string GetWMIString(string clazz, string property) {
     192      ManagementClass mgtClass = new ManagementClass(clazz);
     193      ManagementObjectCollection mgtCol = mgtClass.GetInstances();
     194
     195      foreach (ManagementObject mgtObj in mgtCol) {
     196        foreach (var prop in mgtObj.Properties) {
     197          if (prop.Value != null && prop.Name == property) {
     198            try {
     199              return prop.Value.ToString();
     200            }
     201            catch {
     202              return string.Empty;
     203            }
     204          }
     205        }
     206      }
     207      return string.Empty;
     208    }
     209
    155210    public static double RunBenchmark() {
    156211      Linpack linpack = new Linpack();
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/ClientViews/ClientView.Designer.cs

    r7534 r7536  
    1 namespace HeuristicLab.Clients.Access.ClientViews {
     1namespace HeuristicLab.Clients.Access {
    22  partial class ClientView {
    33    /// <summary>
     
    2424    /// </summary>
    2525    private void InitializeComponent() {
    26       components = new System.ComponentModel.Container();
     26      this.label1 = new System.Windows.Forms.Label();
     27      this.label2 = new System.Windows.Forms.Label();
     28      this.label3 = new System.Windows.Forms.Label();
     29      this.label4 = new System.Windows.Forms.Label();
     30      this.label5 = new System.Windows.Forms.Label();
     31      this.label6 = new System.Windows.Forms.Label();
     32      this.label7 = new System.Windows.Forms.Label();
     33      this.label8 = new System.Windows.Forms.Label();
     34      this.label9 = new System.Windows.Forms.Label();
     35      this.label10 = new System.Windows.Forms.Label();
     36      this.label11 = new System.Windows.Forms.Label();
     37      this.txtName = new System.Windows.Forms.TextBox();
     38      this.txtDescription = new System.Windows.Forms.TextBox();
     39      this.txtVersion = new System.Windows.Forms.TextBox();
     40      this.txtTimestamp = new System.Windows.Forms.TextBox();
     41      this.txtMemory = new System.Windows.Forms.TextBox();
     42      this.txtNumberOfCores = new System.Windows.Forms.TextBox();
     43      this.txtClientType = new System.Windows.Forms.TextBox();
     44      this.txtClientConfiguration = new System.Windows.Forms.TextBox();
     45      this.txtProcessor = new System.Windows.Forms.TextBox();
     46      this.txtOS = new System.Windows.Forms.TextBox();
     47      this.txtPerformanceValue = new System.Windows.Forms.TextBox();
     48      this.label13 = new System.Windows.Forms.Label();
     49      this.txtId = new System.Windows.Forms.TextBox();
     50      this.SuspendLayout();
     51      //
     52      // label1
     53      //
     54      this.label1.AutoSize = true;
     55      this.label1.Location = new System.Drawing.Point(3, 6);
     56      this.label1.Name = "label1";
     57      this.label1.Size = new System.Drawing.Size(38, 13);
     58      this.label1.TabIndex = 0;
     59      this.label1.Text = "Name:";
     60      //
     61      // label2
     62      //
     63      this.label2.AutoSize = true;
     64      this.label2.Location = new System.Drawing.Point(3, 32);
     65      this.label2.Name = "label2";
     66      this.label2.Size = new System.Drawing.Size(63, 13);
     67      this.label2.TabIndex = 1;
     68      this.label2.Text = "Description:";
     69      //
     70      // label3
     71      //
     72      this.label3.AutoSize = true;
     73      this.label3.Location = new System.Drawing.Point(3, 58);
     74      this.label3.Name = "label3";
     75      this.label3.Size = new System.Drawing.Size(62, 13);
     76      this.label3.TabIndex = 2;
     77      this.label3.Text = "HL Version:";
     78      //
     79      // label4
     80      //
     81      this.label4.AutoSize = true;
     82      this.label4.Location = new System.Drawing.Point(3, 84);
     83      this.label4.Name = "label4";
     84      this.label4.Size = new System.Drawing.Size(47, 13);
     85      this.label4.TabIndex = 3;
     86      this.label4.Text = "Memory:";
     87      //
     88      // label5
     89      //
     90      this.label5.AutoSize = true;
     91      this.label5.Location = new System.Drawing.Point(3, 110);
     92      this.label5.Name = "label5";
     93      this.label5.Size = new System.Drawing.Size(61, 13);
     94      this.label5.TabIndex = 4;
     95      this.label5.Text = "Timestamp:";
     96      //
     97      // label6
     98      //
     99      this.label6.AutoSize = true;
     100      this.label6.Location = new System.Drawing.Point(3, 136);
     101      this.label6.Name = "label6";
     102      this.label6.Size = new System.Drawing.Size(62, 13);
     103      this.label6.TabIndex = 5;
     104      this.label6.Text = "CPU Cores:";
     105      //
     106      // label7
     107      //
     108      this.label7.AutoSize = true;
     109      this.label7.Location = new System.Drawing.Point(3, 162);
     110      this.label7.Name = "label7";
     111      this.label7.Size = new System.Drawing.Size(57, 13);
     112      this.label7.TabIndex = 6;
     113      this.label7.Text = "Processor:";
     114      //
     115      // label8
     116      //
     117      this.label8.AutoSize = true;
     118      this.label8.Location = new System.Drawing.Point(3, 188);
     119      this.label8.Name = "label8";
     120      this.label8.Size = new System.Drawing.Size(36, 13);
     121      this.label8.TabIndex = 7;
     122      this.label8.Text = "Client:";
     123      //
     124      // label9
     125      //
     126      this.label9.AutoSize = true;
     127      this.label9.Location = new System.Drawing.Point(3, 214);
     128      this.label9.Name = "label9";
     129      this.label9.Size = new System.Drawing.Size(63, 13);
     130      this.label9.TabIndex = 8;
     131      this.label9.Text = "OS Version:";
     132      //
     133      // label10
     134      //
     135      this.label10.AutoSize = true;
     136      this.label10.Location = new System.Drawing.Point(3, 240);
     137      this.label10.Name = "label10";
     138      this.label10.Size = new System.Drawing.Size(101, 13);
     139      this.label10.TabIndex = 9;
     140      this.label10.Text = "Client Configuration:";
     141      //
     142      // label11
     143      //
     144      this.label11.AutoSize = true;
     145      this.label11.Location = new System.Drawing.Point(3, 266);
     146      this.label11.Name = "label11";
     147      this.label11.Size = new System.Drawing.Size(100, 13);
     148      this.label11.TabIndex = 10;
     149      this.label11.Text = "Performance Value:";
     150      //
     151      // txtName
     152      //
     153      this.txtName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     154                  | System.Windows.Forms.AnchorStyles.Right)));
     155      this.txtName.Location = new System.Drawing.Point(110, 3);
     156      this.txtName.Name = "txtName";
     157      this.txtName.Size = new System.Drawing.Size(265, 20);
     158      this.txtName.TabIndex = 12;
     159      //
     160      // txtDescription
     161      //
     162      this.txtDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     163                  | System.Windows.Forms.AnchorStyles.Right)));
     164      this.txtDescription.Location = new System.Drawing.Point(111, 29);
     165      this.txtDescription.Name = "txtDescription";
     166      this.txtDescription.Size = new System.Drawing.Size(264, 20);
     167      this.txtDescription.TabIndex = 13;
     168      //
     169      // txtVersion
     170      //
     171      this.txtVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     172                  | System.Windows.Forms.AnchorStyles.Right)));
     173      this.txtVersion.Location = new System.Drawing.Point(111, 55);
     174      this.txtVersion.Name = "txtVersion";
     175      this.txtVersion.Size = new System.Drawing.Size(264, 20);
     176      this.txtVersion.TabIndex = 14;
     177      //
     178      // txtTimestamp
     179      //
     180      this.txtTimestamp.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     181                  | System.Windows.Forms.AnchorStyles.Right)));
     182      this.txtTimestamp.Location = new System.Drawing.Point(110, 107);
     183      this.txtTimestamp.Name = "txtTimestamp";
     184      this.txtTimestamp.Size = new System.Drawing.Size(265, 20);
     185      this.txtTimestamp.TabIndex = 15;
     186      //
     187      // txtMemory
     188      //
     189      this.txtMemory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     190                  | System.Windows.Forms.AnchorStyles.Right)));
     191      this.txtMemory.Location = new System.Drawing.Point(110, 81);
     192      this.txtMemory.Name = "txtMemory";
     193      this.txtMemory.Size = new System.Drawing.Size(265, 20);
     194      this.txtMemory.TabIndex = 16;
     195      //
     196      // txtNumberOfCores
     197      //
     198      this.txtNumberOfCores.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     199                  | System.Windows.Forms.AnchorStyles.Right)));
     200      this.txtNumberOfCores.Location = new System.Drawing.Point(110, 133);
     201      this.txtNumberOfCores.Name = "txtNumberOfCores";
     202      this.txtNumberOfCores.Size = new System.Drawing.Size(265, 20);
     203      this.txtNumberOfCores.TabIndex = 17;
     204      //
     205      // txtClientType
     206      //
     207      this.txtClientType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     208                  | System.Windows.Forms.AnchorStyles.Right)));
     209      this.txtClientType.Location = new System.Drawing.Point(111, 185);
     210      this.txtClientType.Name = "txtClientType";
     211      this.txtClientType.Size = new System.Drawing.Size(264, 20);
     212      this.txtClientType.TabIndex = 18;
     213      //
     214      // txtClientConfiguration
     215      //
     216      this.txtClientConfiguration.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     217                  | System.Windows.Forms.AnchorStyles.Right)));
     218      this.txtClientConfiguration.Location = new System.Drawing.Point(110, 237);
     219      this.txtClientConfiguration.Name = "txtClientConfiguration";
     220      this.txtClientConfiguration.Size = new System.Drawing.Size(265, 20);
     221      this.txtClientConfiguration.TabIndex = 19;
     222      //
     223      // txtProcessor
     224      //
     225      this.txtProcessor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     226                  | System.Windows.Forms.AnchorStyles.Right)));
     227      this.txtProcessor.Location = new System.Drawing.Point(111, 159);
     228      this.txtProcessor.Name = "txtProcessor";
     229      this.txtProcessor.Size = new System.Drawing.Size(264, 20);
     230      this.txtProcessor.TabIndex = 20;
     231      //
     232      // txtOS
     233      //
     234      this.txtOS.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     235                  | System.Windows.Forms.AnchorStyles.Right)));
     236      this.txtOS.Location = new System.Drawing.Point(111, 211);
     237      this.txtOS.Name = "txtOS";
     238      this.txtOS.Size = new System.Drawing.Size(264, 20);
     239      this.txtOS.TabIndex = 21;
     240      //
     241      // txtPerformanceValue
     242      //
     243      this.txtPerformanceValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     244                  | System.Windows.Forms.AnchorStyles.Right)));
     245      this.txtPerformanceValue.Location = new System.Drawing.Point(110, 263);
     246      this.txtPerformanceValue.Name = "txtPerformanceValue";
     247      this.txtPerformanceValue.Size = new System.Drawing.Size(265, 20);
     248      this.txtPerformanceValue.TabIndex = 23;
     249      //
     250      // label13
     251      //
     252      this.label13.AutoSize = true;
     253      this.label13.Location = new System.Drawing.Point(3, 292);
     254      this.label13.Name = "label13";
     255      this.label13.Size = new System.Drawing.Size(48, 13);
     256      this.label13.TabIndex = 24;
     257      this.label13.Text = "Client Id:";
     258      //
     259      // txtId
     260      //
     261      this.txtId.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     262                  | System.Windows.Forms.AnchorStyles.Right)));
     263      this.txtId.Location = new System.Drawing.Point(111, 289);
     264      this.txtId.Name = "txtId";
     265      this.txtId.Size = new System.Drawing.Size(264, 20);
     266      this.txtId.TabIndex = 25;
     267      //
     268      // ClientView
     269      //
     270      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    27271      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     272      this.Controls.Add(this.txtId);
     273      this.Controls.Add(this.label13);
     274      this.Controls.Add(this.txtPerformanceValue);
     275      this.Controls.Add(this.txtOS);
     276      this.Controls.Add(this.txtProcessor);
     277      this.Controls.Add(this.txtClientConfiguration);
     278      this.Controls.Add(this.txtClientType);
     279      this.Controls.Add(this.txtNumberOfCores);
     280      this.Controls.Add(this.txtMemory);
     281      this.Controls.Add(this.txtTimestamp);
     282      this.Controls.Add(this.txtVersion);
     283      this.Controls.Add(this.txtDescription);
     284      this.Controls.Add(this.txtName);
     285      this.Controls.Add(this.label11);
     286      this.Controls.Add(this.label10);
     287      this.Controls.Add(this.label9);
     288      this.Controls.Add(this.label8);
     289      this.Controls.Add(this.label7);
     290      this.Controls.Add(this.label6);
     291      this.Controls.Add(this.label5);
     292      this.Controls.Add(this.label4);
     293      this.Controls.Add(this.label3);
     294      this.Controls.Add(this.label2);
     295      this.Controls.Add(this.label1);
     296      this.Name = "ClientView";
     297      this.Size = new System.Drawing.Size(378, 315);
     298      this.ResumeLayout(false);
     299      this.PerformLayout();
     300
    28301    }
    29302
    30303    #endregion
     304
     305    protected System.Windows.Forms.Label label1;
     306    protected System.Windows.Forms.Label label2;
     307    protected System.Windows.Forms.Label label3;
     308    protected System.Windows.Forms.Label label4;
     309    protected System.Windows.Forms.Label label5;
     310    protected System.Windows.Forms.Label label6;
     311    protected System.Windows.Forms.Label label7;
     312    protected System.Windows.Forms.Label label8;
     313    protected System.Windows.Forms.Label label9;
     314    protected System.Windows.Forms.Label label10;
     315    protected System.Windows.Forms.Label label11;
     316    protected System.Windows.Forms.TextBox txtName;
     317    protected System.Windows.Forms.TextBox txtDescription;
     318    protected System.Windows.Forms.TextBox txtVersion;
     319    protected System.Windows.Forms.TextBox txtTimestamp;
     320    protected System.Windows.Forms.TextBox txtMemory;
     321    protected System.Windows.Forms.TextBox txtNumberOfCores;
     322    protected System.Windows.Forms.TextBox txtClientType;
     323    protected System.Windows.Forms.TextBox txtClientConfiguration;
     324    protected System.Windows.Forms.TextBox txtProcessor;
     325    protected System.Windows.Forms.TextBox txtOS;
     326    protected System.Windows.Forms.TextBox txtPerformanceValue;
     327    protected System.Windows.Forms.Label label13;
     328    protected System.Windows.Forms.TextBox txtId;
     329
    31330  }
    32331}
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/ClientViews/ClientView.cs

    r7534 r7536  
    2323using HeuristicLab.MainForm;
    2424
    25 namespace HeuristicLab.Clients.Access.ClientViews {
     25namespace HeuristicLab.Clients.Access {
    2626  [View("Client View")]
    2727  [Content(typeof(Client), true)]
    2828  public partial class ClientView : ItemView {
     29    public new Client Content {
     30      get { return (Client)base.Content; }
     31      set { base.Content = value; }
     32    }
     33
    2934    public ClientView() {
    3035      InitializeComponent();
    3136    }
     37
     38    protected override void OnContentChanged() {
     39      base.OnContentChanged();
     40
     41      if (Content == null) {
     42        txtClientConfiguration.Text = string.Empty;
     43        txtClientType.Text = string.Empty;
     44        txtDescription.Text = string.Empty;
     45        txtMemory.Text = string.Empty;
     46        txtName.Text = string.Empty;
     47        txtNumberOfCores.Text = string.Empty;
     48        txtPerformanceValue.Text = string.Empty;
     49        txtProcessor.Text = string.Empty;
     50        txtTimestamp.Text = string.Empty;
     51        txtVersion.Text = string.Empty;
     52        txtId.Text = string.Empty;
     53        txtOS.Text = string.Empty;
     54      } else {
     55        if (Content.ClientConfiguration != null) {
     56          txtClientConfiguration.Text = Content.ClientConfiguration.Description; //??
     57        }
     58        if (Content.ClientType != null) {
     59          txtClientType.Text = Content.ClientType.Name;
     60        }
     61        if (Content.OperatingSystem != null) {
     62          txtOS.Text = Content.OperatingSystem.Name;
     63        }
     64        txtDescription.Text = Content.Description;
     65        txtMemory.Text = Content.MemorySize.ToString();
     66        txtName.Text = Content.Name;
     67        txtNumberOfCores.Text = Content.NumberOfCores.ToString();
     68        txtPerformanceValue.Text = Content.PerformanceValue.ToString();
     69        txtProcessor.Text = Content.ProcessorType;
     70        txtTimestamp.Text = Content.Timestamp.ToShortDateString();
     71        txtVersion.Text = Content.HeuristicLabVersion;
     72        txtId.Text = Content.Id.ToString();
     73      }
     74    }
    3275  }
    3376}
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/HeuristicLab.Clients.Access-3.3.csproj

    r7534 r7536  
    102102    <Compile Include="ClientInformation.cs" />
    103103    <Compile Include="ClientInformationUtils.cs" />
     104    <Compile Include="ClientViews\ClientInformationDialog.cs">
     105      <SubType>Form</SubType>
     106    </Compile>
     107    <Compile Include="ClientViews\ClientInformationDialog.Designer.cs">
     108      <DependentUpon>ClientInformationDialog.cs</DependentUpon>
     109    </Compile>
     110    <Compile Include="ClientViews\ClientRegistrationDialog.cs">
     111      <SubType>Form</SubType>
     112    </Compile>
     113    <Compile Include="ClientViews\ClientRegistrationDialog.Designer.cs">
     114      <DependentUpon>ClientRegistrationDialog.cs</DependentUpon>
     115    </Compile>
    104116    <Compile Include="ClientViews\ClientView.cs">
    105117      <SubType>UserControl</SubType>
     
    107119    <Compile Include="ClientViews\ClientView.Designer.cs">
    108120      <DependentUpon>ClientView.cs</DependentUpon>
     121    </Compile>
     122    <Compile Include="ClientViews\AdminClientView.cs">
     123      <SubType>UserControl</SubType>
     124    </Compile>
     125    <Compile Include="ClientViews\AdminClientView.Designer.cs">
     126      <DependentUpon>AdminClientView.cs</DependentUpon>
    109127    </Compile>
    110128    <Compile Include="MenuItems\ClientInfoMenuItem.cs" />
     
    162180    <None Include="UpdateLocalInstallation.cmd" />
    163181  </ItemGroup>
    164   <ItemGroup />
    165182  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    166183  <PropertyGroup>
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/MenuItems/ClientInfoMenuItem.cs

    r7534 r7536  
    3232    }
    3333    public override void Execute() {
    34       //    MainFormManager.MainForm.ShowContent(HiveClient.Instance);
     34      if (ClientInformation.Instance.ClientExists) {
     35        using (ClientInformationDialog dialog = new ClientInformationDialog()) {
     36          dialog.ShowDialog();
     37        }
     38      } else {
     39        using (ClientRegistrationDialog regDialog = new ClientRegistrationDialog()) {
     40          regDialog.ShowDialog();
     41        }
     42      }
    3543    }
    3644    public override int Position {
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/ServiceClients/AccessServiceClient.cs

    r7534 r7536  
    10841084
    10851085    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAccessService/AddClient", ReplyAction = "http://tempuri.org/IAccessService/AddClientResponse")]
    1086     System.Guid AddClient(HeuristicLab.Clients.Access.Client client);
     1086    void AddClient(HeuristicLab.Clients.Access.Client client);
    10871087
    10881088    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAccessService/UpdateClient", ReplyAction = "http://tempuri.org/IAccessService/UpdateClientResponse")]
     
    12971297    }
    12981298
    1299     public System.Guid AddClient(HeuristicLab.Clients.Access.Client client) {
    1300       return base.Channel.AddClient(client);
     1299    public void AddClient(HeuristicLab.Clients.Access.Client client) {
     1300      base.Channel.AddClient(client);
    13011301    }
    13021302
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/UserInformation.cs

    r7534 r7536  
    8383
    8484      try {
    85         AccessClient.CallRunCreationService(x => user = x.Login());
    86         AccessClient.CallRunCreationService(x => groups = x.GetGroupsOfCurrentUser());
    87         AccessClient.CallRunCreationService(x => roles = x.GetRolesOfCurrentUser());
     85        AccessClient.CallAccessService(x => user = x.Login());
     86        AccessClient.CallAccessService(x => groups = x.GetGroupsOfCurrentUser());
     87        AccessClient.CallAccessService(x => roles = x.GetRolesOfCurrentUser());
    8888        errorOccured = false;
    8989        userExists = true;
  • branches/ClientUserManagement/HeuristicLab.Services.Access-3.3.Tests/UnitTest.cs

    r7355 r7536  
    5757      DT.ClientType clientType = new DT.ClientType() { Name = "Client" };
    5858      DT.OperatingSystem os = new DT.OperatingSystem() { Name = "Windows 7" };
     59      Guid id = Guid.NewGuid();
    5960
    6061      DT.Client client = new DT.Client() {
     
    6970        OperatingSystem = os,
    7071        ProcessorType = "Intel i7",
    71         Timestamp = DateTime.Now
     72        Timestamp = DateTime.Now,
     73        Id = id
    7274      };
    7375
    74       Guid id = service.AddClient(client);
     76      service.AddClient(client);
    7577      Assert.IsTrue(service.ClientExists(id));
    7678      Assert.AreEqual(1, service.GetAllClients().Count());
     
    118120      ClearDB();
    119121      AccessService service = new AccessService();
     122      Guid id = Guid.NewGuid();
    120123
    121124      DT.Client client = new DT.Client() {
     
    126129        Name = "testClient",
    127130        ProcessorType = "Intel i7",
    128         Timestamp = DateTime.Now
     131        Timestamp = DateTime.Now,
     132        Id = id
    129133      };
    130134
    131       client.Id = service.AddClient(client);
     135      service.AddClient(client);
    132136      Assert.IsTrue(service.ClientExists(client.Id));
    133137
  • branches/ClientUserManagement/HeuristicLab.Services.Access.DataAccess/3.3/ClientManagement.dbml

    r7534 r7536  
    33  <Table Name="dbo.Resource" Member="Resources">
    44    <Type Name="Resource" InheritanceCode="Resource" IsInheritanceDefault="true">
    5       <Column Name="Id" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
     5      <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" />
    77      <Column Name="Description" Type="System.String" DbType="NVarChar(MAX)" CanBeNull="false" />
  • branches/ClientUserManagement/HeuristicLab.Services.Access.DataAccess/3.3/ClientManagement.dbml.layout

    r7534 r7536  
    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); (5.79166666666667 : 2.26 : JumpStart); (5.95833333333333 : 2.26 : JumpEnd); (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" />
     
    5959      </nestedChildShapes>
    6060    </classShape>
    61     <associationConnector edgePoints="[(5.875 : 2.07859537760417); (5.875 : 2.34875); (8.125 : 2.34875)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     61    <associationConnector edgePoints="[(5.875 : 2.07859537760417); (5.875 : 2.34875); (8.125 : 2.34875)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    6262      <AssociationMoniker Name="/ClientManagementDataContext/Resource/Resource_ClientLog" />
    6363      <nodes>
     
    121121      </nodes>
    122122    </associationConnector>
    123     <associationConnector edgePoints="[(5.90625 : 2.07859537760417); (5.90625 : 6.22199625651042); (5.625 : 6.22199625651042)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     123    <associationConnector edgePoints="[(5.90625 : 2.07859537760417); (5.90625 : 6.22199625651042); (5.625 : 6.22199625651042)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    124124      <AssociationMoniker Name="/ClientManagementDataContext/Resource/Resource_ResourcePlugin" />
    125125      <nodes>
     
    172172      </nodes>
    173173    </associationConnector>
    174     <associationConnector edgePoints="[(2.5 : 1.69399251302083); (2.875 : 2.06899251302083); (2.875 : 4.12102376302084); (3.75 : 4.12102376302084)]" fixedFrom="NotFixed" fixedTo="Algorithm">
     174    <associationConnector edgePoints="[(2.5 : 1.69399251302083); (2.875 : 2.06899251302083); (2.875 : 4.12102376302084); (3.75 : 4.12102376302084)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    175175      <AssociationMoniker Name="/ClientManagementDataContext/ClientType/ClientType_Client" />
    176176      <nodes>
     
    179179      </nodes>
    180180    </associationConnector>
    181     <associationConnector edgePoints="[(2.5 : 2.72199625651042); (2.79166666666667 : 2.72199625651042 : JumpStart); (2.95833333333333 : 2.72199625651042 : JumpEnd); (3.75 : 2.72199625651042)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     181    <associationConnector edgePoints="[(2.5 : 2.72199625651042); (3.75 : 2.72199625651042)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    182182      <AssociationMoniker Name="/ClientManagementDataContext/OperatingSystem/OperatingSystem_Client" />
    183183      <nodes>
     
    186186      </nodes>
    187187    </associationConnector>
    188     <associationConnector edgePoints="[(2.5 : 3.49801188151042); (2.79166666666667 : 3.49801188151042 : JumpStart); (2.95833333333333 : 3.49801188151042 : JumpEnd); (3.75 : 3.49801188151042)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     188    <associationConnector edgePoints="[(2.5 : 3.49801188151042); (3.75 : 3.49801188151042)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    189189      <AssociationMoniker Name="/ClientManagementDataContext/Country/Country_Client" />
    190190      <nodes>
     
    193193      </nodes>
    194194    </associationConnector>
    195     <associationConnector edgePoints="[(2.5 : 4.74120198567708); (3.75 : 4.74120198567708)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     195    <associationConnector edgePoints="[(2.5 : 4.74120198567708); (3.75 : 4.74120198567708)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    196196      <AssociationMoniker Name="/ClientManagementDataContext/ClientConfiguration/ClientConfiguration_Client" />
    197197      <nodes>
  • branches/ClientUserManagement/HeuristicLab.Services.Access.DataAccess/3.3/ClientManagement.designer.cs

    r7534 r7536  
    244244    }
    245245   
    246     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     246    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
    247247    public System.Guid Id
    248248    {
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs

    r7436 r7536  
    6464                    where c.Id == id
    6565                    select c;
    66 
    67         return Convert.ToDto(query.FirstOrDefault());
     66        if (query.Count() > 0) {
     67          return Convert.ToDto(query.FirstOrDefault());
     68        } else {
     69          return null;
     70        }
    6871      }
    6972    }
     
    8689    }
    8790
    88     public Guid AddClient(DT.Client client) {
     91    public void AddClient(DT.Client client) {
    8992      string country = string.Empty;
    9093
     
    105108                      where c.Name == country
    106109                      select c;
    107 
    108110          if (query.Count() > 0) {
    109111            entity.CountryId = query.First().Id;
     
    111113        }
    112114
     115        if (entity.OperatingSystem != null) {
     116          string osversion = entity.OperatingSystem.Name;
     117          var query = from os in context.GetTable<DA.OperatingSystem>()
     118                      where os.Name == osversion
     119                      select os;
     120          if (query.Count() > 0) {
     121            entity.OperatingSystem = query.First();
     122          }
     123        }
     124
     125        if (entity.ClientType != null) {
     126          string cType = entity.ClientType.Name;
     127          var query = from t in context.GetTable<DA.ClientType>()
     128                      where t.Name == cType
     129                      select t;
     130          if (query.Count() > 0) {
     131            entity.ClientType = query.First();
     132          }
     133        }
     134
    113135        context.Resources.InsertOnSubmit(entity);
    114136        context.SubmitChanges();
    115         return entity.Id;
    116137      }
    117138    }
     
    162183    public Guid AddClientGroup(DT.ClientGroup group) {
    163184      using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) {
     185        if (group.Id == Guid.Empty)
     186          group.Id = Guid.NewGuid();
     187
    164188        var entity = Convert.ToEntity(group);
    165189        context.Resources.InsertOnSubmit(entity);
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/IAccessService.cs

    r7436 r7536  
    4444
    4545    [OperationContract]
    46     Guid AddClient(Client client);
     46    void AddClient(Client client);
    4747
    4848    [OperationContract]
Note: See TracChangeset for help on using the changeset viewer.