SmsManager/DLG_BBS_Send.cpp
2025-01-14 10:46:18 +08:00

203 lines
5.0 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 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("");
m_strAgent = _T("");
//}}AFX_DATA_INIT
memset(&m_See,0,sizeof(m_See));
m_lType = 0;
}
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);
DDV_MaxChars(pDX, m_strCorp, 10);
DDX_Text(pDX, IDC_BBS_SEND_USER, m_strUser);
DDV_MaxChars(pDX, m_strUser, 10);
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);
DDV_MaxChars(pDX, m_strType, 15);
DDX_Text(pDX, IDC_BBS_SEND_AGENTID, m_strAgent);
DDV_MaxChars(pDX, m_strAgent, 10);
//}}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 );
}
if ( m_See.lRAgentID == -1 )
{
m_strAgent =_T("所有");
}
//过期日加三天
COleDateTimeSpan tAdd(3,1,0,0);
m_tExpTime = COleDateTime::GetCurrentTime();
m_tExpTime += tAdd;
m_strMsg = m_See.szBZ;
#ifdef SMSMANAGER_KF
GetDlgItem(IDC_BBS_SEND_CORP)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BBS_SEND_USER)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BBS_SEND_AGENTID)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BBS_SEND_CORP_S)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BBS_SEND_USER_S)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BBS_SEND_AGENTID_S)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BBS_SEND_CORP_S2)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BBS_SEND_USER_S2)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BBS_SEND_AGENTID_S2)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BBS_SEND_EXPTIME_S1)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BBS_SEND_EXPTIME)->ShowWindow(SW_HIDE);
#endif
CString strTemp;
if ( m_lType ==1 )
{
strTemp= _T("非常感谢您使用我们的产品与服务!\r\n\r\n\r\n\r\n") \
_T("  客服热线400-111-0168\r\n\r\n") \
_T(" 并祝工作快乐!\r\n\r\n") \
_T(" %04d年%02d月%02d日");
}
if ( m_lType ==2 )
{
strTemp= _T("非常感谢您使用我们的产品与服务!\r\n \r\n\r\n\r\n") \
_T(" 并祝工作快乐!\r\n\r\n") \
_T(" %04d年%02d月%02d日");
}
if ( m_lType ==3 )
{
strTemp= _T("尊敬的短信用户:!\r\n 你的短信帐号有异常上行短信,号码已加入黑名单,请检查是否存在错发或资料错误的情况,及时更正!\r\n 手机号码:\r\n 上行内容:\r\n\r\n") \
_T(" 并祝工作快乐!\r\n\r\n") \
_T(" %04d年%02d月%02d日");
}
if ( strTemp.GetLength()>0 )
{
COleDateTime t=COleDateTime::GetCurrentTime();
m_strMsg.Format( strTemp , t.GetYear(),t.GetMonth(),t.GetDay());
}
if ( m_lType>0 )
{
((CEdit*)GetDlgItem(IDC_BBS_SEND_CORP))->SetReadOnly(true);
((CEdit*)GetDlgItem(IDC_BBS_SEND_USER))->SetReadOnly(true);
((CEdit*)GetDlgItem(IDC_BBS_SEND_AGENTID))->SetReadOnly(true);
}
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,long lType)
{
m_See = See;
m_lType=lType;
}
ANS_BBS_SeeData DLG_BBS_Send::GetParam()
{
return m_See;
}
void DLG_BBS_Send::OnOK()
{
if ( !UpdateData(true))
return ;
if ( m_strCorp == _T("所有") )
{
m_See.lRCorpID =-1;
m_See.lRUserID =-1;
}
else
{
m_See.lRCorpID = _ttol(m_strCorp);
if ( m_strUser == _T("所有") )
m_See.lRUserID = -1;
else
m_See.lRUserID = _ttol(m_strUser);
}
if ( m_strAgent == _T("所有") )
m_See.lRAgentID = -1;
else
m_See.lRAgentID = _ttol(m_strAgent );
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();
}