www.pudn.com > classSystem(c++).rar > UserEditDlg.cpp


// UserEditDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "ClassSystem.h" 
#include "UserEditDlg.h" 
#include "UserNode.h" 
#include "UserList.h" 
 
extern CUserNode curUser; 
extern CUserList userlist; 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CUserEditDlg dialog 
 
 
CUserEditDlg::CUserEditDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CUserEditDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CUserEditDlg) 
/*	m_account = curUser. 
	m_CET4 = _T(""); 
	m_city = _T(""); 
	m_CET6 = _T(""); 
	m_college = _T(""); 
	m_dormitory = _T(""); 
	m_email = _T(""); 
	m_homeAddress = _T(""); 
	m_major = _T(""); 
	m_mobilephone = _T(""); 
	m_name = _T(""); 
	m_phone = _T(""); 
	m_postNumber = _T("");*/ 
	//}}AFX_DATA_INIT 
	m_account = curUser.m_account; 
	m_CET4 = curUser.m_CET4; 
	m_city = curUser.m_city; 
	m_CET6 = curUser.m_CET6; 
	m_college = curUser.m_college; 
	m_dormitory = curUser.m_dormitory; 
	m_email = curUser.m_email; 
	m_homeAddress = curUser.m_homeAddress; 
	m_major = curUser.m_major; 
	m_mobilephone = curUser.m_mobilephone; 
	m_name = curUser.m_name; 
	m_phone = curUser.m_phone; 
	m_postNumber = curUser.m_postNumber; 
} 
 
 
void CUserEditDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CUserEditDlg) 
	DDX_Text(pDX, IDC_EDIT_ACCOUNT, m_account); 
	DDX_Text(pDX, IDC_EDIT_CET4, m_CET4); 
	DDX_Text(pDX, IDC_EDIT_CITY, m_city); 
	DDX_Text(pDX, IDC_EDIT_CET6, m_CET6); 
	DDX_Text(pDX, IDC_EDIT_COLLEGE, m_college); 
	DDX_Text(pDX, IDC_EDIT_DORM, m_dormitory); 
	DDX_Text(pDX, IDC_EDIT_EMAIL, m_email); 
	DDX_Text(pDX, IDC_EDIT_HOME, m_homeAddress); 
	DDX_Text(pDX, IDC_EDIT_MAJOR, m_major); 
	DDX_Text(pDX, IDC_EDIT_MOBILE, m_mobilephone); 
	DDX_Text(pDX, IDC_EDIT_NAME, m_name); 
	DDX_Text(pDX, IDC_EDIT_PHONE, m_phone); 
	DDX_Text(pDX, IDC_EDIT_POST, m_postNumber); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CUserEditDlg, CDialog) 
	//{{AFX_MSG_MAP(CUserEditDlg) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CUserEditDlg message handlers 
 
void CUserEditDlg::OnOK()  
{ 
	// TODO: Add extra validation here 
	UpdateData(); 
 
	if(m_account =="") 
	{ 
		MessageBox("学号不能为空!"); 
		return ; 
	} 
	if(m_college == "") 
	{ 
		MessageBox("学院不能为空!"); 
		return ; 
	} 
	if( m_major == "" ) 
	{ 
		MessageBox("专业不能为空!") ; 
		return ; 
	} 
	if(m_name == "") 
	{ 
		MessageBox("姓名不能为空!"); 
		return ; 
	} 
	curUser.m_CET4 = m_CET4; 
	curUser.m_CET6 = m_CET6; 
	curUser.m_city = m_city; 
	curUser.m_college = m_college; 
	curUser.m_dormitory = m_dormitory; 
	curUser.m_email = m_email; 
	curUser.m_homeAddress = m_homeAddress; 
	curUser.m_major = m_major; 
	curUser.m_mobilephone = m_mobilephone; 
	curUser.m_name = m_name; 
	curUser.m_phone = m_phone; 
	curUser.m_postNumber = m_postNumber; 
 
	if(userlist.editInfo(curUser.m_key,curUser)) 
	{ 
		MessageBox("资料修改成功!"); 
	} 
 
	CDialog::OnOK(); 
}