Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/20/09 13:37:39 (16 years ago)
Author:
svonolfe
Message:

Created Heuristiclab DB Core (refactoring) #527

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.Console/HiveServerManagementConsole.cs

    r1267 r1377  
    4444    private ResponseList<ClientInfo> clientInfo = null;
    4545    private ResponseList<Job> jobs = null;
    46     private ResponseList<UserGroup> userGroups = null;
    47     private ResponseList<User> usersList = null;
    4846
    4947    private Dictionary<long, ListViewGroup> clientObjects;
     
    5553    private Job currentJob = null;
    5654    private ClientInfo currentClient = null;
    57     private User currentUser = null;
    5855    private string nameCurrentJob = "";
    5956    private string nameCurrentClient = "";
     
    7067      AddClients();
    7168      AddJobs();
    72       AddUsers();
    7369      timerSyncronize.Start();
    7470    }
     
    182178
    183179    /// <summary>
    184     /// Adds users to ListView and TreeView
    185     /// </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         } // Users
    215         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>
    233180    /// if one client is clicked, a panel is opened with the details
    234181    /// </summary>
     
    320267    }
    321268
    322     /// <summary>
    323     /// if one user is clicked, a panel is opened with the details
    324     /// </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 
    337269    #region Eventhandlers
    338270    /// <summary>
     
    368300      AddClients();
    369301      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);                                             
    383302    }
    384303
     
    419338
    420339    }
    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 
    443340
    444341    private void btnClientClose_Click(object sender, EventArgs e) {
Note: See TracChangeset for help on using the changeset viewer.