CorpSms/DLG_Send_User.cpp
2025-02-27 16:58:16 +08:00

155 lines
3.5 KiB
C++

// DLG_Send_User.cpp : implementation file
//
#include "stdafx.h"
#include "CorpSms.h"
#include "DLG_Send_User.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// DLG_Send_User dialog
DLG_Send_User::DLG_Send_User(CWnd* pParent /*=NULL*/)
: CDialog(DLG_Send_User::IDD, pParent)
{
//{{AFX_DATA_INIT(DLG_Send_User)
m_strBZ = _T("");
m_strMobile = _T("");
m_strName = _T("");
m_strNickName = _T("");
//}}AFX_DATA_INIT
memset( &m_User , 0 , sizeof(m_User) );
m_lType = 0;
}
void DLG_Send_User::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DLG_Send_User)
DDX_Text(pDX, IDC_SEND_USER_BZ, m_strBZ);
DDV_MaxChars(pDX, m_strBZ, 178);
DDX_Text(pDX, IDC_SEND_USER_MOBILE, m_strMobile);
DDV_MaxChars(pDX, m_strMobile, 18);
DDX_Text(pDX, IDC_SEND_USER_NAME, m_strName);
DDV_MaxChars(pDX, m_strName, 30);
DDX_Text(pDX, IDC_SEND_USER_NICKNAME, m_strNickName);
DDV_MaxChars(pDX, m_strNickName, 30);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DLG_Send_User, CDialog)
//{{AFX_MSG_MAP(DLG_Send_User)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DLG_Send_User message handlers
void DLG_Send_User::SetParam(Send_User user)
{
m_User = user;
}
Send_User DLG_Send_User::GetParam()
{
return m_User;
}
BOOL DLG_Send_User::OnInitDialog()
{
CDialog::OnInitDialog();
m_strName = m_User.szName;
m_strNickName = m_User.szNickName;
m_strMobile = m_User.szMobile;
m_strBZ = m_User.szBZ;
UpdateData( false );
if ( m_lType == 2 ) //´«Õæ
{
GetDlgItem(IDC_SEND_USER_NICKNAME)->EnableWindow(false);
GetDlgItem(IDC_SEND_USER_BZ)->EnableWindow(false);
GetDlgItem(IDC_SEND_USER_MOBILE_S)->SetWindowText(_T("´«Õæ"));
}
if ( m_lType == 3 ) //²ÊÐÅ
{
GetDlgItem(IDC_SEND_USER_NICKNAME)->EnableWindow(false);
GetDlgItem(IDC_SEND_USER_BZ)->EnableWindow(false);
}
if ( m_lType == 4 ) //QQͨѶ¼
{
GetDlgItem(IDC_SEND_USER_NICKNAME)->EnableWindow(false);
GetDlgItem(IDC_SEND_USER_BZ)->EnableWindow(false);
}
#ifdef UNICODE
((CEdit*)GetDlgItem(IDC_SEND_USER_BZ))->LimitText(MAX_MSG_LEN_UNI);
#else
((CEdit*)GetDlgItem(IDC_SEND_USER_BZ))->LimitText(MAX_MSG_LEN);
#endif
#ifdef CHINABANK_VER
((CEdit*)GetDlgItem(IDC_SEND_USER_BZ))->LimitText(MAX_MSG_LEN_UNI_BANK);
#endif
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void DLG_Send_User::OnOK()
{
UpdateData( true );
BOOL bOK=true;
switch(m_lType)
{
case 2:
bOK = isFaxNum( (TCHAR*)(LPCTSTR)m_strMobile );
break;
case 3:
bOK = isMmsNum( (TCHAR*)(LPCTSTR)m_strMobile );
break;
case 4:
bOK = isMmsNum( (TCHAR*)(LPCTSTR)m_strMobile );
break;
default:
bOK = isMobileNum( (TCHAR*)(LPCTSTR)m_strMobile );
break;
}
if ( !bOK )
{
if ( m_lType==2 )
MessageBox( _T("´«ÕæºÅÂëÊäÈëÓÐÎó£¬ÇëÖØÊ䣡"),_T("´íÎó"),MB_ICONWARNING);
else
MessageBox( _T("ÊÖ»úºÅÂëÊäÈëÓÐÎó£¬ÇëÖØÊ䣡"),_T("´íÎó"),MB_ICONWARNING);
GetDlgItem(IDC_SEND_USER_MOBILE)->SetFocus();
return ;
}
if ( m_strNickName == _T("ÈÎÎñºÅÂë×é") )
{
MessageBox( _T("ÎÞ·¨Ê¹ÓôËêdzƣ¬Çë¸ü»»£¡"),_T("´íÎó"),MB_ICONWARNING);
GetDlgItem(IDC_SEND_USER_NICKNAME)->SetFocus();
return ;
}
_tcscpy( m_User.szName , m_strName );
_tcscpy( m_User.szNickName , m_strNickName );
_tcscpy( m_User.szMobile , m_strMobile );
_tcscpy( m_User.szBZ , m_strBZ );
CDialog::OnOK();
}
void DLG_Send_User::SetEditType(long lType)
{
m_lType = lType;
}