Exemplo n.º 1
0
//////new version database read and save
bool CAirportsManager::loadDatabase(CAirportDatabase* pAirportDatabase)
{
	ASSERT(pAirportDatabase);
	if(!pAirportDatabase)
		return false;

	Clear();

	CString strSQL(_T(""));
	CADORecordset adoAirportRecordset;
	long lCount = 0 ;
	strSQL.Format(_T("SELECT * FROM TB_AIRPORTDB_AIRPORT"));
	try
	{
		CDatabaseADOConnetion::ExecuteSQLStatement(strSQL,lCount,adoAirportRecordset,pAirportDatabase->GetAirportConnection()) ;
	}
	catch (CADOException& e)
	{
		e.ErrorMessage();
		return false;
	}

	while(!adoAirportRecordset.IsEOF())
	{
		 CAirport* pAirport = new CAirport;
		 pAirport->loadDatabase(adoAirportRecordset);
		 m_vAirports.push_back(pAirport);
		 adoAirportRecordset.MoveNextData();
	}

	//read all sector
	CADORecordset adoSectorRecordset;
	strSQL.Format(_T("SELECT * FROM TB_AIRPORTDB_SECTOR"));
	try
	{
		CDatabaseADOConnetion::ExecuteSQLStatement(strSQL,lCount,adoSectorRecordset,pAirportDatabase->GetAirportConnection());
	}
	catch (CADOException& e)
	{
		e.ErrorMessage();
		return false;
	}
	
	while(!adoSectorRecordset.IsEOF())
	{
		CSector* pSector = new CSector(this);
		pSector->loadDatabase(adoSectorRecordset,pAirportDatabase);
		m_vSectors.push_back(pSector);
		adoSectorRecordset.MoveNextData();
	}

	return true;
}
Exemplo n.º 2
0
//read common data
bool CAirportsManager::loadARCDatabase(CAirportDatabase* pAirportDatabase)
{
	CString strSQL(_T(""));
	CADORecordset adoAirportRecordset;
	long lCount = 0 ;
	strSQL.Format(_T("SELECT * FROM TB_AIRPORTDB_AIRPORT"));
	try
	{
		CDatabaseADOConnetion::ExecuteSQLStatement(strSQL,lCount,adoAirportRecordset,pAirportDatabase->GetAirportConnection()) ;
	}
	catch (CADOException& e)
	{
		e.ErrorMessage();
		return false;
	}

	while(!adoAirportRecordset.IsEOF())
	{
		CAirport* pAirport = new CAirport;
		pAirport->loadDatabase(adoAirportRecordset);
		m_vAirports.push_back(pAirport);
		adoAirportRecordset.MoveNextData();
	}
	return true;
}
Exemplo n.º 3
0
////////new version database read and save/////////////////////////////////////////////////
bool CACTypesManager::loadDatabase(CAirportDatabase* pAirportDatabase)
{
	ASSERT(pAirportDatabase);

	Clear();
	m_ACTypeDataSet.SetACCategoryList(&m_vACCategories);
	m_ACTypeDataSet.SetDelACCategoryList(&m_DelCaccate);
	m_ACTypeDataSet.SetACTypesManager(this);
	m_ACTypeDataSet.loadDatabase(pAirportDatabase);

	CString strSQL(_T(""));
	strSQL.Format(_T("SELECT * FROM TB_AIRPORTDB_ACTYPE"));
	CADORecordset adoRecordset;
	long lCount = 0;
	try
	{
		CDatabaseADOConnetion::ExecuteSQLStatement(strSQL,lCount,adoRecordset,pAirportDatabase->GetAirportConnection());
	}
	catch (CADOException& e)
	{
		e.ErrorMessage();
		return false;
	}
	while(!adoRecordset.IsEOF())
	{
		CACType* pACType = new CACType();
		pACType->loadDatabase(pAirportDatabase,adoRecordset);
		m_vACTypes.push_back(pACType);
		adoRecordset.MoveNextData();
	}
	
	
	//ClacCategoryACTypeList();
	return true;
}
Exemplo n.º 4
0
//read common data
bool CACTypesManager::loadARCDatabase(CAirportDatabase* pAirportDatabase)
{
	Clear();
	CString strSQL(_T(""));
	strSQL.Format(_T("SELECT * FROM TB_AIRPORTDB_ACTYPE"));
	CADORecordset adoRecordset;
	long lCount = 0;
	try
	{
		CDatabaseADOConnetion::ExecuteSQLStatement(strSQL,lCount,adoRecordset,pAirportDatabase->GetAirportConnection());
	}
	catch (CADOException& e)
	{
		e.ErrorMessage();
		return false;
	}
	while(!adoRecordset.IsEOF())
	{
		CACType* pACType = new CACType();
		pACType->loadDatabase(pAirportDatabase,adoRecordset);
		m_vACTypes.push_back(pACType);
		adoRecordset.MoveNextData();
	}
	/*ACALIASMANAGER->SetCACTypeManager(this);*/
	return true;
}
Exemplo n.º 5
0
CStandGroupClosureAtAirport::CStandGroupClosureAtAirport(CADORecordset &adoRecordset):CClosureAtAirport(adoRecordset)
{
	if(!adoRecordset.IsEOF()){

		CString strSQL = _T("");
		strSQL.Format(_T("SELECT * FROM STANDGROUPCLOSURENODE   WHERE (PARENTID = %d);"),m_nID);
		long nRecordCount = -1;
		CADORecordset adoRecordsetChild;
		CADODatabase::ExecuteSQLStatement(strSQL, nRecordCount, adoRecordsetChild);

		/*std::vector<int> vStands;
		ALTAirport::GetStandsIDs(m_nAirportID, vStands);*/	
		/*ALTObjectGroup altObjGroup;	
		altObjGroup.ReadData(pStandGroupClosureNode->m_nStandGroupID);*/
		while (!adoRecordsetChild.IsEOF()) {
			int nStandGroupID = -1;
			adoRecordsetChild.GetFieldValue(_T("STANDGROUPID"),nStandGroupID);
			/*bool bAdd = false;
			if(std::find(vStands.begin(),vStands.end(),nStandGroupID) != vStands.end())*/
			bool bAdd = true;
		
			CStandGroupClosureNode * pNode = new CStandGroupClosureNode(adoRecordsetChild);
			if(pNode){
				if(bAdd)
					m_vrStandGroupClosure.push_back(pNode);
				else 
					m_vrStandGroupClosureDeleted.push_back(pNode);
			}

			adoRecordsetChild.MoveNextData();
		}
	}
}
Exemplo n.º 6
0
void ALTAirspace::GetHoldList( int nAirspaceID, ALTObjectUIDList& IDList )
{
	CString strSQL = _T("");
	strSQL.Format("SELECT ID FROM HOLD_VIEW WHERE APTID = %d",nAirspaceID);

	try
	{
		long nRecordCount;
		CADORecordset adoRs;
		CADODatabase::ExecuteSQLStatement(strSQL,nRecordCount,adoRs);

		while (!adoRs.IsEOF())
		{
			int nID = -1;
			adoRs.GetFieldValue(_T("ID"),nID);
			IDList.push_back(nID);

			adoRs.MoveNextData();
		}
	}
	catch (CADOException& e)
	{
		e.ErrorMessage();
	}
}
Exemplo n.º 7
0
CTaxiwayClosureAtAirport::CTaxiwayClosureAtAirport(CADORecordset &adoRecordset):CClosureAtAirport(adoRecordset)
{
	if(!adoRecordset.IsEOF()){ 

		CString strSQL = _T("");
		strSQL.Format(_T("SELECT * FROM TAXIWAYCLOSURENODE  WHERE (PARENTID = %d);"),m_nID);
		long nRecordCount = -1;
		CADORecordset adoRecordsetChild;
		CADODatabase::ExecuteSQLStatement(strSQL, nRecordCount, adoRecordsetChild);

		std::vector<int> vrTaxiwayID;
		ALTAirport::GetTaxiwaysIDs(m_nAirportID,vrTaxiwayID);
		while (!adoRecordsetChild.IsEOF()) {
			int nTaxiwayID = -1;
			adoRecordsetChild.GetFieldValue(_T("TAXIWAYID"),nTaxiwayID);
			bool bAdd = false;
			if(std::find(vrTaxiwayID.begin(),vrTaxiwayID.end(),nTaxiwayID) != vrTaxiwayID.end())
				bAdd = true;

			CTaxiwayClosureNode * pNode = new CTaxiwayClosureNode(adoRecordsetChild);
			if(pNode){
				if(bAdd)
					m_vrTaxiwayClosure.push_back(pNode);
				else
					m_vrTaxiwayClosureDeleted.push_back(pNode);
			}
			adoRecordsetChild.MoveNextData();
		}
	}
}
Exemplo n.º 8
0
bool CProbDistManager::loadDatabase(CAirportDatabase* pAirportDatabase)
{
	clear();

	CString strSQL(_T(""));
	strSQL.Format(_T("SELECT * FROM TB_AIRPORTDB_PRODISTMANAGER"));
	CADORecordset adoRecordset ;
	long count = 0;
	try
	{
		CDatabaseADOConnetion::ExecuteSQLStatement(strSQL,count,adoRecordset,pAirportDatabase->GetAirportConnection()) ; 
	}
	catch (CADOException& e)
	{
		e.ErrorMessage() ;
		return false;
	}
	CString sName(_T(""));
	CString sProbtype(_T(""));
	CString sProbdate(_T(""));
	int nID = -1 ;
	while (!adoRecordset.IsEOF())
	{
		adoRecordset.GetFieldValue(_T("PRODIST_NAME"),sName) ;
		adoRecordset.GetFieldValue(_T("PROBDISTDATA"),sProbdate) ;
		adoRecordset.GetFieldValue(_T("ID"),nID) ;
		ProbabilityDistribution* pProb = NULL ;
		try
		{
			pProb = ProbabilityDistribution::GetTerminalRelateProbDistributionFromDB (sProbdate);
		}
		catch (TwoStringError& e)
		{
			char string[256];
			e.getMessage (string);
			MessageBox(NULL,"Unknown Probability Distribution ","Error",MB_OK) ;
			adoRecordset.MoveNextData();
			continue ;
		}
		CProbDistEntry* pProbDist = new CProbDistEntry( sName, pProb );
		pProbDist->SetID(nID) ;
		m_vProbDist.push_back(pProbDist);

		adoRecordset.MoveNextData() ;
	}
	return true;
}
Exemplo n.º 9
0
///////////////////////////////old code version, no more use///////////////////////////////////////////
void CProbDistManager::ReadDataFromDB(int _airportDBID,DATABASESOURCE_TYPE type )
{
	clear() ;
    CString SQL ;
	SQL.Format(_T("SELECT * FROM TB_AIRPORTDB_PRODISTMANAGER WHERE AIRPORTDB_ID = %d"),_airportDBID) ;
	CADORecordset recordset ;
	long count = 0;
	try
	{
		CADODatabase::ExecuteSQLStatement(SQL,count,recordset,type) ; 
	}
	catch (CADOException e)
	{
		e.ErrorMessage() ;
		return ;
	}
	CString name ;
	CString pProb_type ;
	CString pProb_date ;
	int id = -1 ;
	while (!recordset.IsEOF())
	{
         recordset.GetFieldValue(_T("PRODIST_NAME"),name) ;
		 recordset.GetFieldValue(_T("PROBDISTDATA"),pProb_date) ;
         recordset.GetFieldValue(_T("ID"),id) ;
		 ProbabilityDistribution* pProb = NULL ;
		 try
		 {
			 pProb = ProbabilityDistribution::GetTerminalRelateProbDistributionFromDB (pProb_date);
		 }
		 catch (TwoStringError e)
		 {
		 	MessageBox(NULL,"Unknown Probability Distribution ","Error",MB_OK) ;
			recordset.MoveNextData() ;
			continue ;
		 }
		 CProbDistEntry* pProbDist = new CProbDistEntry( name, pProb );
         pProbDist->SetID(id) ;
		 m_vProbDist.push_back(pProbDist);
         
		 recordset.MoveNextData() ;
	}
}
Exemplo n.º 10
0
void CAirportDatabaseList::ReadAirportDBData()
{
	clear() ;
	CString SQL ;
    SQL.Format(_T("SELECT * FROM TB_PROJECT_AIRPORTDB")) ;
	CADORecordset recordset ;
	long count ;
	try
	{
		CADODatabase::ExecuteSQLStatement(SQL,count,recordset,DATABASESOURCE_TYPE_ACCESS_GLOBALDB) ;
	}
	catch (CADOException e)
	{
		e.ErrorMessage() ;
		return ;
	}
	CShareTemplateDatabase* _pDB = NULL; 
	int id = -1 ;
	CString _name ;

	CString strSharePath(_T(""));
	CString strARCPath(_T(""));
	strARCPath.Format(_T("%s\\%s"),PROJMANAGER->GetAppPath(),_T("Databases\\arc.mdb"));
	while(!recordset.IsEOF())
	{
	   recordset.GetFieldValue(_T("ID"),id) ;
	   recordset.GetFieldValue(_T("AIRPORTDB_NAME"),_name) ;
	  
	   int nPos = checkIfIncludeKeyWords(_name.GetBuffer());
	   if (nPos != -1)
	   {
		   CString strLeft(_T(""));
		   CString strRight(_T(""));
		   strLeft = _name.Left(nPos);
		   strRight = _name.Right(_name.GetLength() - nPos - 1);
		   _name = strLeft + strRight;
	   }

	   strSharePath.Format(_T("%s\\ImportDB\\%s.mdb"),PROJMANAGER->GetAppPath(),_name);
	   _pDB  = new CShareTemplateDatabase(strARCPath,strSharePath) ;
	   _pDB->setName(_name) ;
	   _pDB->SetID(id) ;
	   if (!getAirportDBByName(_name))
	   {
		    m_vAirportDB.push_back(_pDB) ;
	   }

	   if(recordset.GetFieldValue(_T("VERSION"),id))
		   _pDB->m_nVersion = id ;
	   else
		   _pDB->m_nVersion = 0 ;
	   recordset.MoveNextData() ;
	}
}
Exemplo n.º 11
0
void IntersectedStretchInAirport::ReadData( int nAirportID )
{
	m_vIntersectedStretches.clear();
	long nItemCount =0;
	CADORecordset adoRecordset;
	IntersectedStretch newStretch;
	CString selectSQL;
	newStretch.GetSelectSQL(nAirportID,selectSQL);
	CADODatabase::ExecuteSQLStatement(selectSQL,nItemCount,adoRecordset);
	while (!adoRecordset.IsEOF())
	{	
		newStretch.InitFromDBRecordset(adoRecordset);
		AddItem(newStretch);
		adoRecordset.MoveNextData();
	}
}
Exemplo n.º 12
0
std::vector<IntersectItem*> IntersectItem::ReadData(int nParentID)
{

	std::vector<IntersectItem*> vReslt;
	CString strSQL;
	GetSelectSQL(nParentID, strSQL);
	long nCount = 0;
	CADORecordset adoRecordset;
	CADODatabase::ExecuteSQLStatement(strSQL,nCount, adoRecordset);

	while (!adoRecordset.IsEOF())
	{
		vReslt.push_back( ReadData(adoRecordset) );		
		adoRecordset.MoveNextData();
	} 

	return vReslt;
}
Exemplo n.º 13
0
void CConflictResolution::ReadData(int nProjID)
{
	SqlSelectScriptMaker selectSql(TB_CONFLICTRESOLUTION);
	selectSql.SetCondition( SqlScriptColumn(COL_PROJID, nProjID).EqualCondition() );
	
	
	long lRecordCount = 0;
	CADORecordset adoRecordset;

	CADODatabase::ExecuteSQLStatement(selectSql.GetScript(),lRecordCount,adoRecordset);
	while(!adoRecordset.IsEOF())
	{		
		adoRecordset.GetFieldValue(COL_ID,m_nID);
		adoRecordset.GetFieldValue(COL_RADIUSOFCONCERN,m_nRadiusOfConcern);
		int nAtIntersectionOnRight;
		adoRecordset.GetFieldValue(COL_ENUMATINTERSECTIONONRIGHT,nAtIntersectionOnRight);
		m_enumAtIntersectionOnRight = (YesOrNo)nAtIntersectionOnRight;
		int nFirstInATaxiway;
		adoRecordset.GetFieldValue(COL_ENUMFIRSTINATAXIWAY,nFirstInATaxiway);
		m_enumFirstInATaxiway = (YesOrNo)nFirstInATaxiway;
		int nOnSpecificTaxiways;
		adoRecordset.GetFieldValue(COL_ENUMONSPECIFICTAXIWAYS,nOnSpecificTaxiways);
		m_enumOnSpecificTaxiways = (YesOrNo)nOnSpecificTaxiways;
		
		adoRecordset.GetFieldValue(COL_RUNWAYCROSSBUFFERTIME, m_nRunwayCrossBuffer);

		long nTime;
		adoRecordset.GetFieldValue(COL_RUNAYASTAXIWAY_NOAPPROACHDIST, m_dRunwayAsTaxiwayNoApporachDistance);
		adoRecordset.GetFieldValue(COL_RUNAYASTAXIWAY_NOAPPROACHTIME, nTime); m_tRunwayAsTaxiwayNoApporachTime.setPrecisely(nTime);
		adoRecordset.GetFieldValue(COL_RUNWAYASTAXIWAY_NOTAKEOFFTIME, nTime); m_tRuwnayAsTaxiwayNoTakeoffTime.setPrecisely(nTime);

		adoRecordset.MoveNextData();
	}
	m_pAtIntersectionOnRightList->SetAirportDB(m_pAirportDB);
	m_pAtIntersectionOnRightList->ReadData(m_nID);
	m_pFirstInATaxiwayList->SetAirportDB(m_pAirportDB);
	m_pFirstInATaxiwayList->ReadData(m_nID);
	m_pOnSpecificTaxiwaysList->SetAirportDB(m_pAirportDB);
	m_pOnSpecificTaxiwaysList->ReadData(m_nID);
	m_vCrossBuffers.SetAirportDB(m_pAirportDB);
	m_vCrossBuffers.ReadData(m_nID);

}
Exemplo n.º 14
0
void IntersectedStretch::ReadAirportStretchs( int nAirportID ,const IntersectionNodesInAirport& vnodes,std::vector<IntersectedStretch>& vStretches)
{
	//read intersection Node

	long nItemCount =0;
	CADORecordset adoRecordset;
	IntersectedStretch newStretch;
	CString selectSQL;
	newStretch.GetSelectSQL(nAirportID,selectSQL);
	CADODatabase::ExecuteSQLStatement(selectSQL,nItemCount,adoRecordset);
	while (!adoRecordset.IsEOF())
	{	
		newStretch.ReadData(adoRecordset,vnodes);
		if(newStretch.GetIntersectionNode().GetID()>=0)
			vStretches.push_back(newStretch);
		else 
			newStretch.DeleteData();

		adoRecordset.MoveNextData();
	}
}
void IntersectionNodesInAirport::ExportIntersectionNodes(CAirsideExportFile& exportFile)
{
	exportFile.getFile().writeField(_T("ID, NAME, AIRPORTID, OBJECTID1, OBJ1DISTPOS, OBJECTID2, OBJ2DISTPOS, NODEINDEX, POS_X, POS_Y, POS_Z"));
	exportFile.getFile().writeLine();

	CString strSQL =_T("");
	strSQL.Format(_T("SELECT * FROM INTERSECTIONNODE WHERE AIRPORTID IN (SELECT ID FROM ALTAIRPORT WHERE PROJID = %d) "),exportFile.GetProjectID());

	CADORecordset adoRecordset;
	long nItemCount =-1;
	CADODatabase::ExecuteSQLStatement(strSQL,nItemCount,adoRecordset);

	while (!adoRecordset.IsEOF())
	{
		IntersectionNode itersecNode;
		itersecNode.ReadData(adoRecordset);
		itersecNode.ExportIntersectionNode(exportFile);
		exportFile.getFile().writeLine();
		adoRecordset.MoveNextData();
	}
	exportFile.getFile().endFile();
}
Exemplo n.º 16
0
void CClosure::ReadData(void)
{
	CString strSQL = _T("");
	strSQL.Format(_T("SELECT * FROM CLOSUREATAIRPORT WHERE (PROJID = %d);"),m_nProjID);
	long nRecordCount = -1;
	CADORecordset adoRecordset;
	CADODatabase::ExecuteSQLStatement(strSQL, nRecordCount, adoRecordset);

	std::vector<int> vAirportIds;
	InputAirside::GetAirportList(m_nProjID, vAirportIds);	

	Clear();

	if(adoRecordset.IsEOF()){
		std::vector<int>::iterator itrID;
		for (itrID = vAirportIds.begin();itrID != vAirportIds.end();++itrID) {
			switch(m_nObjectMark) {
				case 1://CRunwayClosureAtAirport
					{
						CRunwayClosureAtAirport * pRunwayClosure = new CRunwayClosureAtAirport;
						pRunwayClosure->m_nAirportID = *itrID;
						if(pRunwayClosure)m_vrClosureAtAirport.push_back(pRunwayClosure);
					}
					break;
				case 2://CTaxiwayClosureAtAirport
					{
						CTaxiwayClosureAtAirport* pTaxiwayClosure = new CTaxiwayClosureAtAirport;
						pTaxiwayClosure->m_nAirportID = *itrID;
						if(pTaxiwayClosure)m_vrClosureAtAirport.push_back(pTaxiwayClosure);
					}
					break;
				case 3://CStandGroupClosureAtAirport
					{
						CStandGroupClosureAtAirport* pStandGroupClosure = new CStandGroupClosureAtAirport;
						pStandGroupClosure->m_nAirportID = *itrID;
						if(pStandGroupClosure)m_vrClosureAtAirport.push_back(pStandGroupClosure);
					}
					break;
				default:
					break;
			}
		}
	}

	while (!adoRecordset.IsEOF()) {
		int nID = -1;
		int nAirportID = -1;
		int nObjectMark = -1;
		adoRecordset.GetFieldValue(_T("ID"),nID);
		adoRecordset.GetFieldValue(_T("AIRPORTID"),nAirportID);
		adoRecordset.GetFieldValue(_T("OBJECTMARK"),nObjectMark);

		bool bAdd = false;
		if(std::find(vAirportIds.begin(),vAirportIds.end(),nAirportID) != vAirportIds.end())
			bAdd = true;

		bool bInitialize = true;
		if(nObjectMark != m_nObjectMark)
			bInitialize = false;
			
		if(bInitialize){
			switch(m_nObjectMark) 
			{
			case 1://CRunwayClosureAtAirport
				{
					CRunwayClosureAtAirport * pRunwayClosure = new CRunwayClosureAtAirport(adoRecordset);
					if(pRunwayClosure){
						if(bAdd)
							m_vrClosureAtAirport.push_back(pRunwayClosure);
						else
							m_vrClosureAtAirportDeleted.push_back(pRunwayClosure);
					}
				}
				break;
			case 2://CTaxiwayClosureAtAirport
				{
					CTaxiwayClosureAtAirport* pTaxiwayClosure = new CTaxiwayClosureAtAirport(adoRecordset);
					if(pTaxiwayClosure){
						if(bAdd)
							m_vrClosureAtAirport.push_back(pTaxiwayClosure);
						else
							m_vrClosureAtAirportDeleted.push_back(pTaxiwayClosure);
					}
				}
				break;
			case 3://CStandGroupClosureAtAirport
				{
					CStandGroupClosureAtAirport* pStandGroupClosure = new CStandGroupClosureAtAirport(adoRecordset);
					if(pStandGroupClosure){
						if(bAdd)
							m_vrClosureAtAirport.push_back(pStandGroupClosure);
						else
							m_vrClosureAtAirportDeleted.push_back(pStandGroupClosure);
					}
				}
				break;
			default:
				break;
			}
		}
		adoRecordset.MoveNextData();
	}

}