VehicleMessageSet.cpp
上传用户:yffx2008
上传日期:2014-10-12
资源大小:12414k
文件大小:2k
源码类别:
交通/航空行业
开发平台:
Visual C++
- // VehicleMessageSet.cpp : implementation file
- //
- #include "stdafx.h"
- #include "GpsSC.h"
- #include "VehicleMessageSet.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CVehicleMessageSet
- IMPLEMENT_DYNAMIC(CVehicleMessageSet, CRecordset)
- CVehicleMessageSet::CVehicleMessageSet(CDatabase* pdb)
- : CRecordset(pdb)
- {
- //{{AFX_FIELD_INIT(CVehicleMessageSet)
- m_ID = 0;
- m_CarPhone = _T("");
- m_Time = _T("");
- m_Speed= _T("");
- m_CarEstate = _T("");
- m_CarPlace = _T("");
- m_Longitude = _T("");
- m_Latitude = _T("");
- m_nFields = 8;
- //}}AFX_FIELD_INIT
- m_nDefaultType = snapshot;
- }
- CString CVehicleMessageSet::GetDefaultConnect()
- {
- return _T("ODBC;DSN=CenterDataBase");
- }
- CString CVehicleMessageSet::GetDefaultSQL()
- {
- return _T("[VehicleMessage]");
- }
- void CVehicleMessageSet::DoFieldExchange(CFieldExchange* pFX)
- {
- //{{AFX_FIELD_MAP(CVehicleMessageSet)
- pFX->SetFieldType(CFieldExchange::outputColumn);
- RFX_Long(pFX, _T("[ID]"), m_ID);
- RFX_Text(pFX, _T("[车载电话号码]"), m_CarPhone);
- RFX_Text(pFX, _T("[收到消息时间]"), m_Time);
- RFX_Text(pFX, _T("[汽车速度]"), m_Speed);
- RFX_Text(pFX, _T("[汽车状态]"), m_CarEstate);
- RFX_Text(pFX, _T("[汽车位置]"), m_CarPlace);
- RFX_Text(pFX, _T("[经度]"), m_Longitude);
- RFX_Text(pFX, _T("[纬度]"), m_Latitude);
- //}}AFX_FIELD_MAP
- }
- /////////////////////////////////////////////////////////////////////////////
- // CVehicleMessageSet diagnostics
- #ifdef _DEBUG
- void CVehicleMessageSet::AssertValid() const
- {
- CRecordset::AssertValid();
- }
- void CVehicleMessageSet::Dump(CDumpContext& dc) const
- {
- CRecordset::Dump(dc);
- }
- #endif //_DEBUG
- void CVehicleMessageSet::AddMessage(CString strCarPhone, CString strTime, CString strCarEstate, CString strCarPlace, CString strLongitude, CString strLatitude, CString strSpeed)
- {
- try
- {
- if(!IsOpen())
- Open();
- AddNew();
- m_CarPhone = strCarPhone;
- m_Time = strTime;
- m_CarEstate = strCarEstate;
- m_CarPlace = strCarPlace;
- m_Longitude = strLongitude;
- m_Latitude = strLatitude;
- m_Speed = strSpeed;
- Update();
- }
- catch(CDBException* Exp)
- {
- AfxMessageBox(Exp->m_strError);
- }
- }