123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- #ifndef __ORDERDIRMGR_H__
- #define __ORDERDIRMGR_H__
- #include <vector>
- //////////////////////////////////////////////////////////////////////////
- // 共享目录信息表NetShareInfo;
- typedef struct ST_TblNetShareInfo
- {
- BOOL bEnable; //是否可用
- TCHAR szBranchId[MAX_PATH]; //域名
- TCHAR szShareDirectory[MAX_PATH]; //共享目录
- BYTE byMinCapacity; //最小容量
- BYTE byMaxCapacity; //最大容量
- BYTE byPhotoType; //相片类型
- BYTE byPriority; //优先级
- ST_TblNetShareInfo()
- {
- memset(szBranchId,0,sizeof(TCHAR)*MAX_PATH);
- memset(szShareDirectory,0,sizeof(TCHAR)*MAX_PATH);
- bEnable = FALSE;
- byMinCapacity = 0;
- byMaxCapacity = 0;
- byPhotoType = 0;
- byPriority = 0;
- }
- ST_TblNetShareInfo(const ST_TblNetShareInfo &another)
- {
- bEnable = another.bEnable;
- byMinCapacity = another.byMinCapacity;
- byMaxCapacity = another.byMaxCapacity;
- byPriority = another.byPriority;
- byPhotoType = another.byPhotoType;
- _stprintf_s(szBranchId,_T("%s"),another.szBranchId);
- _stprintf_s(szShareDirectory,_T("%s"),another.szShareDirectory);
- }
- ST_TblNetShareInfo& operator=(const ST_TblNetShareInfo &another)
- {
- if ( this == &another )
- {
- return *this;
- }
- bEnable = another.bEnable;
- byMinCapacity = another.byMinCapacity;
- byMaxCapacity = another.byMaxCapacity;
- byPriority = another.byPriority;
- byPhotoType = another.byPhotoType;
- _stprintf_s(szBranchId,_T("%s"),another.szBranchId);
- _stprintf_s(szShareDirectory,_T("%s"),another.szShareDirectory);
- return *this;
- }
- void Clone(IN const BOOL bEnable, IN LPCTSTR lpBranchId, IN LPCTSTR lpDir, IN const BYTE byPhotoType, IN const BYTE byMinCapacity, IN const BYTE byMaxCapacity, IN const BYTE byPriority)
- {
- if(lpBranchId == NULL || lpDir == NULL)
- return;
- this->bEnable = bEnable;
- this->byMaxCapacity = byMaxCapacity;
- this->byMinCapacity = byMinCapacity;
- this->byPhotoType = byPhotoType;
- this->byPriority = byPriority;
- #ifdef _UNICODE
- wcscpy(this->szBranchId, lpBranchId);
- wcscpy(this->szShareDirectory, lpDir);
- #else
- strcpy(this->szBranchId, lpBranchId);
- strcpy(this->szShareDirectory, lpDir);
- #endif //#ifdef _UNICODE
- }
- }TblNetShareInfo, *LPTblNetShareInfo;
- //订单目录
- typedef struct _SOrderDirInfo
- {
- TCHAR szPath[MAX_PATH]; // 备份相片的全路径
- TCHAR szDomain[64]; // 域名
- TCHAR szOrder[64]; // 订单号
- TCHAR szOptTime[64]; // 操作时间
- BYTE byPhotoType; // 相片类型
- _SOrderDirInfo()
- {
- memset(szPath, 0, sizeof(TCHAR)*MAX_PATH);
- memset(szOrder, 0, sizeof(TCHAR)*64);
- byPhotoType = 0;
- }
- }SORDERDIRINFO, *LPSORDERDIRINFO;
- class DataBaseOpt;
- class OrderDirMgr
- {
- public:
- OrderDirMgr();
- ~OrderDirMgr();
- static OrderDirMgr* GetInstance()
- {
- static OrderDirMgr obj;
- return &obj;
- }
- int InitShareDir(IN DataBaseOpt* pDBOpt, IN LPCTSTR lpLocalDomain);
- int GetBackupDirFromDB(IN DataBaseOpt* pDBOpt, IN LPCTSTR lpLocalDomain);
- int GetShareDirFromDB(IN DataBaseOpt* pDBOpt);
- void LoadLocalShareDir(IN LPCTSTR lpLocalDomain);
-
- void GetOrderOfDir(IN CString& strST, IN CString& strET, IN LPCTSTR lpLocalDomain);
- void FindAllOrderDir(IN CString& strST, IN CString& strET, IN LPCTSTR lpLocalDomain, IN LPCTSTR lpRootDir, IN LPCTSTR lpDir, IN const BYTE byPhotoType, OUT std::vector<LPSORDERDIRINFO>& vOrderDir);
- void ClearShareInfo();
- void ClearOrderInfo();
- void ScreeningOrderDir(IN CArray<CStringArray,CStringArray>& logsArr, IN const CString& strLocalDomain);
- int FindEnableBakDir(IN const BYTE nPhotoType, OUT CString& strTargetDir);
- BOOL GetDiskSpaceInfo(IN LPCTSTR lpRootPathName,IN OUT double &dTotalNum, IN OUT double &dFreeNum);
- std::vector<LPSORDERDIRINFO>* GetOrderDirs(){return &m_vOrderDir;}
- std::vector<LPTblNetShareInfo>* GetShareDirs(){return &m_vShareDir;}
- private:
- std::vector<LPTblNetShareInfo> m_vShareDir; // 共享目录组
- std::vector<LPSORDERDIRINFO> m_vOrderDir;
- };
- #endif //#ifndef __SHAREDIRMGR_H__
|