📄 cwzh.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 = "CwZh"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Dim M_CwZhMc As String
Dim M_CwZhIsStop As Integer
Dim M_CwZhNo As Double
Dim M_CwZh_id As Integer
Dim M_CwZh_Key As Long
Private Sub Class_Initialize()
M_CwZh_id = -1
End Sub
Public Property Get CwZhMc() As String
CwZhMc = M_CwZhMc
End Property
Public Property Get CwZhIsStop() As Integer
CwZhIsStop = M_CwZhIsStop
End Property
Public Property Get CwZhNo() As Double
CwZhNo = M_CwZhNo
End Property
Public Property Get CwZh_id() As Integer
CwZh_id = M_CwZh_id
End Property
Public Property Get CwZh_Key() As Long
CwZh_Key = M_CwZh_Key
End Property
Public Property Let CwZhMc(vCwZhMc As String)
If Trim(vCwZhMc) = "" Then
Err.Raise vbObjectError + 1, , "账户名称不能为空!"
Exit Property
End If
If vCwZhMc <> M_CwZhMc Then
If M_CwZh_id = -1 Or vCwZhMc <> M_CwZhMc Then
If gPublicFunction.ExistFlg("FROM CwZhREC WHERE CwZhMc='" + vCwZhMc + "'") = 1 Then
Err.Raise Number:=vbObjectError + 1, Description:="已有账户名称:" & vCwZhMc
Exit Property
End If
End If
M_CwZhMc = vCwZhMc
End If
End Property
Public Property Let CwZhIsStop(vCwZhIsStop As Integer)
If vCwZhIsStop <> 0 And vCwZhIsStop <> 1 Then
Err.Raise vbObjectError + 1, , "停用标志只能为0或1!"
Exit Property
End If
M_CwZhIsStop = vCwZhIsStop
End Property
Public Property Let CwZh_id(vCwZh_id As Integer)
M_CwZh_id = vCwZh_id
End Property
Public Property Let CwZh_Key(vCwZh_Key As Long)
M_CwZh_Key = vCwZh_Key
End Property
Public Sub DbSave()
Dim Cmd As ADODB.Command
Dim mSqlStr As String
On Error GoTo ErrorHandle
Set Cmd = New ADODB.Command
Set Cmd.ActiveConnection = gDbCommon.Conn
If M_CwZh_id = -1 Then
Cmd.CommandText = "{CALL CwZhREC_INSERT(?,?,?)}"
Cmd.Parameters(0) = M_CwZhMc
Cmd.Parameters(1) = M_CwZhIsStop
Cmd.Parameters(2).Direction = adParamOutput
Cmd.Execute
M_CwZh_id = 1
M_CwZhNo = Cmd.Parameters(2)
Else
Cmd.CommandText = "{CALL CwZhREC_UPDATE(?,?,?)}"
Cmd(0) = M_CwZhNo
Cmd(1) = M_CwZhMc
Cmd(2) = M_CwZhIsStop
Cmd.Execute
End If
Set Cmd = Nothing
Exit Sub
ErrorHandle:
Set Cmd = Nothing
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Public Sub DbDel()
Dim Cmd As ADODB.Command
gPublicFunction.CheckCanBeDelete "CWZHREC", "CWZHNO", CStr(M_CwZhNo)
On Error GoTo ErrorHandle
Set Cmd = New ADODB.Command
Set Cmd.ActiveConnection = gDbCommon.Conn
Cmd.CommandText = "{call CwZhrec_delete(?)}"
Cmd.Parameters(0) = M_CwZhNo
gDbCommon.Conn.BeginTrans
Cmd.Execute
gDbCommon.Conn.CommitTrans
Set Cmd = Nothing
Exit Sub
ErrorHandle:
Set Cmd = Nothing
gDbCommon.Conn.RollbackTrans
End Sub
Public Function Requery(vCwZhMc As String) As Integer
Dim Rs As DbRs
On Error GoTo ErrorHandle
Set Rs = New DbRs
Rs.Fillbydb ("select CwZhMc,CwZhISSTOP,CwZhNo from CwZhrec where CwZhMc='" + vCwZhMc + "'")
Requery = -1
If Not Rs.EOF Then
Requery = 1
BatchLet Rs!CwZhMc, Rs!CwZhIsStop, Rs!CwZhNo
End If
Set Rs = Nothing
Exit Function
ErrorHandle:
Set Rs = Nothing
End Function
Public Sub BatchLet(ParamArray Properties())
M_CwZhMc = Properties(0)
M_CwZhIsStop = Properties(1)
M_CwZhNo = Properties(2)
M_CwZh_id = 1
End Sub
Public Property Get Name() As String
Name = "CwZh"
End Property
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -