www.gusucode.com > VC++开发的ACD树形策略编辑器-源码程序 > VC++开发的ACD树形策略编辑器-源码程序/code/DateTime.cpp

    //Download by http://www.NewXing.com
// DateTime.cpp : implementation file
//

#include "stdafx.h"
#include "dsACD_IVR.h"
#include "DateTime.h"

#include "dsACD_IVRDoc.h"
#include "dsACD_IVRView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDateTime dialog


CDateTime::CDateTime(CWnd* pParent /*=NULL*/)
	: CDialog(CDateTime::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDateTime)
	m_csComment = _T("");
	m_csType = _T("");
	m_csVariable = _T("");
	m_nSystem = -1;
	//}}AFX_DATA_INIT
}


void CDateTime::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDateTime)
	DDX_Text(pDX, IDC_DATECOMMENT, m_csComment);
	DDX_CBString(pDX, IDC_DATETYPE, m_csType);
	DDX_CBString(pDX, IDC_DATEVAR, m_csVariable);
	DDX_Radio(pDX, IDC_RADIOSYSTEM, m_nSystem);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CDateTime message handlers

BOOL CDateTime::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	CComboBox *pVariable=(CComboBox *)GetDlgItem(IDC_DATEVAR);
	CComboBox *pType=(CComboBox *)GetDlgItem(IDC_DATETYPE);

	CString buf, csNameString;
	m_pDsACD_IVRView->ReadVariable(buf);
	while (!buf.IsEmpty())
	{
		csNameString = buf.Left(buf.Find(";" ));
		pVariable->AddString(csNameString);
		buf.Delete(0, buf.Find(";" )+1);
	}

	int nIndex;

	nIndex = pVariable->SelectString(-1, m_csVariable);
	pVariable->SetCurSel(nIndex);

	nIndex = pType->SelectString(-1, m_csType);
	pType->SetCurSel(nIndex);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDateTime::DisplayDlg(dsACDObjectBase *pObj)
{
	dsDT_INFO * pDTInfo = (dsDT_INFO*) pObj->Read();

	m_csVariable = pDTInfo->Variable;	
//	if (pDTInfo->Style== "系统日期")
		m_nSystem = 0;
	if (pDTInfo->Style== "变量日期")
		m_nSystem = 1;

	m_csType = pDTInfo->Type;
	m_csComment = pDTInfo->Comment;

	if(DoModal()==IDOK)
	{
		if (m_csVariable == "")
			m_csVariable = "无变量";
		if (m_csType == "")
			m_csType = "无操作";

		pDTInfo->Variable = m_csVariable;
		if (m_nSystem == 1)
			pDTInfo->Style = "变量日期";
		else 
			pDTInfo->Style = "系统日期";

		pDTInfo->Type = m_csType;
		pDTInfo->Comment = m_csComment;
	}
	else 
		return;
}