268 lines
7.1 KiB
C++
268 lines
7.1 KiB
C++
// DLG_User_ModifyS.cpp : implementation file
|
||
//
|
||
|
||
#include "stdafx.h"
|
||
#include "corpsms.h"
|
||
#include "DLG_User_ModifyS.h"
|
||
|
||
#ifdef _DEBUG
|
||
#define new DEBUG_NEW
|
||
#undef THIS_FILE
|
||
static char THIS_FILE[] = __FILE__;
|
||
#endif
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// DLG_User_ModifyS dialog
|
||
|
||
#include "MainFrm.h"
|
||
#include "FSAddress.h"
|
||
|
||
DLG_User_ModifyS::DLG_User_ModifyS(CWnd* pParent /*=NULL*/)
|
||
: CDialog(DLG_User_ModifyS::IDD, pParent)
|
||
{
|
||
//{{AFX_DATA_INIT(DLG_User_ModifyS)
|
||
m_strAddr = _T("");
|
||
m_strBH = _T("");
|
||
m_strBZ = _T("");
|
||
m_strEmail = _T("");
|
||
m_tInDate = COleDateTime::GetCurrentTime();
|
||
m_tBirthday = COleDateTime::GetCurrentTime();
|
||
m_strName = _T("");
|
||
m_strLocal = _T("");
|
||
m_strMobile = _T("");
|
||
m_tOutDate = COleDateTime::GetCurrentTime();
|
||
m_strPrice = _T("");
|
||
m_strTel = _T("");
|
||
m_strYWY = _T("");
|
||
m_lSex = -1;
|
||
//}}AFX_DATA_INIT
|
||
|
||
m_pFSAddress = (CFSAddress *)pParent;
|
||
m_AdoRS.SetAdoConnection( &m_pFSAddress->m_pMainFrame->m_adoConnection );
|
||
memset( &m_Address , 0 , sizeof(m_Address));
|
||
m_bAdd = true;
|
||
m_bFind = false;
|
||
}
|
||
|
||
|
||
void DLG_User_ModifyS::DoDataExchange(CDataExchange* pDX)
|
||
{
|
||
CDialog::DoDataExchange(pDX);
|
||
//{{AFX_DATA_MAP(DLG_User_ModifyS)
|
||
DDX_Text(pDX, IDC_USERMODIFYS_ADDR, m_strAddr);
|
||
DDV_MaxChars(pDX, m_strAddr, 49);
|
||
DDX_Text(pDX, IDC_USERMODIFYS_BH, m_strBH);
|
||
DDV_MaxChars(pDX, m_strBH, 15);
|
||
DDX_Text(pDX, IDC_USERMODIFYS_BZ, m_strBZ);
|
||
DDV_MaxChars(pDX, m_strBZ, 49);
|
||
DDX_Text(pDX, IDC_USERMODIFYS_EMAIL, m_strEmail);
|
||
DDV_MaxChars(pDX, m_strEmail, 49);
|
||
DDX_DateTimeCtrl(pDX, IDC_USERMODIFYS_INDATE, m_tInDate);
|
||
DDX_Text(pDX, IDC_USERMODIFYS_KHNAME, m_strName);
|
||
DDV_MaxChars(pDX, m_strName, 23);
|
||
DDX_Text(pDX, IDC_USERMODIFYS_NICKNAME, m_strNickName);
|
||
DDV_MaxChars(pDX, m_strNickName, 23);
|
||
DDX_Text(pDX, IDC_USERMODIFYS_LOCAL, m_strLocal);
|
||
DDX_Text(pDX, IDC_USERMODIFYS_MOBILE, m_strMobile);
|
||
DDV_MaxChars(pDX, m_strMobile, 15);
|
||
DDX_DateTimeCtrl(pDX, IDC_USERMODIFYS_OUTDATE, m_tOutDate);
|
||
DDX_DateTimeCtrl(pDX, IDC_USERMODIFYS_BIRTHDAY, m_tBirthday);
|
||
DDX_Text(pDX, IDC_USERMODIFYS_PRICE, m_strPrice);
|
||
DDV_MaxChars(pDX, m_strPrice, 8);
|
||
DDX_Text(pDX, IDC_USERMODIFYS_TEL, m_strTel);
|
||
DDV_MaxChars(pDX, m_strTel, 49);
|
||
DDX_Text(pDX, IDC_USERMODIFYS_YWY, m_strYWY);
|
||
DDV_MaxChars(pDX, m_strYWY, 23);
|
||
DDX_CBIndex(pDX, IDC_USERMODIFYS_SEX, m_lSex);
|
||
//}}AFX_DATA_MAP
|
||
}
|
||
|
||
|
||
BEGIN_MESSAGE_MAP(DLG_User_ModifyS, CDialog)
|
||
//{{AFX_MSG_MAP(DLG_User_ModifyS)
|
||
//}}AFX_MSG_MAP
|
||
END_MESSAGE_MAP()
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// DLG_User_ModifyS message handlers
|
||
|
||
BOOL DLG_User_ModifyS::OnInitDialog()
|
||
{
|
||
CDialog::OnInitDialog();
|
||
|
||
m_strBH = m_Address.szBH;
|
||
m_strName = m_Address.szName;
|
||
m_strNickName = m_Address.szNickName;
|
||
long lSex = 0;
|
||
if ( CString(m_Address.szSex)==_T("<EFBFBD><EFBFBD>") )
|
||
lSex = 1;
|
||
if ( CString(m_Address.szSex)==_T("Ů") )
|
||
lSex = 2;
|
||
m_lSex = lSex;
|
||
m_strMobile = m_Address.szMobile;
|
||
m_strTel = m_Address.szTel;
|
||
m_strEmail = m_Address.szEmail;
|
||
m_strAddr = m_Address.szAddr;
|
||
|
||
m_strYWY = m_Address.szYWY;
|
||
m_strPrice = m_Address.szPrice;
|
||
m_strBZ = m_Address.szBZ;
|
||
m_strLocal = m_szLocal;
|
||
|
||
COleDateTime tTemp3(m_Address.tBirthday);
|
||
if ( tTemp3.GetStatus() != COleDateTime::valid ) //<2F><>Чʱ<D0A7><CAB1>
|
||
{
|
||
m_tBirthday.SetStatus( COleDateTime::null );
|
||
}
|
||
else
|
||
{
|
||
m_tBirthday = tTemp3;
|
||
}
|
||
|
||
COleDateTime tTemp(m_Address.tInDate);
|
||
if ( tTemp.GetStatus() != COleDateTime::valid ) //<2F><>Чʱ<D0A7><CAB1>
|
||
{
|
||
m_tInDate.SetStatus( COleDateTime::null );
|
||
}
|
||
else
|
||
{
|
||
m_tInDate = tTemp;
|
||
}
|
||
COleDateTime tTemp2(m_Address.tOutDate);
|
||
if ( tTemp.GetStatus() != COleDateTime::valid ) //<2F><>Чʱ<D0A7><CAB1>
|
||
{
|
||
m_tOutDate.SetStatus( COleDateTime::null );
|
||
}
|
||
else
|
||
{
|
||
m_tOutDate = tTemp2;
|
||
}
|
||
|
||
if ( m_bFind )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYS_LOCAL)->ShowWindow(SW_HIDE);
|
||
GetDlgItem(IDC_USERMODIFYS_GROUP)->ShowWindow(SW_SHOW);
|
||
GetDlgItem(IDC_USERMODIFYS_GROUPALL)->ShowWindow(SW_SHOW);
|
||
|
||
CButton * pButton = (CButton * )GetDlgItem(IDC_USERMODIFYS_GROUP);
|
||
pButton->SetCheck(true);
|
||
}
|
||
else
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYS_LOCAL)->ShowWindow(SW_SHOW);
|
||
GetDlgItem(IDC_USERMODIFYS_GROUP)->ShowWindow(SW_HIDE);
|
||
GetDlgItem(IDC_USERMODIFYS_GROUPALL)->ShowWindow(SW_HIDE);
|
||
}
|
||
|
||
UpdateData(false);
|
||
|
||
return TRUE; // return TRUE unless you set the focus to a control
|
||
// EXCEPTION: OCX Property Pages should return FALSE
|
||
}
|
||
|
||
void DLG_User_ModifyS::SetParam(CSAddress address, TCHAR *pLocal, BOOL bAdd, BOOL bFind)
|
||
{
|
||
m_Address = address;
|
||
_tcscpy( m_szLocal , pLocal );
|
||
m_bAdd = bAdd;
|
||
m_bFind = bFind;
|
||
}
|
||
|
||
CSAddress DLG_User_ModifyS::GetParam()
|
||
{
|
||
return m_Address;
|
||
}
|
||
|
||
void DLG_User_ModifyS::OnOK()
|
||
{
|
||
if ( !UpdateData(true) )
|
||
return ;
|
||
|
||
if ( !m_bFind )
|
||
{
|
||
if (m_strName.GetLength() <= 0 )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYS_KHNAME)->SetFocus();
|
||
MessageBox( _T("<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
|
||
//<2F><><EFBFBD>أ<EFBFBD><D8A3><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD>ظ<EFBFBD>
|
||
if (m_strMobile.GetLength()>0 && CString(m_Address.szMobile) != m_strMobile)
|
||
{
|
||
TCHAR szSelect[128]={0};
|
||
_stprintf( szSelect , _T("select * from saddress where Mobile='%s' and UserType='1' ") , m_strMobile);
|
||
BOOL b = m_AdoRS.Open( szSelect );
|
||
if ( b && m_AdoRS.GetRecordCount() )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYS_MOBILE)->SetFocus();
|
||
int iRet = MessageBox( _T("<EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONQUESTION|MB_YESNO );
|
||
if ( iRet != IDYES )
|
||
return ;
|
||
}
|
||
}
|
||
}
|
||
|
||
_tcscpy( m_Address.szBH , m_strBH );
|
||
_tcscpy( m_Address.szName , m_strName );
|
||
_tcscpy( m_Address.szNickName , m_strNickName );
|
||
if ( m_lSex == 0 )
|
||
_tcscpy( m_Address.szSex , _T("") );
|
||
else
|
||
if ( m_lSex == 1 )
|
||
_tcscpy( m_Address.szSex , _T("<EFBFBD><EFBFBD>") );
|
||
else
|
||
_tcscpy( m_Address.szSex , _T("Ů") );
|
||
|
||
_tcscpy( m_Address.szMobile , m_strMobile );
|
||
_tcscpy( m_Address.szTel , m_strTel );
|
||
_tcscpy( m_Address.szEmail , m_strEmail );
|
||
_tcscpy( m_Address.szAddr , m_strAddr );
|
||
|
||
_tcscpy( m_Address.szYWY , m_strYWY );
|
||
_tcscpy( m_Address.szPrice , m_strPrice );
|
||
_tcscpy( m_Address.szBZ , m_strBZ );
|
||
|
||
if ( m_tBirthday.GetStatus() == COleDateTime::valid )
|
||
m_tBirthday.GetAsSystemTime( m_Address.tBirthday );
|
||
else
|
||
memset(&m_Address.tBirthday,0,sizeof(m_Address.tBirthday));
|
||
|
||
if ( m_tInDate.GetStatus() == COleDateTime::valid )
|
||
m_tInDate.GetAsSystemTime( m_Address.tInDate );
|
||
else
|
||
memset(&m_Address.tInDate,0,sizeof(m_Address.tInDate));
|
||
|
||
if ( m_tOutDate.GetStatus() == COleDateTime::valid )
|
||
m_tOutDate.GetAsSystemTime( m_Address.tOutDate );
|
||
else
|
||
memset(&m_Address.tOutDate,0,sizeof(m_Address.tOutDate));
|
||
|
||
if ( m_bFind )
|
||
{
|
||
CButton * pButton = (CButton * )GetDlgItem(IDC_USERMODIFYS_GROUPALL);
|
||
if ( pButton->GetCheck() )
|
||
{
|
||
m_Address.bGroupAll = true;
|
||
}
|
||
}
|
||
|
||
if ( !m_bFind && m_bAdd )
|
||
{
|
||
m_pFSAddress->AddUser(m_Address );
|
||
_tcscpy( m_Address.szName , _T("") );
|
||
_tcscpy( m_Address.szNickName , _T("") );
|
||
_tcscpy( m_Address.szMobile , _T("") );
|
||
m_strName = _T("");
|
||
m_tBirthday.SetStatus( COleDateTime::null );
|
||
m_tInDate.SetStatus( COleDateTime::null );
|
||
m_tOutDate.SetStatus( COleDateTime::null );
|
||
m_strMobile = "";
|
||
UpdateData(false);
|
||
GetDlgItem(IDC_USERMODIFYS_KHNAME)->SetFocus();
|
||
return ;
|
||
}
|
||
|
||
CDialog::OnOK();
|
||
}
|