// MsgProperty.cpp : implementation file // #include "stdafx.h" #include "mbamdb.h" #include "MsgProperty.h" #include "MBAMDBFun.h" #include "Msg.h" // MsgProperty CMsgPropertyItem::CMsgPropertyItem() { m_nRowType = ROWTYPE_MSG; Clear(); } CMsgPropertyItem::~CMsgPropertyItem() { } BOOL CMsgPropertyItem::GetItemValue( CString strName, COleVariant &varData ) { return FALSE; } void CMsgPropertyItem::Clear() { m_strName = _T(""); m_strValue = _T(""); } BOOL CMsgPropertyItem::InsertRecord( CDBConnect *pAConnect) { CString strSQL; BOOL bReturn = true; strSQL.Format( _T("INSERT INTO TN_STK_MSGPROPERTY( S_C2 , S_C3, G_C1 ) VALUES ( '%s', '%s', '%s')"), CMBAMDBFun::GetDBReplaceStr( m_strName ), CMBAMDBFun::GetDBReplaceStr( m_strValue ), m_strMsgID ); try { bReturn = CDBSQLiteCommFun::RunSQL(strSQL, pAConnect); } catch ( CDBSQliteException ex ) { CString strError = ex.GetErrInfo(); CString strErrInfo; strErrInfo = _T("InsertRecord - MsgProperty- ") + strError; CMBAMDBFun::WriteDBErrToFile( strErrInfo ); return false; } return true; } BOOL CMsgPropertyItem::UpdateRecord( CDBConnect *pAConnect ) { CString strSQL; BOOL bReturn = true; strSQL.Format( _T("UPDATE TN_STK_MSGPROPERTY SET S_C3 = '%s' WHERE S_C2 = '%s' AND G_C1 = '%s'"), CMBAMDBFun::GetDBReplaceStr( m_strValue ), CMBAMDBFun::GetDBReplaceStr( m_strName ), m_strMsgID ); try { bReturn = CDBSQLiteCommFun::RunSQL(strSQL, pAConnect); } catch ( CDBSQliteException ex ) { CString strError = ex.GetErrInfo(); CString strErrInfo; strErrInfo.Format( _T("UpdateRecord(%s) - MsgProperty - %s "),strSQL, strError); CMBAMDBFun::WriteDBErrToFile( strErrInfo ); return false; } return true; } //=========================================================== // ÅжÏÊÇ·ñÊÇÏûÏ¢µÄϵͳÊôÐÔ //=========================================================== BOOL CMsgPropertyItem::IsMsgSysAttrib( ) { if ( m_strName.CompareNoCase( _T("subject") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("sourcemsgid") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("receive-users") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("needconfirm") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("msgtype") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("msgflag") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("msgexttype") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("MeetID") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("date") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("content-type") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("content-length") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("attachment-count") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("apptype") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("lastmodify") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("opendate") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("attachment") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("attitudeset") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("user-login") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("password") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("senderip") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("localip") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("macaddr") ) == 0 ) return true; else if ( m_strName.CompareNoCase( _T("charset") ) == 0 ) return true; return false; } BOOL CMsgPropertyItem::IsMsgSysAttribDefValue( ) { BOOL bReturn = false; if ( m_strName.CompareNoCase( _T("msgentype") ) == 0 ) { if ( m_strValue == _T("0") ) return true; } else if ( m_strName.CompareNoCase( _T("foldername") ) == 0 ) { if ( m_strValue == _T("") ) return true; } else if ( m_strName.CompareNoCase( _T("leftbutton") ) == 0 ) { if ( m_strValue == _T("") ) return true; } else if ( m_strName.CompareNoCase( _T("rightbutton") ) == 0 ) { if ( m_strValue == _T("") ) return true; } return false; } CMsgPropertys::CMsgPropertys(CMBAMDBConnect *pAConnect) { m_pMsgs = NULL; m_pAConnect = pAConnect; } CMsgPropertys::~CMsgPropertys() { } // CMsgProperty member functions void CMsgPropertys::operator =( const CMsgPropertys& item ) { m_pMsgs = item.m_pMsgs; m_pAConnect = item.m_pAConnect; m_strSQL = item.m_strSQL; m_nRowType = item.m_nRowType; m_strName = item.m_strName; m_strValue = item.m_strValue; m_strMsgID = item.m_strMsgID; } bool CMsgPropertys::GetData( ) { return false; } void CMsgPropertys::LoadData( CMsgPropertyItem msgProperty ) { m_strName = msgProperty.m_strName; m_strValue = msgProperty.m_strValue; m_strMsgID = msgProperty.m_strMsgID; } bool CMsgPropertys::GetMsg( CMsgs &msg ) { if ( m_pMsgs == NULL ) return false; msg = (*m_pMsgs); return true; }