361 lines
11 KiB
C++
361 lines
11 KiB
C++
// DLG_User_ModifyK.cpp : implementation file
|
||
//
|
||
|
||
#include "stdafx.h"
|
||
#include "corpsms.h"
|
||
#include "DLG_User_ModifyK.h"
|
||
|
||
#ifdef _DEBUG
|
||
#define new DEBUG_NEW
|
||
#undef THIS_FILE
|
||
static char THIS_FILE[] = __FILE__;
|
||
#endif
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// DLG_User_ModifyK dialog
|
||
#include "MainFrm.h"
|
||
#include "FKAddress.h"
|
||
|
||
DLG_User_ModifyK::DLG_User_ModifyK(CWnd* pParent /*=NULL*/)
|
||
: CDialog(DLG_User_ModifyK::IDD, pParent)
|
||
{
|
||
//{{AFX_DATA_INIT(DLG_User_ModifyK)
|
||
m_strAddr = _T("");
|
||
m_tBirthday = COleDateTime::GetCurrentTime();
|
||
m_strBuyCity = _T("");
|
||
m_tBuyDate = COleDateTime::GetCurrentTime();
|
||
m_strBuyProvince = _T("");
|
||
m_strBZ = _T("");
|
||
m_strCarNum = _T("");
|
||
m_strCarType = _T("");
|
||
m_strDPNum = _T("");
|
||
m_strFDJNum = _T("");
|
||
m_strFWName = _T("");
|
||
m_strFWNum = _T("");
|
||
m_strLocal = _T("");
|
||
m_strMobile = _T("");
|
||
m_strName = _T("");
|
||
m_strPostcode = _T("");
|
||
m_strProvince = _T("");
|
||
m_tRegDate = COleDateTime::GetCurrentTime();
|
||
m_strSCNum = _T("");
|
||
m_strSFZ = _T("");
|
||
m_strTel = _T("");
|
||
m_tSCDate = COleDateTime::GetCurrentTime();
|
||
m_strCorp = _T("");
|
||
//}}AFX_DATA_INIT
|
||
|
||
m_pFKAddress = (CFKAddress *)pParent;
|
||
m_AdoRS.SetAdoConnection( &m_pFKAddress->m_pMainFrame->m_adoConnection );
|
||
memset( &m_Address , 0 , sizeof(m_Address));
|
||
m_bAdd = true;
|
||
m_bFind = false;
|
||
}
|
||
|
||
|
||
void DLG_User_ModifyK::DoDataExchange(CDataExchange* pDX)
|
||
{
|
||
CDialog::DoDataExchange(pDX);
|
||
//{{AFX_DATA_MAP(DLG_User_ModifyK)
|
||
DDX_Text(pDX, IDC_USERMODIFYK_ADDR, m_strAddr);
|
||
DDV_MaxChars(pDX, m_strAddr, 49);
|
||
DDX_DateTimeCtrl(pDX, IDC_USERMODIFYK_BIRTHDAY, m_tBirthday);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_BUYCITY, m_strBuyCity);
|
||
DDV_MaxChars(pDX, m_strBuyCity, 15);
|
||
DDX_DateTimeCtrl(pDX, IDC_USERMODIFYK_BUYDATE, m_tBuyDate);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_BUYPROVINCE, m_strBuyProvince);
|
||
DDV_MaxChars(pDX, m_strBuyProvince, 6);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_BZ, m_strBZ);
|
||
DDV_MaxChars(pDX, m_strBZ, 49);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_CARNUM, m_strCarNum);
|
||
DDV_MaxChars(pDX, m_strCarNum, 8);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_CARTYPE, m_strCarType);
|
||
DDV_MaxChars(pDX, m_strCarType, 15);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_DPNUM, m_strDPNum);
|
||
DDV_MaxChars(pDX, m_strDPNum, 17);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_FDJNUM, m_strFDJNum);
|
||
DDV_MaxChars(pDX, m_strFDJNum, 8);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_FWNAME, m_strFWName);
|
||
DDV_MaxChars(pDX, m_strFWName, 12);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_FWNUM, m_strFWNum);
|
||
DDV_MaxChars(pDX, m_strFWNum, 5);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_LOCAL, m_strLocal);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_MOBILE, m_strMobile);
|
||
DDV_MaxChars(pDX, m_strMobile, 11);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_NAME, m_strName);
|
||
DDV_MaxChars(pDX, m_strName, 31);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_POSCODE, m_strPostcode);
|
||
DDV_MaxChars(pDX, m_strPostcode, 6);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_PROVINCE, m_strProvince);
|
||
DDV_MaxChars(pDX, m_strProvince, 6);
|
||
DDX_DateTimeCtrl(pDX, IDC_USERMODIFYK_REGDATE, m_tRegDate);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_SCNUM, m_strSCNum);
|
||
DDV_MaxChars(pDX, m_strSCNum, 6);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_SFZ, m_strSFZ);
|
||
DDV_MaxChars(pDX, m_strSFZ, 18);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_TEL, m_strTel);
|
||
DDV_MaxChars(pDX, m_strTel, 19);
|
||
DDX_DateTimeCtrl(pDX, IDC_USERMODIFYK_SCDATE, m_tSCDate);
|
||
DDX_Text(pDX, IDC_USERMODIFYK_CORP, m_strCorp);
|
||
DDV_MaxChars(pDX, m_strCorp, 49);
|
||
//}}AFX_DATA_MAP
|
||
}
|
||
|
||
|
||
BEGIN_MESSAGE_MAP(DLG_User_ModifyK, CDialog)
|
||
//{{AFX_MSG_MAP(DLG_User_ModifyK)
|
||
//}}AFX_MSG_MAP
|
||
END_MESSAGE_MAP()
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// DLG_User_ModifyK message handlers
|
||
|
||
BOOL DLG_User_ModifyK::OnInitDialog()
|
||
{
|
||
CDialog::OnInitDialog();
|
||
|
||
m_strName = m_Address.szName;
|
||
m_strCarNum = m_Address.szCarNum;
|
||
m_strProvince = m_Address.szProvince;
|
||
m_strAddr = m_Address.szAddr;
|
||
m_strCorp = m_Address.szCorp;
|
||
m_strPostcode = m_Address.szPostcode;
|
||
m_strTel = m_Address.szTel;
|
||
m_strMobile = m_Address.szMobile;
|
||
m_strSFZ = m_Address.szSFZ;
|
||
m_strBuyProvince=m_Address.szBuyProvince;
|
||
m_strBuyCity = m_Address.szBuyCity;
|
||
m_strCarType = m_Address.szCarType;
|
||
m_strFDJNum = m_Address.szFDJNum;
|
||
m_strDPNum = m_Address.szDPNum;
|
||
m_strSCNum = m_Address.szSCNum;
|
||
m_strFWNum = m_Address.szFWNum;
|
||
m_strFWName = m_Address.szFWName;
|
||
m_strBZ = m_Address.szBZ;
|
||
m_strLocal = m_szLocal;
|
||
|
||
COleDateTime tTemp(m_Address.tBirthday);
|
||
if ( tTemp.GetStatus() != COleDateTime::valid ) //<2F><>Чʱ<D0A7><CAB1>
|
||
{
|
||
m_tBirthday.SetStatus( COleDateTime::null );
|
||
}
|
||
else
|
||
{
|
||
m_tBirthday = tTemp;
|
||
}
|
||
COleDateTime tTemp2(m_Address.tBuyDate);
|
||
if ( tTemp.GetStatus() != COleDateTime::valid ) //<2F><>Чʱ<D0A7><CAB1>
|
||
{
|
||
m_tBuyDate.SetStatus( COleDateTime::null );
|
||
}
|
||
else
|
||
{
|
||
m_tBuyDate = tTemp2;
|
||
}
|
||
COleDateTime tTemp3(m_Address.tRegDate);
|
||
if ( tTemp.GetStatus() != COleDateTime::valid ) //<2F><>Чʱ<D0A7><CAB1>
|
||
{
|
||
m_tRegDate.SetStatus( COleDateTime::null );
|
||
}
|
||
else
|
||
{
|
||
m_tRegDate = tTemp3;
|
||
}
|
||
COleDateTime tTemp4(m_Address.tSCDate);
|
||
if ( tTemp.GetStatus() != COleDateTime::valid ) //<2F><>Чʱ<D0A7><CAB1>
|
||
{
|
||
m_tSCDate.SetStatus( COleDateTime::null );
|
||
}
|
||
else
|
||
{
|
||
m_tSCDate = tTemp4;
|
||
}
|
||
|
||
if ( m_bAdd )
|
||
{
|
||
GetDlgItem( IDOK )->SetWindowText( _T("<EFBFBD><EFBFBD> <20><>") );
|
||
}
|
||
|
||
if ( m_bFind )
|
||
{
|
||
GetDlgItem( IDOK )->SetWindowText( _T("<EFBFBD><EFBFBD> <20><>") );
|
||
this->SetWindowText( _T("<EFBFBD><EFBFBD><EFBFBD>ҿͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>") );
|
||
}
|
||
|
||
if ( m_bFind )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYK_LOCAL)->ShowWindow(SW_HIDE);
|
||
GetDlgItem(IDC_USERMODIFYK_GROUP)->ShowWindow(SW_SHOW);
|
||
GetDlgItem(IDC_USERMODIFYK_GROUPALL)->ShowWindow(SW_SHOW);
|
||
|
||
CButton * pButton = (CButton * )GetDlgItem(IDC_USERMODIFYK_GROUP);
|
||
pButton->SetCheck(true);
|
||
}
|
||
else
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYK_LOCAL)->ShowWindow(SW_SHOW);
|
||
GetDlgItem(IDC_USERMODIFYK_GROUP)->ShowWindow(SW_HIDE);
|
||
GetDlgItem(IDC_USERMODIFYK_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_ModifyK::OnOK()
|
||
{
|
||
UpdateData(true);
|
||
|
||
if ( !m_bFind )
|
||
{
|
||
if (m_strName.GetLength() <= 0 )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYK_NAME)->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 kaddress where Mobile='%s' and UserType='1' ") , m_strMobile);
|
||
BOOL b = m_AdoRS.Open( szSelect );
|
||
if ( b && m_AdoRS.GetRecordCount() )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYK_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 ;
|
||
}
|
||
}
|
||
if ( m_strCarNum.GetLength()>0 && m_strCarNum.GetLength()!=8 )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYK_CARNUM)->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><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
if ( m_strSFZ.GetLength()>0 && !(m_strSFZ.GetLength()==15 || m_strSFZ.GetLength()==18 ) )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYK_SFZ)->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><EFBFBD><EFBFBD>!") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
if ( m_strFWNum.GetLength()>0 && m_strFWNum.GetLength()!=5 )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYK_FWNUM)->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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
if ( m_strFWName.GetLength()>0 && m_strFWName.GetLength()!=12 )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYK_FWNAME)->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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
if ( m_strFDJNum.GetLength()>0 && m_strFDJNum.GetLength()!=8 )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYK_FDJNUM)->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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
if ( m_strDPNum.GetLength()>0 && m_strDPNum.GetLength()!=17 )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYK_DPNUM)->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><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
if ( m_strMobile.GetLength()>0 && m_strMobile.GetLength()!=11 )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYK_MOBILE)->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><EFBFBD><EFBFBD>!") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
if ( m_strPostcode.GetLength()>0 && m_strPostcode.GetLength()!=6 )
|
||
{
|
||
GetDlgItem(IDC_USERMODIFYK_POSCODE)->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><EFBFBD><EFBFBD>!") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
}
|
||
|
||
_tcscpy( m_Address.szName , m_strName );
|
||
_tcscpy( m_Address.szCarNum , m_strCarNum );
|
||
_tcscpy( m_Address.szProvince , m_strProvince );
|
||
_tcscpy( m_Address.szAddr , m_strAddr );
|
||
_tcscpy( m_Address.szCorp , m_strCorp );
|
||
_tcscpy( m_Address.szPostcode , m_strPostcode );
|
||
_tcscpy( m_Address.szTel , m_strTel );
|
||
_tcscpy( m_Address.szMobile , m_strMobile );
|
||
_tcscpy( m_Address.szSFZ , m_strSFZ );
|
||
_tcscpy( m_Address.szBuyProvince , m_strBuyProvince );
|
||
_tcscpy( m_Address.szBuyCity , m_strBuyCity );
|
||
_tcscpy( m_Address.szCarType , m_strCarType );
|
||
_tcscpy( m_Address.szFDJNum , m_strFDJNum );
|
||
_tcscpy( m_Address.szDPNum , m_strDPNum );
|
||
_tcscpy( m_Address.szSCNum , m_strSCNum );
|
||
_tcscpy( m_Address.szFWNum , m_strFWNum );
|
||
_tcscpy( m_Address.szFWName , m_strFWName );
|
||
_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_tBuyDate.GetStatus() == COleDateTime::valid )
|
||
m_tBuyDate.GetAsSystemTime( m_Address.tBuyDate );
|
||
else
|
||
memset(&m_Address.tBuyDate,0,sizeof(m_Address.tBuyDate));
|
||
|
||
if ( m_tRegDate.GetStatus() == COleDateTime::valid )
|
||
m_tRegDate.GetAsSystemTime( m_Address.tRegDate );
|
||
else
|
||
memset(&m_Address.tRegDate,0,sizeof(m_Address.tRegDate));
|
||
|
||
if ( m_tSCDate.GetStatus() == COleDateTime::valid )
|
||
m_tSCDate.GetAsSystemTime( m_Address.tSCDate );
|
||
else
|
||
memset(&m_Address.tSCDate,0,sizeof(m_Address.tSCDate));
|
||
|
||
if ( m_bFind )
|
||
{
|
||
CButton * pButton = (CButton * )GetDlgItem(IDC_USERMODIFYK_GROUPALL);
|
||
if ( pButton->GetCheck() )
|
||
{
|
||
m_Address.bGroupAll = true;
|
||
}
|
||
}
|
||
|
||
if ( !m_bFind && m_bAdd )
|
||
{
|
||
m_pFKAddress->AddUser(m_Address );
|
||
_tcscpy( m_Address.szName , _T("") );
|
||
_tcscpy( m_Address.szMobile , _T("") );
|
||
m_strName = _T("");
|
||
m_tBirthday.SetStatus( COleDateTime::null );
|
||
m_strMobile = _T("");
|
||
UpdateData(false);
|
||
GetDlgItem(IDC_USERMODIFYK_NAME)->SetFocus();
|
||
return ;
|
||
}
|
||
|
||
CDialog::OnOK();
|
||
}
|
||
|
||
void DLG_User_ModifyK::SetParam(KAddress address, TCHAR *pLocal, BOOL bAdd,BOOL bFind)
|
||
{
|
||
m_Address = address;
|
||
_tcscpy( m_szLocal , pLocal );
|
||
m_bAdd = bAdd;
|
||
m_bFind = bFind;
|
||
}
|
||
|
||
KAddress DLG_User_ModifyK::GetParam()
|
||
{
|
||
return m_Address;
|
||
}
|