public void TearDown() { //AM THINKING THAT AFTER EACH TESt HAS RUN WE DISCARD THE CHANGES MADE THE CODE // AND RESTORE THE TABLE TO ITS ORIGINAL STATE if (all_students != null) { StudentsManager.DropTable(); CreateTableIfItDoesntExist(); PopulateTable(); } }
public void CN12(StudentsManager std) { Console.Clear(); if (std.count == 0) { Console.WriteLine("Danh sách sinh viên trống!"); Press(); } else { Console.WriteLine("=========== Cập nhật thông tin sinh viên ============"); std.update(); } }
public void check(StudentsManager std) { int index; for (int i = 0; i < std.count; i++) { index = cls.FindIndex(x => x.IDClass == std.idClass(i)); if (index == -1) { Console.WriteLine("\nWarning ! Học viên {0}, mã sinh viên {1} có lớp {2} chưa được mở" , std.display(i).Name, std.display(i).ID, std.display(i).IDClass); } } }
public void PopulateTable() { //WE GET ALL OBJECTS AT THE START ONLY INORDER TO REDUCE THE TIME TAKEN //TO RUN THE TESTS if (all_students == null) { all_students = StudentsManager.GetAllStudents(); } foreach (var student in all_students) { StudentsManager.Save(student); } }
private RateMyPClient() { var httpClient = new HttpClient(); //httpClient.BaseAddress = new Uri("https://localhost:44382"); httpClient.BaseAddress = new Uri("https://ratemypserver79.azurewebsites.net"); httpClient.DefaultRequestHeaders.Accept.Clear(); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); Teachers = new TeachersManager(httpClient); Students = new StudentsManager(httpClient); Ratings = new RatingsManager(httpClient); Courses = new CoursesManager(httpClient); Tags = new TagsManager(httpClient); }
public void CN31(StudentsManager std) { Console.Clear(); Console.Clear(); if (std.count == 0) { Console.WriteLine("Danh sách sinh viên trống!"); Press(); } else { Console.WriteLine("================ Nhập điểm thi ================="); std.addScore(); } }
//CONSTRUCTOR public StudentRecognitionThread(Image <Bgr, byte>[] faces_to_recognize) : base(null) { running = true; paused = false; WORK_DONE = false; this.faces_manager = new FacesManager(); this.faces_to_recognize.AddRange(faces_to_recognize); //GET ALL STUDENTS students = StudentsManager.GetAllStudents(); //ENROLL STUDENT FACES EnrollFacesToBeComparedAgainst(); }
public List <Student> getStudentsPerClass(int _classID) { List <Student> students = new List <Student>(); StudentsManager manager = new StudentsManager(); try { students = manager._getStudentsPerClass(_classID: _classID); } catch (Exception ex) { throw new Exception(ex.Message); } return(students); }
private void BtnUpdate_Click(object sender, EventArgs e) { try { if (!CheckUpdate()) { return; } string strSex = " "; if (this.rbUpdateSexBoy.Checked) { strSex = "男"; } else if (this.rbUpdateSexGirl.Checked) { strSex = "女"; } else { return; } Students students = new Students(); students.LoginId = Convert.ToInt32(this.textUpdateStuId.Text.Trim()); students.LoginPwd = this.textUpdateStuPwd.Text.Trim(); students.Name = this.textUpdateStuName.Text.Trim(); students.Sex = strSex; students.UserType = this.cboUpdateStuType.Text.Trim(); students.Tell = this.textUpdateStuTell.Text.Trim(); students.Address = this.textUpdateStuAddress.Text.Trim(); students.Email = this.textUpdateStuEmail.Text.Trim(); int ret = new StudentsManager().UpdateStudent(students); if (ret > 0) { MessageBox.Show(UPDATESUCCEED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information); StudentDataBind(); } else { MessageBox.Show(UPDATEFAILED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, OPERATIONFAILSED, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
//单击添加 private void BtnAdd_Click(object sender, EventArgs e) { try { if (!CheckInputNotEmpty()) { return; } string strSex = " "; if (this.radioBtnF.Checked) { strSex = "男"; } else if (this.radioBtnM.Checked) { strSex = "女"; } else { return; } Students students = new Students(); students.LoginId = Convert.ToInt32(this.textStudentId.Text.Trim()); students.LoginPwd = this.textStudentPwd.Text.Trim(); students.Name = this.textStudentName.Text.Trim(); students.Sex = strSex; students.UserType = this.comboStudentType.Text.Trim(); students.Tell = this.textStudentTell.Text.Trim(); students.Address = this.textStudentAddress.Text.Trim(); students.Email = this.textStudentEmail.Text.Trim(); int ret = new StudentsManager().AddStudent(students); if (ret > 0) { MessageBox.Show(INSERTSUCCEED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(INSERTFAILED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, OPERATIONFAILSED, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public static void Run() { StudentsManager manager = new StudentsManager(StudentsSerializer.Xml()); manager.Add("Иван", "Сидоров", "Андреевич", DateTime.Now.AddYears(-21)); manager.Add("Андрей", "Сидоров", "Андреевич", DateTime.Now.AddYears(-20)); manager.Add("Александр", "Сидоров", "Андреевич", DateTime.Now.AddYears(-16)); manager.Add("Дмитрий", "Сидоров", "Андреевич", DateTime.Now.AddYears(-29)); manager.Add("Евгений", "Сидоров", "Андреевич", DateTime.Now.AddYears(-19)); manager.Add("Алексей", "Сидоров", "Андреевич", DateTime.Now.AddYears(-22)); manager.Add("Степан", "Сидоров", "Андреевич", DateTime.Now.AddYears(-30)); manager.Add("Василий", "Сидоров", "Андреевич", DateTime.Now.AddYears(-31)); manager.Add("Николай", "Сидоров", "Андреевич", DateTime.Now.AddYears(-33)); manager.Add("Артём", "Сидоров", "Андреевич", DateTime.Now.AddYears(-20)); manager.SaveTo("students.xml"); }
public List <Student> getStudentByLastName(string lastName) { List <Student> students = new List <Student>(); try { StudentsManager _studentsManager = new StudentsManager(); students = _studentsManager._getStudentByLastName(lastName: lastName); } catch (Exception ex) { throw new Exception(ex.Message); } return(students); }
//version 3.0------------------------------------------------------------------------------ public List <Student> getStudentsBySubject(int subjectID) { List <Student> students = new List <Student>(); try { StudentsManager _studentsManager = new StudentsManager(); students = _studentsManager._getStudentsPerSubject(subjectID: subjectID); } catch (Exception ex) { throw new Exception(ex.Message); } return(students); }
public void CN11(StudentsManager std) { Console.Clear(); if (std.count == 0) { Console.WriteLine("Danh sách sinh viên trống!"); } else { Console.WriteLine("+--------------------------------------------------------------------------+"); Console.WriteLine("| Danh sách sinh viên |"); Console.WriteLine("+--------------------------------------------------------------------------+"); Console.WriteLine("| Mã SV | Họ và tên | Địa chỉ | Ngày Sinh | Lớp |"); Console.WriteLine("+--------------------------------------------------------------------------+"); std.display(); Console.WriteLine("+--------------------------------------------------------------------------+"); } }
static void Main(string[] args) { StudentsManager manager = new StudentsManager(); try { manager.StudentsList = CSVReader.ReadStudentFile("st.csv"); } catch (Exception ex) { Console.WriteLine("An error trying to read the CSV file has occurred."); } Console.WriteLine("The CSV file has been read correctly... Press a key to continue"); Console.ReadLine(); Console.Clear(); Menu mnu = new Menu(manager); mnu.Begin(); }
public Boolean updateStudentDetails(int _studentID, string _firstName, string _middleName, string _lastName, DateTime _dateOfBirth) { bool done = true; try { StudentsManager _studentsManager = new StudentsManager(); done = _studentsManager._updateStudentDetails(_studentID: _studentID, _firstName: _firstName, _middleName: _middleName, _lastName: _lastName, _dateOfBirth: _dateOfBirth); } catch (Exception ex) { throw new Exception(ex.Message); } return(done); }
public void CN33(StudentsManager std) { Console.Clear(); if (std.count == 0) { Console.WriteLine("Danh sách sinh viên trống!"); } else { Console.WriteLine("=================== Điểm thi theo môn ===================="); Console.Write(" Nhập môn thi: "); string temp = Console.ReadLine(); Console.Clear(); Console.WriteLine("+---------------------------------------------------------------+"); Console.WriteLine("| Danh sách sinh viên |"); Console.WriteLine("+---------------------------------------------------------------+"); Console.WriteLine("| Mã lớp | Tên sinh viên | Môn thi | Điểm | Đánh giá |"); Console.WriteLine("+---------------------------------------------------------------+"); std.displayBySubject(temp); Console.WriteLine("+---------------------------------------------------------------+"); } }
private void addStudent_Click(object sender, EventArgs e) { try { String first_name = this.textbox_firstname.Text; String last_name = this.textbox_lastname.Text; String middle_name = this.textbox_middlename.Text; String student_no = this.textbox_studentno.Text; String reg_no = this.textbox_regno.Text; String course = this.textbox_course.Text; String dob = this.combobox_day.Text + "/" + this.combobox_month.Text + "/" + this.combobox_year.Text; String gender = this.combobox_gender.Text; if (String.IsNullOrEmpty(first_name) || String.IsNullOrEmpty(last_name) || String.IsNullOrEmpty(student_no) || String.IsNullOrEmpty(reg_no) || String.IsNullOrEmpty(course) || photos.Count < MIN_PHOTOS_PER_STUDENT) { label_status.Visible = true; label_status.Text = "Please fill in all the fields and pick atleast 5 pictures of the student:" + photos.Count(); return; } Student student = new Student(first_name, middle_name, last_name, student_no, reg_no, course, dob, gender, photos.ToArray()); if (StudentsManager.Save(student)) { MessageBox.Show("Student Added Successfully"); this.Close(); } else { label_status.Visible = true; label_status.Text = "Operation Not Successfully\n Please try again"; } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
public Menu(StudentsManager mgrList) { StudentsMngr = mgrList; }
public void CN13(StudentsManager std) { Console.Clear(); Console.WriteLine("============== Thêm mới một sinh viên ==============="); std.add(); }
public void check(ClassManager cls, StudentsManager std) { cls.check(std); }
public void StudentsManagerSaveTest() { bool sucess = StudentsManager.Save(all_students[0]); Assert.IsTrue(sucess); }
public static void MenouHeadMaster(int hm_id) { using (MyContext db = new MyContext()) { Console.WriteLine($"\nHello {db.HeadMasters.Find(hm_id).FirstName},\n"); while (1 == 1) { try { Console.WriteLine(""); Console.WriteLine("1 - Add a Student"); Console.WriteLine("2 - Update a Student"); Console.WriteLine("3 - Delete a Student"); Console.WriteLine("4 - Add a Trainer"); Console.WriteLine("5 - Update a Trainer"); Console.WriteLine("6 - Delete a Trainer"); Console.WriteLine("7 - Add a Course"); Console.WriteLine("8 - Update a Course"); Console.WriteLine("9 - Delete a Course"); Console.WriteLine("10 - Add an Assignment"); Console.WriteLine("11 - Update an Assignment"); Console.WriteLine("12 - Delete an Assignment"); Console.WriteLine("13 - Add a Head-Master"); Console.WriteLine("14 - Delete a Head-Master"); Console.WriteLine("15 - Relate Courses and Students(students per courses)"); Console.WriteLine("16 - UN-Relate Courses and Students(students per courses)"); Console.WriteLine("17 - Relate Trainers and Courses(Trainers per courses)"); Console.WriteLine("18 - UN-Relate Trainers and Courses(Trainers per courses)"); Console.WriteLine("19 - Relate Assignments and Courses(Assignments per courses)"); Console.WriteLine("20 - UN-Relate Assignments and Courses(Assignments per courses)"); Console.WriteLine("21 - Relate Assignments and Students(Assignments per Students)"); Console.WriteLine("22 - UN-Relate Assignments and Students(Assignments per Students)"); Console.WriteLine("23 - Exit from the programme"); Console.WriteLine("Please select one of the options: "); int user_chioce = Convert.ToInt32(Console.ReadLine()); switch (user_chioce) { case 1: StudentsManager.AddStudent(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 2: StudentsManager.UpdateStudent(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 3: StudentsManager.DeleteStudent(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 4: TrainerManager.AddTrainer(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 5: TrainerManager.UpdateTrainer(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 6: TrainerManager.DeleteTrainer(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 7: CourseManager.AddCourse(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 8: CourseManager.UpdateCourse(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 9: CourseManager.DeleteCourse(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 10: AssignmentManager.AddAssignment(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 11: AssignmentManager.UpdateAssignment(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 12: AssignmentManager.DeleteAssignment(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 13: HeadMasterManager.AddHeadMaster(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 14: HeadMasterManager.DeleteHeadMaster(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 15: StudentsManager.RelateStudentsCourses(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 16: StudentsManager.UNRelateStudentsCourses(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 17: TrainerManager.RelateCoursesToTrainers(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 18: TrainerManager.UNRelateCoursesToTrainers(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 19: CourseManager.RelateAssignmentsToCourses(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 20: CourseManager.UNRelateAssignmentsToCourses(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 21: StudentsManager.RelateStudentsAssignments(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 22: StudentsManager.UNRelateStudentsAssignments(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); break; case 23: Environment.Exit(0); break; } } catch (Exception) { Console.WriteLine("Wrong input"); } } } }
public void StudentsManagerGetAllStudentsTest() { Student[] students = StudentsManager.GetAllStudents(); Assert.IsNotNull(students); }
public void StudentsManagerGetStudentTest() { Student student = StudentsManager.GetStudent(all_students[0].id); Assert.IsNotNull(student); }
public void StudentsManagerPopulateTableTest() { bool sucess = StudentsManager.PopulateTable(); Assert.IsTrue(sucess); }
public void StudentsManagerDropTableTest() { bool sucess = StudentsManager.DropTable(); Assert.IsTrue(sucess); }
public void StudentsManagerDeleteTest() { bool sucess = StudentsManager.Delete(all_students[0].id); Assert.IsTrue(sucess); }
public void StudentsManagerGetStudentPhotosTest() { Image <Bgr, byte>[] faces = StudentsManager.GetStudentPhotos(1); Assert.IsNotNull(faces); }
public void CreateTableIfItDoesntExist() { StudentsManager.CreateTable(); }