// SP2DTdRecord.cpp: implementation of the CSP2DTdRecord class. // ////////////////////////////////////////////////////////////////////// #include "geomative.h" #include "SP2DTdRecord.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CSP2DTdRecord::CSP2DTdRecord(DWORD dwChID, _ConnectionPtr& pConnection):CTdRecord(pConnection) { m_dwChID = dwChID; m_iTsn = (int)VAL_ZERO; m_iC1 = (int)VAL_ZERO; m_iC2 = (int)VAL_ZERO; m_iP1 = (int)VAL_ZERO; m_iP2 = (int)VAL_ZERO; m_iN = (int)VAL_ZERO; m_fK = (float)VAL_ZERO; m_fI = (float)VAL_ZERO; m_fV = (float)VAL_ZERO; m_fR0 = (float)VAL_ZERO; m_fSP = (float)VAL_ZERO; m_iLevel = (int)VAL_ZERO; m_iPosInLevel = (int)VAL_ZERO; m_colorREF = RGB(0xFF,0xFF,0xFF); m_recPtArea.SetRectEmpty(); } CSP2DTdRecord::~CSP2DTdRecord() { } void CSP2DTdRecord::ClearAll() { m_fI = (float)VAL_ZERO; m_fV = (float)VAL_ZERO; m_fR0 = (float)VAL_ZERO; m_fSP = (float)VAL_ZERO; m_colorREF = RGB(0xFF,0xFF,0xFF); } BOOL CSP2DTdRecord::SaveData(DWORD dwChID) { _RecordsetPtr pRecTdCha; _CommandPtr pCmdIns; CString szSql = _T(""); int iTdRecIndex = (int)VAL_ZERO; pRecTdCha.CreateInstance(_uuidof(Recordset)); pCmdIns.CreateInstance(_uuidof(Command)); pCmdIns->ActiveConnection = m_pConnection; try { m_dwChID = dwChID; szSql.Empty(); szSql.Format(_T("insert into td2dcon(TCHID,TSN,C1,C2,P1,P2,N,K,I,V,R0,SP) values(%u,%d,%d,%d,%d,%d,%d,%f,%f,%f,%f,%f)"), m_dwChID, this->m_iTsn, this->m_iC1, this->m_iC2, this->m_iP1, this->m_iP2, this->m_iN, this->m_fK, this->m_fI, this->m_fV, this->m_fR0, this->m_fSP); pCmdIns->CommandText = szSql.AllocSysString(); pCmdIns->Execute(NULL, NULL, adCmdText); } catch(_com_error e) { throw e; return FALSE; } return TRUE; } BOOL CSP2DTdRecord::LoadOrgData() { // AfxMessageBox(_T("CRsp2DTdRecord::LoadOrgData")); this->Load2DOrgData(); return TRUE; }