/// <summary> /// ウィンドウがロードされた時 /// </summary> public void Init() { // DB接続開始 X4Database.Open(); SettingDatabase.Open(); var pathes = new List <string>(); var vmList = new List <WorkAreaViewModel>(); SettingDatabase.Instance.ExecQuery("SELECT * FROM OpenedFiles", (dr, _) => { var path = (string)dr["Path"]; if (File.Exists(path)) { pathes.Add(path); } }); // 開いているファイルテーブルを初期化 SettingDatabase.Instance.ExecQuery("DELETE FROM OpenedFiles"); _WorkAreFileIO.OpenFiles(pathes); // 何も開かなければ空の計画を追加する if (!pathes.Any()) { _WorkAreFileIO.CreateNew(); } }
private void button_send_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(TextBox_title.Text)) { MessageBox.Show("Enter title"); } else if (String.IsNullOrEmpty(TextBox_body.Text)) { MessageBox.Show("Enter message body"); } else { string name; if (registrar != null) { name = registrar.Name; } else { name = ST.Name; } CollectiveMessage ms = new CollectiveMessage() { senderName = name, text = TextBox_body.Text, title = TextBox_title.Text }; SettingDatabase.Add_Message(ms); TextBox_title.Clear(); TextBox_body.Clear(); } }
private void button_update_Click(object sender, EventArgs e) { if (currentStudent == null) { MessageBox.Show("Choose student"); return; } foreach (var c in panel1.Controls) { if (c is TextBox) { if (((TextBox)c).Text == "") { MessageBox.Show("All fields of student details should be full\n Not all have to be chainged."); return; } } } currentStudent.Name = textBox_Name.Text; currentStudent.user.password = textBox_password.Text; currentStudent.Phone = textBox_phone.Text; currentStudent.Study_semester = textBox_StudySemester.Text; currentStudent.Study_year = int.Parse(textBox_studyYear.Text); SettingDatabase.Update_Student_Details(currentStudent); }
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(); }
/// <summary> /// ウィンドウがロードされた時 /// </summary> public void Init() { // DB接続開始 X4Database.Open(); SettingDatabase.Open(); var vmList = new List <WorkAreaViewModel>(); const string sql = "SELECT Path FROM OpenedFiles"; var pathes = SettingDatabase.Instance.Query <string>(sql) .Where(x => File.Exists(x)) .ToArray(); // 開いているファイルテーブルを初期化 SettingDatabase.Instance.Execute("DELETE FROM OpenedFiles"); _WorkAreFileIO.OpenFiles(pathes); // 何も開かなければ空の計画を追加する if (!pathes.Any()) { _WorkAreFileIO.CreateNew(); } }
public bool removeCourseFromPractitioner(Practitioner p, Course c) { if (p.RemoveAllMyLessonsInCourse(c)) // הסרת כל השיעורים השייכים למתרגל בקורס { (new Form_toastMassage("מחקת את כל השיעורים מהמרצה, כדי לבצע פעולה זאת")).Show(); // הצגת הודעת קופצת שהפעולה מחיקת השיעור לסטודנט בוצעה בהצלחה return(SettingDatabase.RemoveCourseFromPractitioner(p, c)); // הסרת הקורס מהמתרגל } return(false); // במידה והפעולה של הסרח שיעורים לא הצליחה, אז תחזיר שקר, כלומר אינה יכול למחוק כרגע את הקורס מהמרצה }
public bool ScheduleLessonLabToPractitionerInCourse(Practitioner prac, Course c, Lesson les) { if (SettingDatabase.PractitionerHasMoreThenAllowsHours(prac, les)) { MessageBox.Show("Can't register any more lessons to this Practitioner, because he above more then 16 weekly hours teaching"); return(false); } return(SettingDatabase.AddLabInCourseToPractitioner(prac, c, les)); }
public bool ScheduleLessonLectureToLectureInCourse(Lecturer lec, Course c, Lesson les) { if (SettingDatabase.LectureHasMoreThenAllowsHours(lec, les)) { MessageBox.Show("Can't register any more lessons to this lecturer, because he above more then 12 weekly hours teaching"); return(false); } return(SettingDatabase.AddLectureInCourseToLecturer(lec, c, les)); }
public bool removeCourseFromPractitioner(Practitioner p, Course c) { if (p.RemoveAllMyLessonsInCourse(c)) { (new Form_toastMassage("מחקת את כל השיעורים מהמרצה, כדי לבצע פעולה זאת")).Show(); return(SettingDatabase.RemoveCourseFromPractitioner(p, c)); } return(false); }
public bool removeCourseFromLecturer(Lecturer l, Course c) { if (l.RemoveAllMyLessonsInCourse(c)) // הסרת כל השיעורים מהמרצה ב { (new Form_toastMassage("מחקת את כל השיעורים מהמרצה, כדי לבצע פעולה זאת")).Show(); return(SettingDatabase.RemoveCourseFromLecturer(l, c)); } return(false); }
private void button_confirm_Click(object sender, EventArgs e) { if (updateCourse == false) { if (comboBox_lecture.Visible == true && comboBox_lecture.SelectedItem == null || comboBox_lab.Visible == true && comboBox_lab.SelectedItem == null || comboBox_practise.Visible == true && comboBox_practise.SelectedItem == null) { MessageBox.Show("When adding new course to student you need also add all course lessons"); } else { SettingDatabase.addCourseToStudent(currentStudent.ID, currentCourse.ID); currentStudent.add_Lesson(currentLab); currentStudent.add_Lesson(currentPractise); currentStudent.add_Lesson(currentLecture); label_lab.Hide(); label_lecture.Hide(); label_practise.Hide(); comboBox_lab.Hide(); comboBox_lecture.Hide(); comboBox_practise.Hide(); } } else { if (comboBox_lecture.Visible == true && comboBox_lecture.SelectedItem == null && comboBox_lab.Visible == true && comboBox_lab.SelectedItem == null && comboBox_practise.Visible == true && comboBox_practise == null) { MessageBox.Show("You need to chose at least one lesson to update"); } else { if (comboBox_lecture.Visible == true && comboBox_lecture.SelectedItem != null) { currentStudent.add_Lesson(currentLecture); } if (comboBox_lab.Visible == true && comboBox_lab.SelectedItem != null) { currentStudent.add_Lesson(currentLab); } if (comboBox_practise.Visible == true && comboBox_practise.SelectedItem != null) { currentStudent.add_Lesson(currentPractise); } label_lab.Hide(); label_lecture.Hide(); label_practise.Hide(); comboBox_lab.Hide(); comboBox_lecture.Hide(); comboBox_practise.Hide(); } } }
private void Reload() { DbContextDal dal = new DbContextDal(); student = dal.students.Where(x => x.ID == student.ID).FirstOrDefault(); checkBox_grade.Checked = false; checkBox_test.Checked = false; button_confirm.Hide(); comboBox_Course.Items.Clear(); studentCourses = SettingDatabase.GetAllLearnedCoursesOfStudent(student); foreach (Course item in studentCourses) { comboBox_Course.Items.Add(item.Name); } float studentGrade = 0; int counter = 0; List <Enrollment> allStudentCourses = student.Enrollments.ToList(); dataGridView1.Rows.Clear(); dataGridView1.Refresh(); foreach (Enrollment item in allStudentCourses) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dataGridView1); // this line was missing row.Cells[0].Value = item.Course.Name; if (item.Grade != null) { row.Cells[1].Value = item.Grade; studentGrade = float.Parse(item.Grade.ToString()); counter++; } if (item.gradeAppeal != null) { row.Cells[2].Value = item.gradeAppeal; } else { row.Cells[2].Value = "Not requested"; } if (item.additionalTest != null) { row.Cells[3].Value = item.additionalTest; } else { row.Cells[3].Value = "Not requested"; } dataGridView1.Rows.Add(row); } studentGrade = studentGrade / counter; label_GPA.Text = "GPA: " + studentGrade; }
private void button_confirm_Click(object sender, EventArgs e) { if (checkBox_grade.Checked == false && checkBox_test.Checked == false) { MessageBox.Show("You have to pick type of request"); return; } DbContextDal dal = new DbContextDal(); Enrollment studentCourse = dal.Enrollments.Where(x => x.CourseId == currentCourse.ID && x.StudentId == student.ID).FirstOrDefault(); if (checkBox_grade.Checked == true) { if (studentCourse.gradeAppeal != null) { MessageBox.Show("You allready requested grade appeal"); } else if (studentCourse.additionalTest != null) { if (!(studentCourse.additionalTest.Equals(requestState.testPassed.ToString()))) { MessageBox.Show("You allready requested for additional test, you cant request until final grade received"); } } else if (studentCourse.Grade == -1) { MessageBox.Show("You don't have grade for this course yet. You can make request after you get the grade"); } else { studentCourse.gradeAppeal = requestState.Submitted.ToString(); SettingDatabase.Change_Grade_Status_Request(student, studentCourse); Reload(); } } else if (checkBox_test.Checked == true) { if (studentCourse.additionalTest != null) { MessageBox.Show("You allready requested for additional test"); } else if (studentCourse.Grade == -1) { MessageBox.Show("You don't have grade for this course yet. You can make request after you get the grade"); } else { studentCourse.additionalTest = requestState.Submitted.ToString(); SettingDatabase.Change_Test_Status_Request(student, studentCourse); Reload(); } } }
public List <Practitioner> getAllPractitionerInMyCourse(Course c) { DbContextDal dal = new DbContextDal(); if (dal.approveLecturersCourse.Find(ID, c.ID) != null) { return(SettingDatabase.GetAllPractitionersWhoLearchCourse(c)); } else { return(null); } }
public List <Student> getAllStudentsInMyCourse(Course c) { DbContextDal dal = new DbContextDal(); if (dal.approveLecturersCourse.Find(ID, c.ID) != null) { return(SettingDatabase.GetAllStudenstWhoLearchCourse(c)); } else { return(null); } }
public Lesson geLessonByDayAndHour(string day, int hour) { Lesson l = SettingDatabase.GetLessonPractisePractitionerByDayAndHour(this, day, hour); if (l == null) { return(SettingDatabase.GetLessonLabPractitionerByDayAndHour(this, day, hour)); } else { return(l); } }
private void button_confirm_Click(object sender, EventArgs e) { if (currentCourse.Grade != -1) { DialogResult result = MessageBox.Show("Student allready have grade at this course. Dou you want to change it?", "caption", MessageBoxButtons.YesNo); if (result == DialogResult.No) { MessageBox.Show("Grade didnt changed"); return; } } SettingDatabase.ChangeGradeOfStudentInCourse(currentStudent, currentCourse.Course, tempGrade); Reload(); }
public String getTeacherName(Lesson item) { Lecturer lecturer = SettingDatabase.getLecturerByID(item.LTeacherID); if (lecturer != null) { return(lecturer.Name); } else { Practitioner practioner = SettingDatabase.getPractitionerByID(item.LTeacherID); return(practioner.Name); } }
public bool setapprovedCourseForPractitioner(Practitioner p, Course c, bool approved = true) { if (approved == false && p.RemoveAllMyLessonsInCourse(c)) // הסרת כל השיעורים מהמרצה ב { (new Form_toastMassage("מחקת את כל השיעורים מהמתרגל, כדי לבצע פעולה זאת")).Show(); return(SettingDatabase.ApprovedCourseForPractitioner(p, c, approved)); } else if (approved) { return(SettingDatabase.ApprovedCourseForPractitioner(p, c, approved)); } else { return(false); } }
public bool add_Lesson(Lesson lesson) { List <Lesson> lessons = getAllMyLessons(); DbContextDal dal = new DbContextDal(); if (lesson != null) { if (lessons.Any(item => item.LCourseID == lesson.LCourseID && item.Type.Equals(lesson.Type))) { MessageBox.Show("Student allready sighned to this " + lesson.Type); return(false); } int numberOfStudents = 0; if (lesson.Type.Equals("Lab")) { numberOfStudents = ((Lab)lesson).NumStudent; } else if (lesson.Type.Equals("Practise")) { numberOfStudents = ((Practise)lesson).NumStudent; } else if (lesson.Type.Equals("Lecture")) { numberOfStudents = ((Lecture)lesson).NumStudent; } if (numberOfStudents + 1 > lesson.classroom.maxStudents) { MessageBox.Show("This " + lesson.Type + " allready have maximum number of students"); return(false); } foreach (Lesson item in lessons) { if (lesson.Start > item.Start && lesson.Start < item.End || lesson.End > item.Start && lesson.End < item.End) { MessageBox.Show("Student allready have another lesson at this time " + lesson.Type + " not added"); return(false); } } SettingDatabase.registerStudentToLesson(this, lesson, lesson.Type); } return(false); }
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 button_confirm_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Student course will be permanently removed, are you sure?", "caption", MessageBoxButtons.YesNo); if (result == DialogResult.No) { MessageBox.Show("Student course didn't removed"); } else { SettingDatabase.RemoveCourseFromStudent_AdminMode(currentStudent, currentCourse); currentStudent = new Student(); currentCourse = new Course(); comboBox_course.Items.Clear(); label_course.Hide(); comboBox_course.Hide(); button_confirm.Hide(); } }
private void button_confirm_Click(object sender, EventArgs e) { if (gradeAppeal == false) { if (waitingForGrade == true) { currentCourse.additionalTest = requestState.testPassed.ToString(); SettingDatabase.ChangeGradeOfStudentInCourse(currentStudent, currentCourse.Course, newGrade); } else { if (checkBox_approve.Checked == true) { currentCourse.additionalTest = requestState.Approved.ToString(); } else { currentCourse.additionalTest = requestState.NotApproved.ToString(); } } SettingDatabase.Change_Test_Status_Request(currentStudent, currentCourse); } else { if (checkBox_approve.Checked == true) { currentCourse.Grade = newGrade; currentCourse.gradeAppeal = requestState.Approved.ToString(); SettingDatabase.ChangeGradeOfStudentInCourse(currentStudent, currentCourse.Course, newGrade); } else { currentCourse.gradeAppeal = requestState.NotApproved.ToString(); } SettingDatabase.Change_Grade_Status_Request(currentStudent, currentCourse); } Reload(); }
private void btn_recoveryPassword_Click(object sender, EventArgs e) { if (textBox_userName.TextLength > 0) { int id = -1; string username = textBox_userName.Text; try { id = System.Convert.ToInt32(username); } catch (Exception) { } User user; if (id != -1) { user = SettingDatabase.GetUserById(id); } else { user = SettingDatabase.GetUserByEmail(username); } if (user != null) { if (user.email != null) { MessageBox.Show("In your email you get this message: \n\nUser ID : " + user.ID + "\nEmail: " + user.email + "\nYour password is: " + user.password); } else { MessageBox.Show("you have to update you email in the system to get the option to recovery your password"); } } else { MessageBox.Show("you have to update you email in the system to get the option to recovery your password"); } } }
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(); } }
public List <Lesson> getAllMyLessons() { return(SettingDatabase.StudentGetAllMyLesson(this)); }
public float getGradesAveragePoint() { return(SettingDatabase.GetGradeAverangPoint(this)); }
public List <Course> getAllMyCourses() { return(SettingDatabase.GetAllLearnedCoursesOfStudent(this)); }
public float getGradeInCourse(Course c) { return(SettingDatabase.GetGradeOfStudentInCourse(this, c)); }
public bool AlreadyRegistedToLessonInCourseOfLesson(Lesson l) { return(SettingDatabase.StudentAlreadyRegistedToLessonInCourseOfLesson(this, l)); }