?? personnelinfo.cpp
字號:
// PersonnelInfo.cpp : implementation file
//
#include "stdafx.h"
#include "train.h"
#include "PersonnelInfo.h"
#include "PersonSet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPersonnelInfo dialog
CPersonnelInfo::CPersonnelInfo(CWnd* pParent /*=NULL*/)
: CDialog(CPersonnelInfo::IDD, pParent)
{
//{{AFX_DATA_INIT(CPersonnelInfo)
m_name = _T("");
m_history = _T("");
m_sex = _T("");
m_deptid = 0;
m_hometown = _T("");
m_country = _T("");
m_nation = _T("");
m_idcardnumber = _T("");
m_marriage = _T("");
m_health = _T("");
m_state = _T("");
m_address = _T("");
m_tele = _T("");
m_email = _T("");
m_jobid = 0;
m_startwork = 0;
m_statetime = 0;
m_birth = 0;
//}}AFX_DATA_INIT
}
void CPersonnelInfo::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPersonnelInfo)
DDX_Text(pDX, IDC_EDIT1, m_name);
DDX_CBString(pDX, IDC_COMBO3, m_history);
DDX_CBString(pDX, IDC_COMBO4, m_sex);
DDX_Text(pDX, IDC_EDIT2, m_deptid);
DDX_Text(pDX, IDC_EDIT6, m_hometown);
DDX_Text(pDX, IDC_EDIT7, m_country);
DDX_Text(pDX, IDC_EDIT8, m_nation);
DDX_Text(pDX, IDC_EDIT9, m_idcardnumber);
DDX_Text(pDX, IDC_EDIT10, m_marriage);
DDX_Text(pDX, IDC_EDIT11, m_health);
DDX_Text(pDX, IDC_EDIT13, m_state);
DDX_Text(pDX, IDC_EDIT15, m_address);
DDX_Text(pDX, IDC_EDIT16, m_tele);
DDX_Text(pDX, IDC_EDIT17, m_email);
DDX_Text(pDX, IDC_EDIT18, m_jobid);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER12, m_startwork);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER14, m_statetime);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER5, m_birth);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPersonnelInfo, CDialog)
//{{AFX_MSG_MAP(CPersonnelInfo)
ON_BN_CLICKED(IDC_BUTTONRESET, OnButtonreset)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPersonnelInfo message handlers
void CPersonnelInfo::OnCancel()
{
// TODO: Add extra cleanup here
m_database.Close();
CDialog::OnCancel();
}
void CPersonnelInfo::OnButtonreset()
{
// TODO: Add your control notification handler code here
m_address.Empty();
m_country.Empty();
m_deptid=0;
m_email.Empty();
m_health.Empty();
m_history.Empty();
m_hometown.Empty();
m_idcardnumber.Empty();
m_jobid=0;
m_marriage.Empty();
m_name.Empty();
m_nation.Empty();
m_sex.Empty();
m_state.Empty();
m_tele.Empty();
UpdateData(FALSE);
}
void CPersonnelInfo::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
CString strSQL;
// CResourceSet m_recordset(&m_database);
int i=1;
int flag=0;
while(!flag){
CPersonSet m_recordset(&m_database);
strSQL.Format("select * from PERSONNEL where EMP_NO=%d",i);
m_recordset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL);
if(m_recordset.GetRecordCount()==0){
strSQL.Format("insert into PERSONNEL values(%d,\'%s\',%d,\'%s\',\'%s\',\'%d-%d-%d\',\'%s\',\'%s\',\'%s\',\'%s\',\'%s\',\'%s\',\'%d-%d-%d\',\'%s\',\'%d-%d-%d\',\'%s\',%d,\'%s\',%d)",i,m_name,m_deptid,m_history,m_sex,m_birth.GetYear(),m_birth.GetMonth(),m_birth.GetDay(),m_hometown,m_country,m_nation,m_idcardnumber,m_marriage,m_health,m_startwork.GetYear(),m_startwork.GetMonth(),m_startwork.GetDay(),m_state,m_statetime.GetYear(),m_statetime.GetMonth(),m_statetime.GetDay(),m_address,m_tele,m_email,m_jobid);
m_database.ExecuteSQL(strSQL);
m_database.Close();
CDialog::OnOK();
flag=1;
}
i++;
//m_recordset.Delete();
}
CDialog::OnOK();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -