【VC开源代码栏目提醒】:网学会员鉴于大家对VC开源代码十分关注,论文会员在此为大家搜集整理了“Date_SearchView.cpp”一文,供大家参考学习
// Date_SearchView.cpp : implementation of the CDate_SearchView class
//
#include "stdafx.h"
#include "Date_Search.h"
#include "Date_SearchSet.h"
#include "Date_SearchDoc.h"
#include "Date_SearchView.h"
#include"find.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDate_SearchView
IMPLEMENT_DYNCREATE(CDate_SearchView, CRecordView)
BEGIN_MESSAGE_MAP(CDate_SearchView, CRecordView)
//{{AFX_MSG_MAP(CDate_SearchView)
ON_COMMAND(ID_RECORD_FIND, OnRecordFind)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CRecordView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CRecordView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRecordView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDate_SearchView construction/destruction
CDate_SearchView::CDate_SearchView()
: CRecordView(CDate_SearchView::IDD)
{
//{{AFX_DATA_INIT(CDate_SearchView)
m_pSet = NULL;
//}}AFX_DATA_INIT
// TODO: add construction code here
}
CDate_SearchView::~CDate_SearchView()
{
}
void CDate_SearchView::DoDataExchange(CDataExchange* pDX)
{
CRecordView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDate_SearchView)
DDX_FieldText(pDX, IDC_EDIT1, m_pSet->m_column1, m_pSet);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_pSet->m_column2);
//}}AFX_DATA_MAP
}
BOOL CDate_SearchView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CRecordView::PreCreateWindow(cs);
}
void CDate_SearchView::OnInitialUpdate()
{
m_pSet = &GetDocument()->m_date_SearchSet;
CRecordView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
}
/////////////////////////////////////////////////////////////////////////////
// CDate_SearchView printing
BOOL CDate_SearchView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CDate_SearchView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CDate_SearchView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CDate_SearchView diagnostics
#ifdef _DEBUG
void CDate_SearchView::AssertValid() const
{
CRecordView::AssertValid();
}
void CDate_SearchView::Dump(CDumpContext& dc) const
{
CRecordView::Dump(dc);
}
CDate_SearchDoc* CDate_SearchView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDate_SearchDoc)));
return (CDate_SearchDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CDate_SearchView database support
CRecordset* CDate_SearchView::OnGetRecordset()
{
return m_pSet;
}
/////////////////////////////////////////////////////////////////////////////
// CDate_SearchView message handlers
void CDate_SearchView::OnRecordFind()
{
// TODO: Add your command handler code here
Cfind find;
m_pSet->m_strFilter="";
m_pSet->Requery();
UpdateData(false);
if(find.DoModal()==IDOK)
{
CString string,string0;
COleDateTime dt=0.0,dt0=0.0;
switch(find.ChooseWhat)
{
case 1:
dt=find.m_beforev;
string.Format("%d-%d-%d",dt.GetYear(),dt.GetMonth(),dt.GetDay());
m_pSet->m_strFilter="出生日期 <'"+ string+"'";
break;
case 2:
dt=find.m_afterv;
string.Format("%d-%d-%d",dt.GetYear(),dt.GetMonth(),dt.GetDay());
m_pSet->m_strFilter="出生日期 >'"+ string+"'";
break;
case 3:
dt=find.m_onv;
string.Format("%d-%d-%d",dt.GetYear(),dt.GetMonth(),dt.GetDay());
m_pSet->m_strFilter="出生日期 ='"+ string+"'";
break;
case 4:
dt0=find.m_between1v;
dt=find.m_between2v;
string0.Format("%d-%d-%d",dt0.GetYear(),dt0.GetMonth(),dt0.GetDay());
string.Format("%d-%d-%d",dt.GetYear(),dt.GetMonth(),dt.GetDay());
m_pSet->m_strFilter="出生日期 between '"+string0+"' and '"+string+"'";
}
}
m_pSet->Requery();
UpdateData(false);
}
上一篇:
FMDestine.frm
下一篇:
关于听觉掩蔽的语音增强算法及DSP实现