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();
		}
	}
}
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();
		}
	}
}
//////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;
}
////////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;
}
//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;
}
Beispiel #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();
	}
}
//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;
}
CClosureAtAirport::CClosureAtAirport(CADORecordset &adoRecordset)
{
	if(!adoRecordset.IsEOF()){
		adoRecordset.GetFieldValue(_T("ID"),m_nID);
		adoRecordset.GetFieldValue(_T("PROJID"),m_nProjID);
		adoRecordset.GetFieldValue(_T("AIRPORTID"),m_nAirportID);
		adoRecordset.GetFieldValue(_T("OBJECTMARK"),m_nObjectMark);
	}
}
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() ;
	}
}
Beispiel #10
0
void Heliport::ReadObject(int nObjID)
{
	m_nObjID = nObjID;

	CADORecordset adoRecordset;
	long nRecordCount = -1;

	CADODatabase::ExecuteSQLStatement(ALTObject::GetSelectScript(nObjID),nRecordCount,adoRecordset);
	if (!adoRecordset.IsEOF())
		ALTObject::ReadObject(adoRecordset);

	CADODatabase::ExecuteSQLStatement(GetSelectScript(nObjID),nRecordCount,adoRecordset);
	if (!adoRecordset.IsEOF())
	{	
		adoRecordset.GetFieldValue(_T("PATHID"),m_nPathID );
		m_path.clear();
		CADODatabase::ReadPath2008FromDatabase(m_nPathID,m_path);

		adoRecordset.GetFieldValue(_T("RADIUS"),m_Radius);
//		m_Radius = ARCUnit::ConvertLength(m_Radius,ARCUnit::CM,ARCUnit::M);
	}
}
CStandGroupClosureNode::CStandGroupClosureNode(CADORecordset &adoRecordset)
{
	if(!adoRecordset.IsEOF())
	{
		adoRecordset.GetFieldValue(_T("ID"),m_nID);
		adoRecordset.GetFieldValue(_T("PARENTID"),m_nParentID);
		adoRecordset.GetFieldValue(_T("STANDGROUPID"),m_nStandGroupID);
		int nValue = -1;
		adoRecordset.GetFieldValue(_T("TIMEFROM"),nValue);
		m_startTime.set(nValue);
		adoRecordset.GetFieldValue(_T("TIMETO"),nValue);
		m_endTime.set(nValue);
	}
}
CRunwayClosureNode::CRunwayClosureNode(CADORecordset &adoRecordset)
{
	if(!adoRecordset.IsEOF())
	{
		adoRecordset.GetFieldValue(_T("ID"),m_nID);
		adoRecordset.GetFieldValue(_T("PARENTID"),m_nParentID);
		adoRecordset.GetFieldValue(_T("RUNWAYID"),m_nRunwayID);
		adoRecordset.GetFieldValue(_T("INTERNODEIDFROM"),m_nIntersectNodeIDFrom);
		adoRecordset.GetFieldValue(_T("INTERNODEIDTO"),m_nIntersectNodeIDTo);
		int nValue = -1;
		adoRecordset.GetFieldValue(_T("TIMEFROM"),nValue);
		m_startTime.set(nValue);
		adoRecordset.GetFieldValue(_T("TIMETO"),nValue);
		m_endTime.set(nValue);
	}
}
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();
	}
}
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;
}
void CAirsideSimSettingClosure::ReadData(void)
{
	CString strSQL = _T("");
	strSQL.Format(_T("SELECT * FROM SIMENGINGSETTING WHERE (PRJID = %d);"),m_nProjID);
	long nRecordCount = -1;
	CADORecordset adoRecordset;
	CADODatabase::ExecuteSQLStatement(strSQL, nRecordCount, adoRecordset);
	if(!adoRecordset.IsEOF())
	{
		int nPrjID = -1;
		int nVehicleService = -1;
		int nCyclicGroundRoute = -1;
		adoRecordset.GetFieldValue(_T("ID"),m_nID);
		adoRecordset.GetFieldValue(_T("PRJID"),nPrjID);
		adoRecordset.GetFieldValue(_T("VEHICLESERVICE"),nVehicleService);
		adoRecordset.GetFieldValue(_T("CYCLICGROUNDROUTE"),nCyclicGroundRoute);

		if(!adoRecordset.GetFieldValue(_T("ITINERANTFLIGHT"), m_nItinerantFlight))
		{
			m_nItinerantFlight = 0;
		}

		if(!adoRecordset.GetFieldValue(_T("TRAININGFLIGHT"),m_nTrainingFlight))
		{
			m_nTrainingFlight = 0;
		}



		if(nVehicleService > 0)
			m_bVehicleService = true;
		else
			m_bVehicleService = false;

		if (nCyclicGroundRoute > 0)
		{
			m_bAllowCyclicGroundRoute = true;
		}else
		{
			m_bAllowCyclicGroundRoute = false;
		}
	}

	m_airsideRunwayClosure.ReadData();
	m_airsideTaxiwayClosure.ReadData();
	m_airsideStandGroupClosure.ReadData();
}
Beispiel #16
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;
}
Beispiel #17
0
BOOL CXhDevice::Init( void )
{
	if (!m_strBlkName.IsEmpty())
	{
		CADODatabase adoDb;
		CADORecordset rs;
		adoDb.Open(g_strAdoCon) ;
		rs.SetConnection(&adoDb) ;

		CString strSql ;
		strSql.Format(_T("select * from define_default_device where block_name='%s'"), m_strBlkName) ;
		if (rs.Open(strSql))
		{
			while(!rs.IsEOF())
			{
				long nTmp = 0 ;
				CString strTmp ;
				rs.GetFieldValue(_T("has_box"), nTmp) ;
				m_bHasBox = (nTmp==0?FALSE:TRUE) ;
				rs.GetFieldValue(_T("box_type"), m_strBoxType) ;
				rs.GetFieldValue(_T("cable_num"),m_nCable);
				rs.GetFieldValue(_T("core_num1"), m_nCoreNum1) ;
				rs.GetFieldValue(_T("core_num2"), m_nCoreNum2) ;
				rs.GetFieldValue(_T("cable_string1"), m_strCable1) ;
				rs.GetFieldValue(_T("cable_string2"), m_strCable2) ;
				rs.GetFieldValue(_T("has_phone"), nTmp) ;
				m_bHasPhone = (nTmp==0?FALSE:TRUE) ;
				rs.GetFieldValue(_T("has_gt"), nTmp) ;
				m_bHasGT = (nTmp==0?FALSE:TRUE) ;
				rs.GetFieldValue(_T("has_ground"), nTmp) ;
				m_bHasGround = (nTmp==0?FALSE:TRUE) ;
				rs.MoveNext() ;
			}
			rs.Close() ;
		}


		rs.Close() ;
		adoDb.Close() ;
	}

	return 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() ;
	}
}
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);

}
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();
}
///////////////Old version code, should not be modified//////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
double CAirportDatabaseList::GetGloabalVersion()
{
	CString SQL ;
	SQL.Format(_T("SELECT * FROM TB_DATABASE_VERSION")) ;
	CADORecordset recordset ;
	long count = -1 ;
	try
	{
		CADODatabase::ExecuteSQLStatement(SQL,count,recordset,DATABASESOURCE_TYPE_ACCESS_GLOBALDB) ;
	}
	catch (CADOException e)
	{
		e.ErrorMessage() ;
		return 1.0;
	}
	double version = 1.0 ; 
	while(!recordset.IsEOF())
	{
		recordset.GetFieldValue(_T("VERSION"),version) ;
		break ;
	}
	return version ;
}
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();
	}

}