www.pudn.com > Library.rar > BookReturnDlg.cpp, change:2009-04-12,size:1675b


// BookReturnDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Library.h" 
#include "BookReturnDlg.h" 
#include "BookDataSet.h" 
#include "BorrowSet.h" 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CBookReturnDlg dialog 
 
 
CBookReturnDlg::CBookReturnDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CBookReturnDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CBookReturnDlg) 
	m_BOOK_ID = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
 
void CBookReturnDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CBookReturnDlg) 
	DDX_Text(pDX, IDC_BOOK_NUM, m_BOOK_ID); 
	DDV_MaxChars(pDX, m_BOOK_ID, 8); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CBookReturnDlg, CDialog) 
	//{{AFX_MSG_MAP(CBookReturnDlg) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CBookReturnDlg message handlers 
 
void CBookReturnDlg::OnOK()  
{ 
	UpdateData(true); 
 
	if(!m_rsDataSet.IsOpen()){ 
		m_rsDataSet.Open(); 
	} 
	m_rsDataSet.m_strFilter ="reader.reader_ID=borrow.reader_ID and BOOK_ID='"+m_BOOK_ID+"'"; 
	m_rsDataSet.Requery(); 
	if(m_rsDataSet.IsEOF()){ 
		AfxMessageBox("此书不存在或已经还掉"); 
		CDialog::OnOK(); 
		return ; 
	} 
 
	if(!m_rsBookDataSet.IsOpen()){ 
		m_rsBookDataSet.Open(); 
	} 
	m_rsBookDataSet.m_strFilter.Format("BOOK_ID='%s'",m_BOOK_ID); 
	m_rsBookDataSet.Requery(); 
	m_rsBookDataSet.Edit(); 
	m_rsBookDataSet.m_FLAG_BORROW = "Y"; 
	m_rsBookDataSet.Update(); 
	 
	AfxMessageBox("还书成功"); 
 
	CDialog::OnOK(); 
}