📄 accountdlg.cpp
字号:
// AccountDlg.cpp : implementation file
//
#include "stdafx.h"
#include "sm.h"
#include "AccountList.h"
#include "AccountsetDlg.h"
#include "AccountDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAccountDlg dialog
//##ModelId=40A481F80001
CAccountDlg::CAccountDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAccountDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CAccountDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
//##ModelId=40A481F80024
void CAccountDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAccountDlg)
DDX_Control(pDX, IDC_TEACHER_LIST, m_List);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAccountDlg, CDialog)
//{{AFX_MSG_MAP(CAccountDlg)
ON_WM_DESTROY()
ON_BN_CLICKED(IDC_NEW, OnNew)
ON_BN_CLICKED(IDC_EDIT, OnEdit)
ON_BN_CLICKED(IDC_DELETE, OnDelete)
ON_BN_CLICKED(IDCANCEL2, OnCancel)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAccountDlg message handlers
//##ModelId=40A481F8002F
BOOL CAccountDlg::OnInitDialog()
{
CDialog::OnInitDialog();
pList = new AccountList(&m_List);
pList->Init();
pList->Load();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//##ModelId=40A481F80031
void CAccountDlg::OnDestroy()
{
CDialog::OnDestroy();
delete pList;
}
//##ModelId=40A481F8003F
void CAccountDlg::OnNew()
{
CAccountSetDlg dlg;
if(dlg.DoModal())
pList->Load();
}
//##ModelId=40A481F8004E
void CAccountDlg::OnEdit()
{
CAccountSetDlg dlg(&pList->GetSelectedAccount());
if(dlg.DoModal())
{
long id = pList->GetSelected();
pList->Load();
pList->SetSelected(id-1);
}
}
//##ModelId=40A481F80050
void CAccountDlg::OnDelete()
{
CDaoTableDef TD(&theDatabase);
TD.Open("account");
CDaoRecordset RS;
RS.Open(&TD);
long id = pList->GetSelected();
pList->GetSelectedAccount().Delete(&RS);
pList->SetSelected(id-1);
RS.Close();
TD.Close();
pList->Load();
}
//##ModelId=40A481F8005D
void CAccountDlg::OnCancel()
{
// TODO: Add your control notification handler code here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -