📄 studentclassr.cpp
字号:
// StudentClassR.cpp : implementation file
//
#include "stdafx.h"
#include "数据库作业.h"
#include "StudentClassR.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStudentClassR dialog
CStudentClassR::CStudentClassR(CWnd* pParent /*=NULL*/)
: CDialog(CStudentClassR::IDD, pParent)
{
//{{AFX_DATA_INIT(CStudentClassR)
m_sno = _T("");
m_cno = 0;
m_grade = 0;
m_bDateStatus = FALSE;
m_sWindowTitle = _T("添加学生信息");
//}}AFX_DATA_INIT
}
void CStudentClassR::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStudentClassR)
DDX_Text(pDX, IDC_EDIT1, m_sno);
DDX_Text(pDX, IDC_EDIT2, m_cno);
DDX_Text(pDX, IDC_EDIT3, m_grade);
DDV_MinMaxInt(pDX, m_grade, 0, 10000);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStudentClassR, CDialog)
//{{AFX_MSG_MAP(CStudentClassR)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStudentClassR message handlers
void CStudentClassR::OnOK()
{
// TODO: Add extra validation here
UpdateData();
if (CheckDate())
{
m_date.cno = m_cno;
m_date.sno = m_sno;
m_date.grade = m_grade;
m_bDateStatus = TRUE;
CDialog::OnOK();
}
}
scinfo CStudentClassR::GetDate() const
{
return m_date;
}
BOOL CStudentClassR::GetDateStatus() const
{
return m_bDateStatus;
}
BOOL CStudentClassR::CheckDate()
{
CString sErr;
if(m_sno.IsEmpty())
{
sErr += "学号必须输入";
AfxMessageBox(sErr);
return FALSE;
}
if (m_cno==0)
{
sErr += "课程号号必须输入";
AfxMessageBox(sErr);
return FALSE;
}
return TRUE;
}
void CStudentClassR::SetDate(scinfo date)
{
m_cno = date.cno;
m_sno = date.sno;
m_grade = date.grade;
}
BOOL CStudentClassR::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText(m_sWindowTitle);
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -