Beispiel #1
0
int CDomainContainer::AddDomainReplace( CDomainContainer & newdomains )
{
	int nCount = 0;
	for( int i=0; i<newdomains.GetSize(); i++ )
	{
		if( AddDomainReplace( newdomains.ElementAt(i) ) >= 0 )
			nCount ++;
	}
	return nCount;
}
Beispiel #2
0
CDomainContainer &AfxGetGroupContainer( )
{
	static	CDomainContainer	g_groupcontainer;
	if( g_groupcontainer.GetSize() == 0 )
	{
		// Add Default
		CDomain	domain;
		domain.m_strName	=	domain_self;
		g_groupcontainer.AddDomain( domain );
	}
	return g_groupcontainer;
}
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;
}
int CDomainComboBox::InitStrings( BOOL bHasClass, BOOL bHasDomain, CDomainContainer & groups )
{
	ResetContent( );

	CDomainContainer & domains = AfxGetDomainContainer( );
	CStockContainer & container = AfxGetStockContainer();

	int	nItemCount	=	groups.GetSize();
	if( bHasClass )		nItemCount	+=	8;
	if( bHasDomain )	nItemCount	+=	domains.GetSize();
	
	// Init Storage
	InitStorage( nItemCount, 32 );
	CString	strGroup;

	if( bHasClass )
	{
		strGroup.LoadString( IDS_DOMAIN_ALL );
		int nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeAll );

		strGroup.LoadString( IDS_DOMAIN_INDEX );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeIndex );
		
		strGroup.LoadString( IDS_DOMAIN_CLASSSHAA );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassShaa );

		strGroup.LoadString( IDS_DOMAIN_CLASSSHAB );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassShab );

		strGroup.LoadString( IDS_DOMAIN_CLASSSZNA );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassSzna );

		strGroup.LoadString( IDS_DOMAIN_CLASSSZNB );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassSznb );

		strGroup.LoadString( IDS_DOMAIN_CLASSSHABOND );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassShabond );

		strGroup.LoadString( IDS_DOMAIN_CLASSSZNBOND );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassSznbond );
	}

	// Domains
	if( bHasDomain )
	{
		for( int i=0; i<domains.GetSize(); i++ )
		{
			CDomain	& domain = domains.ElementAt(i);
			int nItem = AddString( domain.m_strName );
			SetItemData( nItem, CStockContainer::typeDomain );
		}
	}

	// Groups
	for( int i=0; i<groups.GetSize(); i++ )
	{
		CDomain	& domain = groups.ElementAt(i);
		int nItem = AddString( domain.m_strName );
		SetItemData( nItem, CStockContainer::typeGroup );
	}

	return nItemCount;
}