private void Courses_Box_SelectedIndexChanged(object sender, EventArgs e) { Courses_Lable.Show(); //Filling the ****LECTURE BOX***** int curItem = Convert.ToInt32(Courses_Box.SelectedItem.ToString().Substring(0, Courses_Box.SelectedItem.ToString().IndexOf('-'))); //if course is pre condition check_pre_courses(curItem); //MessageBox.Show(curItem.ToString()); //Uplode data add_course.SetCourseID(curItem); int CourseToRemove = curItem; Lectures_Box.Items.Clear(); string course_name = ""; for (int i = 0; i < Courses_ID_Name.Count; i++) { if (curItem == Courses_ID_Name[i].GetCourseID()) { course_name = Courses_ID_Name[i].getCourseName(); } } //Uplode data add_course.setCourseName(course_name); string LecID; string Query = "select * from schedualing where courseName = '" + course_name + "' and lecturer IS NOT NULL"; SqlConnection conDatabase = new SqlConnection(Connecting_String); SqlCommand cmdDatabase = new SqlCommand(Query, conDatabase); SqlDataReader myReader; try { conDatabase.Open(); myReader = cmdDatabase.ExecuteReader(); while (myReader.Read()) { LecID = Convert.ToString(myReader.GetInt32(7)) + "-" + Convert.ToString(myReader.GetInt32(8) + "Day." + Convert.ToString(myReader["day"].ToString())); //MessageBox.Show(Convert.ToString(myReader.GetString(4))); if (!overlap_hours_Lec(sd.getID(), Convert.ToInt32(myReader.GetInt32(7)), Convert.ToInt32(myReader.GetInt32(8)), Convert.ToString(myReader.GetString(4)))) { Lectures_Box.Items.Add(LecID); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } Lectures_Box.Show(); }
public void POPUP_Messege() { // Put Out Messege that there are more courses or no more courses - need to be fixed!!!!! string display_placement = ""; regiCourses.Add(add_course); regicourseint.Add(add_course.GetCourseID()); for (int i = 0; i < regiCourses.Count; i++) { display_placement = Convert.ToString(regiCourses[i].GetCourseID()) + "\n " + "Course Name: " + Convert.ToString(regiCourses[i].getCourseName()) + "\n " + "Lecture: " + Convert.ToString(regiCourses[i].GetLecBegin()) + " - " + Convert.ToString(regiCourses[i].GetLecEnd()) + "\n " + Convert.ToString(regiCourses[i].GetLectureDay()) + "\n " + "Practice:" + Convert.ToString(regiCourses[i].GetPracticeBegin()) + " - " + Convert.ToString(regiCourses[i].GetPracticeEnd()) + "\n " + Convert.ToString(regiCourses[i].GetPracticeDay()) + "\n " + "Lab: " + Convert.ToString(regiCourses[i].GetLabBegin()) + " - " + Convert.ToString(regiCourses[i].GetLabEnd()) + "\n " + Convert.ToString(regiCourses[i].GetLabDay()) + "\n " + "Placement Succesfull"; /* * display_placement = Convert.ToString(regiCourses[i].GetCourseID()) + "\n" + * "Course Name: " + * Convert.ToString(regiCourses[i].getCourseName()) + "\n" + * "Lecture: " + * Convert.ToString(regiCourses[i].GetLecBegin()) + " - " + * Convert.ToString(regiCourses[i].GetLecEnd()) + "\n" + * "Practice:"+ * Convert.ToString(regiCourses[i].GetPracticeBegin()) + " - " + * Convert.ToString(regiCourses[i].GetPracticeEnd()) + "\n" + * "Lab: "+ * Convert.ToString(regiCourses[i].GetLabBegin()) + " - " + * Convert.ToString(regiCourses[i].GetLabEnd()) + "\n" + "Placement Succesfull"; */ MessageBox.Show(display_placement); //Regi_Courses.Items.Add(display_placement); } Lectures_Box.Hide(); Practices_Box.Hide(); Labs_Box.Hide(); Courses_Box.Hide(); Courses_Box.Items.Clear(); start(); }
public void start() { int i; add_course = new Course(); Fill_Courses_Box(); for (i = 0; i < courses.Count; i++) { Courses_Name_ID(courses[i]); } for (i = 0; i < Courses_ID_Name.Count; i++) { display += Convert.ToString(Courses_ID_Name[i].GetCourseID()) + " " + Courses_ID_Name[i].getCourseName() + "\n"; } button1.Hide(); Courses_Box.Show(); Lectures_Box.Hide(); Practices_Box.Hide(); Labs_Box.Hide(); }