AgentManager/DLG_BBS_Send.cpp
2025-01-22 15:45:17 +08:00

122 lines
2.6 KiB
C++

// 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();
}