public void NewAssignment()
        {
            Console.WriteLine("Enter Assignment's Title");
            string Title = Console.ReadLine();

            Console.WriteLine("Enter Assignment's Description");
            string Description = Console.ReadLine();

            Console.WriteLine("When you have to turn in the assignment");
            bool result0 = DateTime.TryParse(Console.ReadLine(), out DateTime subDateTime);

            while (result0 == false && subDateTime < Convert.ToDateTime((2019, 01, 01)))
            {
                Console.WriteLine("Wrong Input");
                result0 = DateTime.TryParse(Console.ReadLine(), out subDateTime);
            }
            Console.WriteLine("Provide Oral Mark");
            decimal oralmark = Convert.ToDecimal(Console.ReadLine());

            Console.WriteLine("Provide Total Mark");
            decimal totalmark = Convert.ToDecimal(Console.ReadLine());

            db.AddAssignment(Title, Description, subDateTime, oralmark, totalmark);
            db.GetAId(Title);
            Console.WriteLine("Would you like to add this Assignment to a Student?");
            Console.WriteLine("If yes press 'Y'");
            string answer = Console.ReadLine();

            if (answer == "Y")
            {
                Console.WriteLine(db.GetCId(Title)); Console.WriteLine("Provide the Student ID for Course to be added to");
                int id = Convert.ToInt32(Console.ReadLine());
                db.AddAssignmenttoStudent(db.GetAId(Title), id);
            }
            Console.WriteLine("Would you like to add this Assignment to a Course?");
            Console.WriteLine("If yes press 'Y'");
            string answer1 = Console.ReadLine();

            if (answer1 == "Y")
            {
                Console.WriteLine(db.GetCId(Title)); Console.WriteLine("Provide the Course ID for Course to be added to");
                int id = Convert.ToInt32(Console.ReadLine());
                db.AddAssignmenttoStudent(db.GetAId(Title), id);
            }
        }
Exemple #2
0
        public void NewCourse()
        {
            Console.WriteLine("Enter Course's title");
            string Title = Console.ReadLine();

            Console.WriteLine("Enter Course's stream");
            string Stream = Console.ReadLine();

            Console.WriteLine("Enter Course's type");
            string Type = Console.ReadLine();

            Console.WriteLine("Enter Course's Start Date");
            bool result = DateTime.TryParse(Console.ReadLine(), out DateTime startdate);

            while (result == false && startdate < Convert.ToDateTime((2018, 09, 11)))
            {
                Console.WriteLine("Wrong Input");
                result = DateTime.TryParse(Console.ReadLine(), out startdate);
            }
            Console.WriteLine("Enter Course's end date");
            bool result0 = DateTime.TryParse(Console.ReadLine(), out DateTime enddate);

            while (result0 == false && enddate < Convert.ToDateTime((2019, 01, 01)))
            {
                Console.WriteLine("Wrong Input");
                result0 = DateTime.TryParse(Console.ReadLine(), out enddate);
            }
            db.AddCourse(Title, Stream, Type, startdate, enddate);
            Console.WriteLine("Would you like to add this course to a Student?");
            Console.WriteLine("If yes press 'Y'");
            string answer = Console.ReadLine();

            if (answer == "Y")
            {
                Console.WriteLine(db.GetCId(Title)); Console.WriteLine("Provide the Student ID for Course to be added to");
                int id = Convert.ToInt32(Console.ReadLine());
                db.AddStudenttoCourse(db.GetCId(Title), id);
            }
        }