public List <Room> getRoomByRoomType(string roomType) { DataTable dtInput = rDB.getByRoomTypeID(roomType); List <Room> r = new List <Room>(); DateTime d = DateTime.Now; foreach (DataRow dr in dtInput.Rows) { string ID = (dr["roomID"]).ToString(); // Beware of the possible conversion errors due to type mismatches int status; if (checkStatus(ID, d)) { status = 1; } else { status = 0; } int num = (int)dr["numPerson"]; string type = dr["roomtypeID"].ToString(); r.Add(new Room(ID, status, num, type)); } return(r); }