private void comboBox_Department_SelectedIndexChanged(object sender, EventArgs e) { //filter courses by department dataGridView_courses.Rows.Clear(); List <string> row = new List <string>(8); int i = 0, countRows = 0; List <string> courseList = SQLFunctions.findCoursePropertiesByDepartment(comboBox_Department.Text); countRows = courseList.Count / 8; for (i = 0; i < courseList.Count; i += 9) { dataGridView_courses.Rows.Add(courseList[i], courseList[i + 1], courseList[i + 2], courseList[i + 3], courseList[i + 4], courseList[i + 5], courseList[i + 6], (int)Convert.ToDouble(courseList[i + 7]) / 1, Convert.ToString((Convert.ToDouble(courseList[i + 7]) % 1) * 10)); } }
private void comboBox_Department_SelectedIndexChanged(object sender, EventArgs e) { //filter courses by department dataGridView_courses.Rows.Clear(); List <string> row = new List <string>(8); int i = 0; DataTable courseList_dt = SQLFunctions.findCoursePropertiesByDepartment(comboBox_Department.Text); if (courseList_dt != null) { for (i = 0; i < courseList_dt.Rows.Count; i++) { dataGridView_courses.Rows.Add(courseList_dt.Rows[i]["Name"].ToString(), Convert.ToInt32(courseList_dt.Rows[i]["ID"]), (courseList_dt.Rows[i]["PreReqID"]).ToString(), Convert.ToInt32(courseList_dt.Rows[i]["Credits"]), Convert.ToInt32(courseList_dt.Rows[i]["LectureHour"]), Convert.ToInt32(courseList_dt.Rows[i]["PracticeHour"]), Convert.ToInt32(courseList_dt.Rows[i]["ReceptionHour"]), Convert.ToInt32(courseList_dt.Rows[i]["Year"]), Convert.ToChar(courseList_dt.Rows[i]["Semester"])); } } }
public FormSecretary_AddOrRemoveLecture(int _id, string _password) { InitializeComponent(); comboBox_year.Items.Add(DateTime.Today.Year); comboBox_year.Items.Add(DateTime.Today.Year + 1); string department; DataTable coursesProperties = new DataTable(); List <int> coursesID = new List <int>(); List <int> lecturesID = new List <int>(); id = _id; password = _password; department = SQLFunctions.getUsersDepartment(id); DataTable LecturesByDepartment = SQLFunctions.getLecturesByDepartment(department); coursesProperties = SQLFunctions.findCoursePropertiesByDepartment(department); for (int i = 0; i < coursesProperties.Rows.Count; i++) { coursesID.Add(Convert.ToInt32(coursesProperties.Rows[i]["ID"])); } if (LecturesByDepartment.Rows != null) { for (int j = 0; j < LecturesByDepartment.Rows.Count; j++) { lectureIDS.Add(Convert.ToInt32(LecturesByDepartment.Rows[j]["LectureID"].ToString())); comboBox_Lectures.Items.Add(LecturesByDepartment.Rows[j]["Name"].ToString() + " " + LecturesByDepartment.Rows[j]["LectureID"].ToString()); } } this.AcceptButton = button_accept; textBox_StartTime.MaxLength = 2; textBox_EndTime.MaxLength = 2; textBox_day.MaxLength = 2; textBox_month.MaxLength = 2; textBox_title.MaxLength = 48; comboBox_day.DropDownStyle = ComboBoxStyle.DropDownList; comboBox_month.DropDownStyle = ComboBoxStyle.DropDownList; comboBox_year.DropDownStyle = ComboBoxStyle.DropDownList; comboBox_AddRemove.DropDownStyle = ComboBoxStyle.DropDownList; comboBox_Lectures.DropDownStyle = ComboBoxStyle.DropDownList; }
public FormSecretary_AddOrRemoveLecture(int _id, string _password) { InitializeComponent(); string department; List <string> coursesProperties = new List <string>(); List <int> coursesID = new List <int>(); List <int> lecturesID = new List <int>(); id = _id; password = _password; department = SQLFunctions.getUsersDepartment(id); coursesProperties = SQLFunctions.findCoursePropertiesByDepartment(department); for (int i = 1; i < coursesProperties.Count; i += 9) { coursesID.Add(Convert.ToInt32(coursesProperties[i])); } for (int i = 0; i < coursesID.Count; i++) { lecturesID = SQLFunctions.findLecturesIDsForCourse(coursesID[i]); for (int j = 0; j < lecturesID.Count; j++) { lectureIDS.Add(lecturesID[j]); comboBox_Lectures.Items.Add(SQLFunctions.covertLectureIDtoLectureName(lecturesID[j]) + " " + lecturesID[j]); } } comboBox_Lectures.Items.Add("All"); this.AcceptButton = button_accept; textBox_StartTime.MaxLength = 2; textBox_EndTime.MaxLength = 2; textBox_day.MaxLength = 2; textBox_month.MaxLength = 2; textBox_year.MaxLength = 2; comboBox_AddRemove.DropDownStyle = ComboBoxStyle.DropDownList; comboBox_Lectures.DropDownStyle = ComboBoxStyle.DropDownList; }