📄 chaxunkebiaodlg.cpp
字号:
// chaxunkebiaoDlg.cpp : implementation file
//
#include "stdafx.h"
#include "pmz.h"
#include "chaxunkebiaoDlg.h"
#include "pmzDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// chaxunkebiaoDlg dialog
extern CString user_name;
chaxunkebiaoDlg::chaxunkebiaoDlg(CWnd* pParent /*=NULL*/)
: CDialog(chaxunkebiaoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(chaxunkebiaoDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pdb=new CDatabase; //yang
m_pdb->Open( NULL, FALSE, FALSE,mydb); //yang
}
chaxunkebiaoDlg::~chaxunkebiaoDlg()
{m_pdb->Close();
delete m_pdb;
}
void chaxunkebiaoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(chaxunkebiaoDlg)
DDX_Control(pDX, IDC_LIST1, m_pList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(chaxunkebiaoDlg, CDialog)
//{{AFX_MSG_MAP(chaxunkebiaoDlg)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// chaxunkebiaoDlg message handlers
BOOL chaxunkebiaoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CListCtrl* m_pList = (CListCtrl*)GetDlgItem(IDC_LIST1);
DWORD dwStyle= GetWindowLong(m_pList->m_hWnd, GWL_STYLE);
SetWindowLong( m_pList->m_hWnd, GWL_STYLE, dwStyle | LVS_REPORT);
//设置ListCtrl可以整行选择和网格条纹
DWORD styles = m_pList->GetExtendedStyle();
m_pList->SetExtendedStyle(styles|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
m_pList->SetBkColor(RGB(0xFF, 0xFF, 0xE0));
m_pList->SetTextBkColor(RGB(0xFF, 0xFF, 0xE0));
//设置列的题头
m_pList->InsertColumn(1,"",LVCFMT_CENTER,60);
m_pList->InsertColumn(2,"星期一",LVCFMT_CENTER,120);
m_pList->InsertColumn(3,"星期二",LVCFMT_CENTER,120);
m_pList->InsertColumn(4,"星期三",LVCFMT_CENTER,120);
m_pList->InsertColumn(5,"星期四",LVCFMT_CENTER,120);
m_pList->InsertColumn(6,"星期五",LVCFMT_CENTER,120);
m_pList->InsertColumn(7,"星期六",LVCFMT_CENTER,120);
m_pList->InsertColumn(7,"星期日",LVCFMT_CENTER,120);
m_pList->InsertItem(0,"1,2");
m_pList->InsertItem(1,"3,4");
m_pList->InsertItem(2,"5,6");
m_pList->InsertItem(3,"7,8");
m_pList->InsertItem(4,"9,10");
//m_pList->SetItemText(1,2,"cname+cplace");
CString str5="select * from SC_info where S_no='"+user_name+"' ";
m_scprecordset=new SC_infodb(m_pdb);
m_scprecordset->Open(SC_infodb::snapshot,str5);
CString cno;
int i=0;
if(m_scprecordset->IsEOF())
{
return true;
}
else
{
m_scprecordset->MoveFirst();
while(!m_scprecordset->IsEOF())
{cno=m_scprecordset->m_C_no;
CString str1="select * from CT_info where C_no='"+cno+"' ";
m_ktprecordset=new KT_infodb(m_pdb);
m_ktprecordset->Open(KT_infodb::snapshot,str1);
if(m_ktprecordset->IsEOF())
{
return true;
}
else
{m_ktprecordset->MoveFirst();
while(!m_ktprecordset->IsEOF())
{CString str4="select * from C_info where C_no='"+cno+"' ";
m_cprecordset=new kecheng_infodb(m_pdb);
m_cprecordset->Open(kecheng_infodb::snapshot,str4);
CString ctime,ctimel,ctimer;
CString cplace,cname;
int j;
int k=1;
cname=m_cprecordset->m_C_name;
cplace=m_ktprecordset->m_C_place;
ctime=m_ktprecordset->m_C_time;
ctime.TrimLeft();
ctime.TrimRight();
ctimel=ctime.Left(6);
ctimer=ctime.Right(3);
if(ctimel=="星期一") {j=1;}
if(ctimel=="星期二") {j=2;}
if(ctimel=="星期三") {j=3;}
if(ctimel=="星期四") {j=4;}
if(ctimel=="星期五") {j=5;}
if(ctimel=="星期六") {j=6;}
if(ctimel=="星期日") {j=7;}
if(ctimer=="1,2") {k=0;}
else if(ctimer=="3,4") {k=1;}
else if(ctimer=="5,6") {k=2;}
else if(ctimer=="7,8") {k=3;}
else {k=4;}
m_pList->SetItemText(k,j,cname+cplace);
m_ktprecordset->MoveNext();
}
}
m_scprecordset->MoveNext();
i++;
}
}
delete m_scprecordset;
delete m_cprecordset;
delete m_ktprecordset;
return true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -