Exemple #1
0
void CSListView::SetCurrentStatus( int nType, LPCTSTR lpszDomain, DWORD dwDate )
{
	AfxGetSListStockContainer().RetrieveFromStatic( nType, lpszDomain, AfxGetActiveStrategy(), dwDate );
	OnUpdate( NULL, UPDATE_HINT_SLISTVIEW, NULL );

	CMainFrame	* pFrame = AfxGetMainFrame();
	if( pFrame )
		pFrame->m_DateBox.SetCurrentWindowText( );
}
Exemple #2
0
BOOL CStkUIApp::OnDBChanged( BOOL bRecalculate )
{
	CWaitCursor	waitcursor;

	// Reload DB
	AfxGetStockContainer().Load( &AfxGetDB(), NULL, NULL );
	AfxGetDomainContainer().Load( AfxGetProfile().GetDomainFile() );
	AfxGetGroupContainer().Load( AfxGetProfile().GetGroupFile() );
	AfxGetDB().LoadKDataCache( AfxGetStockContainer(), NULL, NULL, 0, STKLIB_MAX_PROGRESS );
	AfxGetStockContainer().OnDataChanged( );

	AfxGetStkReceiver().RefreshStockContainer( AfxGetStockContainer(), TRUE );

	// Reload AfxGetStockMain()
	AfxReloadStockMain( );

	// Recalcuate Yield
	if( bRecalculate && IDYES == AfxMessageBox( IDS_INSTALLPAC_IFRECALCULATE, MB_YESNO|MB_ICONINFORMATION ) )
	{
		AfxRecalculateYield( AfxGetProfile().GetYieldAverageDays(), TRUE );
		AfxGetStockContainer().ReloadBase( &AfxGetDB() );
	}

	// Update SListBar
	CMainFrame	* pMainFrame	=	AfxGetMainFrame();
	if( pMainFrame )
	{
		pMainFrame->m_SearchBox.InitStocks( TRUE, TRUE, TRUE );
		pMainFrame->m_SearchBox.SetCurrentWindowText( );
		//pMainFrame->m_DateBox.InitDates( );
		//pMainFrame->m_DateBox.SetCurrentWindowText( );
	}

	// Update Views
	AfxGetSListStockContainer().ReRetrieveFromStatic( AfxGetActiveStrategy(), TRUE );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SLISTVIEW, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_GRAPHVIEW, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_BASEVIEW, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SIMUVIEW_REREALRUN, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SELECTORVIEW, NULL );
	::PostMessage( AfxGetGroupView()->GetSafeHwnd(), WM_USER_UPDATEGROUPS, 0, 0 );

	return TRUE;
}
void CSetBaseDlg::OnStart() 
{
	UpdateData( );

	CNetDatabase	netdb;
	if( !netdb.SetRootPath( AfxGetProfile().GetSelfDBPath(), IStStore::dbtypeSelfDB ) )
	{
		AfxMessageBox( IDS_ROOTPATH_ERROR, MB_OK | MB_ICONINFORMATION );
		return;
	}

	if( ( m_strFileF10.IsEmpty() && m_strFileTdx.IsEmpty() && m_strFileFxj.IsEmpty() && m_strPathFxjBlock.IsEmpty() )
		|| ( 0 != access(m_strFileF10,0) && 0 != access(m_strFileTdx,0) && 0 != access(m_strFileFxj,0) && 0 != access(m_strPathFxjBlock,0) ) )
	{
		AfxMessageBox( IDS_SETBASE_FILENOTEXISTS, MB_OK|MB_ICONINFORMATION );
		return;
	}

	m_btnStart.EnableWindow( FALSE );

	AfxGetApp()->WriteProfileString( "setbasedlg", "filef10", m_strFileF10 );
	AfxGetApp()->WriteProfileString( "setbasedlg", "filetdx", m_strFileTdx );
	AfxGetApp()->WriteProfileString( "setbasedlg", "filefxj", m_strFileFxj );
	AfxGetApp()->WriteProfileString( "setbasedlg", "pathfxjblock", m_strPathFxjBlock );

	m_ctrlProgress.SetWindowPos( NULL, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE );
	m_ctrlProgress.SetRange( 0, STKLIB_MAX_PROGRESS );
	m_ctrlProgress.SetPos( 0 );

	if( m_strFileF10.GetLength() > 0 )
	{
		CPackage	pac;
		pac.m_nType		=	CPackage::packageBasetext;
		pac.m_bIsZipped	=	( m_strFileF10.GetLength() > 4 && 0 == m_strFileF10.Right(4).CompareNoCase(".zip") );
		pac.m_strDescript	=	m_strFileF10;
		if( netdb.InstallPackageEx( pac, m_strFileF10, InstallBaseCallback, GetSafeHwnd() ) )
			AfxMessageBox( IDS_SETBASE_INSTALLF10OK, MB_OK|MB_ICONINFORMATION );
		else
			AfxMessageBox( IDS_SETBASE_INSTALLF10FAIL, MB_OK|MB_ICONINFORMATION );
	}
	
	if( m_strFileTdx.GetLength() > 0 )
	{
		CPackage	pac;
		pac.m_nType		=	CPackage::packageBasetable;
		pac.m_bIsZipped	=	( m_strFileTdx.GetLength() > 4 && 0 == m_strFileTdx.Right(4).CompareNoCase(".zip") );
		pac.m_strDescript	=	m_strFileTdx;
		if( netdb.InstallPackageEx( pac, m_strFileTdx, NULL, NULL ) )
			AfxMessageBox( IDS_SETBASE_INSTALLTDXOK, MB_OK|MB_ICONINFORMATION );
		else
			AfxMessageBox( IDS_SETBASE_INSTALLTDXFAIL, MB_OK|MB_ICONINFORMATION );
	}
	
	if( m_strFileFxj.GetLength() > 0 )
	{
		CPackage	pac;
		pac.m_nType		=	CPackage::packageBasetable;
		pac.m_bIsZipped	=	( m_strFileFxj.GetLength() > 4 && 0 == m_strFileFxj.Right(4).CompareNoCase(".zip") );
		pac.m_strDescript	=	m_strFileFxj;
		if( netdb.InstallPackageEx( pac, m_strFileFxj, NULL, NULL ) )
			AfxMessageBox( IDS_SETBASE_INSTALLFXJOK, MB_OK|MB_ICONINFORMATION );
		else
			AfxMessageBox( IDS_SETBASE_INSTALLFXJFAIL, MB_OK|MB_ICONINFORMATION );
	}

	if( m_strPathFxjBlock.GetLength() > 0 )
	{
		CPackage	pac;
		pac.m_nType		=	CPackage::packageCode;
		pac.m_bIsZipped	=	( m_strPathFxjBlock.GetLength() > 4 && 0 == m_strPathFxjBlock.Right(4).CompareNoCase(".zip") );
		pac.m_strDescript	=	m_strPathFxjBlock;

		BOOL bOK = FALSE;
		int	nFileCountTotal	=	CNetDatabase::GetFileCount( m_strPathFxjBlock, FALSE );

		DWORD	attr = GetFileAttributes( m_strPathFxjBlock );
		if( 0xFFFFFFFF != attr && (attr & FILE_ATTRIBUTE_DIRECTORY) )
			bOK =	netdb.InstallPackagePath( pac, m_strPathFxjBlock, InstallBaseCallback, GetSafeHwnd(), nFileCountTotal, 0, FALSE );
		else
			bOK =	netdb.InstallPackage( pac, m_strPathFxjBlock, InstallBaseCallback, GetSafeHwnd() );

		if( bOK )
		{
			AfxGetDomainContainer().Store( AfxGetProfile().GetDomainFile() );
			AfxMessageBox( IDS_SETBASE_INSTALLFXJBLOCKOK, MB_OK|MB_ICONINFORMATION );
		}
		else
			AfxMessageBox( IDS_SETBASE_INSTALLFXJBLOCKFAIL, MB_OK|MB_ICONINFORMATION );
	}

	m_ctrlProgress.SetPos( STKLIB_MAX_PROGRESS );
	m_btnStart.EnableWindow( TRUE );

	AfxGetStockContainer().ReloadBase( &AfxGetDB() );
	AfxGetSListStockContainer().ReRetrieveFromStatic( AfxGetActiveStrategy() );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_GRAPHVIEW, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_BASEVIEW, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SLISTVIEW, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SELECTORVIEW, NULL );
}
void CSetColumnDlg::OnOK() 
{
	// TODO: Add extra validation here
	m_btnOK.EnableWindow( FALSE );

	// Store Show Items
	CSPDWordArray	& anShow	= AfxGetProfile().GetSListColumnsShow( );
	CSPDWordArray	& anOrder	= AfxGetProfile().GetSListColumnsOrder( );
	anShow.RemoveAll();
	anOrder.RemoveAll();
	for( int i=0; i<m_listColumn.GetItemCount(); i++ )
	{
		UINT	nID	=	m_listColumn.GetItemData( i );
		anOrder.Add( nID );

		if( m_listColumn.GetCheck( i ) )
			anShow.Add( nID );
	}

	if( 0 == anShow.GetSize() && IDNO == AfxMessageBox( IDS_SETCOLUMN_NOSELECT, MB_YESNO ) )
		return;

	// Store Parameters
	m_listColumn.HideItemComboBox( );
	for( int nItem=0; nItem<m_listColumn.GetItemCount(); nItem++ )
	{
		// Set Item Text
		UINT	nID	=	m_listColumn.GetItemData(nItem);

		// Set Column Combo Text
		CString	strParam;
		if( SLH_DIFF == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetDiffDays( nDays );
		}
		else if( SLH_DIFFPERCENT == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetDiffPercentDays( nDays );
		}
		else if( SLH_SCOPE == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetScopeDays( nDays );
		}
		else if( SLH_RATIO_CHANGEHAND == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetRatioChangeHandDays( nDays );
		}
		else if( SLH_RATIO_VOLUME == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetRatioVolumeDays( nDays );
		}
		else if( SLH_RS == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetRSDays( nDays );
		}
		else if( SLH_ANNGAINS_AVERAGE == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetYieldAverageDays( nDays );
		}
	}
	
	AfxGetProfile().StoreProfile( );

	CXFDialog::OnOK();

	//CMainFrame	* pMainFrame	=	AfxGetMainFrame();
	//if( pMainFrame )
	//{
	//	pMainFrame->m_DateBox.InitDates( );
	//	pMainFrame->m_DateBox.SetCurrentWindowText( );
	//}

	// Recalculate Yield Average
	if( AfxGetProfile().GetYieldAverageDays() != m_nYieldAverageDaysOld )
	{
		// Need Recalculate
		if( IDYES == AfxMessageBox( IDS_SETCOLUMN_IFRECALCULATE, MB_YESNO|MB_ICONINFORMATION ) )
		{
			AfxRecalculateYield( AfxGetProfile().GetYieldAverageDays(), TRUE );
			AfxGetStockContainer().ReloadBase( &AfxGetDB() );
			AfxGetSListStockContainer().ReRetrieveFromStatic( AfxGetActiveStrategy() );
		}
	}
	
	//	Clear the User Defined Index Cache
	if( m_bUserIndexModified )
		AfxGetSListStockContainer().ClearVariantSaveValue();
}
Exemple #5
0
void CSetKDataDlg::OnCompleted( )
{
	AfxGetSListStockContainer().ReRetrieveFromStatic( AfxGetActiveStrategy() );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_GRAPHVIEW, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SLISTVIEW, NULL );
}