Пример #1
0
BOOL CDomainListBox::SetCurrentStocks( int nType, LPCTSTR lpszDomain, CDomainContainer & groups )
{
	// Delete All
	ResetContent( );

	CStockContainer & container = AfxGetStockContainer();
	CStockContainer cntn;

	BOOL	bOK	=	FALSE;
	if( nType == CStockContainer::typeGroup )
	{
		CSPStringArray	astrSpecify;
		if( groups.GetDomainStocks( lpszDomain, astrSpecify ) )
			bOK	=	cntn.RetrieveSpecify( astrSpecify );	//	Not Set dwDate
	}
	else
	{
		bOK	=	cntn.RetrieveFromStatic( nType, lpszDomain, NULL, -1 );
	}

	if( bOK )
	{
		InitStorage( cntn.GetSize(), 32 );
		for( int i=0; i<cntn.GetSize(); i++ )
		{
			CStockInfo & info = cntn.ElementAt(i);
			CString	strItem	=	CString(info.GetStockCode()) + "(" + info.GetStockShortName() + ")    ";
			while( strItem.GetLength() < 16 )	strItem	+=	" ";
			strItem	+= info.GetStockName() ;
			int nItem = AddString( strItem );
		}
	}

	return bOK;
}
Пример #2
0
BOOL CSelectStk::OnInitDialog()
{
	CPropertyPageEx::OnInitDialog();
	
	CWaitCursor	waitcursor;

	// TODO: Add extra initialization here
	CDomainContainer & groups = AfxGetGroupContainer( );
	CDomainContainer & domains = AfxGetDomainContainer( );
	CStockContainer & container = AfxGetStockContainer();

	// Src
	m_comboGroupSrc.InitStrings( TRUE, TRUE, groups );
	m_comboGroupSrc.SetCurSel( 0 );
	OnSelchangeComboGroupsrc();

	// Dest
	m_listStockDest.InitStorage( m_listStockSrc.GetCount(), 32 );
	CStockContainer cntn;
	if( cntn.RetrieveSpecify( m_domainTemp ) )
	{
		for( int i=0; i<cntn.GetSize(); i++ )
		{
			CStockInfo & info = cntn.ElementAt(i);
			CString	strItem	=	CString(info.GetStockCode()) + "(" + info.GetStockShortName() + ")    ";
			while( strItem.GetLength() < 16 )	strItem	+=	" ";
			strItem	+= info.GetStockName() ;
			int nItem = m_listStockDest.AddString( strItem );
		}
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Пример #3
0
BOOL CDomainContainer::GetAllDomainInfo( CStockContainer * pContainer, DWORD dwDate )
{
	SP_ASSERT( pContainer );
	if( NULL == pContainer )
		return FALSE;

	DWORD	dwDateLatest = -1;
	AfxGetStockContainer().GetLatestTechDate( &dwDateLatest );

	for( int nDomain=0; nDomain<GetSize(); nDomain++ )
	{
		CDomain	&	domain	=	ElementAt(nDomain);
		CStockContainer	cntn;
		if( cntn.RetrieveSpecify( domain ) )
		{
			if( -1 != dwDate && dwDateLatest != dwDate )
			{
				for( int i=0; i<cntn.GetSize(); i++ )
				{
					CStockInfo	& info	=	cntn.ElementAt(i);
					info.StatBaseIndex( dwDate );
					info.StatTechIndex( dwDate );
				}
			}
			// cntn.SetMap( );
			cntn.SetAverage( );

			CStockInfo	info	=	cntn.GetAverage( );
			info.SetStockName( domain.m_strName );
			info.SetStockShortName( domain.m_strName );
			pContainer->Add( info );
		}
	}
	pContainer->SetMap();
	pContainer->SetAverage();
	return TRUE;
}