DBOperator.h
上传用户:xiaoke98
上传日期:2014-06-29
资源大小:5718k
文件大小:3k
- // DBOperator.h: interface for the CDBOperator class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_DBOPERATOR_H__30806192_62A2_4BD1_BE1F_144191526725__INCLUDED_)
- #define AFX_DBOPERATOR_H__30806192_62A2_4BD1_BE1F_144191526725__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #pragma warning(disable:4129)
- // 导入 ado 库 -----------------------------------------------------------
- #pragma warning(disable:4146)
- #import "C:Program FilesCommon FilesSystemADOmsado15.dll" named_guids rename("EOF","adoEOF"), rename("BOF","adoBOF")
- #pragma warning(default:4146)
- using namespace ADODB;
- #include "FinanceDBGrid.h"
- class CSysDataStruct
- {
- public:
- CSysDataStruct();
- virtual ~CSysDataStruct();
- public:
- struct CClassInfo
- {
- int m_iClassNum;
- enum {MAXCLASSNUM = 40};
- CString m_Classes[MAXCLASSNUM];
- double m_dTotal[MAXCLASSNUM];
- };
-
- };
- enum SELECTORDER
- {
- enDate = 0,
- enMoney
- };
- class CDBOperator
- {
- public:
- BOOL ConnectToDB(void);
- //与用户登录相关
- BOOL VerifyUser(CString& strUser, CString& strPasswd);//检查登录信息是否正确
- BOOL addUser(CString strUserName, CString strPassword, char* pImgData, int iDataLen);
- BOOL getUserImg(CString strUserName, char** pImageData, int& iDataLen);
- //与收入相关
- void selectFinanceIn(CString& strStartTime, CString& strEndTime, CFinanceDBGrid& DBGrid, CString& strTotalIn, SELECTORDER order = enDate);
- void ReOrderFinanceIn(CString& strStartTime, CString& strEndTime, CFinanceDBGrid& DBGrid, CString& strTotalIn, CString& strTitle, CString& strOder);
-
- void addFinanceIn(CString& strMoney, CString& strClass,
- CString& strDate, CString& strRemark);
- int getClassID(CString& strClass);
- void getMoneyInClassInfo(CSysDataStruct::CClassInfo& ClassInfo);
- void getInClassInfo(CListCtrl* pdbGrid);
- void DeleteFinanceIn(int iID);
- void getMoneyInClassTotal(CString& strStartTime, CString& strEndTime, CSysDataStruct::CClassInfo& ClassInfo);
- void addInClass(CString& strClass);
- //与支出相关
- void selectFinanceOut(CString& strStartTime, CString& strEndTime, CFinanceDBGrid& DBGrid, CString& strTotalOut, SELECTORDER order = enDate);
- void addFinanceOut(CString& strMoney, CString& strClass, CString& strDate, CString& strRemark);
- int getOutClassID(CString& strClass);
- void getMoneyOutClassInfo(CSysDataStruct::CClassInfo& ClassInfo);
- void getOutClassInfo(CListCtrl* pdbGrid);
- void DeleteFinanceOut(int iID);
- void getMoneyOutClassTotal(CString& strStartTime, CString& strEndTime, CSysDataStruct::CClassInfo& ClassInfo);
- void addOutClass(CString& strClass);
- void ReOrderFinanceOut(CString& strStartTime, CString& strEndTime, CFinanceDBGrid& DBGrid, CString& strTotalOut, CString& strTitle, CString& strOder);
- //更新收入或支出表
- void UpdateRecord(int iID, CString& strSum, CString& strClass, CString& strDate, CString& strRemark, bool bIsMoneyOut);
- //收支平衡表
- void getBalance(CString& strStartTime,
- CString& strEndTime,
- CTreeCtrl& treeBalance,
- CString& strTotalIn,
- CString& strTotalOut);
- public:
- CDBOperator();
- virtual ~CDBOperator();
- private:
- //数据库连接变量
- _ConnectionPtr m_DBConnection;
- _CommandPtr m_Command;
- _RecordsetPtr m_Recordset;
-
- CString m_strAppPath;
- };
- extern CDBOperator gDBOperator;
- #endif // !defined(AFX_DBOPERATOR_H__30806192_62A2_4BD1_BE1F_144191526725__INCLUDED_)