📄 clsappendmerchandise.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 = "clsAppendMerchandise"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Member0" ,"clsAppendMerchandiseSet"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit
'保持属性值的局部变量
Private mvarapplyid As Long '局部复制
Private mvarshopId As Integer '局部复制
Private mvarmerchandiseId As Integer '局部复制
Private mvarapplyCount As Integer '局部复制
Private mvarappendCount As Integer '局部复制
Private mvarshopName As String '局部复制
Private mvarmerchandiseName As String '局部复制
'保持属性值的局部变量
Private mvarapplyDate As Date '局部复制
Public Property Let applyDate(ByVal vData As Date)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.applyDate = 5
mvarapplyDate = vData
End Property
Public Property Get applyDate() As Date
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.applyDate
applyDate = mvarapplyDate
End Property
Public Property Let merchandiseName(ByVal vData As String)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.merchandiseName = 5
mvarmerchandiseName = vData
End Property
Public Property Get merchandiseName() As String
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.merchandiseName
merchandiseName = mvarmerchandiseName
End Property
Public Property Let shopName(ByVal vData As String)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.shopName = 5
mvarshopName = vData
End Property
Public Property Get shopName() As String
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.shopName
shopName = mvarshopName
End Property
Public Property Let appendCount(ByVal vData As Integer)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.appendCount = 5
mvarappendCount = vData
End Property
Public Property Get appendCount() As Integer
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.appendCount
appendCount = mvarappendCount
End Property
Public Property Let applyCount(ByVal vData As Integer)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.applyCount = 5
mvarapplyCount = vData
End Property
Public Property Get applyCount() As Integer
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.applyCount
applyCount = mvarapplyCount
End Property
Public Property Let merchandiseId(ByVal vData As Integer)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.merchandiseId = 5
mvarmerchandiseId = vData
End Property
Public Property Get merchandiseId() As Integer
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.merchandiseId
merchandiseId = mvarmerchandiseId
End Property
Public Property Let shopId(ByVal vData As Integer)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.shopId = 5
mvarshopId = vData
End Property
Public Property Get shopId() As Integer
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.shopId
shopId = mvarshopId
End Property
Public Property Let applyid(ByVal vData As Long)
'向属性指派值时使用,位于赋值语句的左边。
'Syntax: X.applyid = 5
mvarapplyid = vData
End Property
Public Property Get applyid() As Long
'检索属性值时使用,位于赋值语句的右边。
'Syntax: Debug.Print X.applyid
applyid = mvarapplyid
End Property
'***********************************************************************
'* 函数名:ApplyIdIsExist
'* 功 能:当前申请ID是否已存在于数据库中
'* 参 数:
'* 返回值:Boolean True 存在 False 不存在或数据查询错误
'* 版 本:2006.01.04 颜志军 初版
'***********************************************************************
Private Function ApplyIdIsExist() As Boolean
'变量定义
Dim sql As String 'SQL
Dim rs As ADODB.Recordset '记录集
'生成查询SQL
sql = "SELECT * FROM appendmerchandise WHERE applyid = " & CStr(applyid)
'执行查询
ApplyIdIsExist = False
On Error GoTo FUNEND
Set rs = g_conn.Execute(sql)
If Not rs.EOF Then
ApplyIdIsExist = True
End If
rs.Close
Set rs = Nothing
FUNEND:
End Function
'***********************************************************************
'* 函数名:LoadById
'* 功 能:从数据库中载入指定补货ID信息
'* 参 数:Long `申请ID
'* 返回值:DbOpResult 数据库操作结果
'* 版 本:2006.01.04 颜志军 初版
'***********************************************************************
Public Function LoadById(ByVal curId As Long) As DbOpResult
'变量定义
Dim sql As String 'SQL
Dim rs As ADODB.Recordset '记录集
'生成查询SQL
sql = "SELECT * FROM view_appendmerchandise WHERE applyid = " & CStr(curId)
'执行查询
LoadById = DbOpNG
On Error Resume Next
Set rs = g_conn.Execute(sql)
If Not rs.EOF Then
Me.applyid = rs("applyid")
Me.appendCount = rs("appendCount")
Me.applyCount = rs("applyCount")
Me.merchandiseId = rs("merchandiseId")
Me.merchandiseName = rs("merchandiseName")
Me.shopId = rs("shopId")
Me.shopName = rs("shopName")
LoadById = DbOpRecExist
Else
LoadById = DbOpRecNoExist
End If
rs.Close
Set rs = Nothing
End Function
'***********************************************************************
'* 函数名:AppendNew
'* 功 能:追加当前补货申请信息到数据库
'* 参 数:
'* 返回值:DbOpResult 数据库操作结果
'* 版 本:2006.01.04 颜志军 初版
'***********************************************************************
Public Function AppendNew() As DbOpResult
'变量定义
Dim sql As String 'SQL
Dim affectLines As Long '影响行数
'生成SQL
sql = "INSERT INTO appendmerchandise(shopId, merchandiseId, applyCount) VALUES(" & _
CStr(shopId) & "," & CStr(merchandiseId) & "," & CStr(applyCount) & ")"
'执行插入
AppendNew = DbOpNG
On Error Resume Next
g_conn.Execute sql, affectLines
If affectLines = 1 Then
AppendNew = DbOpOk
End If
End Function
'***********************************************************************
'* 函数名:Update
'* 功 能:更新当前补货申请到数据库
'* 参 数:
'* 返回值:DbOpResult 数据库操作结果
'* 版 本:2006.01.04 颜志军 初版
'***********************************************************************
Public Function Update() As DbOpResult
'变量定义
Dim sql As String 'SQL
Dim affectLines As Long '影响行数
'检查当前店ID是否存在
If Not ApplyIdIsExist() Then
Update = DbOpRecNoExist
Exit Function
End If
'生成SQL
sql = "UPDATE appendmerchandise SET shopId = " & CStr(shopId)
sql = sql & ", merchandiseId = " & CStr(merchandiseId)
sql = sql & ", applyCount = " & CStr(applyCount)
sql = sql & ", applyDate = GETDATE()"
sql = sql & " WHERE applyid =" & CStr(applyid)
'执行更新
Update = DbOpNG
On Error Resume Next
g_conn.Execute sql, affectLines
If affectLines = 1 Then
Update = DbOpOk
End If
End Function
'***********************************************************************
'* 函数名:UpdateAllow
'* 功 能:核对当前补货申请到数据库
'* 参 数:
'* 返回值:DbOpResult 数据库操作结果
'* 版 本:2006.01.04 颜志军 初版
'***********************************************************************
Public Function UpdateAllow() As DbOpResult
'变量定义
Dim sql As String 'SQL
Dim affectLines As Long '影响行数
'检查当前店ID是否存在
If Not ApplyIdIsExist() Then
UpdateAllow = DbOpRecNoExist
Exit Function
End If
'生成SQL
sql = "UPDATE appendmerchandise SET appendCount = " & CStr(appendCount)
sql = sql & " WHERE applyid =" & CStr(applyid)
'执行更新
UpdateAllow = DbOpNG
On Error Resume Next
g_conn.Execute sql, affectLines
If affectLines = 1 Then
UpdateAllow = DbOpOk
End If
End Function
'***********************************************************************
'* 函数名:Delete
'* 功 能:从数据库中删除当前补货申请
'* 参 数:
'* 返回值:DbOpResult 数据库操作结果
'* 版 本:2006.01.04 颜志军 初版
'***********************************************************************
Public Function Delete() As DbOpResult
'变量定义
Dim sql As String 'SQL
Dim affectLines As Long '影响行数
'生成SQL
sql = "DELETE FROM appendmerchandise WHERE applyid = " & CStr(shopId)
sql = sql & " AND appendCount = -1"
'执行删除
Delete = DbOpNG
On Error Resume Next
g_conn.Execute sql, affectLines
If affectLines = 1 Then
Delete = DbOpOk
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -