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

📄 readermanage.cpp

📁 java 大作业 《处方跟踪系统》源代码 gui界面
💻 CPP
字号:
// ReaderManage.cpp : implementation file
//

#include "stdafx.h"
#include "libraryMS.h"
#include "ReaderManage.h"

#include "datagrid.h"
#include "adodc.h"
#include "ADOConn.h"

#include "LogLibrary.h"

#include "Reader.h"
#include "ReaderAdd.h"
#include "ReaderChange.h"

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

/////////////////////////////////////////////////////////////////////////////
// CReaderManage dialog


CReaderManage::CReaderManage(CWnd* pParent /*=NULL*/)
	: CDialog(CReaderManage::IDD, pParent)
{
	//{{AFX_DATA_INIT(CReaderManage)
	m_Qreader = _T("");
	//}}AFX_DATA_INIT
}


void CReaderManage::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CReaderManage)
	DDX_Control(pDX, IDC_Condition, m_condition);
	DDX_Control(pDX, IDC_ADODC1, m_adodc);
	DDX_Control(pDX, IDC_DATAGRID1, m_datagrid);
	DDX_Text(pDX, IDC_Reader_EDIT, m_Qreader);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CReaderManage, CDialog)
	//{{AFX_MSG_MAP(CReaderManage)
	ON_BN_CLICKED(IDExit, OnExit)
	ON_BN_CLICKED(IDC_Add, OnAdd)
	ON_BN_CLICKED(IDC_Delete, OnDelete)
	ON_BN_CLICKED(IDC_change, Onchange)
	ON_BN_CLICKED(IDC_Query, OnQuery)
	ON_BN_CLICKED(IDC_QueryAll, OnQueryAll)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CReaderManage message handlers

void CReaderManage::OnExit() 
{
	// TODO: Add your control notification handler code here
    OnOK();

	
}

void CReaderManage::OnAdd() 
{
	// TODO: Add your control notification handler code here
    CReaderAdd Reader_Add_dlg;
	Reader_Add_dlg.DoModal();
    m_adodc.Refresh();
	
}

void CReaderManage::OnDelete() 
{
	// TODO: Add your control notification handler code here
	CReader vReader;
	vReader.SetIDReader(m_datagrid.GetItem(0));
	vReader.SetNameReader(m_datagrid.GetItem(1));//删除功能可以不用设置NameReader
	vReader.SetMaxBook(m_datagrid.GetItem(2));//删除功能可以不用设置MaxBook
	CString str;
	str="借书证号:"+vReader.GetIDReader()+"\n"+"姓名:"+vReader.GetNameReader()+"\n";
	int nChoice = MessageBox(str,"确定要删除吗",MB_OKCANCEL|MB_ICONQUESTION);

	if(nChoice == IDOK)
	{
		CLogLibrary Log_dlg;
	    Log_dlg.DoModal();
	    vReader.SetLogReader(Log_dlg.m_logMS);
		MessageBox("删除进行");
		vReader.sql_delete(vReader.GetIDReader());
	}
	m_adodc.Refresh();
}

void CReaderManage::Onchange() 
{
	// TODO: Add your control notification handler code here
	CReaderChange Change_dlg;
	Change_dlg.m_IDReader =m_datagrid.GetItem(0);
	Change_dlg.m_NameReader =m_datagrid.GetItem(1);
	Change_dlg.m_MaxBook =m_datagrid.GetItem(2);
	Change_dlg.DoModal();
	m_adodc.Refresh();
	
}

BOOL CReaderManage::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	m_condition.SetCurSel(0);
	UpdateData(false);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CReaderManage::OnQuery() 
{
	// TODO: Add your control notification handler code here//[IDReader], [NameReader], [MaxBook]
    UpdateData(true);
	m_adodc.SetRecordSource("select IDReader as 借书证号, NameReader as 读者姓名, MaxBook as 最大借书量 from t_Reader where IDReader = '"+m_Qreader+"'");
	m_adodc.Refresh();
	
}

void CReaderManage::OnQueryAll() 
{
	// TODO: Add your control notification handler code here
	m_adodc.SetRecordSource("select IDReader as 借书证号, NameReader as 读者姓名, MaxBook as 最大借书量 from t_Reader");
	m_adodc.Refresh();
	
}

⌨️ 快捷键说明

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