使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 0408576e9da10015ffa9da0079b8c985113ce4b3
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
#include "StdAfx.h"
#include "MBMasterClsAttrMgr.h"
 
 
CMBMasterClsAttrMgr::CMBMasterClsAttrMgr(void)
{
     RemoveAllAttr(); 
}
 
 
CMBMasterClsAttrMgr::~CMBMasterClsAttrMgr(void)
{
    RemoveAllAttr(); 
}
 
void    CMBMasterClsAttrMgr::GetVector( CMBMasterClsAttrVector &vectorAttr)
{
    vectorAttr.clear();
    vectorAttr = m_vectorAttr;     
}
 
CMBMasterClsAttr  *CMBMasterClsAttrMgr::GetAttr( CString strAttr ) 
{
    if( strAttr.IsEmpty() )
        return NULL;
 
    CMBMasterClsAttrMap::iterator    it; 
    CMBMasterClsAttr *pAttr  = NULL;
 
    it = m_mapAttr.find(strAttr);
 
    if( it!= m_mapAttr.end() )
        pAttr = it->second;
 
    return pAttr;   
}
 
bool  CMBMasterClsAttrMgr::AddAttr( CMBMasterClsAttr *pAttr )
{
    if( NULL ==  pAttr || pAttr->m_strAttr.IsEmpty() )
        return false;
 
    CMBMasterClsAttrMap::iterator    it;  
    CString strAttr;
 
    strAttr = pAttr->m_strAttr;
    it = m_mapAttr.find(strAttr);
 
    // Èç¹ûÕҵõ½ ·µ»Ø
    if( it != m_mapAttr.end() )
        return false;
 
    m_mapAttr[strAttr] = pAttr;     
    m_vectorAttr.push_back(pAttr);
 
    return true; 
}
 
bool  CMBMasterClsAttrMgr::RemoveAllAttr()
{
    CMBMasterClsAttrMap::iterator    it;  
    CMBMasterClsAttr *pAttr  = NULL;
 
    for( it = m_mapAttr.begin();it != m_mapAttr.end();it++ )
    {
        pAttr = it->second;
        delete pAttr;
        pAttr = NULL;        
    }
 
    m_mapAttr.clear();  
    m_vectorAttr.clear();
 
    return true;
}
 
 
CString  CMBMasterClsAttrMgr::GetAllAttr()
{
    CString strAttrs;
 
    CMBMasterClsAttrMap::iterator    it;  
    CMBMasterClsAttr *pAttr  = NULL;
 
    for( it = m_mapAttr.begin();it != m_mapAttr.end();it++ )
    {
        pAttr = it->second;
        strAttrs +=  pAttr->m_strAttr;
        strAttrs += _T(";");
    }
 
    strAttrs = strAttrs.Left(strAttrs.GetLength()-1);
 
    return strAttrs;
}
 
 
CString  CMBMasterClsAttrMgr::GetAttrSql()
{
    CString strSql,strAttrSql;
 
    CMBMasterClsAttrMap::iterator    it;  
    CMBMasterClsAttr *pAttr  = NULL;
 
    for( it = m_mapAttr.begin();it != m_mapAttr.end();it++ )
    {
        pAttr = it->second;
        strAttrSql.Format(_T("%s varchar(%s),"),pAttr->m_strAttr,pAttr->m_strSize);
        strSql += strAttrSql;
    }
 
    strSql = strSql.Left(strSql.GetLength()-1);
 
    return strSql;
}