} // Continue Button Action private void ComboBox_Loaded(object sender, RoutedEventArgs e) { //Create List of departments to show in department ComboBox List <String> Departments = new List <string> { "Select Department" }; //Add AD Departments to list ADInterface SearchInterface = new ADInterface(); //create required list to eliminate forbidden OU's from user shown list List <string> BadOUs = new List <string> { "Temp", "Test OU", "TST - Test Computers", "Sitecode Change", "Staff Exceptions" }; Departments = SearchInterface.GetOrgUnits("LDAP://OU=Employee Computers, OU=Marylhurst Computers, DC=campus, DC=marylhurst, DC=edu", BadOUs); //make list alphabetical Departments.Sort(); //Add inital prefix item for list display Departments.Insert(0, "Select Department"); //Update box Items with new departments list var this_box = sender as ComboBox; this_box.ItemsSource = Departments; this_box.SelectedIndex = 0; } // Department Box Loading Actions
} // Cancel Button Action private void Continue(object sender, RoutedEventArgs e) { Validate_And_SetErrorBorders(); if ((_errors > 0) || _ROOMerrors) { MessageBox.Show("Error: Please resolve the above problems before continuing.", "ERROR"); } else { //move the computer in AD and update the machine description per the user defined department information ADInterface MoveInterface = new ADInterface(); MoveInterface.MoveOrgUnit(Department_Box.Text, "LDAP://OU=Employee Computers, OU=Marylhurst Computers, DC=campus, DC=marylhurst, DC=edu"); //Departnment_Box.Text is refering to the content on the form labled department box, this works because the user control is named. MoveInterface.UpdateDescription(Building_Box.Text, Room_Box.Text, Computer_Type.Text); LocalSystemInterface localSystemInterface = new LocalSystemInterface(); localSystemInterface.UpdatePolicy(); MessageBox.Show("Computer policy configuration and invetory compleate. \n Please enjoy your new computer", "SUCCESS"); System.Windows.Application.Current.Shutdown(); } } // Continue Button Action