使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 4905e2e7537d507f218e8e9595485e09d9f3a2b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#pragma once
#include "MBAMDBConnect.h"
#include "Msg.h"
#include "CrowdMsg.h"
#include "STKMsgRowSet.h"
#include "CrowdMsgRowSet.h"
#include "MBAMDBDef.h"
// CMBAMBaseDBMgr command target
typedef CArray<CMsgItem, CMsgItem&> CArrayMsg;
typedef CArray<CCrowdMsgItem, CCrowdMsgItem&> CArrayCrowdMsg;
 
typedef struct _stAMOpenMsg
{
    CString        strMsgID;
    CString        strUser;
    CString        strOpenDate;
    _stAMOpenMsg(): strMsgID(_T("")),strUser(_T("")),strOpenDate(_T("")) {};
}stAMOpenMsg;
typedef CArray<stAMOpenMsg, stAMOpenMsg&> CArrayAMOpenMsg;
 
class AFX_EXT_CLASS CMBAMBaseDBMgr : public CObject
{
public:
    CMBAMBaseDBMgr();
    virtual ~CMBAMBaseDBMgr();
// Attributers
public:
    CMBAMDBConnect            *m_pDBConnect;//Êý¾Ý¿âÁ¬½Ó¶ÔÏó
    CString                    m_strLoginName;//µÇ½Ãû
    CString                    m_strPassword;//ÃÜÂë
    CString                    m_strServerID;//µÇ½Ãû
    DWORD                    m_dwLocalVer;    // Êý¾Ý¿â°æ±¾
    
    BOOL                    m_bIsCloseDB;    //Êý¾Ý¿âÁ¬½ÓÊÇ·ñÒѹرÕ
 
    CArrayMsg                m_arSaveToDBMsg;
    CArrayCrowdMsg            m_arSaveToDBCrowdMsg;
    CArrayMsg                m_arBatchSaveToDBSyncMsg;
    CArrayAMOpenMsg            m_arAMOpenMsg;
    CCriticalSection          m_csAMOpenMsg;
 
    CStringArray             m_arBackupDBFile;    //±¸·ÝÊý¾Ý¿â
// Operations
public:
    //Á¬½ÓÊý¾Ý¿â
    int            Logined( CString strLogin, CString strPassword, CString strServerID, BOOL &bFirstDB);
    //Á¬½ÓÖ¸¶¨Êý¾Ý¿âÎļþ
    int            CreateDBConnect( CString strLogin,CString strDBFile);
    //Çå³ýÊý¾Ý¿âÁ¬½Ó¶ÔÏó
    void        CleanDBConnect( );
    //ÑéÖ¤Êý¾Ý¿â°æ±¾
    BOOL        VerifyDBVersion( DWORD dwVersion );
    //»ñÈ¡Êý¾Ý¿âÁ¬½Ó¶ÔÏó
    CMBAMDBConnect* GetMBAMDBConnect(  );
 
    //¸ù¾ÝÓû§Êý¾Ý¿â°æ±¾ÐÞ¸ÄÊý¾Ý¿â±í
    BOOL        UpdateNewDBTableInfo(int nVer );
    //ÉèÖÃÁ¬½ÓµÄÓû§ÐÅÏ¢
    BOOL        SetUserInfo( CString strLogin, CString strPassword );
    //ÒÆ³ý ×î½üÁªÏµÈË
    BOOL        RemoveLastContact( CString strID, int nType);
    // »ñÈ¡×î½üÁªÏµÈË
    BOOL        LoadLastContact(CArraySTKLastContact &arLastContact, int nLimitCount );
    // »ñȡָ¶¨µÄ×î½üÁªÏµÈË
    BOOL        GetLastContactItem(CString strID, int nType,stSTKLastContact &itemLastContact );
    // »ñȡָ¶¨Óû§»òÕßȺµÄδ¶ÁÏûÏ¢ÊýÄ¿
    int            GetUnreadMsgCount( CString strID, int nType);
    // »ñȡδ¶ÁÏûÏ¢ÊýÄ¿
    int            GetUnreadMsgCount();
    // µÃµ½ÏûÏ¢Ö¸¶¨µÄFolderÃû³Æ
    long        GetMsgFolderID( CString strFolderName );
    long        GetMsgFolderID( long nParentFolderID, CString strFolderName );
    // µÃµ½Ö¸¶¨µÄFolderÃû³Æ
    bool        GetFolderName( long nFolderID, CString &strFolderName );
    // ±£´æÏûÏ¢µ½±¾µØÊý¾Ý¿â
    BOOL        SaveSendMulMsgToDB( CMsgItem *pMsg );
    // ±£´æÏûÏ¢µ½±¾µØÊý¾Ý¿â
    BOOL        SaveMsgToDB( CMsgItem *pMsg, long nComfirmFlag = 0 );
    // ÅÉ·¢ÐÅÏ¢
    // ±¾µØÏûÏ¢
    void        DispatchMsg( CMsgItem * pMsgItem );
    // Ìí¼ÓÐèÒª±£´æµÄͬ²½ÏûÏ¢
    void        AddBatchSaveSyncMsgToDB( CMsgItem *pMsg );
    // ÅúÁ¿±£´æµÄͬ²½ÏûÏ¢
    void        BatchSaveSyncMsgToDB( );
    // ±£´æµÄδÀ´µÃ¼°±£´æµÄÏûÏ¢
    void        SaveNeedSaveMsg();
    // ÅúÁ¿±£´æÏûÏ¢ÒѶÁÐÅÏ¢µ½±¾µØÊý¾Ý¿â
    void        SaveAMMsgsOpenDate( );
    // ±£´æÏûÏ¢µ½±¾µØÊý¾Ý¿â
    BOOL        SaveSendMsgToDB( CMsgItem *pMsg, long nComfirmFlag = 0 );
    // ¸üÐÂÏûÏ¢½ÓÊÕÕß
    BOOL        UpdateMsgOwnerOpened( CString strMsgID, CString strOwner, CString strOpenDate );
    // ÉèÖÃÏûÏ¢ÒѶÁÈ¡
    bool        SetMsgReaded( CString strMsgID );    
    // ÉèÖÃȺÏûÏ¢ÒѶÁÈ¡
    BOOL        SetCrowdMsgReaded(CString strMsgID );
    // ÉèÖÃȺÏûÏ¢ºöÂÔ
    bool        SetMsgIgnore( CString strMsgID);
    // ÉèÖÃȺÏûÏ¢ºöÂÔ
    bool        SetCrowdMsgIgnore( CString strMsgID );
    // µÃµ½ÈËÔ±ÏêϸÐÅÏ¢
    BOOL        LoadUserInfo( CString strLogin, CString &strXml, int &nVer);
    // ±£´æÈËÔ±ÏêϸÐÅÏ¢
    BOOL        SaveUserInfo( CString strLogin, CString strXml, int nVer);
    // µÃµ½ÈËÔ±ÐÅÏ¢°æ±¾
    BOOL        LoadUserInfoVer( CString strLogin, int &nVer);
    // ¸üÐÂÓû§ÏûϢ̬¶È
    BOOL        UpdateUserAttitude(CString strID, CString strUser, CString strAttitude);
    // ÅжÏÏûÏ¢ÊÇ·ñ´æÔÚ
    BOOL        HasMsg( CString strMsgID );
 
    // »ñÈ¡²éѯÏûÏ¢
    bool        ListTalking3(CString strStartDate,CString strEndDate, CString strUser, CSTKMsgRowSet *pMsgRowSet ,long nLimitCount,long &nCount, BOOL bTimeAsc = FALSE   );
    bool        ListTalking2(CString strStartDate,CString strEndDate, CString strUser, CSTKMsgRowSet *pMsgRowSet ,long nLimitCount,long &nCount, BOOL bTimeAsc = FALSE   );
    bool        ListTalking(CString strStartDate,CString strEndDate, CString strUser, CSTKMsgRowSet *pMsgRowSet ,long &nCount,bool bOnlyAttachmentMsg = false, bool bGroupSend = false,BOOL bTimeAsc = FALSE   );
    bool        ListSearchingTalking(CString strStartDate,CString strEndDate, CString strUser, CString strKey,bool bOnlyAttachmentMsg, CSTKMsgRowSet *pMsgRowSet, long &nCount,bool bGroupSend = false, BOOL bTimeAsc = FALSE   );
    bool        ListTalkingAllMsg(CString strStartDate,CString strEndDate, CString strUser, CSTKMsgRowSet *pMsgRowSet ,long &nCount, BOOL bTimeAsc = FALSE   );
    bool        ListSearchingTalkingAllMsg(CString strStartDate,CString strEndDate, CString strUser, CString strKey,CSTKMsgRowSet *pMsgRowSet, long &nCount, BOOL bTimeAsc = FALSE   );
    // »ñÈ¡²éѯȺÏûÏ¢
    bool        ListCrowdMsg2(CString strStartDate,CString strEndDate, CString strCrowdID, CCrowdMsgRowSet *pMsgRowSet ,long nLimitCount, long &nCount, BOOL bTimeAsc = FALSE  );
    bool        ListCrowdMsg(CString strStartDate,CString strEndDate, CString strCrowdID, CCrowdMsgRowSet *pMsgRowSet , long &nCount, BOOL bTimeAsc = FALSE  );
    bool        ListSearchCrowdMsg(CString strStartDate,CString strEndDate, CString strCrowdID, CString strKey, CCrowdMsgRowSet *pMsgRowSet , long &nCount, BOOL bTimeAsc = FALSE  );
    // »ñÈ¡ÏûÏ¢¹ÜÀíÆ÷ÏûÏ¢
    bool        ListReceiveBoxMsg(CString strStartDate,CString strEndDate, CString strSender,CString strSenderName,CString strContentKey, int nAttach, CSTKMsgRowSet *pMsgRowSet,long &nCount );
    bool        ListSendBoxMsg(CString strStartDate,CString strEndDate, CString strReceiver,CString strReceiverName,CString strContentKey, int nAttach, CSTKMsgRowSet *pMsgRowSet,long &nCount );
    bool        ListFavBoxMsg(CString strStartDate,CString strEndDate, CString strSender,CString strSenderName, CString strContentKey, int nFavFolder,CSTKMsgRowSet *pMsgRowSet,long &nCount );
    bool        ListSysBoxMsg(CString strStartDate,CString strEndDate, CSTKMsgRowSet *pMsgRowSet,long &nCount );
    bool        ListMsgAttachment(CString strStartDate,CString strEndDate, CString strSender,CString strSenderName, CString strKey,CSTKMsgRowSet *pMsgRowSet,long &nCount );
    bool        ListSearchingTalkingMsg(CString strStartDate,CString strEndDate, CString strUser, CString strKey,CSTKMsgRowSet *pMsgRowSet, long &nCount, BOOL bTimeAsc = FALSE   );
    bool        ListSearchCrowdMsgBox(CString strStartDate,CString strEndDate, CString strCrowdID, CString strKey,CCrowdMsgRowSet *pMsgRowSet, long &nCount, BOOL bTimeAsc = FALSE   );
    bool        ListSyncBoxMsg(CString strSynchDate,CSTKMsgRowSet *pMsgRowSet,long &nCount );
    // Çå¿ÕÏûÏ¢¹ÜÀíÆ÷ÏûÏ¢
    BOOL        ClearReceiveBoxMsg(CString strStartDate,CString strEndDate, CString strSender,CString strSenderName,CString strContentKey, int nAttach);
    BOOL        ClearSendBoxMsg(CString strStartDate,CString strEndDate, CString strReceiver,CString strReceiverName,CString strContentKey, int nAttach);
    BOOL        ClearSysBoxMsg(CString strStartDate,CString strEndDate);
    BOOL        ClearFavBoxMsg(CString strStartDate,CString strEndDate, CString strContentKey, int nFavFolder);
    BOOL        ClearCrowdMsgBox(CString strStartDate,CString strEndDate, CString strCrowdID, CString strKey);
    // »ñÈ¡¸½¼þÐÅÏ¢
    BOOL        GetMsgFileInfo(CString strMsgID,  CString strFileID, CString &strFileName, CString &strFileSflag, __int64 &nFileSize );
    // »ñÈ¡ÏûÏ¢¸½¼þId
    BOOL        GetMsgFilesInfo( CString strMsgID,CStringArray &arAttachID);
    // »ñÈ¡¸½¼þ·¾¶
    BOOL        GetMsgFilePath(CString strMsgID, CString strFileID, CString &strFilePath );
    // ÉèÖÃÎļþ·¾¶
    BOOL        SetMsgFilePath( CString strMsgID, CString strFileID, CString strFilePath );
    //Áгöδ¶ÁÏûÏ¢
    BOOL        ListUnReadCrowdMsg( CObList &listMsg );
    BOOL        ListUnReadMsg( CObList &listMsg );
    //×°ÔØÓû§Í·Ïñ°æ±¾
    BOOL        LoadUserPictureVer( CString strLoginName, int &nVer );
    //±£´æÓû§Í·Ïñ°æ±¾
    BOOL        SaveUserPictureVer( CString strLoginName, int nVer );
    //±£´æÈºÏûÏ¢
    BOOL        SaveCrowdMsg( CCrowdMsgItem *pMsg);
    //ɾ³ýȺÏûÏ¢
    BOOL        DeletCrowdMsg( CString strMsgID,CString strGroupID);
    // ÉèÖÃÏûÏ¢µÄ´ò¿ª³ö´í
    bool        SetMsgReadError( CString strMsgID );
    // É¾³ýȺ¹²ÏíÎļþÐÅÏ¢
    BOOL        DeleteGroupFileInfo( CString strGroupID, CString strShareID);
        // ¸üÐÂȺ¹²ÏíÎļþÐÅÏ¢
    BOOL        UpdateGroupFileInfo( CString strGroupID, CString strShareID, CString strFilePath, CString strFileName = _T(""), __int64 nFileSize = 0);
    // Ìí¼ÓÊÕµ½Èº¹²ÏíÎļþÐÅÏ¢
    BOOL        AddGroupFileInfo( CString strGroupID, CString strShareID, CString strFileName, __int64 nFileSize );
    // ×°ÔØÈº¹²ÏíÎļþÐÅÏ¢
    BOOL        LoadGroupFilePath( CString strGroupID, CString strShareID, CString &strFilePath  );
    // ×°ÔØÈº¹²ÏíÎļþÐÅÏ¢
    BOOL        LoadGroupFileInfo( CString strGroupID, CString strShareID, CString &strFileName, __int64 &nFileSize  );
    // ×°ÔØÈº¹²ÏíÎļþÐÅÏ¢
    BOOL        LoadGroupFileInfo2( CString strGroupID, CString strShareID, CString &strFileName, CString &strFilePath ,__int64 &nFileSize  );
    // ×°ÔØÊý¾Ý¿âÖеÄÏûÏ¢ÐÅÏ¢
    BOOL        LoadMsgFromDB( CString strMsgID,  CMsgItem *pMsg );
    // ×°ÔØÊý¾Ý¿âÖеĸ½¼þÐÅÏ¢
    BOOL        LoadMsgAttachmentFromDB( CString strMsgID, CString strFileID, CMsgAttachmentItem *pMsg );
    // É¾³ýÏûÏ¢
    BOOL        DeleteMsgFromDB( CString strMsgID);
    // »ñÈ¡µ±ÌìµÄÏûÏ¢
    bool        ListMsg(CString strDate,CString strSender,long nLimitCount,CArrayShortMsg &arUserMsg,BOOL bTimeAsc = FALSE   );
    // »ñÈ¡²å¼þµ±ÌìÏûÏ¢
    bool        ListMsg2(CString strDate,CString strExtType,long nLimitCount,CArrayShortMsg &arUserMsg,BOOL bTimeAsc = FALSE   );
    // ÏûÏ¢ÒÆ¶¯µ½ÊղؼÐ
    bool        MoveMsg( CString strMsgID, long nNewFolderID );
    // »ñÈ¡ÊղؼÐÐÅÏ¢
    bool        ListFolder(long nParentFolderID, CSTKMsgRowSet *pMsgRowSet, long &nCount);
    // É¾³ýÊղؼÐ
    BOOL        DeleteFolder(long nFolderID,int nMoveMsg);
 
    // ×°ÔØÊý¾Ý¿âÖеÄȺÏûÏ¢ÐÅÏ¢
    BOOL        LoadCrowdMsgFromDB( CString strMsgID,  CCrowdMsgItem *pMsg );
        // »ñÈ¡·¢¼þÈË
    bool        GetSendPerson( CArrayAMObject &arAMObject);
    // »ñÈ¡ÊÕ¼þÈË
    bool        GetReceivePerson( CArrayAMObject &arAMObject);
    // »ñÈ¡¸øµ±Ç°Óû§·¢Ë͹ý¸½¼þµÄÓû§
    bool        GetSendAttachPerson(CArrayAMObject &arAMObject);
    // »ñȡȺ
    bool        GetCrowds(CArrayAMObject &arAMObject);
    // ±£´æÓû§±¸×¢
    BOOL        SaveUserRemarks( CString strLogin,CString strRemarks);
    // ×°ÔØËùÓÐÓû§±¸×¢
    BOOL        LoadUsersRemarks(CMapStringToString &mapUserRemarks);
    // »ñÈ¡±¸·ÝÊý¾Ý¿â
    BOOL        LoadBackupDBFile();
    BOOL        GetBackupDBFile(CStringArray &arBackupDB);
    // »ñÈ¡Êý¾Ý¿âÏûÏ¢×îÔçÏûÏ¢µÄÈÕÆÚ
    CString     GetOldestMsg();
    // »ñÈ¡Êý¾Ý¿âÏûÏ¢×îÐÂÏûÏ¢µÄÈÕÆÚ
    CString        GetUpToDateMsg();
    // »ñÈ¡Êý¾Ý¿âÏûÏ¢Êý
    BOOL         GetMsgDataCount(long &nMsgCount,long &nRelatedCount);
    // Çå³ý¸ÃÈÕÆÚ֮ǰµÄÏà¹ØÏûÏ¢ÄÚÈÝ
    BOOL         CleanDateBeforeMsg(CString strDate);
    // Çå³ý¸ÃÈÕÆÚÖ®ºóµÄÏà¹ØÏûÏ¢ÄÚÈÝ
    BOOL         CleanDateAfterMsg(CString strDate);
    // Çå³ý¸ÃºÍÏûÏ¢²»Ïà¹Ø±íµÄÄÚÈÝ
    BOOL        CleanAMExtraData();
    // »ñÈ¡Éϴλñȡδ¶ÁÏûÏ¢µÄʱ¼ä
    BOOL        LoadGetUnreadMsgTime( CString &strLastTime );
    // ±£´æ»ñȡδ¶ÁÏûÏ¢µÄʱ¼ä
    BOOL        SaveGetUnreadMsgTime( CString strLastTime);
    // ×°ÔØÖ¸¶¨ÀàÐÍÁªÏµÈ˵ÄÏûÏ¢ÏÔʾȨÏÞ
    BOOL                LoadContactMsgRight( CMapStringToInt &mapMsgRight,int nContactType = AM_VIEWITEMTYPE_USER);
    // ±£´æÖ¸¶¨ÁªÏµÈ˵ÄÏûÏ¢ÏÔʾȨÏÞ
    BOOL                SaveContactMsgRight( CString strID, int nMsgRight,int nContactType = AM_VIEWITEMTYPE_USER);
private:
    //ÉèÖÃÊý¾Ý¿â°æ±¾
    BOOL        SetDBVersion( DWORD dwVersion );
};