/* * NAME * * Analytics_Form::Analytics_Form - Form Constructor * * DESCRIPTION * * This function initializes the Analytics_Form. * It also instantiates the elements of the form - the * bar graph, line graph, and level average. */ public Analytics_Form() { InitializeComponent(); students = Database_Interface.Query_All_Students(); Instantiate_Bar_Graph(); Instantiate_Avg_Textbox(); Instantiate_Names_Combobox(); }
/* * NAME * * Class_Form::Populate_Data_Grid_View - loads data into the data grid view. * * DESCRIPTION * * This function gets the student data from the database and loads it into the data grid view object. */ private void Populate_Data_Grid_View() { //Get list of all students List <Student> all_students = Database_Interface.Query_All_Students(); int num_students = Database_Interface.Query_Num_Students(); //Add each student to student panel for (int i = 0; i < num_students; i++) { string[] student = all_students.ElementAt(i).ToArray(); StudentPanel.Rows.Add(student); } }
/* * NAME * * Help_Reader_Form::Populate_Combobox - event that populates the combobox with student names. * * DESCRIPTION * * This function loads all student names from the database into the combobox in a "First Last" format. * */ private void Populate_Combobox() { students = Database_Interface.Query_All_Students(); //Query db for all students foreach (Student s in students) { Student_List.Items.Add(s.FirstName + " " + s.LastName); //Add names to combobox } for (char c = 'A'; c <= 'Z'; c++) { Level.Items.Add(c); } }
/* * NAME * * Class_Form::Export_All_Click - sends all students to IO class to be exported. * * SYNOPSIS * * void Export_All_Click(object sender, EventArgs e); * * sender --> the object sending the event. * e --> the event arguments. * * DESCRIPTION * * This function takes all the student data and sends it to the IO class * to be exported separately. It also informs the user where the files will be saved. */ private void Export_All_Click(object sender, EventArgs e) { IO.Students_To_File(Database_Interface.Query_All_Students()); MessageBox.Show("Exports saved in HomeroomHelper directory"); }