Esempio n. 1
0
void CTradeLockDlg::OnShow(BOOL bShow)
{
	if (bShow)
	{
		AFX_MANAGE_STATE(AfxGetStaticModuleState());
		m_edPsw.SetWindowText("");
		m_cbFundAccount.ResetContent();
		IAccount* pCurrAccount = m_pAccountMng->GetCurrentAccount(atTrade);
		int nCurrIndex = 0;
		for (int i = 0; i < m_pAccountMng->GetCount(atTrade); i++)
		{
			IAccount* pAccount = m_pAccountMng->GetAccount(i, atTrade);
			CString sTmp = "";
			sTmp.Format(_T("股票%s(%s)"), pAccount->GetAccountName(), pAccount->GetUserName());
			int nIndex = m_cbFundAccount.AddString(sTmp);
			m_cbFundAccount.SetItemDataPtr(nIndex, pAccount);
			if (pAccount == pCurrAccount)
			{
				nCurrIndex = nIndex;
			}
		}
		if (m_cbFundAccount.GetCount() > 0)
		{
			m_cbFundAccount.SetCurSel(nCurrIndex);
		}
		if (pCurrAccount->GetConnectHandle() == 0)
		{
			m_stErrorHint.SetWindowText("由于未知的原因连接被断开,请检查网络后重新连接!");
		}
		else
		{
			m_stErrorHint.SetWindowText("");
		}
	}
}
Esempio n. 2
0
void CTradeLockDlg::OnBnClickedBtOk()
{
	// TODO: Add your control notification handler code here
	CString sTmp;
	m_edPsw.GetWindowText(sTmp);
	//IAccount* pAccount = m_pAccountMng->GetCurrentAccount(atTrade);
	int nIndex = m_cbFundAccount.GetCurSel();
	IAccount* pAccount = (IAccount*)m_cbFundAccount.GetItemDataPtr(nIndex);
	if (pAccount->GetConnectHandle() == 0)
	{
		pAccount->SetPassword(sTmp);
		if(pAccount->Login(sTmp))
		{
			pAccount->SetIsLocked(FALSE);
			this->GetLayoutWindow()->OpenLayout(CURRENT_LAYOUT_TARGET,LN_TRADINGPANEL,PUBLIC_OWNER);
			m_pAccountMng->SetCurrentAccount(pAccount);
		}
		else
			MessageBox(sTmp, "提示", MB_ICONINFORMATION);
	}
	else
	{
		if (pAccount->GetPassword() == sTmp)
		{
			pAccount->SetIsLocked(FALSE);
			this->GetLayoutWindow()->OpenLayout(CURRENT_LAYOUT_TARGET,LN_TRADINGPANEL,PUBLIC_OWNER);
			m_pAccountMng->SetCurrentAccount(pAccount);
		}
		else
		{
			MessageBox("密码错误!", "提示", MB_ICONINFORMATION);
			m_edPsw.SetFocus();
			m_edPsw.SetSel(0, -1);
		}
	}
	
}