📄 hire.cpp
字号:
// hire.cpp : implementation file
//
#include "stdafx.h"
#include "课程设计.h"
#include "hire.h"
#include "film.h"
#include "rent.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Chire dialog
Chire::Chire(CWnd* pParent /*=NULL*/)
: CDialog(Chire::IDD, pParent)
{
//{{AFX_DATA_INIT(Chire)
m_id = _T("");
//}}AFX_DATA_INIT
}
void Chire::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Chire)
DDX_Text(pDX, IDC_EDIT1, m_id);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(Chire, CDialog)
//{{AFX_MSG_MAP(Chire)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Chire message handlers
void Chire::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
CString str,str1,Id;
CTime t;
CDateTimeCtrl * pDT=(CDateTimeCtrl *)GetDlgItem(IDC_DATETIMEPICKER1);
pDT->GetTime(t);
str.Format("%d",t.GetYear());
str1.Format("%d",t.GetMonth());
str=str + "/" + str1 ;
str1.Format("%d",t.GetDay());
str=str + "/" + str1 ;
Cfilm film;
Crent rent;
Id=m_id;
film.sql_getlend(Id);
if(film.lend==false)
{
film.lend=true;
rent.id=atoi(Id);
rent.time=str;
film.sql_update(Id);
rent.sql_insert();
AfxMessageBox("数据库已经修改");
}
if(film.lend==true)
AfxMessageBox("该影碟已经借出");
//CDialog::OnOK();
}
void Chire::OnButton1()
{
// TODO: Add your control notification handler code here
m_id="";
UpdateData(false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -