예제 #1
0
        public List <Assignment> GetAllAssignments()
        {
            AssignmentDb      asDB = new AssignmentDb();
            List <Assignment> asgs = asDB.GetAllAssignments();

            return(asgs);
        }
예제 #2
0
        public ListForObjects GetAllAssignmentsByTeacherId(int teacherId)
        {
            AssignmentDb   asDB     = new AssignmentDb();
            PersonCtrl     userCtrl = new PersonCtrl();
            ListForObjects list     = new ListForObjects();
            ListForObjects l        = asDB.GetAllAssignmentsByTeacherId(teacherId);

            foreach (Object o in l.Asl)
            {
                Assignment a = (Assignment)o;
                a.teacher = (Teacher)userCtrl.GetPerson(a.teacher.Id);
                list.Asl.Add(a);
            }
            return(list);
        }
예제 #3
0
        public int CreateAssignment(int teacherId, string subject, string title, string exercise, DateTime date, DateTime deadline)
        {
            PersonCtrl usCtrl = new PersonCtrl();

            Assignment ass = new Assignment();

            ass.teacher  = (Teacher)usCtrl.GetPerson(teacherId);
            ass.subject  = subject;
            ass.title    = title;
            ass.exercise = exercise;
            ass.date     = date;
            ass.deadline = deadline;

            AssignmentDb assDb = new AssignmentDb();

            return(assDb.CreateAssignment(ass));
        }
        public static void AddAssignmentInCourse()
        {
            Console.Clear();
            AssignmentDb aDB = new AssignmentDb();
            CourseDb     cDB = new CourseDb();

            List <Course>     courses     = cDB.GetCourses();
            List <Assignment> assignments = aDB.GetAssignments();

            if (courses.Count != 0 && assignments.Count != 0)
            {
                Console.WriteLine("Select an assignment to add by using its number on the list: \n");
                ShowLists.ShowList(assignments, "Students");

                bool result = Int32.TryParse(Console.ReadLine(), out int assignmentID);
                while (!result || (assignmentID < 1 || assignmentID > assignments.Count))
                {
                    Console.Write($"Wrong input! Please select using numbers from 1 to {assignments.Count} ");
                    result = Int32.TryParse(Console.ReadLine(), out assignmentID);
                }
                Console.Clear();

                Console.WriteLine("Select a course by using its number on the list: \n");
                ShowLists.ShowList(courses, "Courses");

                result = Int32.TryParse(Console.ReadLine(), out int courseID);
                while (!result || (courseID < 1 || courseID > courses.Count))
                {
                    Console.Write($"Wrong input! Please select using numbers from 1 to {courses.Count} ");
                    result = Int32.TryParse(Console.ReadLine(), out courseID);
                }
                Console.Clear();
                AssignmentsPerCourseDb.AddAssignmentToCourse(assignmentID, courseID);

                Console.WriteLine("Assignment added successfully to Course!");
            }
            else
            {
                Console.WriteLine("There aren't neither Students nor Courses yet");
            }
        }
예제 #5
0
        public static void CreateAssignment()
        {
            Console.Clear();
            Console.Write("Title: ");
            string title = Console.ReadLine();

            Console.Write("Description: ");
            string description = Console.ReadLine();

            Console.Write("Submission Date: ");
            bool result = DateTime.TryParse(Console.ReadLine(), out DateTime subDateTime);

            while (!result || subDateTime < DateTime.Now || subDateTime.DayOfWeek == DayOfWeek.Saturday || subDateTime.DayOfWeek == DayOfWeek.Sunday)
            {
                Console.Write("Wrong input!\nSubmission Date has to be set as YYYY/MM/DD, can't be in the past and has to be set between Monday and Friday \nSubmission Date: ");
                result = DateTime.TryParse(Console.ReadLine(), out subDateTime);
            }
            Console.WriteLine("Oral Mark: ");
            result = decimal.TryParse(Console.ReadLine(), out decimal oralMark);
            while (!result || oralMark < 0 || oralMark > 101)
            {
                Console.Write("Wrong input!\nOral Mark must be from 1 to 100: \nOral Mark:");
                result = decimal.TryParse(Console.ReadLine(), out oralMark);
            }
            Console.WriteLine("Total Mark: ");
            result = decimal.TryParse(Console.ReadLine(), out decimal totalMark);
            while (!result || totalMark < 0 || totalMark > 101)
            {
                Console.Write("Wrong input!\nTotal Mark must be from 1 to 100: \nTotal Mark:");
                result = decimal.TryParse(Console.ReadLine(), out totalMark);
            }

            AssignmentDb.CreateAssignment(title, description, subDateTime, oralMark, totalMark);

            Console.Clear();
            Console.WriteLine("Assignment creation successful!");
        }
예제 #6
0
        public static void AddAssignmentToStudent()
        {
            Console.Clear();
            AssignmentDb aDB = new AssignmentDb();
            StudentDb sDB = new StudentDb();            

            List<Assignment> assignments = aDB.GetAssignments();
            List<Student> students = sDB.GetStudents();

            if (assignments.Count != 0 && students.Count != 0)
            {
                Console.WriteLine("Select an assignment by using its number on the list: \n");
                ShowLists.ShowList(assignments, "Assignments");

                bool result = Int32.TryParse(Console.ReadLine(), out int assignmentID);
                while (!result || (assignmentID < 1 || assignmentID > assignments.Count))
                {
                    Console.Write($"Wrong input! Please select using numbers from 1 to {assignments.Count} ");
                    result = Int32.TryParse(Console.ReadLine(), out assignmentID);
                }

                Console.WriteLine("Select a student to add by using its number on the list: \n");
                ShowLists.ShowList(students, "Students");

                result = Int32.TryParse(Console.ReadLine(), out int studentID);
                while (!result || (studentID < 1 || studentID > students.Count))
                {
                    Console.Write($"Wrong input! Please select using numbers from 1 to {students.Count} ");
                    result = Int32.TryParse(Console.ReadLine(), out studentID);
                }
                Console.Clear();
                AssignmentsPerStudentDb.AddΑssignmentToStudent(assignmentID, studentID);
                Console.WriteLine("Assignment added to Student successfully!");
            }
            else Console.WriteLine("There aren no Students or Assignments yet");
        }