Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 995 was 995, checked in by svonolfe, 16 years ago

Refactored DAL, Improved Caching (#372)

File size: 4.3 KB
RevLine 
[794]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;
[831]30using HeuristicLab.Hive.Contracts.Interfaces;
31using HeuristicLab.Hive.Contracts.BusinessObjects;
[904]32using HeuristicLab.Hive.Contracts;
[794]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
[904]42    ResponseList<ClientGroup> clients = null;
43    ResponseList<Job> jobs = null;
44    ResponseList<UserGroup> userGroups = null;
[844]45
[794]46    public HiveServerManagementConsole() {
47      InitializeComponent();
[844]48      addItems();
49    }
[831]50
[844]51    private void addItems() {
[831]52      IClientManager clientManager =
[956]53        ServiceLocator.GetClientManager();
[831]54
55      IJobManager jobManager =
56        ServiceLocator.GetJobManager();
57
58      IUserRoleManager userRoleManager =
59        ServiceLocator.GetUserRoleManager();
60
[956]61
[844]62      clients = clientManager.GetAllClientGroups();
[831]63      jobs = jobManager.GetAllJobs();
[978]64
[831]65      userGroups = userRoleManager.GetAllUserGroups();
[956]66
[844]67      lvClientControl.Items.Clear();
68      int count = 0;
[904]69      foreach (ClientGroup cg in clients.List) {
[844]70        tvClientControl.Nodes.Add(cg.Name);
71        ListViewGroup lvg = new ListViewGroup(cg.Name, HorizontalAlignment.Left);
[904]72        foreach (ClientInfo ci in clientManager.GetAllClients().List) {
[844]73          tvClientControl.Nodes[tvClientControl.Nodes.Count - 1].Nodes.Add(ci.Name);
[904]74          lvClientControl.Items.Add(new ListViewItem(ci.Name, count, lvg));
[844]75          count = (count + 1) % 3;
[831]76        }
[904]77        lvClientControl.Groups.Add(lvg);
[978]78      } // Groups
[956]79
80
[904]81      foreach (Job job in jobs.List) {
[995]82        tvJobControl.Nodes.Add(job.Id.ToString());
[978]83      } // Jobs
84
[904]85      foreach (UserGroup ug in userGroups.List) {
[956]86        tvUserControl.Nodes.Add(ug.Name);
87        ListViewGroup lvg = new ListViewGroup(ug.Name, HorizontalAlignment.Left);
88
89        foreach (User users in ug.Members) {
90          tvUserControl.Nodes[tvUserControl.Nodes.Count - 1].Nodes.Add(users.Name);
91          lvUserControl.Items.Add(new ListViewItem(users.Name, count, lvg));
92        }
93        lvUserControl.Groups.Add(lvg);
[978]94      } // Users
[794]95    }
96
97    /// <summary>
98    /// Send event to Login-GUI when closing
99    /// </summary>
100    /// <param name="sender"></param>
101    /// <param name="e"></param>
102    private void close_Click(object sender, EventArgs e) {
103      if (closeFormEvent != null) {
104        closeFormEvent(true);
105      }
106      this.Close();
107    }
108
109    /// <summary>
110    /// Send evnt to Login-GUI when closing
111    /// </summary>
112    /// <param name="sender"></param>
113    /// <param name="e"></param>
114    private void HiveServerConsoleInformation_FormClosing(object sender, FormClosingEventArgs e) {
115      if (closeFormEvent != null) {
116        closeFormEvent(true);
117      }
118
119    }
[956]120
121    private void jobToolStripMenuItem1_Click(object sender, EventArgs e) {
122      AddNewForm newForm = new AddNewForm("Job", false);
123      newForm.Show();
124    }
125
[978]126    private void userToolStripMenuItem1_Click(object sender, EventArgs e) {
127      AddNewForm newForm = new AddNewForm("User", false);
128      newForm.Show();
129    }
130
131    private void groupToolStripMenuItem2_Click(object sender, EventArgs e) {
132      AddNewForm newForm = new AddNewForm("User", true);
133      newForm.Show();
134
135    }
136
[794]137  }
[844]138}
Note: See TracBrowser for help on using the repository browser.