www.pudn.com > stocksoft.rar > SearchDlg.cpp


// SearchDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Accobook_CE.h" 
 
#include "Accobook_CEDoc.h" 
#include "Accobook_CEView.h" 
 
#include "SearchDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
extern int  UpdateList2(int nField,CString s1,CString s2); 
///////////////////////////////////////////////////////////////////////////// 
// CSearchDlg dialog 
CSearchDlg::CSearchDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CSearchDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CSearchDlg) 
	m_sBeiZhu = _T(""); 
	m_sRIQI1 = _T(""); 
	m_sRIQI2 = _T(""); 
	m_sShuE = _T(""); 
	m_sShuE1 = _T(""); 
	m_sShuE2 = _T(""); 
	m_sDaiMa = _T(""); 
	m_sMingChen = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
 
void CSearchDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CSearchDlg) 
	DDX_Text(pDX, IDC_EDIT_SearchBeiZhu, m_sBeiZhu); 
	DDV_MaxChars(pDX, m_sBeiZhu, 2022); 
	DDX_Text(pDX, IDC_EDIT_SearchRIQI1, m_sRIQI1); 
	DDX_Text(pDX, IDC_EDIT_SearchRIQI2, m_sRIQI2); 
	DDX_Text(pDX, IDC_EDIT_SearchSHUE, m_sShuE); 
	DDX_Text(pDX, IDC_EDIT_SearchSHUE1, m_sShuE1); 
	DDX_Text(pDX, IDC_EDIT_SearchSHUE2, m_sShuE2); 
	DDX_Text(pDX, IDC_EDIT_DAIMA, m_sDaiMa); 
	DDV_MaxChars(pDX, m_sDaiMa, 50); 
	DDX_Text(pDX, IDC_EDIT_MINGCHEN, m_sMingChen); 
	DDV_MaxChars(pDX, m_sMingChen, 254); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CSearchDlg, CDialog) 
	//{{AFX_MSG_MAP(CSearchDlg) 
	ON_BN_CLICKED(IDC_BUTTON_BeiZhu, OnBUTTONBeiZhu) 
	ON_BN_CLICKED(IDC_BUTTON_LeiXing, OnBUTTONLeiXing) 
	ON_BN_CLICKED(IDC_BUTTON_RIQI, OnButtonRiqi) 
	ON_BN_CLICKED(IDC_BUTTON_SearchAll, OnBUTTONSearchAll) 
	ON_BN_CLICKED(IDC_BUTTON_ShuE, OnBUTTONShuE) 
	ON_BN_CLICKED(ID_BUTTON_CLEARALL, OnButtonClearall) 
	ON_BN_CLICKED(IDC_BUTTON_DAIMA, OnButtonDaima) 
	ON_BN_CLICKED(IDC_BUTTON_MINGCHEN, OnButtonMingchen) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CSearchDlg message handlers 
 
BOOL CSearchDlg::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
 
    SetWindowText(_T("查询"));	 
 
	GetDlgItem(IDC_BUTTON_DAIMA)->SetWindowText(_T("按代码查询"));	 
	GetDlgItem(IDC_BUTTON_MINGCHEN)->SetWindowText(_T("按股名查询"));	 
	GetDlgItem(IDC_BUTTON_RIQI)->SetWindowText(_T("按日期查询"));	 
	GetDlgItem(IDC_STATIC1)->SetWindowText(_T("到"));	 
	GetDlgItem(IDC_STATIC2)->SetWindowText(_T("至"));	 
	GetDlgItem(IDC_BUTTON_LeiXing)->SetWindowText(_T("按买/卖查询"));	 
	GetDlgItem(IDC_BUTTON_ShuE)->SetWindowText(_T("按数量(股)查询"));	 
	GetDlgItem(IDC_BUTTON_BeiZhu)->SetWindowText(_T("按备注查询"));	 
	GetDlgItem(IDC_BUTTON_SearchAll)->SetWindowText(_T("组合查询"));	 
	GetDlgItem(ID_BUTTON_CLEARALL)->SetWindowText(_T("清屏"));	 
	GetDlgItem(IDOK)->SetWindowText(_T("退出"));	 
	 
	CComboBox* pCombo=(CComboBox*)GetDlgItem(IDC_COMBO1); 
	pCombo->ResetContent(); 
	pCombo->AddString(_T("全部")); 
	pCombo->AddString(_T("买入")); 
	pCombo->AddString(_T("卖出")); 
	pCombo->SetCurSel(0); 
 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CSearchDlg::OnOK()  
{ 
	// TODO: Add extra validation here 
	 
	CDialog::OnOK(); 
} 
 
void CSearchDlg::OnBUTTONLeiXing()//Shou/Zhi  
{ 
CString s; 
CComboBox* pCombo=(CComboBox*)GetDlgItem(IDC_COMBO1); 
int nCurSel=pCombo->GetCurSel(); 
if(nCurSel<0) 
	{ 
	AfxMessageBox(_T("请先选择买入/卖出,再按查询")); 
	return; 
	} 
if(nCurSel==0)s=_T("");//that is 全部	 
if(nCurSel==1)s=_T("买入");	 
if(nCurSel==2)s=_T("卖出");	 
 
CFrameWnd* pWnd=(CFrameWnd*)AfxGetMainWnd( ); 
if(pWnd) 
	{ 
	CAccobook_CEView* pView=(CAccobook_CEView*)pWnd->GetActiveView(); 
	if(pView) 
		pView->UpdateList(1,s); 
	} 
OnOK(); 
} 
 
void CSearchDlg::OnBUTTONBeiZhu()  
{ 
UpdateData(); 
CFrameWnd* pWnd=(CFrameWnd*)AfxGetMainWnd( ); 
if(pWnd) 
	{ 
	CAccobook_CEView* pView=(CAccobook_CEView*)pWnd->GetActiveView(); 
	if(pView) 
		pView->UpdateList(6,m_sBeiZhu); 
	} 
OnOK(); 
} 
 
void CSearchDlg::OnBUTTONShuE()  
{ 
UpdateData(); 
if((m_sShuE1!=_T(""))||(m_sShuE2!=_T(""))) 
	{ 
	CFrameWnd* pWnd=(CFrameWnd*)AfxGetMainWnd( ); 
	if(pWnd) 
		{ 
		CAccobook_CEView* pView=(CAccobook_CEView*)pWnd->GetActiveView(); 
		if(pView) 
			pView->UpdateList2(2,m_sShuE1,m_sShuE2); 
		} 
	} 
OnOK(); 
} 
 
void CSearchDlg::OnButtonRiqi()  
{ 
UpdateData(); 
if((m_sRIQI1!=_T(""))||(m_sRIQI2!=_T(""))) 
	{ 
	CFrameWnd* pWnd=(CFrameWnd*)AfxGetMainWnd( ); 
	if(pWnd) 
		{ 
		CAccobook_CEView* pView=(CAccobook_CEView*)pWnd->GetActiveView(); 
		if(pView) 
			pView->UpdateListByTime(0,m_sRIQI1,m_sRIQI2); 
		} 
	} 
OnOK(); 
} 
 
void CSearchDlg::OnButtonClearall()  
{ 
m_sDaiMa=""; 
m_sMingChen=""; 
m_sBeiZhu=""; 
m_sShuE1=""; 
m_sShuE2=""; 
m_sRIQI1=""; 
m_sRIQI2=""; 
CComboBox* pCombo=(CComboBox*)GetDlgItem(IDC_COMBO1); 
pCombo->SetCurSel(0); 
UpdateData(0); 
} 
 
void CSearchDlg::OnButtonDaima()  
{ 
UpdateData(); 
CFrameWnd* pWnd=(CFrameWnd*)AfxGetMainWnd( ); 
if(pWnd) 
	{ 
	CAccobook_CEView* pView=(CAccobook_CEView*)pWnd->GetActiveView(); 
	if(pView) 
		pView->UpdateList(4,m_sDaiMa); 
	} 
OnOK(); 
} 
 
void CSearchDlg::OnButtonMingchen()  
{ 
UpdateData(); 
CFrameWnd* pWnd=(CFrameWnd*)AfxGetMainWnd( ); 
if(pWnd) 
	{ 
	CAccobook_CEView* pView=(CAccobook_CEView*)pWnd->GetActiveView(); 
	if(pView) 
		pView->UpdateList(5,m_sMingChen); 
	} 
OnOK(); 
} 
 
void CSearchDlg::OnBUTTONSearchAll()  
{ 
UpdateData(); 
CString sType; 
CComboBox* pCombo=(CComboBox*)GetDlgItem(IDC_COMBO1); 
int nCurSel=pCombo->GetCurSel(); 
if(nCurSel<=0) 
	{ 
	sType=_T(""); 
	} 
if(nCurSel==1)sType=_T("买入");	 
if(nCurSel==2)sType=_T("卖出");	 
 
CFrameWnd* pWnd=(CFrameWnd*)AfxGetMainWnd( ); 
if(pWnd) 
	{ 
	CAccobook_CEView* pView=(CAccobook_CEView*)pWnd->GetActiveView(); 
	if(pView) 
		pView->UpdateListWithAll(sType,m_sShuE1,m_sShuE2,m_sRIQI1,m_sRIQI2,m_sBeiZhu,m_sDaiMa,m_sMingChen); 
	} 
//pView->UpdateList(4,m_sBeiZhu); 
//pView->UpdateList2(3,m_sShuE1,m_sShuE2); 
//pView->UpdateListByTime(1,m_sRIQI1,m_sRIQI2); 
 
OnOK(); 
}