Database Development Based on MFC Application in Management of Curriculum Information

There are hundreds of records in the curriculum of our Language Learning Lab every semester and every record has several important properties. It takes too much time to manage the information in the traditional way and it always makes mistakes. Managing the information with database technology, designing program to access the database with Visual c tool, setting a combobox in the application UI and inquiring curriculum information by selecting the room name in the combobox. It is easy to operate the program for the staff members. The result is accurate, this way promotes the efficiency of managing information.


Present Curriculum Management in Language Learning Center
Foreign language is an important course for college students and all the freshmen need to study language course in learning center.There are more than 200 language courses in learning center every semester.Every course includes day of the week, lesson time, room, teacher, lesson name, class name.We got the excel file includes course information from the office of academic affairs at the beginning of the semester.We can see the Figure 1.We can sort there cords simply with excel software.
Lab technicians get the course information.They need to order the informa-

Course Information Query and Simple Sorting
When we sort the course records of the learning center, we can know the room which is available sometime.We can maintain the equipment of the room in the vacant time, so query function is very important.Introduction of SQL sentence [6].We can input command to operate the database.The grammar is as follows.
SELECT column name FROM table name.We can add other condition, such as where, order by [7] [8].The column name is the property.
Example of SELECT sentence (query course information of room 505 and order by day of week).
Select sentence is as follows.SELECT * FROM room where 教室 = "教 5 楼 505" order by 星期 asc.Select is query.Room is the table name, 教室、星期 is the attribute of the table.The data is order by day of week ascending.The result is shown as Figure 2.

Course Information
In Figure 3, we can get the course records of room 505, and the result is sorted by day of week and lesson time.When we use SQL sentence to query the records, we can know the information of room 505 accurately and the result is ordered.

Course Records Query for All the Room in the Learning Center
When a teacher wants to change a room, the technician needs to know the vacant room at a time.We need to query the course records order by "星期、节次、 教室号".The SQL sentence is as follows.SELECT * FROM room order by 星期, 节次, 教室 asc.The result is shown as Figure 4.
When we use the SQL sentence, we can see which room is occupied at a time, and the records are sorted by day of week, lesson time, room.It's very convenient to modify the course information.If a room is vacant at a time, a teacher can add a lesson in the room.

MFC Structure and Program Designing
We can query data in database and it is very efficient.When lab technician wants to use it easily, we need to design software with MFC structure.The paper design an MFC program to query the course database, and it is easily for lab technician to operate [10] [11].

The MFC Frame Structure
Visual studio is a developing toolkit and is a developing environment pushed out by Microsoft Company.We design the program with MFC library.MFC means Microsoft Foundation Classes.When we create an MFC project, the project will generate 4 classes [12] [13] [14] (the view, the doc, the main Frame, the app).It is very convenient for programmer to design software in windows environment.The MFC frame defines the frame and offers the standard ways for user interface.The programer adds the functions in the frame.
CDocument: it is a document class [15], the memory data communicates with database data with it.CView: it is view class.Users communicate with the memory data [16] with it and it includes interface and on draw function.
We add a combobox in the toolbar.The combox accesses the database and gets the course information.When the program is initiated, it adds the room number in the combobox.The user doesn't need to type the room number.CStringsel = "SELECT 教室 FROM room group by 教室".The SQL sentence can query the room number and the records of same room number can generate one room number.The number is sorted.
The variable frame is the pointer of Mainframe in view class, frame->m_wndToolBar.m_combo_room.AddString (strRoom).Add the room number in the combobox, room number is queried form database. strRoom is the room number from database.
When user chooses room number, the room number will be the variable m_strobj Room.The program will operate invalidate (TRUE) to call the On Draw function, then the visual region will be refreshed [17] [18].
(2) Generatingsqlsentenceautomatically according the user's demand.if(strcmp(m_strobjRoom,"全部")==0) { sel.Format("SELECT * FROM room order by 星期, 节次, 教室"); } else { sel.Format("SELECT * FROM room where 教室='%s' order by 星期, 节次 ",m_strobjRoom); } According the user's choice the program generates the SQL sentence.If the user chooses all the room, we query all the room in the course database.If the user chooses one room, the program generates the SQL sentence to query the course information for the room.The variable m_strobjRoom is the selected room number.When the user chooses all the room, the program generate the first SQL sentence.When the user chooses one room, the program generates the second SQL sentence.

The Result Is Shown in the View Class
There is a function called on draw in view class.The result is shown with the function.In order to make it easy to be found for user, the record in a day of week is set a color.For example the data of Monday is green, Tuesday is red.
pDC->SetTextColor(RGB(255,0,0)).The function set text color can set color for data.The value in RGB is different then the color is different.
pDC->TextOut(ptorigin.x+xnstep1,ptorigin.y,strClass).The function prints the records in the view.The variable ptorigin is the origin point.When the next record is shown, ptorigin.y is added a step length.When we traverse the data, all the records are shown in the view with different color.

The Program Flow Char and Operation Interface
The program includes several steps.
1) The program initiates MFC frame and generates the mainframe and the view.
2) The program Accesses the database and gets the course information.It adds the room number in the combobox.
3) The user chooses the choice in the combobox.The program generates SQL sentence.
4) The program opens the Room database, queries the information and gets result.
5) The result is shown in the view.The record's color of different day is different.Close the database.If the user continues to query, go to step 3.
The flow chart is shown as Figure 5.The program's interface and the result is shown as Figure 6.The combobox is shown in the red ellipse.The user can choose room number in the combobox.
The result is the course information of 教 5 楼 312.The data's color from Monday to Friday is different and course information is sorted by day of week, lesson time, it is easy find a record.

The Conclusion
We design a program to access database with Visual studio; it can manage the course information efficiently.When the program query the database, the query time is less than 1 second (the count of records is several hundred).It is more convenient than the traditional way.The course information's color is different, so we can find information easily.The user doesn't need to study the database knowledge and SQL sentence.It can run in OS win 7 win 10 and so on.It solves

Figure 2 .
Figure 2. The query result order by day of week for one room.

Query and Complex Sorting 2 . 2 . 1 .
Query the Course Information for a Room and Complex OrderExample of SELECT sentence (course records query of room 505 and order by day of week, lesson), SELECT sentence is as follows.

Figure 3 .
Figure 3.The query result sorted by day of week, lesson for one room.

Figure 4 .
Figure 4.The query result of all the room.