📄 showdialog.cpp
字号:
// ShowDialog.cpp : implementation file
//
#include "stdafx.h"
#include "qq.h"
#include "ShowDialog.h"
#include "global.h"
#include "ChangeAndDel.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern SEL_TYPE showType;
/////////////////////////////////////////////////////////////////////////////
// CShowDialog dialog
CShowDialog::CShowDialog(CString str,CWnd* pParent /*=NULL*/)
: CDialog(CShowDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CShowDialog)
//}}AFX_DATA_INIT
strText = str;
}
void CShowDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CShowDialog)
DDX_Control(pDX, IDC_SHOW_LIST, m_show_list);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CShowDialog, CDialog)
//{{AFX_MSG_MAP(CShowDialog)
ON_NOTIFY(NM_CLICK, IDC_SHOW_LIST, OnClickShowList)
ON_NOTIFY(NM_DBLCLK, IDC_SHOW_LIST, OnDblclkShowList)
ON_NOTIFY(LVN_COLUMNCLICK, IDC_SHOW_LIST, OnColumnclickShowList)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CShowDialog message handlers
void CShowDialog::show(int k)
{
// UpdateData();
CString score;
CString s;
s.Format("%d",k);
m_show_list.InsertItem(k,s,0);
m_show_list.SetItemText(k,0,m_StuInfoSet.m_gradeclass);
m_show_list.SetItemText(k,1,m_StuInfoSet.m_stuid);
m_show_list.SetItemText(k,3,m_ThesisInfoSet.m_teacher);
m_show_list.SetItemText(k,2,m_StuInfoSet.m_stuname);
m_show_list.SetItemText(k,4,m_ThesisInfoSet.m_name);
m_show_list.SetItemText(k,5,m_ThesisInfoSet.m_type);
score.Format("%.2f",m_ThesisInfoSet.m_score);
m_show_list.SetItemText(k,6,score);
CString chKey = m_ThesisInfoSet.m_chkey1+" "+m_ThesisInfoSet.m_chkey2+" "+m_ThesisInfoSet.m_chkey3+" "+m_ThesisInfoSet.m_chkey4;
m_show_list.SetItemText(k,7,chKey);
CString enKey = m_ThesisInfoSet.m_enkey1+" "+m_ThesisInfoSet.m_enkey2+" "+m_ThesisInfoSet.m_enkey3+" "+m_ThesisInfoSet.m_enkey4;
m_show_list.SetItemText(k,8,enKey);
// UpdateData();
}
void CShowDialog::showSName(CString strStu)
{
int k=0;
bool nHasExist=false;
m_StuInfoSet.Open(AFX_DB_USE_DEFAULT_TYPE);
if( !m_StuInfoSet.IsEOF() )
{
// m_StuInfoSet.Close();//关闭数据库
// MessageBox("没有找到相匹配的记录!","警告",MB_OK);
// CDialog::OnOK();
// return;
m_StuInfoSet.MoveFirst();
do
{
if( m_StuInfoSet.m_stuname == strStu )
{
m_ThesisInfoSet.Open(AFX_DB_USE_DEFAULT_TYPE);
m_ThesisInfoSet.MoveFirst();
do
{
if(m_ThesisInfoSet.m_stuid==m_StuInfoSet.m_stuid)
{
nHasExist = true;
break;
}
m_ThesisInfoSet.MoveNext();
}while(!m_ThesisInfoSet.IsEOF());
if( nHasExist )
{
show(k);
k++;
}
m_ThesisInfoSet.Close();
}
m_StuInfoSet.MoveNext();
}while(!m_StuInfoSet.IsEOF());
}
m_StuInfoSet.Close();//关闭数据库
if( k == 0 )
{
MessageBox("没有找到相匹配的记录!","警告",MB_OK);
CDialog::OnOK();
}
}
void CShowDialog::showTName(CString strTch)
{
int k=0;
bool nHasExist=false;
m_ThesisInfoSet.Open(AFX_DB_USE_DEFAULT_TYPE);
if( !m_ThesisInfoSet.IsEOF() )
{
// m_ThesisInfoSet.Close();//关闭数据库
// MessageBox("没有找到相匹配的记录!","警告",MB_OK);
// CDialog::OnOK();
// return;
m_ThesisInfoSet.MoveFirst();
do
{
if( m_ThesisInfoSet.m_teacher == strTch )
{
m_StuInfoSet.Open(AFX_DB_USE_DEFAULT_TYPE);
m_StuInfoSet.MoveFirst();
do
{
if(m_ThesisInfoSet.m_stuid==m_StuInfoSet.m_stuid)
{
nHasExist = true;
break;
}
m_StuInfoSet.MoveNext();
}while(!m_StuInfoSet.IsEOF());
if( nHasExist )
{
show(k);
k++;
}
m_StuInfoSet.Close();
}
m_ThesisInfoSet.MoveNext();
}while(!m_ThesisInfoSet.IsEOF());
}
m_ThesisInfoSet.Close();//关闭数据库
if( k == 0 )
{
MessageBox("没有找到相匹配的记录!","警告",MB_OK);
CDialog::OnOK();
}
}
void CShowDialog::showKey(CString strText)
{
int k=0;
bool nHasExist=false;
m_ThesisInfoSet.Open(AFX_DB_USE_DEFAULT_TYPE);
if( !m_ThesisInfoSet.IsEOF() )
{
// m_ThesisInfoSet.Close();//关闭数据库
// MessageBox("没有找到相匹配的记录!","警告",MB_OK);
// CDialog::OnOK();
// return;
m_ThesisInfoSet.MoveFirst();
do
{
if( m_ThesisInfoSet.m_chkey1 == strText || m_ThesisInfoSet.m_chkey2 == strText ||
m_ThesisInfoSet.m_chkey3 == strText || m_ThesisInfoSet.m_chkey4 == strText ||
m_ThesisInfoSet.m_enkey1 == strText || m_ThesisInfoSet.m_enkey2 == strText ||
m_ThesisInfoSet.m_enkey3 == strText || m_ThesisInfoSet.m_enkey4 == strText )
{
m_StuInfoSet.Open(AFX_DB_USE_DEFAULT_TYPE);
m_StuInfoSet.MoveFirst();
do
{
if(m_ThesisInfoSet.m_stuid==m_StuInfoSet.m_stuid)
{
nHasExist = true;
break;
}
m_StuInfoSet.MoveNext();
}while(!m_StuInfoSet.IsEOF());
if( nHasExist )
{
show(k);
k++;
}
m_StuInfoSet.Close();
}
m_ThesisInfoSet.MoveNext();
}while(!m_ThesisInfoSet.IsEOF());
}
m_ThesisInfoSet.Close();//关闭数据库
if( k == 0 )
{
MessageBox("没有找到相匹配的记录!","警告",MB_OK);
CDialog::OnOK();
}
}
void CShowDialog::showThesis(CString strText)
{
int k=0;
bool nHasExist=false;
m_ThesisInfoSet.Open(AFX_DB_USE_DEFAULT_TYPE);
if( !m_ThesisInfoSet.IsEOF() )
{
// m_ThesisInfoSet.Close();//关闭数据库
// MessageBox("没有找到相匹配的记录!","警告",MB_OK);
//CDialog::OnOK();
// return;
m_ThesisInfoSet.MoveFirst();
do
{
if( m_ThesisInfoSet.m_name == strText )
{
m_StuInfoSet.Open(AFX_DB_USE_DEFAULT_TYPE);
m_StuInfoSet.MoveFirst();
do
{
if(m_ThesisInfoSet.m_stuid==m_StuInfoSet.m_stuid)
{
nHasExist = true;
break;
}
m_StuInfoSet.MoveNext();
}while(!m_StuInfoSet.IsEOF());
if( nHasExist )
{
show(k);
k++;
}
m_StuInfoSet.Close();
}
m_ThesisInfoSet.MoveNext();
}while(!m_ThesisInfoSet.IsEOF());
}
m_ThesisInfoSet.Close();//关闭数据库
if( k == 0 )
{
MessageBox("没有找到相匹配的记录!","警告",MB_OK);
CDialog::OnOK();
}
}
int CShowDialog::checkText(CString strSource,CString strDes,int nFlag)
{
if( nFlag == -1 )
return 1;
if( nFlag == 0 )
{
if( strSource != strDes )
return 0;
}
else
{
if( strSource.Find(strDes,0) < 0 )
return 0;
}
return 1;
}
/*
int CShowDialog::checkThesis(CString thesis,int thesisFlag)
{
return 0;
}
int CShowDialog::checkKey(CString key,int keyFlag)
{
return 0;
}
int CShowDialog::checkTch(CString tch,int tchFlag)
{
return 0;
}
int CShowDialog::checkStu(CString stu,int stuFlag)
{
return 0;
}*/
void CShowDialog::showUp(CString strText)
{
int k=0;
bool nHasExist=false;
CString stuid,stu,tch,key,thesis,keyWord;
int stuidFlag = -1,stuFlag = -1,tchFlag = -1,keyFlag = -1,thesisFlag = -1;
int nStart = 0,nPos,nPos1,nPos2;
// MessageBox(strText);
nPos = strText.Find("$",nStart);
nPos1 = strText.Find("&",nStart);
nPos2 = strText.Find("@",nStart);
stuid = strText.Mid(nStart,nPos-nStart);
if( nPos1 == nPos+1 )
{
stuidFlag = 1;
nStart = nPos1+1;
}else if( nPos2 == nPos+1)
{
stuidFlag = 0;
nStart = nPos2 + 1;
}
else
nStart = nPos+1;
nPos = strText.Find("$",nStart);
nPos1 = strText.Find("&",nStart);
nPos2 = strText.Find("@",nStart);
stu = strText.Mid(nStart,nPos-nStart);
if( nPos1 == nPos+1 )
{
stuFlag = 1;
nStart = nPos1+1;
}else if( nPos2 == nPos+1)
{
stuFlag = 0;
nStart = nPos2 + 1;
}
else
nStart = nPos+1;
nPos = strText.Find("$",nStart);
nPos1 = strText.Find("&",nStart);
nPos2 = strText.Find("@",nStart);
tch = strText.Mid(nStart,nPos-nStart);
if( nPos1 == nPos+1 )
{
tchFlag = 1;
nStart = nPos1+1;
}else if( nPos2 == nPos+1)
{
tchFlag = 0;
nStart = nPos2 + 1;
}
else
nStart = nPos+1;
nPos = strText.Find("$",nStart);
nPos1 = strText.Find("&",nStart);
nPos2 = strText.Find("@",nStart);
key = strText.Mid(nStart,nPos-nStart);
if( nPos1 == nPos+1 )
{
keyFlag = 1;
nStart = nPos1+1;
}else if( nPos2 == nPos+1)
{
keyFlag = 0;
nStart = nPos2 + 1;
}
else
nStart = nPos+1;
nPos = strText.Find("$",nStart);
nPos1 = strText.Find("&",nStart);
nPos2 = strText.Find("@",nStart);
thesis = strText.Mid(nStart,nPos-nStart);
if( nPos1 == nPos+1 )
{
thesisFlag = 1;
}else if( nPos2 == nPos+1)
{
thesisFlag = 0;
}
//MessageBox(stuid+' '+stu+' '+tch+' '+key+' '+thesis);
m_ThesisInfoSet.Open(AFX_DB_USE_DEFAULT_TYPE);
if( !m_ThesisInfoSet.IsEOF() )
{
// m_ThesisInfoSet.Close();//关闭数据库
// MessageBox("没有找到相匹配的记录!","警告",MB_OK);
// CDialog::OnOK();
// return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -