public List <Room> GetRooms() { try { List <Room> room = room_db.Db_Get_All_Rooms(); return(room); } 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 <Room> room = new List <Room>(); Room a = new Room(); a.Number = 111; a.Type = false; a.Capacity = 6; room.Add(a); Room b = new Room(); b.Number = 222; b.Type = true; b.Capacity = 4; room.Add(b); System.Windows.Forms.MessageBox.Show("Someren couldn't connect to the database"); return(room); } }
public List <Room> GetRooms() { /*try * {*/ List <Room> rooms = room_db.Db_Get_All_Rooms(); return(rooms); /*}*/ /*catch (Exception ex) * { * /* * // 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"); * * * * } * return new List<Room>();*/ }
public List <Room> GetRooms() { try { List <Room> room = room_db.Db_Get_All_Rooms(); return(room); } catch (Exception) { // make some fake rooms when the program is not able to connect to the database List <Room> room = new List <Room>(); Room a = new Room(); a.Number = 2; a.Capacity = 4; a.Type = false; room.Add(a); Room b = new Room(); b.Number = 2; b.Capacity = 4; b.Type = true; room.Add(b); return(room); throw new Exception("Someren couldn't connect"); } }
public List <Room> GetRooms() { try { List <Room> room = room_db.Db_Get_All_Rooms(); return(room); } 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 <Room> room = new List <Room>(); Room a = new Room(); a.Capacity = 5; a.RoomNumber = 474791; a.Type = true; room.Add(a); // a.Type = ; Room b = new Room(); b.Capacity = 5; b.RoomNumber = 474791; b.Type = true; room.Add(b); return(room); //throw new Exception("Someren couldn't connect to the database"); } }
public List <Room> GetRooms() { try { List <Room> room = student_db.Db_Get_All_Rooms(); return(room); } catch (Exception) { /*List<Room> rooms = new List<Room>(); * * Room room = new Room(); * room.Room_Id = 5; * room.Type = "Student"; * room.Occupied = "Taken"; * room.Size = 12; * rooms.Add(room); * * Room room1 = new Room(); * room.Room_Id = 12; * room.Type = "Teacher"; * room.Occupied = "Not Taken"; * room.Size = 43; * rooms.Add(room); * * return rooms;*/ throw new Exception("No connection to the database."); } }
public List <Room> GetRooms() { try { List <Room> room = room_db.Db_Get_All_Rooms(); return(room); } catch (Exception) { List <Room> room = new List <Room>(); Room r1 = new Room(); r1.Number = 2; r1.Capacity = 30; r1.Type = true; room.Add(r1); Room r2 = new Room(); r2.Number = 2; r2.Capacity = 20; r2.Type = false; room.Add(r2); return(room); throw new Exception("Someren couldnt connect!"); } }
public List <Room> GetRooms() { try { List <Room> room = room_db.Db_Get_All_Rooms(); return(room); } catch (Exception e) { Console.WriteLine(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 <Room> room = new List <Room>(); Room a = new Room(); a.Number = 999; a.Capacity = 4; a.Type = true; room.Add(a); Room b = new Room(); b.Number = 998; b.Capacity = 16; b.Type = false; room.Add(b); return(room); //throw new Exception("Someren couldn't connect to the database"); } }
public List <Room> Getrooms() { try { List <Room> rooms = room_db.Db_Get_All_Rooms(); return(rooms); } catch (Exception) { throw new Exception("Someren couldn't connect to the database"); } }
public List <Room> GetRooms() { try { // get the list with rooms by calling a function from the DAL layer List <Room> room = dao.Db_Get_All_Rooms(); return(room); } catch (Exception) { throw new Exception("Something went wrong!"); } }
public List <Room> GetRooms() { try { List <Room> rooms = room_db.Db_Get_All_Rooms(); return(rooms); } 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 <Room> rooms = new List <Room>(); return(rooms); //throw new Exception("Someren couldn't connect to the database"); } }
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(); }
public List <Room> GetRoom() { try { return(room_db.Db_Get_All_Rooms()); } 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 <Room> room = new List <Room>(); Room a = new Room(69420, "Grote kamer", 6); room.Add(a); return(room); throw; //throw new Exception("Someren couldn't connect to the database"); } }
public List <Room> GetRooms() { List <Room> rooms = new List <Room>(); try { rooms = room_db.Db_Get_All_Rooms(); return(rooms); } catch (Exception e) { MessageBox.Show(e.ToString()); Room room1 = new Room() { Number = 1234, Type = false, Capacity = 4 }; rooms.Add(room1); return(rooms); } //hurdur i comment }
public List <Room> GetRooms() { try { List <Room> studentList = room_db.Db_Get_All_Rooms(); return(studentList); } catch (Exception e) { Console.Write(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 <Room> rooms = new List <Room>(); Room a = new Room(); a.Capacity = 1; a.Number = 474791; Room b = new Room(); b.Capacity = 1; b.Number = 474791; rooms.Add(a); rooms.Add(b); return(rooms); //throw new Exception("Someren couldn't connect to the database"); } }