⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parameterset.cpp

📁 个人理财系统(管理股票信息)
💻 CPP
字号:
// ParameterSet.cpp : implementation file
//

#include "stdafx.h"
#include "stocksystem.h"
#include "ParameterSet.h"
#include "AdoRecordSet.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CParameterSet dialog


CParameterSet::CParameterSet(CWnd* pParent /*=NULL*/)
	: CDialog(CParameterSet::IDD, pParent)
{
}


void CParameterSet::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CParameterSet)
	DDX_Control(pDX, IDC_LIST1, m_list);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CParameterSet, CDialog)
	//{{AFX_MSG_MAP(CParameterSet)
	ON_WM_CLOSE()
	ON_BN_CLICKED(IDC_ADD_PARAMETER, OnAddParameter)
	ON_WM_LBUTTONDOWN()
	ON_BN_CLICKED(IDC_BTN_CLOSE, OnBtnClose)
	ON_BN_CLICKED(IDC_DEL_BTN, OnDelBtn)
	ON_BN_CLICKED(IDC_AMEND_BTN, OnAmendBtn)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CParameterSet message handlers

void CParameterSet::OnOK() 
{
}

void CParameterSet::OnCancel() 
{
}

void CParameterSet::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	CDialog::OnCancel();
	CDialog::OnClose();
}

void CParameterSet::OnAddParameter() 
{
	add_parameter.DoModal();
}

BOOL CParameterSet::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_list.ModifyStyle(0, LVS_REPORT);
	m_list.SetExtendedStyle(m_list.GetExtendedStyle() | LVS_EX_GRIDLINES);
	
	CString str[7] = {"股票分类简称", "手续费", "最低手续费", \
		"印花税", "过户费", "最低过户费","委托费"};
	int i;
	for (i = 0; i < 7; i++)
	{
		m_list.InsertColumn(i, str[i], LVCFMT_LEFT, 82);
	}
	//从数据库读取股票列表信息,从TB_STOCK_BASE_INFO表里面读取
	ReadStockInfo();
	m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT);
	return TRUE; 
}

//从数据库读取股票列表信息,从TB_STOCK_BASE_INFO表里面读取
void CParameterSet::ReadStockInfo()
{
	CAdoRecordSet		record;
	CString				command;
	command = "select * from tb_stock_base_info";
	CStockSystemApp *pApp	= (CStockSystemApp *)AfxGetApp();
	int state = pApp->m_pConnection.GetRecordSet(command, record);
	//读取成功
	if (state != 0)
	{
		StockBaseInfo		baseinfo;
		while (!record.IsEof())
		{
			record.GetValue("mart_type", baseinfo.mart_type);
			record.GetValue("stock_spec_code", baseinfo.stock_spec_code);
			record.GetValue("stock_for_short", baseinfo.stock_for_short);
			record.GetValue("poundage", baseinfo.poundage);
			record.GetValue("least_poundage", baseinfo.least_poundage);
			record.GetValue("stamp_tax", baseinfo.stamp_tax);
			record.GetValue("transferrate", baseinfo.transferrate);
			record.GetValue("least_transferred", baseinfo.least_transferred);
			record.GetValue("commission", baseinfo.commission);

			pApp->StockBaseInfoVect.push_back(baseinfo);
			record.MoveNext();
		}
		//读取出来后,把数据显示到列表控件里
		int len = pApp->StockBaseInfoVect.size();
		CString		textstr;
		for (int i=0; i<len; i++)
		{
			//显示数据到列表控件 
			baseinfo = pApp->StockBaseInfoVect[i];
			textstr.Format("%s", baseinfo.stock_spec_code);		
			m_list.InsertItem(i, textstr);
			textstr.Empty();
			textstr.Format("%.2f", baseinfo.poundage);
			m_list.SetItemText(i, 1, textstr);			
			textstr.Empty();
			textstr.Format("%.2f", baseinfo.least_poundage);
			m_list.SetItemText(i, 2, textstr);
			textstr.Empty();
			textstr.Format("%.2f", baseinfo.stamp_tax);
			m_list.SetItemText(i, 3, textstr);
			textstr.Empty();
			textstr.Format("%.2f", baseinfo.transferrate);
			m_list.SetItemText(i, 4, textstr);
			textstr.Empty();
			textstr.Format("%.2f", baseinfo.least_transferred);
			m_list.SetItemText(i, 5, textstr);
			textstr.Empty();
			textstr.Format("%.2f", baseinfo.commission);
			m_list.SetItemText(i, 6, textstr);
		}
	}
	else
	{
		MessageBox("[CParameterSet::ReadStockInfo()]SQL语句执行错误","提示");
	}
	pApp->StockBaseInfoVect.clear();
}

void CParameterSet::OnLButtonDown(UINT nFlags, CPoint point) 
{
	int sel_count = m_list.GetSelectedCount();
	CDialog::OnLButtonDown(nFlags, point);
}

void CParameterSet::OnBtnClose() 
{
	CDialog::OnCancel();
	CDialog::OnClose();
}
//删除按键
void CParameterSet::OnDelBtn() 
{
	MessageBox("删除成功","提示");
}
//修改按键
void CParameterSet::OnAmendBtn() 
{
	MessageBox("修改成功","提示");
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -