/************************************************************************/ /* 版权所有: (C)2015, 利亚方舟科技有限公司。 文件名称: BranchInfo.h 文件标识: 内容摘要: 每个分店的数据操作对象 其他说明: 当前版本: V1.0 作 者: Jeff 完成日期: 2015/04/22 修改记录: 修改日期: 版 本 号: 修 改 人: 修改内容: */ /************************************************************************/ #ifndef __BRANCH_INFO__ #define __BRANCH_INFO__ #pragma once #include "CatalogObj.h" #include "TblDef.h" #define TEST_CREATE_DIRECTORY 0 class CBranchInfo:public CCatalogObj { CBranchInfo(); public: ~CBranchInfo(void); static CBranchInfo* GetInstance() { static CBranchInfo tagInstance; return &tagInstance; } private: TCHAR m_szBranchName[MAX_PATH]; // 店名; TCHAR m_szBranchDoMain[MAX_PATH]; // 店域名; TCHAR m_szBranchIP[MAX_PATH]; // 店铺IP; CString m_strBranchId; // 分店域名; public: // 多店多数据库时,以下两变量为静态,且获取的数据库对象是本店服务器的; static TblVersion m_TblVersion; typedef vector CATALOGINFO; typedef vector NETSHAREINFO; static CATALOGINFO m_TblCatalogInfo; static NETSHAREINFO m_TblNetShareInfo; static void RemvoeCatalogInfo(); static void RemoveNetShareInfo(); public: inline LPCTSTR GetDoMain()CONST{return m_szBranchDoMain;} TblVersion& GetVersionInfo(){return m_TblVersion;} // 获取数据库实例所对就的分店域名; inline CONST CString& GetBranchId()CONST{return m_strBranchId;} void SetBranchId(LPCTSTR lpBranchId){ m_strBranchId = lpBranchId;} // 1.初始化数据库连接串; BOOL InitCatalog( IN CONST DWORD &dwCatalogPort, IN LPCTSTR lpCatalogSource, IN LPCTSTR lpCatalogAccount, IN LPCTSTR lpCatalogPsw, IN LPCTSTR lpCatalogName); // 2.获取特定表信息; BOOL GetTblBranchId(); BOOL GetTblVersion(); BOOL GetTblCatalogInfo(); BOOL GetTblNetShareInfo(); BOOL IsCatalogInfoExists(IN LPCTSTR lpBranchId); BOOL IsNetShareInfoExists(IN LPCTSTR lpBranchId, IN LPCTSTR lpShareDirectory); BOOL GetTblIncrementBackup(OUT CArray &AryOfValues); BOOL GetTblAllPhotoManager(OUT CArray &AryOfValues); BOOL GetTblPhotoManager1(OUT CArray &AryOfValues); BOOL GetTblPhotoManager2(OUT CArray &AryOfValues); BOOL GetTblPhotoManager3(OUT CArray &AryOfValues); BOOL GetTblPhotoManager4(OUT CArray &AryOfValues); BOOL GetTblPhotoManager5(OUT CArray &AryOfValues); BOOL GetTblPhotoManager6(OUT CArray &AryOfValues); BOOL GetTblPhotoManager7(OUT CArray &AryOfValues); BOOL GetTblPhotoManager8(OUT CArray &AryOfValues); BOOL GetEnableShareDirectory(OUT double &dFreeNum, IN const int &nPhotoType, IN LPCTSTR lpBranchId, IN LPCTSTR lpOrderNum, OUT LPTSTR lpEnableShareDirectory); #if TEST_CREATE_DIRECTORY // 测试; BOOL GetTblPhotoManager(OUT CArray &AryOfValues); void CreateOrderDirectory(IN LPCTSTR lpOrderNum); #endif protected: void Separator(IN LPCTSTR lpSeparator, IN LPCTSTR lpString, OUT CStringArray &ResultArray); void AddLocalShareDirectory(); BOOL InsertNetShareInfo(IN LPCTSTR lpShareDirectory, IN LPCTSTR lpBranchId, IN CONST BYTE &nMinCapacity, IN CONST BYTE &nMaxCapacity, IN CONST BYTE &nPhotoType, IN CONST BYTE &nPriority); BOOL GetIncrementContentAndBackup( IN LPCTSTR lpBranchId, IN LPCTSTR lpOpTm, IN LPCTSTR lpOrder, IN CONST BYTE &byPhotoType, IN LPCTSTR lpIncrementContent); BOOL GetRemvoeOrderInfoAndRemove( IN LPCTSTR lpBranchId, IN LPCTSTR lpOrderNum, IN LPCTSTR lpOpTm, IN const BYTE &byPhotoType); BOOL FindImageShareDirectory(IN const BYTE &byPhotoType, IN LPCTSTR lpImage, IN LPCTSTR lpOrderNum, OUT LPTSTR lpShareDirectory); BOOL FindImageShareDirectory(IN const BYTE &byPhotoType, IN LPCTSTR lpImage, IN LPCTSTR lpOrderNum, OUT CStringArray &AryOfShareDirectory); // 判断目录是否为有效可删除的目录; BOOL IsValideDiretory(IN LPCTSTR lpDirectory); // 删除指定的目录; BOOL DeleteDirectory(IN LPCTSTR lpDiretory); static BOOL IsValidDate(LPCTSTR lpDate); static UINT64 EasyGetFileSize(IN LPCTSTR lpFile); static UINT64 EasyGetFileSpacesSzie(IN LPCTSTR lpFileName); static UINT64 EasyGetSizeOfFiles(IN CStringArray &strAryOfFile); static BOOL GetDiskSpaceInfo(IN LPCTSTR lpRootPathName,IN OUT double &dTotalNum, IN OUT double &dFreeNum); static BOOL EasyCopyFile(IN LPCTSTR lpOrderNum, IN LPCTSTR lpExistingFileName, IN LPCTSTR lpTargetDirectory, IN BOOL bFailIfExists = TRUE ); }; #endif