82 lines
2.4 KiB
C++
82 lines
2.4 KiB
C++
// TestingZone.cpp: implementation of the CTestingZone class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "geomative.h"
|
|
#include "TestingZone.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CTestingZone::CTestingZone(DWORD dwID, _ConnectionPtr& pConnection)
|
|
{
|
|
ASSERT(NULL != pConnection);
|
|
m_pConnection = pConnection;
|
|
|
|
CString szSql = _T("");
|
|
_RecordsetPtr pRecTz = NULL;
|
|
|
|
pRecTz.CreateInstance(_uuidof(Recordset));
|
|
|
|
szSql.Empty();
|
|
|
|
szSql.Format(_T("select TZname,TZtype,CN,Format(Cdate,'YYYY-MM-DD') as Cdate,TZdesc,location from tz where ID = %u"), dwID);
|
|
pRecTz->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
|
|
|
if ((long)VAL_ZERO != pRecTz->GetRecordCount())
|
|
{
|
|
m_szTZname = pRecTz->GetCollect(_T("TZname")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("TZname"));
|
|
m_szTZtype = pRecTz->GetCollect(_T("TZtype")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("TZtype"));
|
|
m_szCDate = pRecTz->GetCollect(_T("Cdate")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("Cdate"));
|
|
m_szDesc = pRecTz->GetCollect(_T("TZdesc")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("TZdesc"));
|
|
m_szLocation = pRecTz->GetCollect(_T("location")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("location"));
|
|
m_szCN = pRecTz->GetCollect(_T("CN")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("CN"));
|
|
}
|
|
pRecTz->Close();
|
|
m_dwID = dwID;
|
|
}
|
|
|
|
CTestingZone::~CTestingZone()
|
|
{
|
|
|
|
}
|
|
|
|
bool CTestingZone::ShowDetailInfo(CListCtrl &tzDetailList)
|
|
{
|
|
int iRowIndex = (int)VAL_ZERO;
|
|
|
|
while (tzDetailList.GetItemCount() != iRowIndex)
|
|
{
|
|
tzDetailList.SetItemText(iRowIndex, 1, _T(""));
|
|
iRowIndex++;
|
|
}
|
|
|
|
CString szTzType;
|
|
if (m_szTZtype == "1" || m_szTZtype == "0")
|
|
{
|
|
szTzType = "1D VES | 2D ERI";
|
|
}
|
|
else if (m_szTZtype == "2")
|
|
{
|
|
szTzType = "3D ERT";
|
|
}
|
|
else
|
|
{
|
|
szTzType = "All Type";
|
|
}
|
|
tzDetailList.SetItemText(0, 1, m_szTZname);
|
|
tzDetailList.SetItemText(1, 1, szTzType);
|
|
tzDetailList.SetItemText(2, 1, m_szCDate);
|
|
tzDetailList.SetItemText(3, 1, m_szDesc);
|
|
tzDetailList.SetItemText(4, 1, m_szLocation);
|
|
|
|
return true;
|
|
}
|