/// <summary>
 /// Private constructer called on start-up, loads the data from the database
 /// </summary>
 private DomainControler()
 {
     dataBaseHelper = new DataBase();
     institute = new Institute("it carlow");
     institute.setBuildingList(dataBaseHelper.loadBuildingList(institute));
     institute.setDeptList(dataBaseHelper.loadDepartmentList(institute));
 }
        static void Main(string[] args)
        {
            DataBase mybd = new DataBase();
            Institute itc = new Institute("it carlow");
            itc.setBuildingList(mybd.loadBuildingList(itc));
            itc.setDeptList(mybd.loadDepartmentList(itc));

            Console.Read();
        }
        public Generate(Institute institute)
        {
            //load all the room from the instuite into a single room
            LinkedList Buildings = institute.getBuildingList();
            Node buildNode = Buildings.head ;
            while (buildNode.next != null)
            {
                Building tempBuild = (Building)buildNode.data;
                LinkedList roomList = tempBuild.getRoomList();
                Node roomNode = roomList.head;

            }
        }
 /// <summary>
 /// Private constructer called on start-up, loads the data from the database
 /// </summary>
 private DomainControler()
 {
     dataBaseHelper = new DataBase();
     dataBaseHelper.update();
     institute = new Institute("it carlow");
 }
        /// <summary>
        ///     Returns a list of Departments
        /// </summary>
        /// <param name="institute">The Institute the Departments are in</param>
        /// <returns>A LinkedList of Departments</returns>
        public LinkedList loadDepartmentList(Institute institute)
        {
            LinkedList deptList = new LinkedList();
            Department tempDept ;
            string sqlStatment = "SELECT * FROM Department";
            try
            {
                OpenConection();
                cmd = new OleDbCommand(sqlStatment, conn);
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    if (reader["Deleted"].ToString().Equals("False"))
                    {
                        tempDept = new Department();
                        tempDept.setId(reader["ID"].ToString());
                        tempDept.setName(reader["Dept_Name"].ToString());
                        tempDept.setLecturerList(loadLectuerList(tempDept));
                        tempDept.setCourseList(loadCourseList(tempDept));
                        deptList.addAtTail("tempDept");
                    }

                }
                CloseConnection();
            }
            catch
            {

            }
            return deptList;
        }
        /// <summary>
        ///     Returns a list of buildings
        /// </summary>
        /// <param name="institute">The Institute the Buildings are in</param>
        /// <returns>A LinkedList of Buildings</returns>
        public LinkedList loadBuildingList(Institute institute)
        {
            LinkedList buildingList = new LinkedList();
            Building tempBuild;
            string sqlStatment = "SELECT * FROM Building";
            try
            {
                OpenConection();
                cmd = new OleDbCommand(sqlStatment, conn);
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    if (reader["Deleted"].ToString().Equals("False"))
                    {
                        tempBuild = new Building();
                        tempBuild.setId(reader["ID"].ToString());
                        tempBuild.setName("Building_Name");
                        tempBuild.setRoomList(loadRoomList(tempBuild));
                        buildingList.addAtTail(tempBuild);
                    }
                }
                CloseConnection();
            }
            catch
            {

            }
            return buildingList;
        }