MultiBranchInfo.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef _MULTIBRANCHINFO_HEADER_
  2. #define _MULTIBRANCHINFO_HEADER_
  3. //#include "Global.h"
  4. #include "BranchInfo.h"
  5. #pragma once
  6. class CMultiBranchInfo
  7. {
  8. CMultiBranchInfo(void);
  9. public:
  10. ~CMultiBranchInfo(void);
  11. static CMultiBranchInfo* GetInstance()
  12. {
  13. static CMultiBranchInfo tagInstance;
  14. return &tagInstance;
  15. }
  16. protected:
  17. CBranchInfo *m_pOurBranchInfo;
  18. static TCHAR m_szOurBranchId[MAX_PATH]; // 本店域名;
  19. typedef vector<CBranchInfo*> MULTBRANCH;
  20. MULTBRANCH m_vtMultiBranchInfo;
  21. void RemoveAllBranchInf();
  22. BOOL IsBranchInfoExists(IN CONST CBranchInfo* pBranchInfo);
  23. BOOL IsCatalogExists(IN LPCTSTR lpConnectString);
  24. public:
  25. static INT FindPortEx(int start, BYTE *InByte, int InLen, char *OutPath);
  26. static BOOL GetOurBranchId();
  27. const CBranchInfo* GetOurBranchInfo(){return m_pOurBranchInfo;}
  28. #if TEST_CREATE_DIRECTORY // 测试接口,当没有加密狗时,将硬件的域名设置为数据库的域名;
  29. void SetTestBranchId(LPCTSTR lpBranchId){_stprintf_s(m_szOurBranchId,_T("%s"),lpBranchId);}
  30. #endif
  31. public:
  32. // 1.设置本店域名;
  33. inline void SetOurBranchId(IN LPCTSTR lpOurBranchId)
  34. {
  35. if(_tcscmp(m_szOurBranchId,_T("")) == 0)
  36. _stprintf_s(m_szOurBranchId,lpOurBranchId);
  37. }
  38. LPCTSTR GetOurBranchDomain(){return m_szOurBranchId;}
  39. // 2.添加分店信息;
  40. BOOL AddBranchInfo(
  41. IN CONST DWORD &dwCatalogPort,
  42. IN LPCTSTR lpCatalogSource,
  43. IN LPCTSTR lpCatalogAccount,
  44. IN LPCTSTR lpCatalogPsw,
  45. IN LPCTSTR lpCatalogName);
  46. CBranchInfo* GetOurBranchObj();
  47. CBranchInfo* GetBranchObj(IN LPCTSTR lpBranchId);
  48. BOOL GetTblVersion(IN LPCTSTR lpBranchId, OUT CArray<CStringArray,CStringArray> &AryOfValues);
  49. };
  50. #endif