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

📄 hwfls.cls

📁 制造业产供销与往来系统源码,包括进销存及全部控件!
💻 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 = "HwFls"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Dim OHwFls As Collection

Public Property Get Count() As Integer

Count = OHwFls.Count
    
End Property

Public Sub Add(OHwFl As HwFl)

Dim vKey As Integer, vHwFl As HwFl

For Each vHwFl In OHwFls
   If vHwFl.HwFl_Key > vKey Then
      vKey = vHwFl.HwFl_Key
   End If
Next

vKey = vKey + 1

OHwFl.HwFl_Key = vKey
OHwFls.Add OHwFl, CStr(vKey)

End Sub

Public Function Item(Vindex) As HwFl
Attribute Item.VB_UserMemId = 0

   Set Item = OHwFls.Item(Vindex)

End Function

Public Sub Remove(Vindex, Optional NeedDel As Integer = 1)

If NeedDel = 1 Then
   Dim mHwFl As HwFl
   Set mHwFl = OHwFls(Vindex)
   mHwFl.DbDel
End If
   
OHwFls.Remove (Vindex)
      
End Sub

Public Sub ClearAll()

Dim i, Vcount As Integer
Vcount = OHwFls.Count

For i = 1 To Vcount
   OHwFls.Remove (1)
Next

End Sub

Public Sub Fillbydb(Optional Wherestr As String = "", Optional Orderstr As String = "HwFlCode")
   Dim OHwFl As HwFl
   Dim Rs As DbRs
   Dim SqlStr As String
   Dim vKey As Integer
On Error GoTo ErrorHandle

   ClearAll
   
   SqlStr = "SELECT HwFlCode,HwFlMC,HwFlISSTOP,HwFlNO FROM HwFlREC "
   
   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 OHwFl = New HwFl
      OHwFl.HwFl_Key = vKey
      OHwFl.BatchLet Rs!HwFlCode, Rs!HwFlMc, Rs!HwFlIsStop, Rs!HwFlNo
      OHwFls.Add OHwFl, 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 = OHwFls.[_NewEnum]
  
End Function

Private Sub Class_Initialize()

Set OHwFls = New Collection

End Sub

Private Sub Class_Terminate()

Set OHwFls = Nothing

End Sub

Public Property Get Name() As String

Name = "HwFls"

End Property

Public Sub DbSave()
   Dim mNotSaved As Collection
   Dim mHwFl As HwFl
On Error GoTo ErrorHandle
   
   Set mNotSaved = New Collection
   
   gDbCommon.Conn.BeginTrans
   
   For Each mHwFl In OHwFls
      If mHwFl.HwFl_id = -1 Then
         mNotSaved.Add mHwFl
      End If
      mHwFl.DbSave
   Next
   
   gDbCommon.Conn.CommitTrans
   
   Set mNotSaved = Nothing

Exit Sub
ErrorHandle:
   For Each mHwFl In mNotSaved
      mHwFl.HwFl_id = -1
   Next
   Set mNotSaved = Nothing
   gDbCommon.Conn.RollbackTrans
End Sub




⌨️ 快捷键说明

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