📄 senddlg.cpp
字号:
// SendDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Forth.h"
#include "SendDlg.h"
#include "BookSet.h"
#include "ReaderSet.h"
#include "BorrowSet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSendDlg dialog
CSendDlg::CSendDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSendDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSendDlg)
m_BookId = _T("");
//}}AFX_DATA_INIT
}
void CSendDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSendDlg)
DDX_Text(pDX, IDC_EDIT1, m_BookId);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSendDlg, CDialog)
//{{AFX_MSG_MAP(CSendDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSendDlg message handlers
void CSendDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();
CBookSet book;
char chr='%';
book.m_strFilter.Format("BookId like '%c%s%c'",chr,m_BookId,chr);
book.Open();
if(book.IsEOF())
{
MessageBox("不存在这个书号");
book.Close();
return;
}//打开图书
CBorrowSet borrow;
borrow.m_strFilter.Format("BookId like '%c%s%c'",chr,m_BookId,chr);
borrow.Open();
if(borrow.IsEOF())
{
MessageBox("不存在这个书号");
borrow.Close();
return;
}
//打开借阅关系
CReaderSet reader;
reader.m_strFilter.Format("ReadId like '%c%s%c'",chr,borrow.m_ReaderId,chr);
reader.Open();
if(reader.IsEOF())
{
MessageBox("不存在借这本书的读者");
reader.Close();
return;
}
borrow.Delete();
borrow.Close();
book.Edit();
book.m_NowAmount=book.m_NowAmount+1;
if(book.CanUpdate())
book.Update();
book.Close();
reader.Edit();
reader.m_NowBorrowNumber=reader.m_NowBorrowNumber-1;
if(reader.CanUpdate())
reader.Update();
reader.Close();
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -