private void Reload() { gradeAppeal = false; waitingForGrade = false; comboBox_IDs.Items.Clear(); comboBox_IDs.SelectedIndex = -1; textBox_Grade.Clear(); label_course.Hide(); label_grade.Hide(); comboBox_course.Items.Clear(); comboBox_course.Hide(); textBox_request.Hide(); textBox_Grade.Hide(); button_confirm.Hide(); checkBox_approve.Hide(); checkBox_notApprove.Hide(); dataGridView1.Rows.Clear(); dataGridView1.Refresh(); DbContextDal dal = new DbContextDal(); List <Student> students = students = dal.students.ToList(); foreach (Student item in students) { comboBox_IDs.Items.Add(item.ID); } }
private void comboBox_course_SelectedIndexChanged(object sender, EventArgs e) { DbContextDal dal = new DbContextDal(); String choosenCourseName = comboBox_course.SelectedItem.ToString(); currentCourse = dal.courses.Where(x => x.Name == choosenCourseName).FirstOrDefault(); }
private void UpdateStudentInfo_Load(object sender, EventArgs e) { foreach (var c in panel1.Controls) { if (c is TextBox) { ((TextBox)c).Clear(); ((TextBox)c).Hide(); } } button_reset.Hide(); DbContextDal dal = new DbContextDal(); var IDs = dal.students.Select(x => x.ID).ToList(); foreach (var ID in IDs) { comboBox_IDs.Items.Add(ID); } foreach (var c in panel1.Controls) { if (c is TextBox) { ((TextBox)c).Show(); } } button_reset.Show(); }
private void button_add_Click(object sender, EventArgs e) { DbContextDal dal = new DbContextDal(); if (currentLesson.Type == "Lecture") { StudentsRegisterToLessonLectures temp = dal.studentRegisterdLessonLectures.Where(x => x.StudentId == student.ID && x.CourseID == currentCourse.ID).FirstOrDefault(); if (temp != null) { SettingDatabase.removeLessonFromStudent(student, temp.lecture); } } if (currentLesson.Type == "Lab") { StudentsRegisterToLessonLabs temp = dal.studentRegisterdLessonLabs.Where(x => x.StudentId == student.ID && x.CourseID == currentCourse.ID).FirstOrDefault(); if (temp != null) { SettingDatabase.removeLessonFromStudent(student, temp.lab); } } if (currentLesson.Type == "Practise") { StudentsRegisterToLessonPractises temp = dal.studentRegisterdLessonPractises.Where(x => x.StudentId == student.ID && x.CourseID == currentCourse.ID).FirstOrDefault(); if (temp != null) { SettingDatabase.removeLessonFromStudent(student, temp.Practise); } } SettingDatabase.registerStudentToLesson(student, currentLesson, currentLesson.Type); Reload(); }
private void comboBox_IDs_SelectedIndexChanged(object sender, EventArgs e) { DbContextDal dal = new DbContextDal(); int ChossenID = int.Parse(comboBox_IDs.SelectedItem.ToString()); currentStudent = dal.students.Where(x => x.ID == ChossenID).FirstOrDefault(); currentStudent.user = dal.users.Where(x => x.ID == ChossenID).FirstOrDefault(); addDetails(); }
private void comboBox_ID_SelectedIndexChanged(object sender, EventArgs e) { label_details.Show(); DbContextDal dal = new DbContextDal(); int ChossenID = int.Parse(comboBox_ID.SelectedItem.ToString()); currentStudent = dal.students.Where(x => x.ID == ChossenID).FirstOrDefault(); textBox_details.Text = "Name: " + currentStudent.Name + " ID: " + currentStudent.ID + "\nStudy year: " + currentStudent.Study_year + " Study semester" + currentStudent.Study_semester; textBox_details.Show(); }
private void RemoveStudentCourse_Load(object sender, EventArgs e) { DbContextDal dal = new DbContextDal(); List <Student> students = students = dal.students.ToList(); foreach (Student item in students) { comboBox_ID.Items.Add(item.ID); } }
private void AddStudentCourse_Load(object sender, EventArgs e) { DbContextDal dal = new DbContextDal(); var IDs = dal.students.Select(x => x.ID).ToList(); foreach (var ID in IDs) { comboBox_IDs.Items.Add(ID); } }
private void viewMessages_Load(object sender, EventArgs e) { DbContextDal dal = new DbContextDal(); List <CollectiveMessage> messages = dal.CollectiveMessages.ToList(); foreach (CollectiveMessage item in messages) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dataGridView1); // this line was missing row.Cells[0].Value = item.senderName; row.Cells[1].Value = item.title; row.Cells[2].Value = item.text; dataGridView1.Rows.Add(row); } }
private void comboBox_course_SelectedIndexChanged(object sender, EventArgs e) { DbContextDal dal = new DbContextDal(); currentCourse = courses[comboBox_course.SelectedIndex]; label_grade.Show(); if (currentCourse.Grade != -1) { textBox_grade.Text = currentCourse.Grade.ToString(); } else { textBox_grade.Clear(); } textBox_grade.Show(); }
private void Reload() { comboBox_pickCourse.Items.Clear(); foreach (Control c in Schedule.Controls) { if (c is RichTextBox) { ((RichTextBox)c).Clear(); } } DbContextDal dal = new DbContextDal(); student = dal.students.Where(x => x.ID == student.ID).FirstOrDefault(); lessons = new List <Lesson>(); enrollments = student.Enrollments.ToList(); lessons = SettingDatabase.StudentGetAllMyLesson(student); courses = SettingDatabase.GetAllLearnedCoursesOfStudent(student); lessons = lessons.OrderBy(x => x.Start).ToList(); foreach (Lesson item in lessons) { int i = 1; Days day = (Days)Enum.Parse(typeof(Days), item.Day); int j = (int)day; try { var c = this.Schedule.GetControlFromPosition(j, i); while (!(String.IsNullOrEmpty(c.Text))) { i++; c = ((RichTextBox)Schedule.GetControlFromPosition(j, i)); } Course course = SettingDatabase.getCourseByID(item.LCourseID); c.Text = course.Name + " - " + item.Type + "\n" + item.Start + ":00-" + item.End + ":00 class:" + item.building + item.number + "\n" + getTeacherName(item); } catch (NullReferenceException ex) { MessageBox.Show(ex.Message); } } foreach (Course item in courses) { comboBox_pickCourse.Items.Add(item.Name); } }
private void Reload() { comboBox_IDs.Items.Clear(); label_course.Hide(); label_grade.Hide(); comboBox_course.Hide(); textBox_grade.Hide(); button_confirm.Hide(); dataGridView1.Rows.Clear(); dataGridView1.Refresh(); DbContextDal dal = new DbContextDal(); List <Student> students = students = dal.students.ToList(); foreach (Student item in students) { comboBox_IDs.Items.Add(item.ID); } }
private void showStudyPermit() { DbContextDal dal = new DbContextDal(); StudentStudyForm SF = dal.StudentsStudyForms.Where(x => x.ID == student.ID).FirstOrDefault(); if (SF != null) { textBox_DateCreated.AppendText(SF.FormCreateDate.Date.ToShortDateString()); textBox_name.AppendText("Name: " + student.Name); textBox_ID.AppendText("ID: " + student.ID); textBox_formType.AppendText("Study fee permit"); richTextBox_formText.AppendText("I hereby confirm that " + student.Name + ",student ID " + student.ID + "\nstudies at our institution during the school year " + SF.ValidationDate.Year + " in semester " + student.Study_semester); textBox_validation.AppendText("This permit is valid until: " + SF.ValidationDate.Date.ToShortDateString()); groupBox.Show(); } else { MessageBox.Show("You dont have study permissiom yet"); } }
private void showFeePermit() { DbContextDal dal = new DbContextDal(); StudentFeeForm SF = dal.StudentsFeeForms.Where(x => x.ID == student.ID).FirstOrDefault(); if (SF != null) { textBox_DateCreated.AppendText(SF.FormCreateDate.Date.ToShortDateString()); textBox_name.AppendText("Name: " + student.Name); textBox_ID.AppendText("ID: " + student.ID); textBox_formType.AppendText("Annual fee permit"); richTextBox_formText.AppendText("I hereby confirm that " + student.Name + " studies at our institution during the school year" + SF.ValidationDate.Year + "\nThis are tuition fee for the academic year " + SF.ValidationDate.Year + ": " + SF.anualFee); textBox_validation.AppendText("This permit is valid until: " + SF.ValidationDate.Date.ToShortDateString()); groupBox.Show(); } else { MessageBox.Show("You dont have fee permissiom yet"); } }
private void button_delete_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Student will be permanently deleted, are you sure?", "caption", MessageBoxButtons.YesNo); if (result == DialogResult.No) { MessageBox.Show("Student didn't deleted"); } else { SettingDatabase.DeleteStudent(currentStudent); currentStudent = new Student(); DbContextDal dal = new DbContextDal(); comboBox_ID.Items.Clear(); List <Student> students = students = dal.students.ToList(); foreach (Student item in students) { comboBox_ID.Items.Add(item.ID); } label_details.Hide(); textBox_details.Hide(); } }
private void comboBox_ID_SelectedIndexChanged(object sender, EventArgs e) { DbContextDal dal = new DbContextDal(); int ChossenID = int.Parse(comboBox_ID.SelectedItem.ToString()); currentStudent = dal.students.Where(x => x.ID == ChossenID).FirstOrDefault(); List <Course> studentCourses = currentStudent.getAllMyCourses(); if (studentCourses.Count == 0) { MessageBox.Show("Student not sighned to any courses"); } else { foreach (Course item in studentCourses) { comboBox_course.Items.Add(item.Name); } label_course.Show(); comboBox_course.Show(); button_confirm.Show(); } }
private void comboBox_IDs_SelectedIndexChanged(object sender, EventArgs e) { DbContextDal dal = new DbContextDal(); int ChossenID = int.Parse(comboBox_IDs.SelectedItem.ToString()); currentStudent = dal.students.Where(x => x.ID == ChossenID).FirstOrDefault(); courses = currentStudent.Enrollments.ToList(); comboBox_course.Items.Clear(); foreach (Enrollment item in courses) { comboBox_course.Items.Add(item.Course.Name); } label_course.Show(); comboBox_course.Show(); dataGridView1.Rows.Clear(); foreach (Enrollment item in courses) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dataGridView1); // this line was missing row.Cells[0].Value = item.Course.Name; if (item.Grade != -1) { row.Cells[1].Value = item.Grade; } else { row.Cells[1].Value = "None"; } dataGridView1.Rows.Add(row); } }
private void comboBox_IDs_SelectedIndexChanged(object sender, EventArgs e) { dataGridView1.Rows.Clear(); dataGridView1.Refresh(); DbContextDal dal = new DbContextDal(); int ChossenID = int.Parse(comboBox_IDs.SelectedItem.ToString()); currentStudent = dal.students.Where(x => x.ID == ChossenID).FirstOrDefault(); courses = currentStudent.Enrollments.ToList(); foreach (Enrollment item in courses) { if (item.additionalTest != null || item.gradeAppeal != null) { if (item.additionalTest != null) { if (item.additionalTest.Equals(requestState.Submitted.ToString()) || !item.additionalTest.Equals(requestState.testPassed.ToString())) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dataGridView1); row.Cells[0].Value = item.Course.Name; row.Cells[1].Value = item.Grade; if (item.additionalTest.Equals(requestState.Submitted.ToString())) { row.Cells[2].Value = "Additional Test"; } else if (item.additionalTest.Equals(requestState.Approved.ToString())) { row.Cells[2].Value = "Additional Test approved"; } dataGridView1.Rows.Add(row); } } if (item.gradeAppeal != null) { if (item.gradeAppeal.Equals(requestState.Submitted.ToString())) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dataGridView1); row.Cells[0].Value = item.Course.Name; row.Cells[1].Value = item.Grade; if (item.gradeAppeal.Equals(requestState.Submitted.ToString())) { row.Cells[2].Value = "Grade Appeale"; } dataGridView1.Rows.Add(row); } } } } if (dataGridView1.Rows.Count == 1) { MessageBox.Show("Student didnt maked any requests"); return; } label_course.Show(); foreach (Enrollment item in courses) { if (item.additionalTest != null) { if (item.additionalTest.Equals(requestState.Submitted.ToString()) || !item.additionalTest.Equals(requestState.testPassed.ToString())) { comboBox_course.Items.Add(item.Course.Name); } } if (item.gradeAppeal != null) { if (item.gradeAppeal.Equals(requestState.Submitted.ToString())) { comboBox_course.Items.Add(item.Course.Name); } } } comboBox_course.Show(); }
private void comboBox_IDs_SelectedIndexChanged(object sender, EventArgs e) { dataGridView1.Rows.Clear(); dataGridView1.Refresh(); label_lab.Hide(); label_lab.Hide(); label_practise.Hide(); comboBox_lab.Items.Clear(); comboBox_lecture.Hide(); comboBox_lecture.Items.Clear(); comboBox_practise.Hide(); comboBox_practise.Items.Clear(); button_confirm.Hide(); label_course.Hide(); comboBox_course.Hide(); comboBox_course.Items.Clear(); DbContextDal dal = new DbContextDal(); int ChossenID = int.Parse(comboBox_IDs.SelectedItem.ToString()); currentStudent = dal.students.Where(x => x.ID == ChossenID).FirstOrDefault(); courses = dal.courses.ToList(); foreach (Course item in courses) { comboBox_course.Items.Add(item.Name); } label_course.Show(); comboBox_course.Show(); List <Enrollment> enroll = currentStudent.Enrollments.ToList(); foreach (Enrollment item in enroll) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dataGridView1); // this line was missing row.Cells[0].Value = item.Course.Name; List <Lesson> lesons = currentStudent.getAllMyLessons(); foreach (Lesson temp in lesons) { if (temp.LCourseID == item.Course.ID) { if (temp.Type.Equals("Lecture")) { row.Cells[1].Value = temp.Start + ":00-" + temp.End + ":00" + temp.Day + " " + getTeacherName(temp); } else { row.Cells[1].Value = "None"; } if (temp.Type.Equals("Lab")) { row.Cells[2].Value = temp.Start + ":00-" + temp.End + ":00" + temp.Day + " " + getTeacherName(temp); } else { row.Cells[2].Value = "None"; } if (temp.Type.Equals("Practise")) { row.Cells[3].Value = temp.Start + ":00-" + temp.End + ":00" + temp.Day + " " + getTeacherName(temp); } else { row.Cells[3].Value = "None"; } } } dataGridView1.Rows.Add(row); } }
private void comboBox_course_SelectedIndexChanged(object sender, EventArgs e) { label_lab.Hide(); label_lecture.Hide(); label_practise.Hide(); comboBox_lab.Hide(); comboBox_lab.Items.Clear(); comboBox_lecture.Hide(); comboBox_lecture.Items.Clear(); comboBox_practise.Hide(); comboBox_practise.Items.Clear(); DbContextDal dal = new DbContextDal(); currentCourse = dal.courses.Where(x => x.Name == comboBox_course.SelectedItem.ToString()).FirstOrDefault(); List <Course> enrollments = currentStudent.getAllMyCourses(); foreach (Course item in enrollments) { if (item.ID == currentCourse.ID) { DialogResult result = MessageBox.Show("Student allready sighned to this course. Dou you want to update lab, lecture or practise?", "caption", MessageBoxButtons.YesNo); if (result == DialogResult.No) { return; } else { updateCourse = true; } break; } } List <Lesson> lessons = currentCourse.generate_List_Lessons(); labs = new List <Lesson>(); lectures = new List <Lesson>(); practises = new List <Lesson>(); foreach (Lesson item in lessons) { if (item.Type.Equals("Lab")) { labs.Add(item); } else if (item.Type.Equals("Lecture")) { lectures.Add(item); } else { practises.Add(item); } } if (labs.Count > 0) { foreach (Lesson item in labs) { comboBox_lab.Items.Add(item.Start + ":00-" + item.End + ":00" + item.Day + " " + getTeacherName(item)); } label_lab.Show(); comboBox_lab.Show(); } if (lectures.Count > 0) { foreach (Lesson item in lectures) { comboBox_lecture.Items.Add(item.Start + ":00-" + item.End + ":00" + item.Day + " " + getTeacherName(item)); } label_lecture.Show(); comboBox_lecture.Show(); } if (practises.Count > 0) { foreach (Lesson item in practises) { comboBox_practise.Items.Add(item.Start + ":00-" + item.End + ":00" + item.Day + " " + getTeacherName(item)); } label_practise.Show(); comboBox_practise.Show(); } button_confirm.Show(); }