コード例 #1
0
 public List <Student> GetStudents()
 {
     try
     {
         List <Student> student = student_db.Db_Get_All_Students();
         return(student);
     }
     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 <Student> student = new List <Student>();
         Student        a       = new Student();
         a.FirstName = "Henk";
         a.LastName  = "De Tester";
         a.Purchases = 3;
         a.Number    = 474791;
         //a.BirthDate = DateTime.Parse("1990-07-04");
         student.Add(a);
         Student b = new Student();
         b.FirstName = "Sjaak";
         b.LastName  = "De Tester";
         b.Number    = 197474;
         b.Purchases = 2;
         //b.BirthDate = DateTime.Parse("2019-03-04");
         student.Add(b);
         return(student);
         //throw new Exception("Someren couldn't connect to the database");
     }
 }
コード例 #2
0
        public List <Student> GetStudents()
        {
            try
            {
                List <Student> student = student_db.Db_Get_All_Students();
                return(student);
            }
            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 <Student> student = new List <Student>();
                Student        a       = new Student();
                a.StudentNumber = 639567;
                a.FirstName     = "FirstName";
                a.LastName      = "LastName";
                a.Class         = "A";
                a.Address       = "IJmuiden";
                a.RoomNumber    = 06;
                student.Add(a);

                return(student);
                //    a. = DateTime.Parse("1990-07-04");
                //throw new Exception("Someren couldn't connect to the database");
            }
        }
コード例 #3
0
 public List <Student> GetStudents()
 {
     try
     {
         List <Student> student = student_db.Db_Get_All_Students();
         return(student);
     }
     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<Student> student = new List<Student>();
         //Student a = new Student();
         //a.Name = "Mr. Test Student";
         //a.Number = 474791;
         //a.BirthDate = DateTime.Parse("1990-07-04");
         //student.Add(a);
         //Student b = new Student();
         //b.Name = "Mrs. Test Student";
         //b.Number = 197474;
         //b.BirthDate = DateTime.Parse("2019-03-04");
         //student.Add(b);
         //return student;
         throw new Exception("Someren couldn't connect to the database");
     }
 }
コード例 #4
0
        public List <Student> GetStudents()
        {
            try
            {
                List <Student> student = student_db.Db_Get_All_Students();
                return(student);
            }
            catch (Exception)
            {
                MessageBox.Show("There was an error connecting to the database", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error); //Show Error window if

                // 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 <Student> student = new List <Student>();
                Student        a       = new Student();
                a.FName     = "Test";
                a.LName     = "Student";
                a.Number    = 474791;
                a.BirthDate = DateTime.Parse("1990-07-04");
                student.Add(a);
                Student b = new Student();
                b.LName = "Student2";
                b.FName = "Test";

                b.Number    = 197474;
                b.BirthDate = DateTime.Parse("2019-03-04");
                student.Add(b);
                return(student);
                //throw new Exception("Someren couldn't connect to the database");
            }
        }
コード例 #5
0
ファイル: Student_Service.cs プロジェクト: sensei98/someren
        public List <Student> GetStudents()
        {
            try
            {
                List <Student> student = student_db.Db_Get_All_Students();
                return(student);
            }
            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 <Student> student = new List <Student>();
                Student        a       = new Student();
                a.FirstName     = "Test";
                a.LastName      = "Sample";
                a.StudentNumber = 127345;
                a.Year          = 1;
                student.Add(a);
                Student b = new Student();
                b.FirstName     = "Tester";
                b.LastName      = "Sample";
                b.StudentNumber = 197474;
                b.Year          = 1;
                student.Add(b);
                return(student);

                throw new Exception("Someren couldn't connect to the database");
            }
        }
コード例 #6
0
 public List <Student> GetStudents()
 {
     try
     {
         List <Student> student = student_db.Db_Get_All_Students();
         return(student);
     }
     catch (Exception)
     {
         throw new Exception("Someren (students) couldn't connect to the database");
     }
 }
コード例 #7
0
 public List <Student> GetStudents()
 {
     try
     {
         List <Student> student = student_db.Db_Get_All_Students(); // get the list with students from the DAL layer
         return(student);                                           // return the list
     }
     catch (Exception)
     {
         throw new Exception("Something went wrong!");
     }
 }
コード例 #8
0
        public List <Student> GetStudents()
        {
            List <Student> student = new List <Student>();

            try
            {
                student = student_db.Db_Get_All_Students();
                return(student);
            }
            catch
            {
                string   exp   = "SomerenApp couldn't get the student list";
                ErrorDAO error = new ErrorDAO(exp);
                return(null);
            }
        }
コード例 #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();
        }
コード例 #10
0
        public List <Student> GetStudents()
        {
            try
            {
                return(student_db.Db_Get_All_Students());
            }
            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 <Student> student = new List <Student>();
                Student        a       = new Student(1, "Test", "Student", "*****@*****.**", "0612345678");
                student.Add(a);
                return(student);

                throw;
                //throw new Exception("Someren couldn't connect to the database");
            }
        }
        public List <Student> GetStudents()
        {
            try
            {
                List <Student> student = student_db.Db_Get_All_Students();
                return(student);
            }
            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 <Student> student = new List <Student>();
                Student        a       = new Student(1, "Sander Nederstigt", 1);

                student.Add(a);

                Student b = new Student(2, "Hajk Grigorian", 2);

                student.Add(b);

                return(student);
                //throw new Exception("Someren couldn't connect to the database");
            }
        }
コード例 #12
0
 public List <Student> GetStudents()
 {
     return(student_db.Db_Get_All_Students());
 }