使用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
// STKMsgAttachmentRowSet.cpp : implementation file
//
 
#include "stdafx.h"
#include "mbamdb.h"
#include "STKMsgAttachmentRowSet.h"
#include "MBAMDBFun.h"
 
// STKMsgAttachmentRowSet
 
CSTKMsgAttachmentRowSet::CSTKMsgAttachmentRowSet()
{
    m_pDBConnect    = NULL;
    m_pMsgAttachments    = NULL;
}
 
CSTKMsgAttachmentRowSet::~CSTKMsgAttachmentRowSet()
{
    CleanDataSet( );
}
 
void CSTKMsgAttachmentRowSet::operator = ( const CSTKMsgAttachmentRowSet &Item )
{
    m_strStartDate        = Item.m_strStartDate;
 
    m_strEndDate        = Item.m_strEndDate;
    m_pDBConnect        = Item.m_pDBConnect;
    m_pMsgAttachments                = Item.m_pMsgAttachments;
}
 
void CSTKMsgAttachmentRowSet::CleanDataSet( )
{
    if(m_pMsgAttachments)
        delete    m_pMsgAttachments;
    m_pMsgAttachments    = NULL;
}
 
bool CSTKMsgAttachmentRowSet::SetDBConnect( CMBAMDBConnect *pDBConnect )
{
    m_pDBConnect    = pDBConnect;
 
    return true;
}
bool CSTKMsgAttachmentRowSet::ListAttachments( CString strUser,CString strUserName, CString strKey ,long &nCount  )
{
    nCount = 0;
    if ( !m_pDBConnect || !m_pDBConnect->IsOpenDB() )
        return    false;
    CleanDataSet();
    m_pDBConnect->AddRef();
    m_pMsgAttachments        = new CMsgAttachments( m_pDBConnect);
    CHighTime    tmHigh;
    SYSTEMTIME    tmSystem;
    // Set Filter
    if ( !m_strStartDate.IsEmpty() && tmHigh.ParseDateTime( m_strStartDate ) )
    {
        tmHigh.GetAsSystemTime( tmSystem );
        if ( tmSystem.wSecond < 0 )
            tmSystem.wSecond    = 0;
 
        m_pMsgAttachments->m_tmStartDate    = COleDateTime( tmSystem.wYear, tmSystem.wMonth, tmSystem.wDay,
                                                tmSystem.wHour, tmSystem.wMinute, tmSystem.wSecond );
    }
    if ( !m_strEndDate.IsEmpty() && tmHigh.ParseDateTime( m_strEndDate ) )
    {
        tmHigh.GetAsSystemTime( tmSystem );
        if ( tmSystem.wSecond < 0 )
            tmSystem.wSecond    = 0;
 
        m_pMsgAttachments->m_tmEndDate    = COleDateTime( tmSystem.wYear, tmSystem.wMonth, tmSystem.wDay,
                                            tmSystem.wHour, tmSystem.wMinute, tmSystem.wSecond );
    }
 
    int        nMsgCount(0);
    nMsgCount = m_pMsgs->ListReceiveBoxMsg( strUser,strUserName,strContentKey, nAttach );
    if ( nMsgCount <= 0 )
    {
        delete    m_pMsgs;
        m_pMsgs    = NULL;
        return    true;
    }
    m_nType    = ROWTYPE_MSG;
    m_pMsgs->GetData( );
    nCount    = nMsgCount;
    return true;
}
bool CSTKMsgAttachmentRowSet::ListRecordCount( long &nCount  )
{
    nCount = 0;
 
    if ( m_pMsgAttachments )
        nCount = m_pMsgAttachments->ListRecordCount();
    return true;
}
bool CSTKMsgAttachmentRowSet::Top( )
{
    if ( m_pMsgAttachments && !m_pMsgAttachments->MoveFirst() )
        return    false;
    return true;
}
 
bool CSTKMsgAttachmentRowSet::Prev()
{
    if ( m_pMsgAttachments && !m_pMsgAttachments->MovePrev() )
        return    false;
    return true;
}
 
bool CSTKMsgAttachmentRowSet::Next( )
{
    if ( m_pMsgAttachments && !m_pMsgAttachments->MoveNext() )
        return    false;
    return true;
}
 
bool CSTKMsgAttachmentRowSet::MoveTo( long nPos )
{
    if ( m_pMsgAttachments && !m_pMsgAttachments->MoveTo(nPos) )
        return    false;
    return true;
}
 
bool CSTKMsgAttachmentRowSet::GetRow( CSTKMsgAttachmentRow *pSTKRow )
{
    if ( !pSTKRow )
        return false;
 
    pSTKRow->m_pAConnect    = m_pDBConnect;
    pSTKRow->m_pCursor   = m_pMsgAttachments;
    return true;
}
bool CSTKMsgAttachmentRowSet::GetItemValueStr( CString strItemName, CString &strData )
{
    CString        strValue    = _T( "" );
    CString        strName        = strItemName;
    if ( strName.IsEmpty() )
        return    false;
    if ( !m_pMsgAttachments )
        return false;
 
    m_pMsgAttachments->GetData( );
    if ( !((*m_pMsgAttachments).GetItemValue( strName, strValue )) )
        return    false;
    strData        = strValue;
    return true;
}
bool CSTKMsgAttachmentRowSet::GetItemValue( CString strItemName, VARIANT &vData )
{
    vData.vt        = VT_EMPTY;
 
    CString        strName    = strItemName;
    if ( strName.IsEmpty() )
        return    false;
    COleVariant        oleData;
    if ( !m_pMsgAttachments )
        return false;
 
    m_pMsgAttachments->GetData( );
    if ( !((*m_pMsgAttachments).GetItemValue( strName, oleData )) )
        return    false;
    vData        = oleData;
    return true;
}
 
bool CSTKMsgAttachmentRowSet::SetMsgFilterDate( CString strStartDate, CString strEndDate )
{
    m_strStartDate    = strStartDate;
    m_strEndDate    = strEndDate;
 
    return true;
}