⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clsexpendable.cls

📁 一个vb编的计算机机房管理系统
💻 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 = "clsExpendable"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Public ENAME As String ' --消耗品名称
Public Price As Double ' --价格
Public ECOUNT As Long ' --数量
Public STOREID As String  '  --存储地点


Public Function AddNew() As Boolean
'添加新消耗品
    Dim strCondition As String
    Dim nOldCount As Long
    Dim rsTmp As ADODB.Recordset
    
    strCondition = "EName='" & ENAME & "'"
    If objDBOpt.IsRecordExist("Expendable", strCondition) Then
        '数量增加
        Set rsTmp = objDBOpt.getRecord("Expendable", "ECount", strCondition)
        If rsTmp Is Nothing Then
            AddNew = False
            Exit Function
        End If
        nOldCount = setNotNull(rsTmp.Fields("ECount").Value, 0)
        rsTmp.Close
        AddNew = objDBOpt.ModiRecord("Expendable", "ECount", nOldCount + ECOUNT, strCondition)
        AddNew = objDBOpt.ModiRecord("Expendable", "Price", Price, strCondition)
        AddNew = objDBOpt.ModiRecord("Expendable", "Storeid", "'" & STOREID & "'", strCondition)
        
    Else
        '添加新的记录
        AddNew = objDBOpt.AddRecord("Expendable", "ECount,Price,EName,StoreID", nOldCount + ECOUNT & "," & Price & ",'" & ENAME & "','" & STOREID & "'")
    End If
    
End Function
Public Function Modi() As Boolean
'修改消耗品
    Dim strCondition As String
    Dim nOldCount As Long
    Dim rsTmp As ADODB.Recordset
    
    strCondition = "EName='" & ENAME & "'"
    If objDBOpt.IsRecordExist("Expendable", strCondition) Then
        '数量增加
        Modi = objDBOpt.ModiRecord("Expendable", "ECount", ECOUNT, strCondition)
        Modi = objDBOpt.ModiRecord("Expendable", "price", Price, strCondition)
        Modi = objDBOpt.ModiRecord("Expendable", "Storeid", "'" & STOREID & "'", strCondition)
        Exit Function
    Else
        
        MsgBox "要修改的记录不存在!"
        Modi = False
        Exit Function
    End If
    
End Function
Public Function Delete() As Boolean
'删除消耗品
    Dim strCondition As String
    strCondition = "EName='" & ENAME & "'"
    Delete = objDBOpt.DelRecord("Expendable", strCondition)
    
End Function
Public Function Use() As Boolean
'领用消耗品
    Dim strCondition As String
    Dim nOldCount As Long
    Dim rsTmp As ADODB.Recordset
    
    strCondition = "EName='" & ENAME & "'"
    If objDBOpt.IsRecordExist("Expendable", strCondition) Then
        '数量增加
        Set rsTmp = objDBOpt.getRecord("Expendable", "ECount", strCondition)
        If rsTmp Is Nothing Then
            Use = False
            Exit Function
        End If
        nOldCount = setNotNull(rsTmp.Fields("ECount").Value, 0)
        rsTmp.Close
        If nOldCount - ECOUNT < 0 Then
            MsgBox "数量不足!"
            Use = False
            Exit Function
        End If
        Use = objDBOpt.ModiRecord("Expendable", "ECount", nOldCount - ECOUNT, strCondition)
        Exit Function
    Else
        '添加新的记录
        MsgBox "不存在该类型的消耗品!"
        Use = False
        Exit Function
    End If
    
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -