BOOL COptionsStats::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();

	CTime time(CGetSetOptions::GetTotalDate());
	m_eAllDate = time.Format("%m/%d/%Y %I:%M %p");
	m_eAllCopies.Format(_T("%d"), CGetSetOptions::GetTotalCopyCount());
	m_eAllPastes.Format(_T("%d"), CGetSetOptions::GetTotalPasteCount());

	CTime time2(CGetSetOptions::GetTripDate());
	m_eTripDate = time2.Format("%m/%d/%Y %I:%M %p");
	m_eTripCopies.Format(_T("%d"), CGetSetOptions::GetTripCopyCount());
	m_eTripPastes.Format(_T("%d"), CGetSetOptions::GetTripPasteCount());

	m_eClipsSent.Format(_T("%d"), theApp.m_lClipsSent);
	m_eClipsRecieved.Format(_T("%d"), theApp.m_lClipsRecieved);
	m_eLastStarted = theApp.m_oldtStartUp.Format(_T("%m/%d/%y %I:%M:%S"));
	if(theApp.m_oldtStartUp.GetHour() > 12)
		m_eLastStarted += " PM";
	else
		m_eLastStarted += " AM";

	COleDateTimeSpan span = COleDateTime::GetCurrentTime() - theApp.m_oldtStartUp;

	CString csSpan;
	csSpan.Format(_T("  -  %d.%d.%d (D.H.M)"), (long)span.GetTotalDays(), span.GetHours(), span.GetMinutes());
	m_eLastStarted += csSpan;

	try
	{
		m_eSavedCopies.Format(_T("%d"), theApp.m_db.execScalar(_T("SELECT COUNT(lID) FROM Main")));
		m_eSavedCopyData.Format(_T("%d"), theApp.m_db.execScalar(_T("SELECT COUNT(lID) FROM Data")));
	}
	CATCH_SQLITE_EXCEPTION
	
	__int64 size = FileSize(GetDBName());			

	const int MAX_FILE_SIZE_BUFFER = 255;
	TCHAR szFileSize[MAX_FILE_SIZE_BUFFER];
	StrFormatByteSize(size, szFileSize, MAX_FILE_SIZE_BUFFER);

	m_eDatabaseSize = szFileSize;

	UpdateData(FALSE);

	theApp.m_Language.UpdateOptionStats(this);
		
	return TRUE;
}
void COptionsStats::OnRemoveAll() 
{
	if(MessageBox(theApp.m_Language.GetString("Remove_All", "This will remove all Copy Entries!\n\nContinue?"), _T("Warning"), MB_YESNO) == IDYES)
	{
		if( DeleteAllIDs() )
		{
			m_eSavedCopies.Empty();
			m_eSavedCopyData.Empty();

			struct _stat buf;
			int nResult;
			nResult = STAT(GetDBName(), &buf);
			if(nResult == 0)
				m_eDatabaseSize.Format(_T("%d KB"), (buf.st_size/1024));

			UpdateData(FALSE);
		}
	}
}
예제 #3
0
std::string DBSqlServer::GenerateLinkString()
{
	//return "DRIVER={SQL Server}; SERVER=(local);UID=test; PWD=test123456;Trusted_Connection=yes;DATABASE=mytest; ";
	return fu_string_format("DRIVER={SQL Server};SERVER=%s;UID=%s; PWD=%s;Trusted_Connection=yes;DATABASE=%s;",
							GetDBIP().c_str(), GetDBUID().c_str(), GetDBPwd().c_str(), GetDBName().c_str());
}