continueborrowdlg.cpp
来自「mysql+visual C++编写的mini图书馆数据库管理系统」· C++ 代码 · 共 71 行
CPP
71 行
// ContinueBorrowDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Library.h"
#include "ContinueBorrowDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CContinueBorrowDlg dialog
CContinueBorrowDlg::CContinueBorrowDlg(CWnd* pParent /*=NULL*/)
: CDialog(CContinueBorrowDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CContinueBorrowDlg)
m_strBookNum = _T("");
m_strCardNum = _T("");
//}}AFX_DATA_INIT
}
void CContinueBorrowDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CContinueBorrowDlg)
DDX_Text(pDX, IDC_BOOKNUM, m_strBookNum);
DDX_Text(pDX, IDC_CARDNUM, m_strCardNum);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CContinueBorrowDlg, CDialog)
//{{AFX_MSG_MAP(CContinueBorrowDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CContinueBorrowDlg message handlers
void CContinueBorrowDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();
CTimeSpan span(30,0,0,0); //30天的时间间隔
CTime nextMonth = CTime::GetCurrentTime()+span; //30天后的日期
if(! m_borrowSet.IsOpen()){
m_borrowSet.Open();
}
m_borrowSet.m_strFilter.Format("ISBN='%s' AND cno='%s'",m_strBookNum,m_strCardNum);
m_borrowSet.Requery();
if(!m_borrowSet.IsEOF())
{
m_borrowSet.Edit();
m_borrowSet.m_return_date=nextMonth;
m_borrowSet.Update();
CString s="恭喜,续借成功!\n该书的还书日期已更新为";
CString s1=nextMonth.Format( "%Y-%m-%d %H:%M:%S" );
s+=s1;
AfxMessageBox(s);
}
else
AfxMessageBox("您输入的卡号、书号有误,无法完成续借!");
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?