Example #1
0
 public List <Teacher> GetTeachers()
 {
     try
     {
         List <Teacher> teacher = teacher_db.Db_Get_All_Teachers();
         return(teacher);
     }
     catch (Exception)
     {
         // something went wrong connecting to the database, so we will add a fake student to the list to make sure the rest of the application continues working!
         List <Teacher> teacher = new List <Teacher>();
         Teacher        a       = new Teacher();
         a.Name         = "Mr. Test Teacher";
         a.Number       = 474791;
         a.IsSupervisor = true;
         teacher.Add(a);
         Teacher b = new Teacher();
         b.Name         = "Mrs. Test teacher";
         b.Number       = 197474;
         b.IsSupervisor = false;
         teacher.Add(b);
         return(teacher);
         //throw new Exception("Someren couldn't connect to the database");
     }
 }
Example #2
0
        public List <Teacher> GetTeachers()
        {
            try
            {
                List <Teacher> teacher = teacher_db.Db_Get_All_Teachers();
                return(teacher);
            }
            catch (Exception)
            {
                // something went wrong connecting to the database, so we will add a fake student to the list to make sure the rest of the application continues working!
                List <Teacher> teacher = new List <Teacher>();
                Teacher        a       = new Teacher();
                a.Name   = "Mr. Test Student";
                a.Number = 474791;
                a.Guide  = true;

                teacher.Add(a);
                Teacher b = new Teacher();
                b.Name   = "Mrs. Test Student";
                b.Number = 197474;
                b.Guide  = false;

                teacher.Add(b);

                //Geeft een gebruiks vriendelijke error wanneer er geen data uit de database kan worden gehaald.
                System.Windows.Forms.MessageBox.Show("Someren couldn't connect to the database");
                return(teacher);
            }
        }
Example #3
0
        public List <Teacher> GetTeachers()
        {
            try
            {
                List <Teacher> teacher = teacher_db.Db_Get_All_Teachers();
                return(teacher);
            }
            catch (Exception)
            {
                // something went wrong connecting to the database, so we will add a fake student to the list to make sure the rest of the application continues working!
                List <Teacher> teacher = new List <Teacher>();
                Teacher        a       = new Teacher();

                a.teacherID  = 474791;
                a.FirstName  = "Teacher";
                a.LastName   = " van Fake";
                a.Supervisor = "mr. SuperFake";

                teacher.Add(a);
                return(teacher);

                //a.BirthDate = DateTime.Parse("1990-07-04");
                //Teacher b = new Teacher();
                //b.name = "Mrs. Test  Teacher";
                //b.teacherID = 197474;
                // b.BirthDate = DateTime.Parse("2019-03-04");
                //teacher.Add(b);


                throw new Exception("Someren couldn't connect to the database");
            }
        }
Example #4
0
        public List <Teacher> GetTeachers()
        {
            try
            {
                List <Teacher> teacher = teacher_db.Db_Get_All_Teachers();
                return(teacher);
            }
            catch (Exception)
            {
                //// something went wrong connecting to the database, so we will add a fake student to the list to make sure the rest of the application continues working!
                List <Teacher> teacher = new List <Teacher>();
                Teacher        a       = new Teacher();
                a.FirstName     = "No Name";
                a.LastName      = "No Last Name";
                a.TeacherNumber = 127345;
                a.Speciality    = "Nothing";
                teacher.Add(a);
                Teacher b = new Teacher();
                b.FirstName     = "No Name 2";
                b.LastName      = "No Last Name 2";
                b.TeacherNumber = 197474;
                b.Speciality    = "Nothing 2";
                teacher.Add(b);
                return(teacher);

                throw new Exception("Someren couldn't connect to the database");
            }
        }
Example #5
0
        public List <Teacher> GetTeachers()
        {
            //List<Teacher> teacher = teacher_db.Db_Get_All_Teachers();
            //return teacher;

            try
            {
                List <Teacher> teacher = teacher_db.Db_Get_All_Teachers();
                return(teacher);
            }
            catch (Exception)
            {
                /*
                 * // something went wrong connecting to the database, so we will add a fake student to the list to make sure the rest of the application continues working!
                 * List<Teacher> teacher = new List<Teacher>();
                 * Teacher a = new Teacher();
                 * a.Name = "Mr. Test Teacher";
                 * a.Number = 474791;
                 * //a.BirthDate = DateTime.Parse("1990-07-04");
                 * teacher.Add(a);
                 * Teacher b = new Teacher();
                 * b.Name = "Mrs. Test Teacher2";
                 * b.Number = 197474;
                 * //b.BirthDate = DateTime.Parse("2019-03-04");
                 * teacher.Add(b);
                 * return teacher;
                 */
                throw new Exception("Someren couldn't connect to the database");
            }
        }
 public List <Teacher> GetTeachers()
 {
     try
     {
         List <Teacher> teacher = teacher_db.Db_Get_All_Teachers();
         return(teacher);
     }
     catch (Exception)
     {
         throw new Exception("Someren (teachers) couldn't connect to the database");
     }
 }
 public List <Teacher> GetTeachers()
 {
     try
     {
         // get the list with teachers by calling a function from the DAL layer
         List <Teacher> teacher = dao.Db_Get_All_Teachers();
         return(teacher); // return list
     }
     catch (Exception)
     {
         throw new Exception("Something went wrong!");
     }
 }
        public List <Teacher> GetTeachers()
        {
            try
            {
                return(teacher_db.Db_Get_All_Teachers());
            }
            catch (Exception)
            {
                List <Teacher> dummylijst = new List <Teacher>();

                Teacher nietbestaandedocent1 = new Teacher(1, "Nepdocentnaam1", "Nepvak", 1);

                dummylijst.Add(nietbestaandedocent1);

                return(dummylijst);
            }
        }
Example #9
0
        void Start()
        {
            Student_DAO studentDAO = new Student_DAO();

            //display all students
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Displaying all students...");
            Console.ResetColor();

            List <Student> students = studentDAO.Db_Get_All_Students();

            foreach (Student student in students)
            {
                Console.WriteLine(student);
            }
            Console.ReadKey();
            //display all teachers
            Teacher_DAO teacherDAO = new Teacher_DAO();

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Displaying all teachers...");
            Console.ResetColor();

            List <Teacher> teachers = teacherDAO.Db_Get_All_Teachers();

            foreach (Teacher teacher in teachers)
            {
                Console.WriteLine(teacher);
            }
            Console.ReadKey();
            //display all rooms
            Room_DAO roomDAO = new Room_DAO();

            //display all students
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Displaying all rooms...");
            Console.ResetColor();

            List <Room> rooms = roomDAO.Db_Get_All_Rooms();

            foreach (Room room in rooms)
            {
                Console.WriteLine(room);
            }
            Console.ReadKey();
        }
Example #10
0
        public List <Teacher> GetTeachers()
        {
            try
            {
                return(teacher_db.Db_Get_All_Teachers());
            }
            catch (Exception e)
            {
                // something went wrong connecting to the database, so we will add a fake student to the list to make sure the rest of the application continues working!
                List <Teacher> teacher = new List <Teacher>();
                Teacher        a       = new Teacher(1, "Test", "Teacher", "*****@*****.**", "0612345678");
                teacher.Add(a);
                return(teacher);

                throw;
                //throw new Exception("Someren couldn't connect to the database");
            }
        }
Example #11
0
        public List <Teacher> GetTeachers()
        {
            try
            {
                List <Teacher> teacher = teacher_db.Db_Get_All_Teachers();
                return(teacher);
            }
            catch (Exception)
            {
                // something went wrong connecting to the database, so we will add a fake student to the list to make sure the rest of the application continues working!
                List <Teacher> teachers = new List <Teacher>();
                Teacher        t        = new Teacher();
                t.Name   = "Mr. Stikker";
                t.Number = 474791;
                teachers.Add(t);
                return(teachers);

                throw new Exception("Someren couldn't connect to the database");
            }
        }
Example #12
0
        public List <Teacher> GetTeachers()
        {
            try
            {
                List <Teacher> teachers = teacher_db.Db_Get_All_Teachers();
                return(teachers);
            }
            catch (Exception)
            {
                // add fake teachers
                List <Teacher> teachers = new List <Teacher>();
                Teacher        a        = new Teacher("Mr.", "Teacher", 001);
                teachers.Add(a);

                Teacher b = new Teacher("Mr.", "Teacher", 002);
                teachers.Add(b);

                MessageBox.Show("Someren couldn't connect to the database");
                return(teachers);
            }
        }
Example #13
0
 public List <Teacher> GetTeachers()
 {
     try
     {
         List <Teacher> Teachers = Teacher_db.Db_Get_All_Teachers();
         return(Teachers);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
         return(new List <Teacher>
         {
             new Teacher
             {
                 Id = 50101,
                 TName = "Peter Stikker",
                 Person = 20101,
                 Subject = "Mathematics"
             }
         });
     }
 }
        public List <Teacher> GetTeacher()
        {
            try
            {
                List <Teacher> Lectuers = Lecturers_db.Db_Get_All_Teachers();
                return(Lectuers);
            }
            catch (Exception)
            {
                // something went wrong connecting to the database, so we will add a fake Teacher to the list to make sure the rest of the application continues working!
                List <Teacher> teachers = new List <Teacher>();
                Teacher        a        = new Teacher();
                a.Name   = "Mr. Test Teacher";
                a.Number = 474791;
                teachers.Add(a);
                Teacher b = new Teacher();
                b.Name   = "Mrs. Test Teacher";
                b.Number = 197474;
                teachers.Add(b);
                return(teachers);

                throw new Exception("Someren couldn't connect to the database");
            }
        }
Example #15
0
 public List <Teacher> GetTeacher()
 {
     return(teacher_db.Db_Get_All_Teachers());
 }