// DLG_Find_UBoxLog.cpp : implementation file
//

#include "stdafx.h"
#include "corpsms.h"
#include "DLG_Find_UBoxLog.h"

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

/////////////////////////////////////////////////////////////////////////////
// DLG_Find_UBoxLog dialog


DLG_Find_UBoxLog::DLG_Find_UBoxLog(CWnd* pParent /*=NULL*/)
	: CDialog(DLG_Find_UBoxLog::IDD, pParent)
{
	//{{AFX_DATA_INIT(DLG_Find_UBoxLog)
	m_lStatus = -1;
	m_strYWYMobile = _T("");
	m_strCallNum = _T("");
	m_tBegin = COleDateTime::GetCurrentTime();
	m_tEnd = COleDateTime::GetCurrentTime();
	//}}AFX_DATA_INIT

	m_bShowTime = true;
}


void DLG_Find_UBoxLog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(DLG_Find_UBoxLog)
	DDX_CBIndex(pDX, IDD_FIND_UBOXLOG_STATUS, m_lStatus);
	DDX_Text(pDX, IDD_FIND_UBOXLOG_YWYMOBILE, m_strYWYMobile);
	DDV_MaxChars(pDX, m_strYWYMobile, 16);
	DDX_Text(pDX, IDD_FIND_UBOXLOG_CALLNUM, m_strCallNum);
	DDV_MaxChars(pDX, m_strCallNum, 16);
	DDX_DateTimeCtrl(pDX, IDD_FIND_UBOXLOG_BEGIN, m_tBegin);
	DDX_DateTimeCtrl(pDX, IDD_FIND_UBOXLOG_END, m_tEnd);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// DLG_Find_UBoxLog message handlers

void DLG_Find_UBoxLog::OnOK() 
{

	if ( !UpdateData(true))
		return ;

	if ( m_tEnd<m_tBegin )
	{
		MessageBox( _T("��ѯ��ʼʱ�䲻��С�ڽ���ʱ�䣬���飡"),_T("����"),MB_ICONWARNING );
		GetDlgItem(IDD_FIND_UBOXLOG_END)->SetFocus();
		return ;
	}
	
	CDialog::OnOK();
}

BOOL DLG_Find_UBoxLog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	
	if ( !m_bShowTime )
	{
		GetDlgItem(IDD_FIND_UBOXLOG_BEGIN)->EnableWindow(false);
		GetDlgItem(IDD_FIND_UBOXLOG_END)->EnableWindow(false);
	}

	m_lStatus = 0;

	UpdateData(false);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

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