📄 searchdlg.cpp
字号:
// SearchDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ProjectManage.h"
#include "SearchDlg.h"
// CSearchDlg dialog
IMPLEMENT_DYNCREATE(CSearchDlg, CDialog)
CSearchDlg::CSearchDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSearchDlg::IDD, pParent)
{
}
CSearchDlg::~CSearchDlg()
{
}
void CSearchDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BOOL CSearchDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CComboBox* mComb=(CComboBox*) this->GetDlgItem(IDC_COMBO2);
mComb->AddString("中国移动");
mComb->AddString("中国联通");
mComb->AddString("北方网通");
mComb->AddString("南方电信");
//mComb->SetCurSel(2);
CComboBox* rComb=(CComboBox*)this->GetDlgItem(IDC_COMBO1);
this->m_Storage.OpenSql("RegionTree","DISTINCT(RegionTree.mod_name)","INNER JOIN ProjectTab ON RegionTree.mod_id = ProjectTab.Mod_ID");
if(!this->m_Storage.IsEof())
{
CString name;this->m_Storage.MoveFirst();
while(!this->m_Storage.IsEof())
{
this->m_Storage.GetFieldValue(0,name);
rComb->AddString(name);
this->m_Storage.MoveNext();
}
}
return TRUE; // return TRUE unless you set the focus to a control
}
BEGIN_MESSAGE_MAP(CSearchDlg,CDialog)
ON_BN_CLICKED(IDC_BUTTON1, &CSearchDlg::OnBntSearch)
END_MESSAGE_MAP()
// CSearchDlg message handlers
void CSearchDlg::OnBntSearch()
{
// TODO: 在此添加控件通知处理程序代码
try
{
CProjectManageApp* app=(CProjectManageApp*)AfxGetApp();
CProjectManageView* pView=app->GetMyView();
CString sql,projname,regionname,custtype,stardate1,stardate2,cDateTime,result,omtname;
int chk,ck;
CEdit* projedit=(CEdit*)this->GetDlgItem(IDC_EDIT1);
projedit->GetWindowTextA(projname);
/*CEdit* omtedit=(CEdit*)this->GetDlgItem(IDC_EDIT3);
omtedit->GetWindowTextA(omtname);*/
CComboBox* regionbox=(CComboBox*)this->GetDlgItem(IDC_COMBO1);
regionbox->GetWindowTextA(regionname);
CComboBox* custbox=(CComboBox*)this->GetDlgItem(IDC_COMBO2);
custbox->GetWindowTextA(custtype);
CButton* chkbox=(CButton*)this->GetDlgItem(IDC_CHECK1);
chk=chkbox->GetCheck();
CButton* chkbox2=(CButton*)this->GetDlgItem(IDC_CHECK2);
ck=chkbox2->GetCheck();
CEdit* stardate1b=(CEdit*)this->GetDlgItem(IDC_DATETIMEPICKER1);
stardate1b->GetWindowTextA(stardate1);
CEdit* stardate2b=(CEdit*)this->GetDlgItem(IDC_DATETIMEPICKER3);
stardate2b->GetWindowTextA(stardate2);
CEdit* cd=(CEdit*)this->GetDlgItem(IDC_DATETIMEPICKER2);
cd->GetWindowTextA(cDateTime);
CEdit* jg=(CEdit*)this->GetDlgItem(IDC_EDIT2);
jg->GetWindowTextA(result);
sql=" where 1=1";
if(projname!="")
{
sql+=" and ProjectTab.ProjectName like '%"+projname+"%'";
}
//if(omtname!="")
//{
//sql+=" and ProjectTab.omt_Name like '%"+omtname+"%'";
//}
if(regionname!="")
{
sql+=" and RegionTree.mod_name='"+regionname+"'";
}
if(custtype!="")
{
sql+=" and ProjectTab.UserName='"+custtype+"'";
}
if(chk)
{
if(stardate1!="")
{
sql+=" and ProjectTab.DateTime>=#"+stardate1+"#";
}
if(stardate2!="")
{
sql+=" and ProjectTab.DateTime<=#"+stardate2+"#";
}
}
if(ck)
{
if(cDateTime!="")
{
sql+=" and ProjectTab.cDataTime=#"+cDateTime+"#";
}
}
if(result!="")
{
sql+=" and ProjectTab.Desc='"+custtype+"'";
}
pView->LoadData(sql);
theApp.SQL=sql;
}
catch(_com_error e)
{
MessageBox("请首先选择基本信息");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -