160 lines
3.6 KiB
C++
160 lines
3.6 KiB
C++
|
// DLG_C_HT_Add.cpp : implementation file
|
|||
|
//
|
|||
|
|
|||
|
#include "stdafx.h"
|
|||
|
#include "smsmanager.h"
|
|||
|
#include "DLG_C_HT_Add.h"
|
|||
|
|
|||
|
#ifdef _DEBUG
|
|||
|
#define new DEBUG_NEW
|
|||
|
#undef THIS_FILE
|
|||
|
static char THIS_FILE[] = __FILE__;
|
|||
|
#endif
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
// DLG_C_HT_Add dialog
|
|||
|
|
|||
|
|
|||
|
DLG_C_HT_Add::DLG_C_HT_Add(CWnd* pParent /*=NULL*/)
|
|||
|
: CDialog(DLG_C_HT_Add::IDD, pParent)
|
|||
|
{
|
|||
|
//{{AFX_DATA_INIT(DLG_C_HT_Add)
|
|||
|
m_strBegin = _T("");
|
|||
|
m_strEnd = _T("");
|
|||
|
m_lHTType = -1;
|
|||
|
//}}AFX_DATA_INIT
|
|||
|
m_lAgentID = 0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void DLG_C_HT_Add::DoDataExchange(CDataExchange* pDX)
|
|||
|
{
|
|||
|
CDialog::DoDataExchange(pDX);
|
|||
|
//{{AFX_DATA_MAP(DLG_C_HT_Add)
|
|||
|
DDX_Control(pDX, IDC_USER_CORPID2, m_E_AgentID);
|
|||
|
DDX_Control(pDX, IDC_C_HT_ADD_AGENT, m_L_Agent);
|
|||
|
DDX_Text(pDX, IDC_C_HT_ADD_BEGIN, m_strBegin);
|
|||
|
DDV_MaxChars(pDX, m_strBegin, 8);
|
|||
|
DDX_Text(pDX, IDC_C_HT_ADD_END, m_strEnd);
|
|||
|
DDV_MaxChars(pDX, m_strEnd, 8);
|
|||
|
DDX_CBIndex(pDX, IDC_C_HT_ADD_TYPE, m_lHTType);
|
|||
|
//}}AFX_DATA_MAP
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
BEGIN_MESSAGE_MAP(DLG_C_HT_Add, CDialog)
|
|||
|
//{{AFX_MSG_MAP(DLG_C_HT_Add)
|
|||
|
ON_BN_CLICKED(IDC_USER_QUERY2, OnUserQuery2)
|
|||
|
//}}AFX_MSG_MAP
|
|||
|
END_MESSAGE_MAP()
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
// DLG_C_HT_Add message handlers
|
|||
|
|
|||
|
BOOL DLG_C_HT_Add::OnInitDialog()
|
|||
|
{
|
|||
|
CDialog::OnInitDialog();
|
|||
|
|
|||
|
|
|||
|
m_L_Agent.ResetContent(); //ɾ<><C9BE>ԭ<EFBFBD><D4AD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>ҵ
|
|||
|
m_L_Agent.AddString( _T("<EFBFBD><EFBFBD><EFBFBD>пͻ<EFBFBD>") );
|
|||
|
m_L_Agent.SetItemData( 0 , 0 );
|
|||
|
POSITION pos = m_pAgent->GetHeadPosition();
|
|||
|
POSITION pos2;
|
|||
|
int i=1;
|
|||
|
CString str;
|
|||
|
while (pos)
|
|||
|
{
|
|||
|
pos2 = pos;
|
|||
|
ANS_Agent_NameData * pData = m_pAgent->GetNext( pos );
|
|||
|
if ( pData )
|
|||
|
{
|
|||
|
str.Format( _T("%d - %s") , pData->lAgentID , pData->szAgentName );
|
|||
|
m_L_Agent.AddString(str);
|
|||
|
m_L_Agent.SetItemData(i,pData->lAgentID);
|
|||
|
i++;
|
|||
|
}
|
|||
|
}
|
|||
|
m_L_Agent.SetCurSel(0);
|
|||
|
|
|||
|
m_strBegin= _T("C0000000");
|
|||
|
m_strEnd = _T("C0000100");
|
|||
|
m_lHTType = 0;
|
|||
|
|
|||
|
|
|||
|
UpdateData(false);
|
|||
|
|
|||
|
return TRUE; // return TRUE unless you set the focus to a control
|
|||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|||
|
}
|
|||
|
|
|||
|
void DLG_C_HT_Add::OnOK()
|
|||
|
{
|
|||
|
if ( !UpdateData(true) )
|
|||
|
return ;
|
|||
|
|
|||
|
if ( m_strBegin.GetLength() !=8 )
|
|||
|
{
|
|||
|
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>룡") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
|||
|
GetDlgItem(IDC_C_HT_ADD_BEGIN)->SetFocus();
|
|||
|
return ;
|
|||
|
}
|
|||
|
if ( m_strEnd.GetLength() !=8 )
|
|||
|
{
|
|||
|
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>룡") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
|||
|
GetDlgItem(IDC_C_HT_ADD_END)->SetFocus();
|
|||
|
return ;
|
|||
|
}
|
|||
|
if ( m_strBegin.Left(1) != m_strEnd.Left(1) ||
|
|||
|
m_strBegin.Left(1) != _T("C") && m_strBegin.Left(1) != _T("B") )
|
|||
|
{
|
|||
|
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><EFBFBD>룡") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
|||
|
GetDlgItem(IDC_C_HT_ADD_BEGIN)->SetFocus();
|
|||
|
return ;
|
|||
|
}
|
|||
|
if ( _ttol(m_strBegin.Right(8))>_ttol(m_strEnd.Right(8)) )
|
|||
|
{
|
|||
|
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>룡") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
|||
|
GetDlgItem(IDC_C_HT_ADD_BEGIN)->SetFocus();
|
|||
|
return ;
|
|||
|
}
|
|||
|
|
|||
|
m_lAgentID = m_L_Agent.GetItemData(m_L_Agent.GetCurSel()); //ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
|
|||
|
|
|||
|
CDialog::OnOK();
|
|||
|
}
|
|||
|
|
|||
|
void DLG_C_HT_Add::SetParam(CAgentName *pAgent)
|
|||
|
{
|
|||
|
m_pAgent = pAgent;
|
|||
|
}
|
|||
|
|
|||
|
void DLG_C_HT_Add::OnUserQuery2()
|
|||
|
{
|
|||
|
CString strTemp;
|
|||
|
CString strFind;
|
|||
|
m_E_AgentID.GetWindowText(strFind);
|
|||
|
if ( strFind.GetLength()<=0 )
|
|||
|
return ;
|
|||
|
long lSel = m_L_Agent.GetCurSel();
|
|||
|
long lCount = m_L_Agent.GetCount();
|
|||
|
for ( int i=lSel+1 ; i<lCount ; i++ )
|
|||
|
{
|
|||
|
m_L_Agent.GetLBText(i,strTemp);
|
|||
|
if ( strTemp.Find(strFind)>=0 )
|
|||
|
{
|
|||
|
m_L_Agent.SetCurSel(i);
|
|||
|
return ;
|
|||
|
}
|
|||
|
}
|
|||
|
for ( i=0 ; i<lSel ; i++ )
|
|||
|
{
|
|||
|
m_L_Agent.GetLBText(i,strTemp);
|
|||
|
if ( strTemp.Find(strFind)>=0 )
|
|||
|
{
|
|||
|
m_L_Agent.SetCurSel(i);
|
|||
|
return ;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|