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

📄 client.cpp

📁 基于MFC实现的图书管管理系统
💻 CPP
字号:
// client.cpp : implementation file
//

#include "stdafx.h"
#include "图书馆管理系统.h"
#include "client.h"
#include "borrow.h"
#include "returnbook.h"

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

/////////////////////////////////////////////////////////////////////////////
// client dialog



client::client(CWnd* pParent /*=NULL*/)
	: CDialog(client::IDD, pParent)
{
	//{{AFX_DATA_INIT(client)
	m_skey = _T("");
	m_sid = _T("");
	//}}AFX_DATA_INIT
}


void client::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(client)
	DDX_Text(pDX, IDC_SKEY, m_skey);
	DDX_Text(pDX, IDC_SID, m_sid);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(client, CDialog)
	//{{AFX_MSG_MAP(client)
	ON_BN_CLICKED(IDD_ABOUTBOX8, OnAboutbox8)
	ON_BN_CLICKED(IDD_ABOUTBOX9, OnAboutbox9)
	ON_BN_CLICKED(IDD_ABOUTBOX10, OnAboutbox10)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// client message handlers


void client::OnAboutbox8() //borrow book
{
	// TODO: Add your control notification handler code here
	UpdateData (1);
    borrow dlg;

    if (m_sid.IsEmpty())
	MessageBox ("The ID is empty!","ERROR",MB_ICONSTOP);
	else {
		    m_path="Client\\"+m_sid+".txt";
            dlg.m_path=m_path;
           CFile student;

			if (!student.Open(m_path,CFile::modeCreate|CFile::modeNoTruncate))
				
			{  MessageBox ("Openning file error!");
			 	return;
			}
	
			student.Close();
			UpdateData(0);


	 if (m_skey=="1111")
	{ 
	  dlg.DoModal();
	  CDialog::OnCancel();
	  UpdateData(0);
	}
	else MessageBox ("The keyword is error!","ERROR",MB_ICONSTOP);
	m_sid="";
	m_skey="";
	 UpdateData(0);
	}

}
void client::OnAboutbox9() //returnbook
{
	// TODO: Add your control notification handler code here
	UpdateData (1);
	returnbook dlg;

	///////////////
	 if (m_sid.IsEmpty())
	MessageBox ("The ID is empty!","ERROR",MB_ICONSTOP);
	else {
		    m_path="Client\\"+m_sid+".txt";
			//dlg.m_path=m_path;
           CFile student;
           if (!student.Open(m_path,CFile::modeCreate|CFile::modeNoTruncate))
				
			{  MessageBox ("Openning file error!");
			 	return;
			}
		   student.Close();
			UpdateData(0);
		}

    ///////////////
	if (m_skey=="1111")
	{ dlg.m_path=m_path;
	  dlg.DoModal();
	  CDialog::OnCancel();
	  UpdateData(0);
	}
	else MessageBox ("The keyword is error!","ERROR",MB_ICONSTOP);
	m_sid="";
	m_skey="";
	 UpdateData(0);
	
}

void client::OnAboutbox10() 
{
	// TODO: Add your control notification handler code here
		CDialog::OnCancel();
}

⌨️ 快捷键说明

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