📄 addteacherbasedlg.cpp
字号:
// AddTeacherBaseDlg.cpp : implementation file
//
#include "stdafx.h"
#include "TeacherMIS.h"
#include "AddTeacherBaseDlg.h"
#include "TeacherBase.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAddTeacherBaseDlg dialog
CAddTeacherBaseDlg::CAddTeacherBaseDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAddTeacherBaseDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CAddTeacherBaseDlg)
m_strAddress = _T("");
m_strDegree = _T("");
m_strEmail = _T("");
m_strFolk = _T("");
m_strMail = _T("");
m_strMobile = _T("");
m_strName = _T("");
m_strNative = _T("");
m_strOffice = _T("");
m_strSchool = _T("");
m_strSpecialty = _T("");
m_strTchID = _T("");
m_strBirth = _T("");
//}}AFX_DATA_INIT
CString strConnection="File Name=TeacherMIS.udl";
pDB=new CADODatabase;
pDB->Open(strConnection);
pRs=new CADORecordset(pDB);
}
void CAddTeacherBaseDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAddTeacherBaseDlg)
DDX_Control(pDX, IDC_COMBO_TYPE, m_comboType);
DDX_Control(pDX, IDC_COMBO_MARRIGE, m_comboMar);
DDX_Control(pDX, IDC_COMBO_PROFESSION, m_comboPro);
DDX_Control(pDX, IDC_COMBO_SEX, m_comboSex);
DDX_Text(pDX, IDC_EDIT_ADDRESS, m_strAddress);
DDX_Text(pDX, IDC_EDIT_DEGREE, m_strDegree);
DDX_Text(pDX, IDC_EDIT_EMAIL, m_strEmail);
DDX_Text(pDX, IDC_EDIT_FOLK, m_strFolk);
DDX_Text(pDX, IDC_EDIT_MAIL, m_strMail);
DDX_Text(pDX, IDC_EDIT_MOBILE, m_strMobile);
DDV_MaxChars(pDX, m_strMobile, 11);
DDX_Text(pDX, IDC_EDIT_NAME, m_strName);
DDX_Text(pDX, IDC_EDIT_NATIVE, m_strNative);
DDX_Text(pDX, IDC_EDIT_OFFICE, m_strOffice);
DDV_MaxChars(pDX, m_strOffice, 12);
DDX_Text(pDX, IDC_EDIT_POLITICAL, m_strPolitical);
DDX_Text(pDX, IDC_EDIT_SCHOOL, m_strSchool);
DDX_Text(pDX, IDC_EDIT_SPECIALTY, m_strSpecialty);
DDX_Text(pDX, IDC_EDIT_TCHID, m_strTchID);
DDX_Text(pDX, IDC_EDIT_BIRTH, m_strBirth);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAddTeacherBaseDlg, CDialog)
//{{AFX_MSG_MAP(CAddTeacherBaseDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAddTeacherBaseDlg message handlers
BOOL CAddTeacherBaseDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_comboSex.AddString("男");
m_comboSex.AddString("女");
m_comboMar.AddString("已婚");
m_comboMar.AddString("未婚");
m_comboType.AddString("本科");
m_comboType.AddString("硕士");
m_comboType.AddString("博士");
m_comboType.AddString("博士后");
m_comboPro.AddString("助教");
m_comboPro.AddString("讲师");
m_comboPro.AddString("副教授");
m_comboPro.AddString("教授");
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CAddTeacherBaseDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
CString sex,type,marriage,profession;
CString birth1;
// COleDateTime birthday;
m_comboSex.GetWindowText(sex);
m_comboMar.GetWindowText(marriage);
m_comboType.GetWindowText(type);
m_comboPro.GetWindowText(profession);
// m_strBirth=birthday.Format(_T("%Y-%m-%d"));
// if (birthday.GetYear()<1940)
// {
// MessageBox("输入出生日期出错!");
// return;
// }
CTeacherBase Tch;
Tch.SetTchID(m_strTchID);
Tch.SetSex(sex);
Tch.SetName(m_strName);
Tch.SetAddress(m_strAddress);
Tch.SetBirth(m_strBirth);
Tch.SetDegree(m_strDegree);
Tch.SetEmail(m_strEmail);
Tch.SetFolk(m_strFolk);
Tch.SetMail(m_strMail);
Tch.SetMobilephon(m_strMobile);
Tch.SetNative(m_strNative);
Tch.SetOfficephon(m_strOffice);
Tch.SetPolitical(m_strPolitical);
Tch.SetSchool(m_strSchool);
Tch.SetSpecialty(m_strSpecialty);
Tch.SetProfession(profession);
Tch.SetMarriage(marriage);
Tch.SetTchType(type);
Tch.AddRecord();
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -