#include \#include \#include \#include \#include \#ifdef _DEBUG
#define new DEBUG_NEW #undef THIS_FILE
static char THIS_FILE[] = __FILE__; #endif
//////////////////////////////////////////////////////////////////// // CDelStudentDlg dialog
CDelStudentDlg::CDelStudentDlg(CWnd* pParent /*=NULL*/) {
//{{AFX_DATA_INIT(CDelStudentDlg) m_Name = _T(\m_Sex = _T(\m_Native = _T(\m_Tel = _T(\m_QQ = _T(\m_Email = _T(\m_HomeAddress = _T(\m_Age = 0; //}}AFX_DATA_INIT
: CDialog(CDelStudentDlg::IDD, pParent)
21
}
void CDelStudentDlg::DoDataExchange(CDataExchange* pDX) { }
BEGIN_MESSAGE_MAP(CDelStudentDlg, CDialog)
//{{AFX_MSG_MAP(CDelStudentDlg) ON_COMMAND(ID_MANAGE_DEL, OnManageDel)
ON_BN_CLICKED(IDC_BUTTON_Cancle, OnBUTTONCancle)
ON_CBN_SELCHANGE(IDC_COMBO_DEL_No, OnSelchangeCOMBODELNo) ON_BN_CLICKED(IDC_BUTTON_DEL, OnButtonDel) //}}AFX_MSG_MAP
CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDelStudentDlg)
DDX_Control(pDX, IDC_COMBO_DEL_No, m_No); DDX_Text(pDX, IDC_EDIT_DEL_Name, m_Name); DDX_Text(pDX, IDC_EDIT_DEL_Sex, m_Sex); DDX_Text(pDX, IDC_EDIT_DEL_Native, m_Native); DDX_Text(pDX, IDC_EDIT_DEL_Tel, m_Tel); DDX_Text(pDX, IDC_EDIT_DEL_QQ, m_QQ); DDX_Text(pDX, IDC_EDIT_DEL_Email, m_Email);
DDX_Text(pDX, IDC_EDIT_DEL_HomeAddress, m_HomeAddress); DDX_Text(pDX, IDC_EDIT_DEL_Age, m_Age); //}}AFX_DATA_MAP
END_MESSAGE_MAP()
22
///////////////////////////////////////////////////////////////////// // CDelStudentDlg message handlers
void CDelStudentDlg::OnManageDel() { }
void CDelStudentDlg::OnBUTTONCancle() { }
void CDelStudentDlg::OnSelchangeCOMBODELNo() {
// TODO: Add your control notification handler code here int vSize=(int)m_v.size(); UpdateData(true); CString m_strNo;
m_No.GetWindowText(m_strNo); for(int i=0;i if (m_strNo==m_v[i]->GetStuNo()) { } break; // TODO: Add your control notification handler code here CDialog::OnCancel(); // TODO: Add your command handler code here CDelStudentDlg dlgDel; dlgDel.DoModal(); 23 } } m_Name=m_v[i]->GetStuName(); m_Sex=m_v[i]->GetSex(); m_Native=m_v[i]->GetNative(); m_Age=m_v[i]->GetAge(); m_HomeAddress=m_v[i]->GetHomeAddress(); m_Tel=m_v[i]->GetTelephone(); m_QQ=m_v[i]->GetQQ(); m_Email=m_v[i]->GetEmail(); UpdateData(false); BOOL CDelStudentDlg::OnInitDialog() { return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE CDialog::OnInitDialog(); // TODO: Add extra initialization here CStudentDoc doc; m_v=doc.GetStudentList(); int vSize=(int)m_v.size(); for(int i=0;i UpdateData(false); m_No.AddString(m_v[i]->GetStuNo()); 24 } void CDelStudentDlg::OnButtonDel() { // TODO: Add your control notification handler code here UpdateData(TRUE); CStudent tmpStu; CString m_strNo; m_No.GetWindowText(m_strNo); tmpStu.SetStuName(m_Name); tmpStu.SetStuNo(m_strNo); tmpStu.SetSex(m_Sex); tmpStu.SetAge(m_Age); tmpStu.SetHomeAddress(m_HomeAddress); tmpStu.SetNative(m_Native); tmpStu.SetTelephone(m_Tel); tmpStu.SetQQ(m_QQ); tmpStu.SetEmail(m_Email); CStudentDoc stuDoc; if (stuDoc.Del(tmpStu)) { } else { } MessageBox(\删除学生信息失败!\MessageBox(\成功删除学生信息!\CDialog::OnOK(); 25