- Timestamp:
- 03/20/09 13:37:39 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Console/HiveServerManagementConsole.cs
r1267 r1377 44 44 private ResponseList<ClientInfo> clientInfo = null; 45 45 private ResponseList<Job> jobs = null; 46 private ResponseList<UserGroup> userGroups = null;47 private ResponseList<User> usersList = null;48 46 49 47 private Dictionary<long, ListViewGroup> clientObjects; … … 55 53 private Job currentJob = null; 56 54 private ClientInfo currentClient = null; 57 private User currentUser = null;58 55 private string nameCurrentJob = ""; 59 56 private string nameCurrentClient = ""; … … 70 67 AddClients(); 71 68 AddJobs(); 72 AddUsers();73 69 timerSyncronize.Start(); 74 70 } … … 182 178 183 179 /// <summary> 184 /// Adds users to ListView and TreeView185 /// </summary>186 private void AddUsers() {187 try {188 userGroupsObjects = new Dictionary<long, ListViewGroup>();189 userListObjects = new Dictionary<long, ListViewItem>();190 IUserRoleManager userRoleManager =191 ServiceLocator.GetUserRoleManager();192 193 userGroups = userRoleManager.GetAllUserGroups();194 195 lvUserControl.Items.Clear();196 tvUserControl.Nodes.Clear();197 198 foreach (UserGroup ug in userGroups.List) {199 tvUserControl.Nodes.Add(ug.Name);200 ListViewGroup lvg = new ListViewGroup(ug.Name, HorizontalAlignment.Left);201 202 foreach (PermissionOwner permOwner in ug.Members) {203 if (permOwner is User) {204 User users = permOwner as User;205 tvUserControl.Nodes[tvUserControl.Nodes.Count - 1].Nodes.Add(users.Name);206 ListViewItem item = new ListViewItem(users.Name, 0, lvg);207 lvUserControl.Items.Add(item);208 userListObjects.Add(users.Id, item);209 }210 }211 lvUserControl.Groups.Add(lvg);212 userGroupsObjects.Add(ug.Id, lvg);213 214 } // Users215 usersList = userRoleManager.GetAllUsers();216 ListViewGroup lvunsorted = new ListViewGroup("unsorted", HorizontalAlignment.Left);217 foreach (User u in usersList.List) {218 tvUserControl.Nodes.Add(u.Name);219 lvUserControl.Items.Add(new ListViewItem(u.Name, 0, lvunsorted));220 }221 lvUserControl.Groups.Add(lvunsorted);222 if (flagUser) {223 UserClicked();224 }225 }226 catch (Exception ex) {227 closeFormEvent(true, true);228 this.Close();229 }230 }231 232 /// <summary>233 180 /// if one client is clicked, a panel is opened with the details 234 181 /// </summary> … … 320 267 } 321 268 322 /// <summary>323 /// if one user is clicked, a panel is opened with the details324 /// </summary>325 private void UserClicked() {326 int i = 0;327 while (usersList.List[i].Name != nameCurrentUser) {328 i++;329 }330 currentUser = usersList.List[i];331 scUserControl.Panel2.Controls.Clear();332 scUserControl.Panel2.Controls.Add(plUserDetails);333 pbUserControl.Image = ilUserControl.Images[0];334 lblUserName.Text = currentUser.Id.ToString();335 }336 337 269 #region Eventhandlers 338 270 /// <summary> … … 368 300 AddClients(); 369 301 AddJobs(); 370 AddUsers();371 }372 373 private void AddUser_Click(object sender, EventArgs e) {374 AddUserForm newForm = new AddUserForm("User", false);375 newForm.Show();376 newForm.addUserEvent += new addDelegate(Refresh);377 }378 379 private void AddUserGroup_Click(object sender, EventArgs e) {380 AddUserForm newForm = new AddUserForm("User", true);381 newForm.Show();382 newForm.addUserEvent += new addDelegate(Refresh);383 302 } 384 303 … … 419 338 420 339 } 421 422 private void OnLVUserControlClicked(object sender, EventArgs e) {423 nameCurrentUser = lvUserControl.SelectedItems[0].Text;424 flagUser = true;425 UserClicked();426 }427 428 private void OnTVUserControlClicked(object sender, TreeViewEventArgs e) {429 bool usergroup = false;430 foreach (UserGroup ug in userGroups.List) {431 if (tvUserControl.SelectedNode.Text == ug.Name) {432 usergroup = true;433 }434 }435 if (usergroup == false) {436 nameCurrentUser = tvUserControl.SelectedNode.Text;437 flagUser = true;438 UserClicked();439 }440 441 }442 443 340 444 341 private void btnClientClose_Click(object sender, EventArgs e) {
Note: See TracChangeset
for help on using the changeset viewer.