Пример #1
0
    bool EvalService::doRegEval( const CString& regulation, const AcDbIntArray& clauses )
    {
        // 规程评价没有实现或者尚未注册
        EvalMethod* pEvalMethod = m_pEvalMethodManager->getEvalMethodByName( regulation );
        if( pEvalMethod == 0 ) return false;

        EvalResultGenerator* pEvalResultGenerator = CreateEvalResultGenerator( pEvalMethod );

        // 创建数据库操作对象
        CDaoDatabase* pDB = createDB( m_evalResultDataBasePath, false ); // 每次评价都重建数据库(删除已存在的数据库)
        TableCreator* pTableCreator = new TableCreator( pDB );
        DataWriter* pDataWriter = new DataWriter( pDB );

        int len = clauses.length();
        for( int i = 0; i < len; i++ )
        {
            pEvalResultGenerator->startEval();
            pEvalResultGenerator->setClauseNum( clauses[i] );
            pEvalResultGenerator->initEvalData();
            pEvalResultGenerator->createTable( pTableCreator );
            pEvalResultGenerator->initEvalObject();
            pEvalResultGenerator->writeToTable( pDataWriter );
            pEvalResultGenerator->endEval();
        }

        delete pTableCreator;
        delete pDataWriter;

        pDB->Close();
        delete pDB;

        delete pEvalResultGenerator;

        return true;
    }
//添加一份新的总表
void CEle_Power_DecomposeView::ReadFromMDB( CString filename )
{
	CMainFrame* pMain=(CMainFrame*)AfxGetApp()->m_pMainWnd;
	pMain->panel_test = "读取数据中";
	pMain->OnPaint();

	CDaoDatabase db;
	CDaoRecordset RecSet(&db);

	db.Open(filename);
	RecSet.Open(AFX_DAO_USE_DEFAULT_TYPE,"SELECT * FROM t_power_data",NULL);
	

	Zongbiao.AddNewZongbiao(RecSet);
	
	RecSet.Close();
	db.Close();

	pMain->panel_test = "读取数据完毕";
	pMain->OnPaint();

	ReadMDBFlag = 1;
	ReadMDBFinish = 1;
	
	((CTab1*)m_DlgArray[0])->UpdateList(Zongbiao);
}