⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 punishdlg.cpp

📁 一个完整的MFC系统
💻 CPP
字号:
// PunishDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Library.h"
#include "Punishset.h"
#include "LibrarySet.h"
#include "PunishDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPunishDlg dialog


CPunishDlg::CPunishDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPunishDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPunishDlg)
	m_strbookID = _T("");
	m_strdays = _T("");
	m_strmoney = _T("");
	m_strproofID = _T("");
	//}}AFX_DATA_INIT
}


void CPunishDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPunishDlg)
	DDX_Text(pDX, IDC_EDIT_BOOK_ID, m_strbookID);
	DDX_Text(pDX, IDC_EDIT_DAYS, m_strdays);
	DDX_Text(pDX, IDC_EDIT_MONEY, m_strmoney);
	DDX_Text(pDX, IDC_EDIT_PROOF_ID, m_strproofID);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPunishDlg, CDialog)
	//{{AFX_MSG_MAP(CPunishDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPunishDlg message handlers

void CPunishDlg::OnOK() 
{
    UpdateData(TRUE);
	CPunishset m_punishset;
	CString strSQL;
	strSQL.Format("select * from punishinfo");
	if(!m_punishset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL))
	{
		MessageBox("数据库打开失败!","数据库错误",MB_OK);
		return ;
	}
	int m=0;
	while(!m_punishset.IsEOF())
	{
		m_punishset.MoveNext();
		m++;
	}
	m++;
	
	CString str1;
	str1.Format("%d",m);
	//AfxMessageBox(str1);
	CLibrarySet m_readerset;
	strSQL.Format("select * from readerinfo where Proof_ID='%s'",m_strproofID);
	if(!m_readerset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL))
	{
		MessageBox("数据库打开失败!","数据库错误",MB_OK);
		return ;
	}
	if(m_readerset.GetRecordCount()==0)
	{
		AfxMessageBox("图书证号不存在!");
		return ;
	}
	m_punishset.AddNew();
	m_punishset.m_Puni_ID=str1;
	m_punishset.m_Proof_ID=m_strproofID;
	m_punishset.m_Book_ID=m_strbookID;
	
	int money,days;
	days=atoi(m_strdays);
	money=days*1;
	m_strmoney.Format("%d",money);
	m_punishset.m_Puni_Cause="超期";
	m_punishset.m_Puni_Money=m_strmoney;
	m_punishset.m_Read_Name=m_readerset.m_Name;
	CTime tm=CTime::GetCurrentTime();
	m_punishset.m_Puni_Date=tm;
	m_punishset.Update();
	m_punishset.Close();
    m_readerset.Close();
	UpdateData(FALSE);
	AfxMessageBox("交纳罚金成功!");

	
	//CDialog::OnOK();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -