📄 infodlg.cpp
字号:
// InfoDlg.cpp : implementation file
//
#include "stdafx.h"
#include "library.h"
#include "InfoDlg.h"
#include "BookLibSet.h"
#include "ResultDlg.h"
#include "ReaderInfDlg.h"
#include "AllReaderInf.h"
#include "ReadSet.h"
#include "AllInf.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInfoDlg dialog
CReadSet m_readerset3;
CBookLibSet m_set;
CInfoDlg::CInfoDlg(CWnd* pParent /*=NULL*/)
: CDialog(CInfoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CInfoDlg)
m_leftnum = 0;
m_loannum = 0;
m_selectinf = _T("");
m_selectinf1 = _T("");
m_totalnum = 0;
//}}AFX_DATA_INIT
}
void CInfoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CInfoDlg)
DDX_Control(pDX, IDC_TYPECOMB, m_type);
DDX_Control(pDX, IDC_TYPE1COMB, m_type1);
DDX_Text(pDX, IDC_LEFTNUM, m_leftnum);
DDX_Text(pDX, IDC_LOANNUM, m_loannum);
DDX_Text(pDX, IDC_SELECTINF, m_selectinf);
DDX_Text(pDX, IDC_SELECTINF1, m_selectinf1);
DDX_Text(pDX, IDC_TOTALNUM, m_totalnum);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CInfoDlg, CDialog)
//{{AFX_MSG_MAP(CInfoDlg)
ON_CBN_SELCHANGE(IDC_TYPECOMB, OnSelchangeTypecomb)
ON_CBN_SELCHANGE(IDC_TYPE1COMB, OnSelchangeType1comb)
ON_BN_CLICKED(IDC_ALLBOOKINF, OnAllbookinf)
ON_BN_CLICKED(IDC_ALLREADERINF, OnAllreaderinf)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInfoDlg message handlers
BOOL CInfoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
int totalnum=0,loannumber=0,leftnumber=0;
m_set.m_strFilter="";
m_set.Open();
while(!m_set.IsEOF())
{
if(m_set.m_Status==0)
loannumber++;
totalnum++;
m_set.MoveNext();
}
leftnumber=totalnum-loannumber;
m_totalnum=totalnum;
m_loannum=loannumber;
m_leftnum=leftnumber;
UpdateData(false);
m_set.Close();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CInfoDlg::OnSelchangeTypecomb()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_selectinf=="")
{
MessageBox("请输入查询条件");
}
else
{
int i=m_type.GetCurSel();
CString str;
CResultDlg result;
result.info=m_selectinf;
switch(i)
{
case -1:MessageBox("请选择一种查询方式!");
break;
case 0:
{
m_set.m_strFilter="Bookconcern='"+m_selectinf+"'";
m_set.Open();
if(!m_set.IsEOF())
{
m_set.Close();
result.type=0;
result.DoModal();
}
else
{
m_set.Close();
MessageBox("无法找到符合检索条件的书籍!");
}
}
break;
case 2:
{
m_set.m_strFilter="Bookid='"+m_selectinf+"'";
m_set.Open();
if(!m_set.IsEOF())
{
m_set.Close();
result.type=1;
result.DoModal();
}
else
{
m_set.Close();
MessageBox("无法找到符合检索条件的书籍!");
}
}
break;
case 3:
{
m_set.m_strFilter="Bookname='"+m_selectinf+"'";
m_set.Open();
if(!m_set.IsEOF())
{
m_set.Close();
result.type=2;
result.DoModal();
}
else
{
m_set.Close();
MessageBox("无法找到符合检索条件的书籍!");
}
}
break;
case 4:
{
m_set.m_strFilter="Bookauthor='"+m_selectinf+"'";
m_set.Open();
if(!m_set.IsEOF())
{
m_set.Close();
result.type=3;
result.DoModal();
}
else
{
m_set.Close();
MessageBox("无法找到符合检索条件的书籍!");
}
}
break;
case 1:
{
m_set.m_strFilter="Typeid='"+m_selectinf+"'";
m_set.Open();
if(!m_set.IsEOF())
{
m_set.Close();
result.type=4;
result.DoModal();
}
else
{
m_set.Close();
MessageBox("无法找到符合检索条件的书籍!");
}
}
break;
}
}
}
void CInfoDlg::OnSelchangeType1comb()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_selectinf1=="")
{
MessageBox("请输入查询条件");
}
else
{
int i=m_type1.GetCurSel();
CReaderInfDlg result;
result.info=m_selectinf1;
switch(i)
{
case -1:MessageBox("请选择一种查询方式!");
break;
case 1:
m_readerset3.m_strFilter="Readername='"+m_selectinf1+"'";
m_readerset3.Open();
if(!m_readerset3.IsEOF())
{
m_readerset3.Close();
CAllReaderInf allreaderinf;
allreaderinf.searchtype=1;
allreaderinf.searchinf=m_selectinf1;
allreaderinf.DoModal();
}
else
{
m_readerset3.Close();
MessageBox("无此人信息");
}
break;
case 0:
m_readerset3.m_strFilter="ReaderId='"+m_selectinf1+"'";
m_readerset3.Open();
if(!m_readerset3.IsEOF())
{
m_readerset3.Close();
result.type=2;
result.DoModal();
}
else
{
m_readerset3.Close();
MessageBox("无此人信息");
}
break;
}
}
}
void CInfoDlg::OnAllbookinf()
{
// TODO: Add your control notification handler code here
CAllInf allinf;
allinf.DoModal();
}
void CInfoDlg::OnAllreaderinf()
{
// TODO: Add your control notification handler code here
CAllReaderInf allreaderinf;
allreaderinf.searchtype=0;
allreaderinf.DoModal();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -