private void MunisSearchButton_Click(object sender, EventArgs e) { MunisUser = MunisFunctions.MunisUserSearch(this); if (!string.IsNullOrEmpty(MunisUser.Number)) { CurrentUserTextBox.Text = MunisUser.Name; CurrentUserTextBox.ReadOnly = true; } }
public async void StartSearch() { try { // Prompt user for supervisor. var supervisorMunis = MunisFunctions.MunisUserSearch(this); // Make sure we have an employee number to work with. if (string.IsNullOrEmpty(supervisorMunis.Number)) { return; } var supervisorThis = new Employee(supervisorMunis.Name, supervisorMunis.Number); currentSupervisor = supervisorThis; // Setup form and display working spinner. this.Text += " for " + supervisorThis.Name; this.Show(); workingSpinner.Visible = true; // Populate the employee list. employeeList = await GetEmployeeList(); // Make sure the form hasn't been disposed. if (!this.IsDisposed) { // Build employee hierarchy tree. var empTree = GetSubordinates(supervisorThis); currentTree = empTree; // Build node tree from the employee tree. var nodeTree = new TreeNode(empTree.Employee.Name); nodeTree.Tag = empTree.Employee.Number; BuildTree(empTree, nodeTree); // Set the tree view control to the node tree. HierarchyTree.Nodes.Add(nodeTree); HierarchyTree.Nodes[0].Expand(); // Report completion. statusLabel.Text = employeesFound + " employees found."; } } catch (Exception ex) { ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod()); } finally { // Stop the spinner and remove the big employee list from scope. workingSpinner.Visible = false; employeeList?.Clear(); employeeList = null; } }
private void MunisSearchButton_Click(object sender, EventArgs e) { MunisUser = MunisFunctions.MunisUserSearch(this); }