?? entityobject.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 = "EntityObject"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'--------------------------------
'時間:2001.11.12
'版權:北京用友軟件股份有限公司
'設計:章景峰
'編碼:章景峰
'說明:U8資金管理---實體對象
'--------------------------------
Option Explicit
Private m_iID As Long
Private m_sName As String '實體對象的狀態
Private m_sCaption As String '實體對象的狀態
Private m_Fields As Fields '實體對象的狀態
Private m_iState As EntityStateEnum '實體對象的狀態
Private m_iBIType As Long
Private m_sHelpContextID As String
Private m_sTaskID As String
Private m_sDescription As String
Private m_iSheetID As Long
Private m_iRows As Long
Private m_iCols As Long
Private m_OID As OIDObject
Private m_EOs As Entities
Private m_sSourceTable As String
Private m_sSourceOIDField As String
Private m_ParentOID As OIDObject
Private m_sParentField As String
Private m_sPzSign As String
Private m_bIsUsed As Boolean
Private m_iVchType As Long '實體對象的單據類型
Private m_iDeriveBIType As Long
Private m_iWidth As Double
Private m_iHeight As Double
Private m_bAutoAlarm As Boolean
Private m_iAlarmDays As Long
Public Property Set Fields(ByVal vData As Object)
'當把對象賦值給屬性時在 Set 語句左邊使用。
'Syntax: Set x.Fields = Form1
Set m_Fields = vData
End Property
Public Property Get Fields() As Fields
Attribute Fields.VB_UserMemId = 0
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.Fields
Set Fields = m_Fields
End Property
Public Property Let Caption(ByVal vData As String)
'當給屬性賦值時在參數左邊使用。
'Syntax: X.Caption = 5
m_sCaption = vData
End Property
Public Property Get Caption() As String
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.Caption
Caption = m_sCaption
End Property
Public Property Let Name(ByVal vData As String)
'當給屬性賦值時在參數左邊使用。
'Syntax: X.Name = 5
m_sName = vData
End Property
Public Property Get Name() As String
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.Name
Name = m_sName
End Property
Private Sub Class_Initialize()
Set m_Fields = New Fields
Set m_OID = New OIDObject
Set m_EOs = New Entities
Set m_ParentOID = New OIDObject
End Sub
Private Sub Class_Terminate()
Set m_Fields = Nothing
Set m_OID = Nothing
Set m_EOs = Nothing
Set m_ParentOID = Nothing
End Sub
Public Property Get State() As EntityStateEnum
State = m_iState
End Property
Public Property Let State(ByVal vData As EntityStateEnum)
m_iState = vData
End Property
'校驗實體對象各元素值是否合法
Public Function Validate() As Boolean
Dim oFO As FieldObject
Dim i As Integer
'For Each oFO In Fields
For i = 1 To Fields.Count
Set oFO = Fields.Item(i)
'----已使用并可持久化
If oFO.IsUsed And oFO.Persistent Then
'----設置值為默認值
If IsEmpty(oFO.Value) Or IsNull(oFO.Value) Then
oFO.Value = oFO.DefaultValue
End If
'----檢查不允許為空的域對象是否為空
If Not oFO.AllowNull Then
If IsNull(oFO.Value) Then
Err.Raise vbObjectError + 3000, oFO.Name, oFO.Caption & "不能為空!"
End If
End If
End If
Next
Validate = True
End Function
Public Property Get ID() As Long
ID = m_iID
End Property
Public Property Let ID(ByVal vData As Long)
m_iID = vData
End Property
Public Property Get BIType() As Long
BIType = m_iBIType
End Property
Public Property Let BIType(ByVal vData As Long)
m_iBIType = vData
End Property
Public Property Get HelpContextID() As String
HelpContextID = m_sHelpContextID
End Property
Public Property Let HelpContextID(ByVal vData As String)
m_sHelpContextID = vData
End Property
Public Property Get TaskID() As String
TaskID = m_sTaskID
End Property
Public Property Let TaskID(ByVal vData As String)
m_sTaskID = vData
End Property
Public Property Get Description() As String
Description = m_sDescription
End Property
Public Property Let Description(ByVal vData As String)
m_sDescription = vData
End Property
Public Function Clone(Optional Mode As CloneModeEnum = 0) As EntityObject
Dim oEO As New EntityObject
Dim oFO As FieldObject
Dim i As Integer
With oEO
.ID = Me.ID
.Name = Me.Name
.Caption = Me.Caption
If Mode = esoStructureOnly Then
.State = esoInitialized
Else
.State = Me.State
End If
.BIType = Me.BIType
.SourceOIDField = Me.SourceOIDField
.SourceTable = Me.SourceTable
.ParentField = Me.ParentField
.ParentOID = Me.ParentOID
.OID = Me.OID
.TaskID = Me.TaskID
.HelpContextID = Me.HelpContextID
.Description = Me.Description
.SheetID = Me.SheetID
.Rows = Me.Rows
.Cols = Me.Cols
.IsUsed = Me.IsUsed
.PzSign = Me.PzSign
.VchType = Me.VchType
.DeriveBIType = Me.DeriveBIType
For i = 1 To Fields.Count
Set oFO = Fields.Item(i)
.Fields.AppendEx oFO.Clone(Mode)
Next
If Mode = esoStructureAndData Then
For i = 1 To Me.EOs.Count
.EOs.Append Me.EOs(i), "K" & Me.EOs(i)(Me.EOs(i).SourceOIDField)
Next
End If
If Not Me.EOs.EOMetaData Is Nothing Then
Set .EOs.EOMetaData = Me.EOs.EOMetaData.Clone
End If
End With
Set Clone = oEO
End Function
Public Property Get SheetID() As Long
SheetID = m_iSheetID
End Property
Public Property Let SheetID(ByVal vData As Long)
m_iSheetID = vData
End Property
Public Property Get Rows() As Long
Rows = m_iRows
End Property
Public Property Let Rows(ByVal vData As Long)
m_iRows = vData
End Property
Public Property Get Cols() As Long
Cols = m_iCols
End Property
Public Property Let Cols(ByVal vData As Long)
m_iCols = vData
End Property
Public Property Get EOs() As Entities
Set EOs = m_EOs
End Property
Public Property Set EOs(ByVal vData As Entities)
Set m_EOs = vData
End Property
Public Property Let SourceTable(ByVal vData As String)
'當給屬性賦值時在參數左邊使用。
'Syntax: X.SourceTable = 5
m_sSourceTable = vData
End Property
Public Property Get SourceTable() As String
'當檢索屬性值時在參數右邊使用。
'Syntax: Debug.Print X.SourceTable
SourceTable = m_sSourceTable
End Property
Public Property Get ParentOID() As OIDObject
Set ParentOID = m_ParentOID
End Property
Public Property Let ParentOID(ByVal vData As OIDObject)
Set m_ParentOID = vData
End Property
Public Property Get OID() As OIDObject
Set OID = m_OID
End Property
Public Property Set OID(ByVal vData As OIDObject)
Set m_OID = vData
Me.Fields.Item(Me.SourceOIDField) = m_OID '這條語句是為字段sOID賦值,如果取消,就需要在各個BI中逐個賦值
End Property
Public Property Get ParentField() As String
ParentField = m_sParentField
End Property
Public Property Let ParentField(ByVal vData As String)
m_sParentField = vData
End Property
Public Property Get SourceOIDField() As String
SourceOIDField = m_sSourceOIDField
End Property
Public Property Let SourceOIDField(ByVal vData As String)
m_sSourceOIDField = vData
End Property
Public Property Get PzSign() As String
PzSign = m_sPzSign
End Property
Public Property Let PzSign(ByVal vData As String)
m_sPzSign = vData
End Property
Public Property Get IsUsed() As Boolean
IsUsed = m_bIsUsed
End Property
Public Property Let IsUsed(ByVal vData As Boolean)
m_bIsUsed = vData
End Property
Public Property Get VchType() As Integer
VchType = m_iVchType
End Property
Public Property Let VchType(ByVal vData As Integer)
m_iVchType = vData
End Property
Public Property Get DeriveBIType() As Integer
DeriveBIType = m_iDeriveBIType
End Property
Public Property Let DeriveBIType(ByVal vData As Integer)
m_iDeriveBIType = vData
End Property
Public Property Get Width() As Double
Width = m_iWidth
End Property
Public Property Let Width(ByVal vData As Double)
m_iWidth = vData
End Property
Public Property Get Height() As Double
Height = m_iHeight
End Property
Public Property Let Height(ByVal vData As Double)
m_iHeight = vData
End Property
Public Property Get IsAutoAlarm() As Boolean
IsAutoAlarm = m_bAutoAlarm
End Property
Public Property Let IsAutoAlarm(ByVal vData As Boolean)
m_bAutoAlarm = vData
End Property
Public Property Get AlarmDays() As Integer
AlarmDays = m_iAlarmDays
End Property
Public Property Let AlarmDays(ByVal vData As Integer)
m_iAlarmDays = vData
End Property
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -