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

📄 addparameter.cpp

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CAddParameter dialog


CAddParameter::CAddParameter(CWnd* pParent /*=NULL*/)
	: CDialog(CAddParameter::IDD, pParent)
{
	//{{AFX_DATA_INIT(CAddParameter)
	m_stock_sort_simple = _T("");
	m_trans_money = 0.0;
	m_least_trans_money = 0.0;
	m_consign_money = 0.0;
	m_poundage = 0.0;
	m_least_poundage = 0.0;
	m_stamp_tax = 0.0;
	m_stock_cha_code = _T("");
	//}}AFX_DATA_INIT
}


void CAddParameter::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAddParameter)
	DDX_Control(pDX, IDC_MART_TYPE, m_mart_type);
	DDX_Text(pDX, IDC_STOCK_SOTR_SIMPLE, m_stock_sort_simple);
	DDX_Text(pDX, IDC_TRANS_MONEY, m_trans_money);
	DDX_Text(pDX, IDC_LEAST_TRANS_MONEY, m_least_trans_money);
	DDX_Text(pDX, IDC_CONSIGN_MONEY, m_consign_money);
	DDX_Text(pDX, IDC_POUNDAGE, m_poundage);
	DDX_Text(pDX, IDC_LEAST_POUNDAGE, m_least_poundage);
	DDX_Text(pDX, IDC_STAMP_TAX, m_stamp_tax);
	DDX_Text(pDX, IDC_STOCK_CHA_CODE, m_stock_cha_code);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAddParameter, CDialog)
	//{{AFX_MSG_MAP(CAddParameter)
	ON_WM_CLOSE()
	ON_BN_CLICKED(IDC_ADD_BTN, OnAddBtn)
	ON_BN_CLICKED(IDC_BTN_CANCLE, OnBtnCancle)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAddParameter message handlers

void CAddParameter::OnOK() 
{
	// TODO: Add extra validation here	
//	CDialog::OnOK();
}

void CAddParameter::OnCancel() 
{
	// TODO: Add extra cleanup here	
//	CDialog::OnCancel();
}

void CAddParameter::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	CDialog::OnCancel();
	CDialog::OnClose();
}
//增加参数按钮
void CAddParameter::OnAddBtn() 
{
	UpdateData();
	//获取数据,并进行验证
	if (m_stock_sort_simple.GetLength() == 0)
	{
		MessageBox("[股票分类简称]不能为空","提示");
		return;
	}
	else if (m_stock_cha_code.GetLength() == 0)
	{
		MessageBox("[股票特征码]不能为空","提示");
		return;
	}
 	else if (m_poundage == 0 )
 	{
		MessageBox("[手续费]不能为空","提示");
		return;
 	}
	else if (m_least_trans_money ==0)
	{
		MessageBox("[最低过户费]不能为空","提示");
		return;
	}
	else if (m_consign_money ==0)
	{
		MessageBox("[委托费]不能为空","提示");
		return;
	}
	else if (m_least_poundage ==0)
	{
		MessageBox("[最低手续费]不能为空","提示");
		return;
	}
	else if (m_stamp_tax ==0)
	{
		MessageBox("[印花税]不能为空","提示");
		return;
	}
	//所有数据验证正确后,就可以保存到数据库里面了 
	CStockSystemApp *pApp = (CStockSystemApp *)AfxGetApp();
	CString						mart_type;
	int i = m_mart_type.GetCurSel();
	m_mart_type.GetLBText(i, mart_type);
	if (pApp->m_pConnection.AddParameter(mart_type,m_stock_cha_code,m_stock_sort_simple, m_poundage,m_least_poundage,m_stamp_tax,m_trans_money,m_least_trans_money,m_consign_money))
	{
		//显示数据到列表控件 
		CParameterSet *pParSet		= (CParameterSet *)GetParent();
//		CListCtrl     list_ctrl	= pParSet->m_list;
		CString			textstr;
 		textstr.Format("%s", m_stock_cha_code);		
 		pParSet->m_list.InsertItem(i, textstr);
 		textstr.Empty();
 		textstr.Format("%.2f", m_poundage);
		pParSet->m_list.SetItemText(i, 1, textstr);			
		textstr.Empty();
 		textstr.Format("%.2f", m_least_poundage);
 		pParSet->m_list.SetItemText(i, 2, textstr);
 		textstr.Empty();
		textstr.Format("%.2f", m_stamp_tax);
 		pParSet->m_list.SetItemText(i, 3, textstr);
		textstr.Empty();
 		textstr.Format("%.2f", m_trans_money);
 		pParSet->m_list.SetItemText(i, 4, textstr);
		textstr.Empty();
 		textstr.Format("%.2f", m_least_trans_money);
		pParSet->m_list.SetItemText(i, 5, textstr);
 		textstr.Empty();
 		textstr.Format("%.2f", m_consign_money);
 		pParSet->m_list.SetItemText(i, 6, textstr);
		MessageBox("添加成功","提示");		
		CDialog::OnOK();		
	}
	else
	{
		MessageBox("添加失败","提示");
		return;
	}

}

void CAddParameter::OnBtnCancle() 
{
	CDialog::OnCancel();
}

BOOL CAddParameter::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_mart_type.SetCurSel(0);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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