📄 paymentmethod.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "PaymentMethod"
Attribute VB_GlobalNameSpace = True
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'付款方式类
'作者:黄涛
'日期:1998.02.21
Option Explicit
Public intFindKind As Integer
Private mstrFindKind() As String
'按照付款方式ID提取记录
Public Function GetByPaymentMethodID(ByVal lngID As Long) As Recordset
Dim recRecordset As Recordset
Dim strSQL As String
strSQL = "Select * From PaymentMethod Where lngPaymentMethodID = " & lngID
Set recRecordset = gdbDataBase.OpenRecordset(strSQL, dbOpenSnapshot)
Set GetByPaymentMethodID = recRecordset
End Function
'判断付款方式ID是否使用
Public Function IsUsePaymentMethodID(ByVal lngID As Long) As Boolean
Dim recRecordset As Recordset
Dim strSQL As String
strSQL = "Select lngPaymentMethodID From Activity Where lngPaymentMethodID = " & lngID
Set recRecordset = gdbDataBase.OpenRecordset(strSQL, dbOpenSnapshot)
IsUsePaymentMethodID = (recRecordset.RecordCount >= 1)
recRecordset.Close
End Function
'删除付款方式ID指定记录
Public Function DelByPaymentMethodID(ByVal lngID As Long) As Boolean
Dim strSQL As String
strSQL = "Delete * From PaymentMethod Where lngPaymentMethodID = " & lngID
DelByPaymentMethodID = ExecSQL(strSQL)
End Function
'产生付款方式列表记录集
Public Function ListPaymentMethod(ByVal blnShowAll As Boolean, ByVal intOrderField As Integer) As Recordset
Dim recRecordset As Recordset
If blnShowAll Then
If intOrderField = 1 Then
Set recRecordset = gdbDataBase.OpenRecordset _
("Select lngPaymentMethodID as ID," _
& " iif(blnIsInActive,'√','') as 停用," _
& " strPaymentMethodCode as 付款方式编码," _
& " strPaymentMethodName as 付款方式名称" _
& " FROM PaymentMethod Order By strPaymentMethodCode", dbOpenSnapshot)
Else
Set recRecordset = gdbDataBase.OpenRecordset _
("Select lngPaymentMethodID as ID," _
& " iif(blnIsInActive,'√','') as 停用," _
& " strPaymentMethodCode as 付款方式编码," _
& " strPaymentMethodName as 付款方式名称" _
& " FROM PaymentMethod Order By strPaymentMethodName", dbOpenSnapshot)
End If
Else
If intOrderField = 1 Then
Set recRecordset = gdbDataBase.OpenRecordset _
("Select lngPaymentMethodID as ID," _
& " strPaymentMethodCode as 付款方式编码," _
& " strPaymentMethodName as 付款方式名称" _
& " FROM PaymentMethod Where not blnIsInActive Order By strPaymentMethodCode", dbOpenSnapshot)
Else
Set recRecordset = gdbDataBase.OpenRecordset _
("Select lngPaymentMethodID as ID," _
& " strPaymentMethodCode as 付款方式编码," _
& " strPaymentMethodName as 付款方式名称" _
& " FROM PaymentMethod Where not blnIsInActive Order By strPaymentMethodName", dbOpenSnapshot)
End If
End If
Set ListPaymentMethod = recRecordset
End Function
'按照付款方式ID更新停用标志
Public Function UpdatePaymentMethodInActive(ByVal lngID As Long, ByVal blnIsInActive As Boolean) As Boolean
Dim strSQL As String
strSQL = "UPDATE PaymentMethod SET blnIsInActive = " & blnIsInActive & " WHERE lngPaymentMethodID = " & lngID
UpdatePaymentMethodInActive = ExecSQL(strSQL)
End Function
'新增付款方式记录
Public Function InsertPaymentMethod(ByVal strCode As String, ByVal strName As String, ByVal blnIsInActive As Boolean) As Boolean
Dim strSQL As String
strSQL = "INSERT INTO PaymentMethod (strPaymentMethodCode,strPaymentMethodName,blnIsInActive) VALUES ('" _
& strCode & "','" & strName & "'," & blnIsInActive & ")"
InsertPaymentMethod = ExecSQL(strSQL)
End Function
'修改付款方式记录
Public Function EditPaymentMethod(ByVal lngID As Long, ByVal strCode As String, ByVal strName As String, ByVal pblnIsInActive As Boolean) As Boolean
Dim strSQL As String
strSQL = "UPDATE PaymentMethod Set strPaymentMethodCode = '" & strCode _
& "', strPaymentMethodName = '" & strName & "', blnIsInActive = " & pblnIsInActive _
& " WHERE lngPaymentMethodID = " & lngID
EditPaymentMethod = ExecSQL(strSQL)
End Function
Private Sub Class_Initialize()
intFindKind = 2
ReDim mstrFindKind(intFindKind) As String
mstrFindKind(0) = "付款方式编码"
mstrFindKind(1) = "付款方式名称"
End Sub
Public Property Get strFindKind() As Variant
strFindKind = mstrFindKind()
End Property
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -