資源簡介
mfc郵箱地址管理系統(c++,access),實現個人郵箱和群組郵箱查看,搜索,管理,添加,刪除。群組郵箱可實現一對多對應關系。

代碼片段和文件信息
/************************************************************************/
/*?
郵件地址管理程序?添加模塊
北京交通大學?計科1101?李高鋒???11281009????????????????????????????????????????????????????????????????*/
/************************************************************************/
#include?“stdafx.h“
#include?“EMailManager.h“
#include?“AddGeneral.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
extern?CDatabase?m_db;
extern?CRecordset?m_rec;
/////////////////////////////////////////////////////////////////////////////
//?CAddGeneral?dialog
CAddGeneral::CAddGeneral(CWnd*?pParent?/*=NULL*/)
:?CDialog(CAddGeneral::IDD?pParent)
{
//{{AFX_DATA_INIT(CAddGeneral)
m_mail?=?_T(““);
m_name?=?_T(““);
m_tel?=?_T(““);
m_tip?=?_T(““);
m_info?=?_T(““);
//}}AFX_DATA_INIT
}
void?CAddGeneral::DoDataExchange(CDataExchange*?pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAddGeneral)
DDX_Text(pDX?IDC_EDIT_ADD1_MAIL?m_mail);
DDX_Text(pDX?IDC_EDIT_ADD1_NAME?m_name);
DDX_Text(pDX?IDC_EDIT_ADD1_TEL?m_tel);
DDX_Text(pDX?IDC_STATIC_ADD1TIP?m_tip);
DDX_Text(pDX?IDC_STATIC_ADDINFO?m_info);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAddGeneral?CDialog)
//{{AFX_MSG_MAP(CAddGeneral)
ON_EN_KILLFOCUS(IDC_EDIT_ADD1_MAIL?OnKillfocusEditAdd1Mail)
ON_EN_KILLFOCUS(IDC_EDIT_ADD1_NAME?OnKillfocusEditAdd1Name)
ON_EN_KILLFOCUS(IDC_EDIT_ADD1_TEL?OnKillfocusEditAdd1Tel)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CAddGeneral?message?handlers
void?CAddGeneral::OnOK()?
{
//?TODO:?Add?extra?validation?here
UpdateData(TRUE);
if?(m_mail?==?““)
{
AfxMessageBox(“郵箱地址不能為空!“);
return;
}
if?(AddType?==?““)
{
AddType?=?“個人郵箱“;
}
CString?strSQL;
if?(ParentId?==?““)
{
strSQL?=?“insert?into?[Mail]?(EMail?MailName?Tel??Type?Parent)?values?(‘“?+?m_mail?+?“‘‘“?+?m_name
+?“‘‘“?+?m_tel?+?“‘??‘“?+??AddType?+?“‘?0)“;
}
else
{
strSQL?=?“insert?into?[Mail]?(EMail?MailName?Tel??Type?Parent)?values?(‘“?+?m_mail?+?“‘‘“?+?m_name
+?“‘‘“?+?m_tel?+?“‘??‘“?+??AddType?+?“‘“?+?ParentId?+?“)“;
}
m_db.ExecuteSQL(LPCSTR(strSQL));
CDialog::OnOK();
AfxMessageBox(“添加成功!“);
}
void?CAddGeneral::OnKillfocusEditAdd1Mail()?
{
UpdateData(TRUE);
m_tip?=?““;
if?(ParentId?!=?““)
{
if?(m_mail?==?““)
{
return;
}
CString?strSQL?=?“select?*?from?Mail?where?EMail?=?‘“?+?m_mail?+?“‘?AND??Parent?=?“?+?ParentId;
BSTR?bstrSQL=strSQL.AllocSysString();
m_rec.Open(CRecordset::dynasetstrSQL);
CString?Id;
while(!m_rec.IsEOF())?
{
m_rec.GetFieldValue(“ID“Id);?
m_rec.MoveNext();
}
if(m_rec.IsOpen())
{
m_rec.Close();
}
if?(Id?!=?““)
{
AfxMessageBox(“此群組郵箱已存在要添加的郵箱,請不要重復添加“);
m_mail?=?““;
m_tip?=?““;
UpdateData(FALSE);
GetDlgItem(IDC_EDIT_ADD1_MAIL)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4383??2012-05-17?22:49??EMailManager\AddGeneral.cpp
?????文件???????1428??2012-05-17?20:26??EMailManager\AddGeneral.h
?????文件?????315392??2012-05-17?22:40??EMailManager\data\EMailManager.mdb
?????文件??????38348??2012-05-17?22:41??EMailManager\EMailManager.aps
?????文件???????2671??2012-05-17?22:50??EMailManager\EMailManager.clw
?????文件???????1876??2012-05-17?22:38??EMailManager\EMailManager.cpp
?????文件???????4474??2012-05-17?22:36??EMailManager\EMailManager.dsp
?????文件????????532??2012-05-17?16:17??EMailManager\EMailManager.dsw
?????文件???????1248??2012-05-17?16:17??EMailManager\EMailManager.h
?????文件??????82944??2012-05-17?22:50??EMailManager\EMailManager.ncb
?????文件??????50688??2012-05-17?22:50??EMailManager\EMailManager.opt
?????文件???????1392??2012-05-17?22:49??EMailManager\EMailManager.plg
?????文件???????7455??2012-05-17?22:41??EMailManager\EMailManager.rc
?????文件???????9993??2012-05-17?22:49??EMailManager\EMailManagerDlg.cpp
?????文件???????1766??2012-05-17?21:51??EMailManager\EMailManagerDlg.h
?????文件???????3942??2012-05-17?22:49??EMailManager\MemberOfGroup.cpp
?????文件???????1404??2012-05-17?21:40??EMailManager\MemberOfGroup.h
?????文件???????1078??2012-05-17?16:17??EMailManager\res\EMailManager.ico
?????文件????????404??2012-05-17?16:17??EMailManager\res\EMailManager.rc2
?????文件???????1470??2012-05-17?21:53??EMailManager\resource.h
?????文件????????214??2012-05-17?16:17??EMailManager\StdAfx.cpp
?????文件???????1245??2012-05-17?16:59??EMailManager\StdAfx.h
?????目錄??????????0??2012-05-17?22:50??EMailManager\data
?????目錄??????????0??2012-05-17?22:37??EMailManager\res
?????目錄??????????0??2012-05-17?22:50??EMailManager
-----------?---------??----------?-----??----
???????????????534347????????????????????25
- 上一篇:輸油管道問題.cpp
- 下一篇:集裝箱的裝箱問題c語言算法
評論
共有 條評論