Exemple #1
0
void CDlgTKManage::InitDatabase()
{
	ClearDatabase();
	CAcModuleResourceOverride rs;
	m_pDb = new AcDbDatabase(false);
	m_pDb->readDwgFile(m_strFileName);
}
///////////////////////////////////////////////////////////////////////////
//	Name:	InitializeDatabase
//
//	Description:
//	If a database does not exist at the specified directory, copy an empty one
//	to it from the default directory location.  Clear all information from the
//	database at the specified directory.
//	
//	Declaration:
//	bool CDbVista::InitializeDatabase(CString &strDbBasePath)
//
//	Input:	none
//			mstrComponentName	name of the subpath where this instrument's data is kept
//			mstrMyDbFilename	name of file that indicates a database is present
//			mstrDefaultPath		directory where an empty database is found (under mstrComponentName)
//			mstrDatabaseName	name of the database that is thought to exist at the specified dir (under mstrComponentName)
//
//	Output:	none
//
//	Return:	true (db exists and initialized) / false (error in operation)
//	
//  date    /	author	revision
//  -----------------	--------
//	28-Jan-2002	SFK		Created
//////////////////////////////////////////////////////////////////
bool CDbVista::InitializeDatabase(const CString &strDbBasePath,const bool bPrompt)
{
	//CDirUtilities m_Dir;
	CString strError, strEmptyDbPath;
	
	if ((mstrComponentName.GetLength() == 0) || (mstrMyDbFilename.GetLength() == 0)) {
		strError.Format("Initialize Database: No component name or db filename set program error, cannot continue.");

		//WAS "NOT FOR NDAR".  Reenabled by pjm 11/27/2007 for B2R1
		if (!m_bQuietMode)
			MessageBox(NULL, strError, "Fatal Error", MB_OK|MB_ICONWARNING);

		return(false);
	}

	CString strTemp = m_Dir.AppendPath(strDbBasePath, mstrComponentName);	// create the instrument Com specific path
	
	bool bSuccess = m_Dir.FileExists(strTemp, mstrMyDbFilename);		// does a database exist there already?
	if (mbDatabaseOpen) CloseDatabase();							// close any database that might be open now

	if (!bSuccess) 
	{			// no database where we are to initialize one
		if (mstrDefaultPath.GetLength() == 0) 
		{
			strError.Format("Initialize Database: No Default Path Set program error, cannot continue.");

			//WAS "NOT FOR NDAR".  Reenabled by pjm 11/27/2007 for B2R1
			if (!m_bQuietMode)		
				MessageBox(NULL, strError, "Fatal Error", MB_OK|MB_ICONWARNING);

			return(false);
		}
		strEmptyDbPath = m_Dir.AppendPath(mstrDefaultPath, mstrComponentName);
		bSuccess = m_Dir.CopyDirectory(strEmptyDbPath, strTemp, true);	// copy an empty one over there
	}

	if (bSuccess) 		// database exists, open it and clear it
	{
		bSuccess = OpenDatabase(strTemp, mstrDatabaseName);

		//NDAR change so that ClearDatabase() will do the right thing.
		//Changed back PJM 11/27/2007 for B2R1
		bool b = bPrompt;

		if (m_bQuietMode)
			b = false;

		if (bSuccess) 
			bSuccess = ClearDatabase(mstrDatabaseName, b);
	}

	return (bSuccess);
}
	~cDatabase() {ClearDatabase();};
Exemple #4
0
wxPrintPaperDatabase::~wxPrintPaperDatabase()
{
    ClearDatabase();
}
Exemple #5
0
CDlgTKManage::~CDlgTKManage()
{
	ClearDatabase();
}
Exemple #6
0
//-----------------------------------------------------------------------------
CDlgTKManage::CDlgTKManage (CWnd *pParent /*=NULL*/, HINSTANCE hInstance /*=NULL*/) : CAcUiDialog (CDlgTKManage::IDD, pParent, hInstance) 
 ,m_pDb(NULL)
{
	ClearDatabase();
}