#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 CArrayMsg; typedef CArray CArrayCrowdMsg; typedef struct _stAMOpenMsg { CString strMsgID; CString strUser; CString strOpenDate; _stAMOpenMsg(): strMsgID(_T("")),strUser(_T("")),strOpenDate(_T("")) {}; }stAMOpenMsg; typedef CArray 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 ); };