Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Hive.Server.Console/HiveServerManagementConsole.cs @ 929

Last change on this file since 929 was 929, checked in by msteinbi, 15 years ago

Implementation of UserRoleManager (#417)

File size: 3.5 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.ComponentModel;
25using System.Data;
26using System.Drawing;
27using System.Linq;
28using System.Text;
29using System.Windows.Forms;
30using HeuristicLab.Hive.Contracts.Interfaces;
31using HeuristicLab.Hive.Contracts.BusinessObjects;
32using HeuristicLab.Hive.Contracts;
33
34namespace HeuristicLab.Hive.Server.Console {
35
36  public delegate void closeForm(bool cf);
37
38  public partial class HiveServerManagementConsole : Form {
39
40    public event closeForm closeFormEvent;
41
42    ResponseList<ClientGroup> clients = null;
43    ResponseList<Job> jobs = null;
44    ResponseList<UserGroup> userGroups = null;
45
46    public HiveServerManagementConsole() {
47      InitializeComponent();
48      addItems();
49    }
50
51    private void addItems() {
52      IClientManager clientManager =
53          ServiceLocator.GetClientManager();
54
55      IJobManager jobManager =
56        ServiceLocator.GetJobManager();
57
58      IUserRoleManager userRoleManager =
59        ServiceLocator.GetUserRoleManager();
60
61      clientManager.GetAllUpTimeStatistics();
62      clients = clientManager.GetAllClientGroups();
63      jobs = jobManager.GetAllJobs();
64      userGroups = userRoleManager.GetAllUserGroups();
65      lvClientControl.Items.Clear();
66      int count = 0;
67      foreach (ClientGroup cg in clients.List) {
68        tvClientControl.Nodes.Add(cg.Name);
69        ListViewGroup lvg = new ListViewGroup(cg.Name, HorizontalAlignment.Left);
70        foreach (ClientInfo ci in clientManager.GetAllClients().List) {
71          tvClientControl.Nodes[tvClientControl.Nodes.Count - 1].Nodes.Add(ci.Name);
72          lvClientControl.Items.Add(new ListViewItem(ci.Name, count, lvg));
73          count = (count + 1) % 3;
74        }
75        lvClientControl.Groups.Add(lvg);
76      }
77      foreach (Job job in jobs.List) {
78        tvJobControl.Nodes.Add(job.JobId.ToString());
79      }
80      foreach (UserGroup ug in userGroups.List) {
81        tvUserControl.Nodes.Add(ug.PermissionOwnerId.ToString());
82      }
83    }
84
85    /// <summary>
86    /// Send event to Login-GUI when closing
87    /// </summary>
88    /// <param name="sender"></param>
89    /// <param name="e"></param>
90    private void close_Click(object sender, EventArgs e) {
91      if (closeFormEvent != null) {
92        closeFormEvent(true);
93      }
94      this.Close();
95    }
96
97    /// <summary>
98    /// Send evnt to Login-GUI when closing
99    /// </summary>
100    /// <param name="sender"></param>
101    /// <param name="e"></param>
102    private void HiveServerConsoleInformation_FormClosing(object sender, FormClosingEventArgs e) {
103      if (closeFormEvent != null) {
104        closeFormEvent(true);
105      }
106
107    }
108  }
109}
Note: See TracBrowser for help on using the repository browser.