コード例 #1
0
        // Method to confirm the above is aloud to happen.
        bool swapClassValid(CourseBlock a, CourseBlock b)
        {
            List <CourseBlock> tempList = classList; //create a temp list

            swapCourse(a, b);                        //swap the courses
            return(isValid(tempList));               //see if the temp list is valid
        }
コード例 #2
0
        // Method to confirm the above is aloud to happen.
        bool swapProfessorValid(CourseBlock a, CourseBlock b)
        {
            List <CourseBlock> tempList = classList; //create a temp list

            swapProfessor(a, b);                     //swap the profs
            return(isValid(tempList));               //see if the temp list is valid
        }
コード例 #3
0
ファイル: DBMethods.cs プロジェクト: PlebGates/2413-sys-dev
        public void addCourseBlock(CourseBlock block)
        {
            SQLiteCommand cmd = connection.CreateCommand();

            cmd.CommandText = "INSERT INTO schedule (id,professorid,courseid,roomid,time) values (" + block.id + "," + block.professor.id +
                              "," + block.course.id + "," + block.room.id + "," + block.time + ");";
            cmd.ExecuteNonQuery();
        }
コード例 #4
0
        // Method to swap the class taught between two course blocks.
        void swapCourse(CourseBlock a, CourseBlock b)
        {
            Course acourse = a.course;                         //get a's course
            Course bcourse = b.course;                         //get b's course
            int    indexa  = classList.FindIndex(c => c == a); //get the index of a from the class list
            int    indexb  = classList.FindIndex(c => c == b); //get the index of b from the class list

            classList[indexa].course = bcourse;                //set a's course to b's course
            classList[indexb].course = acourse;                //set b's course to a's course
        }
コード例 #5
0
        // Method to swap a room with another course blocks room.
        void swapRoom(CourseBlock a, CourseBlock b)
        {
            Room aroom  = a.room;                           //get a's room
            Room broom  = b.room;                           //get b's room
            int  indexa = classList.FindIndex(c => c == a); //get the index of a from the class list
            int  indexb = classList.FindIndex(c => c == b); //get the index of b from the class list

            classList[indexa].room = broom;                 //set a's room to b's room
            classList[indexb].room = aroom;                 //set b's room to a's room
        }
コード例 #6
0
        // Method to swap a professor with another course blocks professor.
        void swapProfessor(CourseBlock a, CourseBlock b)
        {
            Professor aprof  = a.professor;                      //get a's professor
            Professor bprof  = b.professor;                      //get b's professor
            int       indexa = classList.FindIndex(c => c == a); //get the index of a from the class list
            int       indexb = classList.FindIndex(c => c == b); //get the index of b from the class list

            classList[indexa].professor = bprof;                 //set a's prof to b's prof
            classList[indexb].professor = aprof;                 //set b's prof to a's prof
        }
コード例 #7
0
        // Method to swap a course with another time block (or course).
        void swapCourseBlock(CourseBlock a, CourseBlock b)
        {
            int atime  = a.time;                           //get the value of a's timeblock
            int btime  = b.time;                           //get the value of b's timeblock
            int indexa = classList.FindIndex(c => c == a); //get the index of a from the class list
            int indexb = classList.FindIndex(c => c == b); //get the index of b from the class list

            classList[indexa].time = btime;                //set the time of a to b's time
            classList[indexb].time = atime;                //set the time of b to a's time
        }
コード例 #8
0
ファイル: DBMethods.cs プロジェクト: PlebGates/2413-sys-dev
        public CourseBlock getBlock(int id)
        {
            SQLiteCommand cmd = connection.CreateCommand();

            cmd.CommandText = "select * from schedule where id = " + id;
            CourseBlock block = new CourseBlock();

            using (SQLiteDataReader data = cmd.ExecuteReader())
            {
                while (data.Read())
                {
                    block.id        = id;
                    block.professor = getProfessor(data.GetInt32(1));
                    block.course    = getCourse(data.GetInt32(2));
                    block.room      = getRoom(data.GetInt32(3));
                    block.time      = data.GetInt32(4);
                    return(block);
                }
            }
            return(null);
        }