// DLG_BBS_Send.cpp : implementation file // #include "stdafx.h" #include "smsmanager.h" #include "DLG_BBS_Send.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // DLG_BBS_Send dialog DLG_BBS_Send::DLG_BBS_Send(CWnd* pParent /*=NULL*/) : CDialog(DLG_BBS_Send::IDD, pParent) { //{{AFX_DATA_INIT(DLG_BBS_Send) m_strCorp = _T(""); m_strUser = _T(""); m_strMsg = _T(""); m_tExpTime = COleDateTime::GetCurrentTime(); m_strType = _T(""); //}}AFX_DATA_INIT memset(&m_See,0,sizeof(m_See)); } void DLG_BBS_Send::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(DLG_BBS_Send) DDX_Control(pDX, IDC_BBS_SEND_TYPE, m_L_Type); DDX_Text(pDX, IDC_BBS_SEND_CORP, m_strCorp); DDX_Text(pDX, IDC_BBS_SEND_USER, m_strUser); DDX_Text(pDX, IDC_BBS_SEND_MSG, m_strMsg); DDV_MaxChars(pDX, m_strMsg, 510); DDX_DateTimeCtrl(pDX, IDC_BBS_SEND_EXPTIME, m_tExpTime); DDX_CBString(pDX, IDC_BBS_SEND_TYPE, m_strType); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(DLG_BBS_Send, CDialog) //{{AFX_MSG_MAP(DLG_BBS_Send) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // DLG_BBS_Send message handlers BOOL DLG_BBS_Send::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here if ( m_See.lRCorpID == -1 ) { m_strCorp = _T("所有"); m_strUser = _T("所有"); } else { m_strCorp.Format( _T("%d") , m_See.lRCorpID ); m_strUser.Format( _T("%d") , m_See.lRUserID ); } //过期日加三天 COleDateTimeSpan tAdd(3,1,0,0); m_tExpTime = COleDateTime::GetCurrentTime(); m_tExpTime += tAdd; m_strMsg = m_See.szBZ; UpdateData(false); m_L_Type.SetCurSel(0); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void DLG_BBS_Send::SetParam(ANS_BBS_SeeData See) { m_See = See; } ANS_BBS_SeeData DLG_BBS_Send::GetParam() { return m_See; } void DLG_BBS_Send::OnOK() { if ( !UpdateData(true)) return ; if ( m_strMsg.GetLength() <=0 ) { MessageBox( _T("你必须输入发送内容,请检查!"),_T("错误"),MB_ICONWARNING ); return; } //过期日加三天 COleDateTimeSpan tAdd(1,0,0,0); if ( m_tExpTime < COleDateTime::GetCurrentTime() + tAdd ) { MessageBox( _T("过期日期小于或等于当前日期,请检查!"),_T("错误"),MB_ICONWARNING ); return ; } ::GetLocalTime( &m_See.tSendTime ); _tcscpy(m_See.szType , m_strType ); m_tExpTime.GetAsSystemTime( m_See.tExpTime ); _tcscpy( m_See.szBZ , m_strMsg ); CDialog::OnOK(); }