#pragma once
#include "2DObject.h"

class CDBOperate
{
public:
	CDBOperate(void);
	virtual ~CDBOperate(void);

	BOOL SaveMap(C2DMap* pMap, CString strMapName);
	C2DMap* CreateMap(CString strMapName);
    BOOL DeleteMap(CString strMapName);
	void GetMapName(CStringArray& arMapName,CStringArray& arTime);
    _ConnectionPtr m_pConnection;
	_RecordsetPtr m_pRecordset;
    static int m_nCount;
protected:
	BOOL CheckDBTables(CStringArray& sa, CString strTableName);
	BOOL CheckDB(CStringArray& sa);
	BOOL CreateMapTable();
	BOOL CreatePointTable();
	BOOL CreateLineTable();
	BOOL CreateCurveTypeTable();
	void SaveC2DPoint(CArray<C2DPoint*,C2DPoint*>& arPt, CString strMapName);
	void ReadC2DPoint(CArray<C2DPoint*,C2DPoint*>& arPt, CString strMapName);
	void SaveC2DBeeLine(CArray<C2DBeeLine*,C2DBeeLine*>& arBL, CString strMapName);
	void ReadC2DBeeLine(CArray<C2DBeeLine*,C2DBeeLine*>& arBL, CString strMapName);
	void SaveC2DCircle(CArray<C2DCircle*,C2DCircle*>& arCir, CString strMapName);
	void ReadC2DCircle(CArray<C2DCircle*,C2DCircle*>& arCir, CString strMapName);
	void SaveC2DPolyLine(CArray<C2DPolyLine*,C2DPolyLine*>& arPL, CString strMapName);
	void ReadC2DPolyLine(CArray<C2DPolyLine*,C2DPolyLine*>& arPL, CString strMapName);
	void SaveC2DTriangle(CArray<C2DTriangle*,C2DTriangle*>& arTIN, CString strMapName);
	void ReadC2DTriangle(CArray<C2DTriangle*,C2DTriangle*>& arTIN, CString strMapName);
	void SaveC2DCurve(CArray<C2DCurve*,C2DCurve*>& arCV, CString strMapName);
	void ReadC2DCurve(CArray<C2DCurve*,C2DCurve*>& arCV, CString strMapName);
};
