?? readermanage.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));//刪除功能可以不用設(shè)置NameReader
vReader.SetMaxBook(m_datagrid.GetItem(2));//刪除功能可以不用設(shè)置MaxBook
CString str;
str="借書證號:"+vReader.GetIDReader()+"\n"+"姓名:"+vReader.GetNameReader()+"\n";
int nChoice = MessageBox(str,"確定要?jiǎng)h除嗎",MB_OKCANCEL|MB_ICONQUESTION);
if(nChoice == IDOK)
{
CLogLibrary Log_dlg;
Log_dlg.DoModal();
vReader.SetLogReader(Log_dlg.m_logMS);
MessageBox("刪除進(jìn)行");
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();
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -