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(); //删除原已有的企业
|
|
m_L_Agent.AddString( _T("自有客户") );
|
|
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("合同开始编号有误,请重新输入!") , _T("错误") , MB_ICONWARNING );
|
|
GetDlgItem(IDC_C_HT_ADD_BEGIN)->SetFocus();
|
|
return ;
|
|
}
|
|
if ( m_strEnd.GetLength() !=8 )
|
|
{
|
|
MessageBox( _T("合同结束编号有误,请重新输入!") , _T("错误") , 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("合同开始编号及结束编号第一位有误,请重新输入!") , _T("错误") , MB_ICONWARNING );
|
|
GetDlgItem(IDC_C_HT_ADD_BEGIN)->SetFocus();
|
|
return ;
|
|
}
|
|
if ( _ttol(m_strBegin.Right(8))>_ttol(m_strEnd.Right(8)) )
|
|
{
|
|
MessageBox( _T("合同开始编号大于结束编号,请重新输入!") , _T("错误") , MB_ICONWARNING );
|
|
GetDlgItem(IDC_C_HT_ADD_BEGIN)->SetFocus();
|
|
return ;
|
|
}
|
|
|
|
m_lAgentID = m_L_Agent.GetItemData(m_L_Agent.GetCurSel()); //取代理商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 ;
|
|
}
|
|
}
|
|
}
|