// DLG_Find_SmsBox.cpp : implementation file
//

#include "stdafx.h"
#include "corpsms.h"
#include "DLG_Find_SmsBox.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// DLG_Find_SmsBox dialog


DLG_Find_SmsBox::DLG_Find_SmsBox(CWnd* pParent /*=NULL*/)
	: CDialog(DLG_Find_SmsBox::IDD, pParent)
{
	//{{AFX_DATA_INIT(DLG_Find_SmsBox)
	m_TBegin = COleDateTime::GetCurrentTime();
	m_TEnd = COleDateTime::GetCurrentTime();
	m_strMsg = _T("");
	//}}AFX_DATA_INIT

	m_bShowTime = true;
	m_lType = 0;
}


void DLG_Find_SmsBox::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(DLG_Find_SmsBox)
	DDX_DateTimeCtrl(pDX, IDD_FIND_SMSBOX_BEGIN, m_TBegin);
	DDX_DateTimeCtrl(pDX, IDD_FIND_SMSBOX_END, m_TEnd);
	DDX_Text(pDX, IDD_FIND_SMSBOX_MSG, m_strMsg);
	DDV_MaxChars(pDX, m_strMsg, 32);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(DLG_Find_SmsBox, CDialog)
	//{{AFX_MSG_MAP(DLG_Find_SmsBox)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// DLG_Find_SmsBox message handlers

BOOL DLG_Find_SmsBox::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	if ( !m_bShowTime )
	{
		GetDlgItem(IDD_FIND_SMSBOX_BEGIN)->EnableWindow(false);
		GetDlgItem(IDD_FIND_SMSBOX_END)->EnableWindow(false);
	}

	if ( m_lType ==2 )
	{
		GetDlgItem(IDD_FIND_SMSBOX_MSG_S)->SetWindowText(_T("�������"));
	}
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void DLG_Find_SmsBox::OnOK() 
{
	if ( !UpdateData(true))
		return ;

	if ( m_TEnd<m_TBegin )
	{
		MessageBox( _T("��ѯ��ʼʱ�䲻��С�ڽ���ʱ�䣬���飡"),_T("����"),MB_ICONWARNING );
		GetDlgItem(IDD_FIND_SMSBOX_BEGIN)->SetFocus();
		return ;
	}

	
	CDialog::OnOK();
}

void DLG_Find_SmsBox::SetParam(BOOL bShowTime)
{
	m_bShowTime = bShowTime;
}

void DLG_Find_SmsBox::SetType(long lType)
{
	m_lType=lType;

}