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

📄 register_inoutcome_accountdlg.cpp

📁 实时系统的实习作业
💻 CPP
字号:
// Register_InOutcome_AccountDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Financing_Master_Hand.h"
#include "Register_InOutcome_AccountDlg.h"
#include "Financing_Master_HandView.h"           //包含现金管理视图类
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CRegister_InOutcome_AccountDlg dialog


CRegister_InOutcome_AccountDlg::CRegister_InOutcome_AccountDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CRegister_InOutcome_AccountDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CRegister_InOutcome_AccountDlg)
	m_sAccountName = _T("");
	m_AccountRemark = _T("");
	//}}AFX_DATA_INIT
	m_nAccountType = 0;
}


void CRegister_InOutcome_AccountDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CRegister_InOutcome_AccountDlg)
	DDX_Control(pDX, IDC_RADIO_SECURITIES, m_Securities);
	DDX_Control(pDX, IDC_RADIO_LOAN, m_Loan);
	DDX_Control(pDX, IDC_RADIO_INVEST, m_Invest);
	DDX_Control(pDX, IDC_RADIO_CASH, m_InOutcome);
	DDX_Text(pDX, IDC_ACCOUNTNAME, m_sAccountName);
	DDV_MaxChars(pDX, m_sAccountName, 8);
	DDX_Text(pDX, IDC_ACCOUNTREMARK, m_AccountRemark);
	DDV_MaxChars(pDX, m_AccountRemark, 256);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CRegister_InOutcome_AccountDlg, CDialog)
	//{{AFX_MSG_MAP(CRegister_InOutcome_AccountDlg)
	ON_BN_CLICKED(IDC_RADIO_CASH, OnRadioCash)
	ON_BN_CLICKED(IDC_RADIO_INVEST, OnRadioInvest)
	ON_BN_CLICKED(IDC_RADIO_LOAN, OnRadioLoan)
	ON_BN_CLICKED(IDC_RADIO_SECURITIES, OnRadioSecurities)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CRegister_InOutcome_AccountDlg message handlers

void CRegister_InOutcome_AccountDlg::OnRadioCash() 
{
	// TODO: Add your control notification handler code here
	SetAccountType(2);
}

void CRegister_InOutcome_AccountDlg::OnRadioInvest() 
{
	// TODO: Add your control notification handler code here
	SetAccountType(3);
}

void CRegister_InOutcome_AccountDlg::OnRadioLoan() 
{
	// TODO: Add your control notification handler code here
	SetAccountType(4);
}

void CRegister_InOutcome_AccountDlg::OnRadioSecurities() 
{
	// TODO: Add your control notification handler code here
	SetAccountType(5);
}

BOOL CRegister_InOutcome_AccountDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_nAccountType = 2;        //初始化为现金管理类型帐号
	SetAccountType(m_nAccountType);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CRegister_InOutcome_AccountDlg::SetAccountType(int type)
{
	if(type ==2)
	{
		m_InOutcome.SetCheck(BST_CHECKED);
		m_Invest.SetCheck(BST_UNCHECKED);
		m_Loan.SetCheck(BST_UNCHECKED);
		m_Securities.SetCheck(BST_UNCHECKED);
		m_nAccountType = 2;
	}
	else if(type ==3)
	{
		m_InOutcome.SetCheck(BST_UNCHECKED);
		m_Invest.SetCheck(BST_CHECKED);
		m_Loan.SetCheck(BST_UNCHECKED);
		m_Securities.SetCheck(BST_UNCHECKED);
		m_nAccountType = 3;
	}
	else if(type ==4)
	{
		m_InOutcome.SetCheck(BST_UNCHECKED);
		m_Invest.SetCheck(BST_UNCHECKED);
		m_Loan.SetCheck(BST_CHECKED);
		m_Securities.SetCheck(BST_UNCHECKED);
		m_nAccountType = 4;
	}
	else if(type ==5)
	{
		m_InOutcome.SetCheck(BST_UNCHECKED);
		m_Invest.SetCheck(BST_UNCHECKED);
		m_Loan.SetCheck(BST_UNCHECKED);
		m_Securities.SetCheck(BST_CHECKED);
		m_nAccountType = 5;
	}
	else return;
}

void CRegister_InOutcome_AccountDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData();
	///////////////////////以下用来查找帐号是否重复//////////////
	int i,n;
	if(m_nAccountType == 2)
	{
		CFinancing_Master_HandApp *TheApp =(CFinancing_Master_HandApp*) AfxGetApp();
		CFinancing_Master_HandView *pFirstView = (CFinancing_Master_HandView *)
			TheApp->m_pFirstView;
		n = pFirstView->m_accountArray.GetSize();
		for(i=0;i<n;i++)
			if(pFirstView->m_accountArray[i] == m_sAccountName) //如果重复
			{
				AfxMessageBox(_T("The account have been registered\nPlease choose another account"));
				return;
			}
	}
	else if(m_nAccountType == 3)
	{}
	else if(m_nAccountType == 4)
	{}
	else if(m_nAccountType == 5)
	{}
	else {}
	CDialog::OnOK();
}

⌨️ 快捷键说明

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