📄 fileserch.cpp
字号:
// FileSerch.cpp : implementation file
//
#include "stdafx.h"
#include "tvnews.h"
#include "FileSerch.h"
#include "Channel.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFileSerch dialog
CFileSerch::CFileSerch(CWnd* pParent /*=NULL*/)
: CDialog(CFileSerch::IDD, pParent)
{
//{{AFX_DATA_INIT(CFileSerch)
m_UserName = _T("");
m_FileName = _T("");
m_Time1 = COleDateTime::GetCurrentTime();
m_Time2 = COleDateTime::GetCurrentTime();
//}}AFX_DATA_INIT
}
void CFileSerch::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFileSerch)
DDX_Control(pDX, IDC_COMBO_SERVER, m_cmbServer);
DDX_Control(pDX, IDC_COMBO_CHANNEL, m_cmbChannel);
DDX_Control(pDX, IDC_COMBO_STATE, m_cmbState);
DDX_CBString(pDX, IDC_COMBO_STATE, m_State);
DDX_CBString(pDX, IDC_COMBO_SERVER, m_Server);
DDX_Text(pDX, IDC_EDIT_USERNAME, m_UserName);
DDX_Text(pDX, IDC_EDIT_FILENAME, m_FileName);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_Time1);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER2, m_Time2);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFileSerch, CDialog)
//{{AFX_MSG_MAP(CFileSerch)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFileSerch message handlers
BOOL CFileSerch::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CChannel Channel;
CStringArray allChannels;
Channel.GetAllChannel(allChannels);
m_cmbChannel.ResetContent();
int i;
for(i=0;i<allChannels.GetSize();i++)
{
m_cmbChannel.AddString(_T(allChannels.GetAt(i)));
}
m_cmbChannel.SelectString(-1,"所有频道");
m_cmbState.SelectString(-1,"所有状态");
m_cmbServer.SelectString(-1,"所有服务器");
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CFileSerch::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
strSQL="";
CChannel Channel;
CString strName;
int number = m_cmbChannel.GetCurSel();
m_cmbChannel.GetLBText(number,strName);
int ChannelID = Channel.GetIDByName(strName);
CString strID;
if(ChannelID==0)
{
strSQL=strSQL+" ";
}
else
{
strID.Format("%d",ChannelID);
strSQL=strSQL+" and ChannelID= "+strID;
}
m_UserName.TrimRight();
m_UserName.TrimLeft();
if(m_UserName=="")
{
strSQL=strSQL+" ";
}
else
{
strSQL=strSQL+ " and b.Name like '%" +m_UserName + "%'";
}
m_FileName.TrimRight();
m_FileName.TrimLeft();
if(m_FileName=="")
{
strSQL=strSQL+" ";
}
else
{
strSQL=strSQL+ " and FileName like '%" +m_FileName + "%'";
}
if((m_State=="所有状态")||(m_State==""))
{
strSQL=strSQL+" ";
}
else if(m_State=="审核通过")
{
strSQL=strSQL + " and a.State = 0 ";
}
else if(m_State=="待审核")
{
strSQL=strSQL + " and a.State = 1 ";
}
else if(m_State=="审核未通过")
{
strSQL=strSQL + " and a.State = 2 ";
}
else if(m_State=="审核中")
{
strSQL=strSQL + " and a.State = 3 ";
}
if((m_Server=="所有服务器")||(m_State==""))
{
strSQL=strSQL+" ";
}
else if(m_Server=="审片主服务器")
{
strSQL=strSQL + " and Type = 0 and Priority = 0 ";
}
else if(m_Server=="审片备份服务器")
{
strSQL=strSQL + " and Type = 0 and Priority = 1 ";
}
else if(m_Server=="总串主服务器")
{
strSQL=strSQL + " and Type = 1 and Priority = 0 ";
}
else if(m_Server=="总串备份服务器")
{
strSQL=strSQL + " and Type = 1 and Priority = 1 ";
}
CString strDate1,strDate2;
strDate1 = m_Time1.Format (_T("%Y-%m-%d"));
strDate2.Format("%4d-%2d-%2d",m_Time2.GetYear(),m_Time2.GetMonth(),m_Time2.GetDay()+1);
strSQL= strSQL + " AND (SendTime BETWEEN '" + strDate1 +"' AND '" + strDate2 + "')";
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -