计算机程序设计实践报告
图5 学生界面
4.2 模块详细设计
4.2.1教师模块设计
1) “查看任务”按钮对应函数:
void CDlg_Teacher::OnOK() { // TODO: Add extra validation here
??
_variant_t theValue;
theValue=m_pRecordset->GetCollect(\课程名称\if(theValue.vt!=VT_NULL)
m_Kecheng=(char*)_bstr_t(theValue);
GetDlgItem(IDC_EDIT_kecheng)->SetWindowText(m_Kecheng); theValue=m_pRecordset->GetCollect(\开始时间\if(theValue.vt!=VT_NULL)
m_Kaishi=(char*)_bstr_t(theValue);
GetDlgItem(IDC_EDIT_kaishi)->SetWindowText(m_Kaishi); theValue=m_pRecordset->GetCollect(\结束时间\
6
计算机程序设计实践报告
}
if(theValue.vt!=VT_NULL)
m_Jieshu=(char*)_bstr_t(theValue);
GetDlgItem(IDC_EDIT_jieshu)->SetWindowText(m_Jieshu); theValue=m_pRecordset->GetCollect(\任务描述\if(theValue.vt!=VT_NULL)
m_Miaoshu=(char*)_bstr_t(theValue);
GetDlgItem(IDC_EDIT_miaoshu)->SetWindowText(m_Miaoshu);
2) “查看所有任务”按钮对应函数:
void CDlg_Teacher::OnButton1() { // TODO: Add your control notification handler code here CDlg_Bianji Bian; Bian.DoModal(); }
3) “添加任务”按钮对应函数:
void CDlg_Teacher::OnPreButton2() { // TODO: Add your control notification handler code here try {
??
m_pRecordset->AddNew();
m_pRecordset->Fields->GetItem(\课程名称\m_pRecordset->Fields->GetItem(\开始时间\m_pRecordset->Fields->GetItem(\结束时间\m_pRecordset->Fields->GetItem(\任务描述\
m_pRecordset->Update(); m_pRecordset->Close();
AfxMessageBox(\任务已经成功添加!\}
catch(_com_error e) {
AfxMessageBox(e.ErrorMessage()); } }
4) “下一条”按钮对应函数:
void CDlg_Teacher::OnNextButton3()
7
计算机程序设计实践报告
{ }
// TODO: Add your control notification handler code here m_pRecordset->MoveNext(); if(m_pRecordset->adoEOF) {
AfxMessageBox(\当前为最新任务\m_pRecordset->MoveFirst(); } ??
5) “删除当前任务”按钮对应函数:
void CDlg_Teacher::OnDeleteButton4() { // TODO: Add your control notification handler code here try {
??
m_pRecordset->Delete(adAffectCurrent); m_pRecordset->Update();
??
}
catch(_com_error e) {
AfxMessageBox(e.ErrorMessage()); } }
6) “查看作业“按钮对应函数:
void CDlg_Teacher::OnchankanButton5() { // TODO: Add your control notification handler code here CDlg_xiazai xia; xia.DoModal(); }
7) “退出系统“按钮对应函数:
void CDlg_Teacher::OnCancel() {
8
计算机程序设计实践报告
}
// TODO: Add extra cleanup here CDlg_Exit1 exit; exit.DoModal(); CDialog::OnCancel();
8) “注销登陆”按钮对应函数:
void CDlg_Teacher::OnzhuxiaoButton6() { // TODO: Add your control notification handler code here CDlg_zhuxiao zhu; zhu.DoModal(); }
教师界面具有的功能 跳转到查看所有任务界面的功能 跳转到下载作业界面的功能 逐条查看任务功能 删除任务功能 添加任务功能 注销系统功能 退出系统功能
图6教师界面功能图
4.2.2学生模块设计
1) “查看任务”按钮对应函数:
void CDlg_Student::OnOK() { // TODO: Add extra validation here ?? m_pRecordset->MoveFirst(); _variant_t theValue; theValue=m_pRecordset->GetCollect(\课程名称\ if(theValue.vt!=VT_NULL)
9
计算机程序设计实践报告
}
m_Kecheng=(char*)_bstr_t(theValue);
GetDlgItem(IDC_EDIT_kecheng)->SetWindowText(m_Kecheng); theValue=m_pRecordset->GetCollect(\开始时间\if(theValue.vt!=VT_NULL)
m_Kaishi=(char*)_bstr_t(theValue);
GetDlgItem(IDC_EDIT_kaishi)->SetWindowText(m_Kaishi); theValue=m_pRecordset->GetCollect(\结束时间\if(theValue.vt!=VT_NULL)
m_Jieshu=(char*)_bstr_t(theValue);
GetDlgItem(IDC_EDIT_jieshu)->SetWindowText(m_Jieshu); theValue=m_pRecordset->GetCollect(\任务描述\if(theValue.vt!=VT_NULL)
m_Miaoshu=(char*)_bstr_t(theValue);
GetDlgItem(IDC_EDIT_miaoshu)->SetWindowText(m_Miaoshu);
2) “查看所有任务”按钮对应函数:
void CDlg_Student::OnButton1() { // TODO: Add your control notification handler code here CDlg_Chakan Cha; Cha.DoModal(); }
3)“下一条”按钮对应函数:
void CDlg_Student::OnNextButton2() { // TODO: Add your control notification handler code here m_pRecordset->MoveNext(); if(m_pRecordset->adoEOF) { AfxMessageBox(\当前为最新任务\ m_pRecordset->MoveFirst(); } }
??
4)“上交作业”按钮对应函数:
void CDlg_Student::OnshangjiaoButton3() { // TODO: Add your control notification handler code here CDlg_shangchuan shang;
10