📄 syscps.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "SysCps"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Dim OSysCps As Collection
Public Property Get Count() As Integer
Count = OSysCps.Count
End Property
Public Sub Add(oSysCp As SysCp)
Dim vKey As Integer, vSysCp As SysCp
For Each vSysCp In OSysCps
If vSysCp.SysCp_Key > vKey Then
vKey = vSysCp.SysCp_Key
End If
Next
vKey = vKey + 1
oSysCp.SysCp_Key = vKey
OSysCps.Add oSysCp, CStr(vKey)
End Sub
Public Function Item(Vindex) As SysCp
Attribute Item.VB_UserMemId = 0
Set Item = OSysCps.Item(Vindex)
End Function
Public Sub Remove(Vindex, Optional NeedDel As Integer = 1)
Dim oSysCp As SysCp
Set oSysCp = OSysCps(Vindex)
If NeedDel = 1 And oSysCp.SysCp_id = 1 Then
oSysCp.DbDel
End If
Set oSysCp = Nothing
OSysCps.Remove (Vindex)
End Sub
Public Sub ClearAll()
Dim i, Vcount As Integer
Vcount = OSysCps.Count
For i = 1 To Vcount
OSysCps.Remove (1)
Next
End Sub
Public Sub Fillbydb(Optional Wherestr As String = "", Optional Orderstr As String = "SysCpCODE")
Dim oSysCp As SysCp
Dim Rs As DbRs
Dim SqlStr As String
Dim vKey As Integer
On Error GoTo ErrorHandle
ClearAll
SqlStr = "select SysCpCODE,SysCpMC,SysCpEMc,SysCpTel,SysCpFax,SysCpAdd,SysCpPCode,SysCpEmail,SysCpWww,SysCpNO from SysCprec "
If Wherestr <> "" Then
SqlStr = SqlStr + " where " + Wherestr
End If
If Orderstr <> "" Then
SqlStr = SqlStr + " order by " + Orderstr
End If
Set Rs = New DbRs
Rs.Fillbydb SqlStr
Rs.MoveFirst
vKey = 1
Do Until Rs.EOF
Set oSysCp = New SysCp
oSysCp.SysCp_Key = vKey
oSysCp.BatchLet Rs!SysCpCode, Rs!SysCpMc, Rs!SysCpEmc, Rs!SysCpTel, Rs!SysCpFax, Rs!SysCpAdd, Rs!SysCpPCode, Rs!SysCpEmail, Rs!SysCpWww, Rs!SysCpNo
OSysCps.Add oSysCp, CStr(vKey)
Rs.MoveNext
vKey = vKey + 1
Loop
Set Rs = Nothing
Exit Sub
ErrorHandle:
Set Rs = Nothing
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Public Function NewEnum() As IUnknown
Attribute NewEnum.VB_UserMemId = -4
Attribute NewEnum.VB_MemberFlags = "40"
Set NewEnum = OSysCps.[_NewEnum]
End Function
Private Sub Class_Initialize()
Set OSysCps = New Collection
End Sub
Private Sub Class_Terminate()
Set OSysCps = Nothing
End Sub
Public Property Get Name() As String
Name = "SysCps"
End Property
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -