📄 returnbookdlg.cpp
字号:
// ReturnBookDlg.cpp : implementation file
//
#include "stdafx.h"
#include "library.h"
#include "ReturnBookDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CReturnBookDlg dialog
CReturnBookDlg::CReturnBookDlg(CWnd* pView /*=NULL*/)
: CDialog(CReturnBookDlg::IDD, pView)
{
//{{AFX_DATA_INIT(CReturnBookDlg)
m_nBid = 0;
m_pView=(CLibraryView*)pView;
m_nRid = 0;
//}}AFX_DATA_INIT
}
void CReturnBookDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CReturnBookDlg)
DDX_Text(pDX, IDC_EDIT_RETURN_BOOK_ID, m_nBid);
DDX_Text(pDX, IDC_EDIT_RETURN_READER_ID, m_nRid);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CReturnBookDlg, CDialog)
//{{AFX_MSG_MAP(CReturnBookDlg)
ON_BN_CLICKED(IDC_BUT_EXIT4, OnButExit4)
ON_BN_CLICKED(IDC_BUT_RETURN_BOOK, OnButReturnBook)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CReturnBookDlg message handlers
void CReturnBookDlg::OnButExit4()
{
// TODO: Add your control notification handler code here
m_pView->PostMessage(DESTROY_RETURN_DLG);
}
void CReturnBookDlg::OnButReturnBook()
{
// TODO: Add your control notification handler code here
UpdateData(true);
int bookid=m_nBid;
int readerid=m_nRid;
Reader* r=m_pView->rdb.query(readerid);
if(r==NULL)
{
AfxMessageBox("该读者信息不存在,请核对信息");
return;
}
Book* b=m_pView->bdb.query(bookid);
if(b==NULL)
{
AfxMessageBox("不存在该图书,还书失败,请核对图书信息");
return;
}
int ret=r->retbook(b->getno());
if(ret==0)
{
AfxMessageBox("读者没有借该书");
return;
}
b->retbook();
AfxMessageBox("还书成功");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -