153 lines
4.5 KiB
C++
153 lines
4.5 KiB
C++
// DLG_Corp_ExpiryRecycling.cpp: 实现文件
|
||
//
|
||
|
||
#include "stdafx.h"
|
||
#include "SmsManager.h"
|
||
#include "afxdialogex.h"
|
||
#include "DLG_Corp_ExpiryRecycling.h"
|
||
|
||
|
||
// DLG_Corp_ExpiryRecycling 对话框
|
||
|
||
IMPLEMENT_DYNAMIC(DLG_Corp_ExpiryRecycling, CDialogEx)
|
||
|
||
DLG_Corp_ExpiryRecycling::DLG_Corp_ExpiryRecycling(CWnd* pParent /*=nullptr*/)
|
||
: CDialogEx(IDD_CORP_EXPIRYRECYCLING, pParent)
|
||
, m_strBZ(_T(""))
|
||
, m_strCorpID(_T(""))
|
||
, m_strCorpName(_T(""))
|
||
, m_strExpiry(_T(""))
|
||
, m_strMmsBalance(_T(""))
|
||
, m_strMmsCount(_T(""))
|
||
, m_strMmsLastCharge(_T(""))
|
||
, m_strSmsBalance(_T(""))
|
||
, m_strSmsCount(_T(""))
|
||
, m_strSmsLastCharte(_T(""))
|
||
, m_strYWY(_T(""))
|
||
, m_strLastLogin(_T(""))
|
||
{
|
||
m_pRecyclingData = NULL;
|
||
m_lUserType = 0;
|
||
|
||
m_lSmsRecyclingCount = 0;
|
||
m_lMmsRecyclingCount = 0;
|
||
}
|
||
|
||
DLG_Corp_ExpiryRecycling::~DLG_Corp_ExpiryRecycling()
|
||
{
|
||
}
|
||
|
||
void DLG_Corp_ExpiryRecycling::DoDataExchange(CDataExchange* pDX)
|
||
{
|
||
CDialogEx::DoDataExchange(pDX);
|
||
DDX_Text(pDX, IDC_CORP_EXPIRYRECYCLING_BZ, m_strBZ);
|
||
DDV_MaxChars(pDX, m_strBZ, 150);
|
||
DDX_Text(pDX, IDC_CORP_EXPIRYRECYCLING_CORPID, m_strCorpID);
|
||
DDX_Text(pDX, IDC_CORP_EXPIRYRECYCLING_CORPNAME, m_strCorpName);
|
||
DDX_Text(pDX, IDC_CORP_EXPIRYRECYCLING_EXPRIY, m_strExpiry);
|
||
DDX_Text(pDX, IDC_CORP_EXPIRYRECYCLING_MMSBALANCE, m_strMmsBalance);
|
||
DDX_Text(pDX, IDC_CORP_EXPIRYRECYCLING_MMSCOUNT, m_strMmsCount);
|
||
DDX_Text(pDX, IDC_CORP_EXPIRYRECYCLING_MMSLASTCHARGE, m_strMmsLastCharge);
|
||
DDX_Text(pDX, IDC_CORP_EXPIRYRECYCLING_SMSBALANCE, m_strSmsBalance);
|
||
DDX_Text(pDX, IDC_CORP_EXPIRYRECYCLING_SMSCOUNT, m_strSmsCount);
|
||
DDX_Text(pDX, IDC_CORP_EXPIRYRECYCLING_SMSLASTCHARGE, m_strSmsLastCharte);
|
||
DDX_Text(pDX, IDC_CORP_EXPIRYRECYCLING_YWY, m_strYWY);
|
||
DDX_Text(pDX, IDC_CORP_EXPIRYRECYCLING_LASTLOGIN, m_strLastLogin);
|
||
}
|
||
|
||
|
||
BEGIN_MESSAGE_MAP(DLG_Corp_ExpiryRecycling, CDialogEx)
|
||
ON_BN_CLICKED(IDOK, &DLG_Corp_ExpiryRecycling::OnBnClickedOk)
|
||
ON_BN_CLICKED(IDCANCEL, &DLG_Corp_ExpiryRecycling::OnBnClickedCancel)
|
||
END_MESSAGE_MAP()
|
||
|
||
|
||
// DLG_Corp_ExpiryRecycling 消息处理程序
|
||
|
||
|
||
void DLG_Corp_ExpiryRecycling::SetData(ANS_Corp_Assist_ExpiryRecycling_Get* pGet,long lUserType)
|
||
{
|
||
m_pRecyclingData = pGet;
|
||
m_lUserType = lUserType;
|
||
}
|
||
|
||
void DLG_Corp_ExpiryRecycling::OnBnClickedOk()
|
||
{
|
||
if (!UpdateData(true))
|
||
return;
|
||
|
||
m_lSmsRecyclingCount = _ttol(m_strSmsCount);
|
||
m_lMmsRecyclingCount = _ttol(m_strMmsCount);
|
||
|
||
if (m_lSmsRecyclingCount<0 || m_lSmsRecyclingCount>m_pRecyclingData->lSmsBalance)
|
||
{
|
||
MessageBox(_T("过期回收的短信量小于0或大于余额,请检查!"), _T("错误"), MB_ICONWARNING);
|
||
GetDlgItem(IDC_CORP_EXPIRYRECYCLING_SMSCOUNT)->SetFocus();
|
||
return;
|
||
}
|
||
if (m_lMmsRecyclingCount<0 || m_lMmsRecyclingCount>m_pRecyclingData->lMmsBalance)
|
||
{
|
||
MessageBox(_T("过期回收的彩信量小于0或大于余额,请检查!"), _T("错误"), MB_ICONWARNING);
|
||
GetDlgItem(IDC_CORP_EXPIRYRECYCLING_MMSCOUNT)->SetFocus();
|
||
return;
|
||
}
|
||
|
||
if (m_lSmsRecyclingCount<=0 && m_lMmsRecyclingCount<=0 )
|
||
{
|
||
MessageBox(_T("过期回收的短信量与彩信量都为0,请检查!"), _T("错误"), MB_ICONWARNING);
|
||
GetDlgItem(IDC_CORP_EXPIRYRECYCLING_SMSCOUNT)->SetFocus();
|
||
return;
|
||
}
|
||
|
||
if (m_strBZ.GetLength() < 4)
|
||
{
|
||
MessageBox(_T("请录入过期回收原因!"), _T("错误"), MB_ICONWARNING);
|
||
GetDlgItem(IDC_CORP_EXPIRYRECYCLING_BZ)->SetFocus();
|
||
return;
|
||
}
|
||
|
||
CDialogEx::OnOK();
|
||
}
|
||
|
||
|
||
void DLG_Corp_ExpiryRecycling::OnBnClickedCancel()
|
||
{
|
||
// TODO: 在此添加控件通知处理程序代码
|
||
CDialogEx::OnCancel();
|
||
}
|
||
|
||
|
||
BOOL DLG_Corp_ExpiryRecycling::OnInitDialog()
|
||
{
|
||
CDialogEx::OnInitDialog();
|
||
|
||
|
||
if (m_lUserType == 1) //代理商
|
||
GetDlgItem(IDC_CORP_EXPIRYRECYCLING_CORPID_S)->SetWindowText(_T("代理商ID"));
|
||
|
||
m_strCorpID.Format(_T("%d"), m_pRecyclingData->lCorpID);
|
||
m_strCorpName = m_pRecyclingData->szCorpName;
|
||
m_strYWY = m_pRecyclingData->szYWY;
|
||
|
||
m_strExpiry.Format(_T("%04d.%02d.%02d"), m_pRecyclingData->tOverTime.wYear, m_pRecyclingData->tOverTime.wMonth, m_pRecyclingData->tOverTime.wDay);
|
||
m_strLastLogin.Format(_T("%04d.%02d.%02d"), m_pRecyclingData->tLastLogin.wYear, m_pRecyclingData->tLastLogin.wMonth, m_pRecyclingData->tLastLogin.wDay);
|
||
|
||
|
||
m_strSmsBalance.Format(_T("%d"), m_pRecyclingData->lSmsBalance);
|
||
m_strMmsBalance.Format(_T("%d"), m_pRecyclingData->lMmsBalance);
|
||
|
||
m_strSmsLastCharte = m_pRecyclingData->szSmsLastCharge;
|
||
m_strMmsLastCharge = m_pRecyclingData->szMmsLastCharge;
|
||
|
||
m_strSmsCount = m_strSmsBalance;
|
||
m_strMmsCount = m_strMmsBalance;
|
||
|
||
|
||
|
||
UpdateData(false);
|
||
|
||
|
||
return TRUE; // return TRUE unless you set the focus to a control
|
||
// 异常: OCX 属性页应返回 FALSE
|
||
}
|