📄 clsimage.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 = "clsImage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit
'local variable(s) to hold property value(s)
Private mvarID As Integer 'local copy
Private mvarIName As String 'local copy
Private mvarIntroduce As String 'local copy
Private mvarTypeID As Integer 'local copy
Private mvarMinX As Double 'local copy
Private mvarMaxX As Double 'local copy
Private mvarMinY As Double 'local copy
Private mvarMaxY As Double 'local copy
Private mvarIDate As Date 'local copy
Private mvarRes As String 'local copy
Private mvarIFormat As String 'local copy
Private mvarTypeName As String 'local copy
Private mvarProj As String 'local copy
Private mvarLabel As String 'local copy
Public Property Let Label(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Label = 5
mvarLabel = vData
End Property
Public Property Get Label() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Label
Label = mvarLabel
End Property
Public Property Let Proj(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Proj = 5
mvarProj = vData
End Property
Public Property Get Proj() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Proj
Proj = mvarProj
End Property
Public Property Let TypeName(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.TypeName = 5
mvarTypeName = vData
End Property
Public Property Get TypeName() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.TypeName
TypeName = mvarTypeName
End Property
Public Property Let IFormat(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.IFormat = 5
mvarIFormat = vData
End Property
Public Property Get IFormat() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.IFormat
IFormat = mvarIFormat
End Property
Public Property Let Res(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Res = 5
mvarRes = vData
End Property
Public Property Get Res() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Res
Res = mvarRes
End Property
Public Property Let IDate(ByVal vData As Date)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.IDate = 5
mvarIDate = vData
End Property
Public Property Get IDate() As Date
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.IDate
IDate = mvarIDate
End Property
Public Property Let MaxY(ByVal vData As Double)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.MaxY = 5
mvarMaxY = vData
End Property
Public Property Get MaxY() As Double
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.MaxY
MaxY = mvarMaxY
End Property
Public Property Let MinY(ByVal vData As Double)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.MinY = 5
mvarMinY = vData
End Property
Public Property Get MinY() As Double
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.MinY
MinY = mvarMinY
End Property
Public Property Let MaxX(ByVal vData As Double)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.MaxX = 5
mvarMaxX = vData
End Property
Public Property Get MaxX() As Double
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.MaxX
MaxX = mvarMaxX
End Property
Public Property Let MinX(ByVal vData As Double)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.MinX = 5
mvarMinX = vData
End Property
Public Property Get MinX() As Double
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.MinX
MinX = mvarMinX
End Property
Public Property Let TypeID(ByVal vData As Integer)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.TypeID = 5
mvarTypeID = vData
End Property
Public Property Get TypeID() As Integer
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.TypeID
TypeID = mvarTypeID
End Property
Public Property Let Introduce(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Introduce = 5
mvarIntroduce = vData
End Property
Public Property Get Introduce() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Introduce
Introduce = mvarIntroduce
End Property
Public Property Let IName(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.IName = 5
mvarIName = vData
End Property
Public Property Get IName() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.IName
IName = mvarIName
End Property
Public Property Let ID(ByVal vData As Integer)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.ID = 5
mvarID = vData
End Property
Public Property Get ID() As Integer
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.ID
ID = mvarID
End Property
Public Function DeleteEx() As gxcDelete
End Function
Public Function Delete(Optional lngID As Long = -1) As gxcDelete
Dim strSQL As String
'如果已传入了要删除的ID,则按此ID删除
If lngID <> -1 Then Me.ID = lngID
g_Conn.BeginTrans
strSQL = "delete from IImage where I_ID=" & Me.ID
g_Conn.Execute (strSQL)
g_Conn.CommitTrans
'如果错误,返回FALSE,表示未删除成功
Delete = IIf(Err.Number = 0, DeleteOK, DeleteFail)
End Function
Public Function Update() As gxcUpdate
Dim strSQL As String
'通过ID判断是否存在该记录,即该记录是否被其他项目端删除
'如果不存在该记录,则返回相应的操作结果给调用者
If Not ExistByID("IImage", "I_ID", Me.ID) Then
Update = RecordNotExist
Exit Function
End If
'通过名称判断是否存在相同名称的记录,如果存在相同的名称,则返回调用者"存在相同名称"的信息
If ExistByNameExceptID("IImage", "I_ID", Me.ID, "I_Name", Me.IName) Then
Update = DuplicateName_Update
Exit Function
End If
strSQL = "update IImage set "
strSQL = strSQL & "I_Name='" & RealString((Me.IName)) & "',"
strSQL = strSQL & "I_Introduce='" & RealString((Me.Introduce)) & "',"
strSQL = strSQL & "I_TypeID='" & Me.TypeID & "',"
strSQL = strSQL & "I_Label='" & Me.Label & "' "
strSQL = strSQL & " where I_ID=" & Me.ID
g_Conn.Execute strSQL
'根据是否出错,返回给调用者相应的信息
Update = IIf(Err.Number = 0, UpdateOK, UpdateFail)
End Function
Public Function AddNew() As gxcAddNew
Dim strSQL As String
'检测输入名称是否存在
If ExistByName("IImage", "I_Name", Me.IName) Then
AddNew = DuplicateName_AddNew
Exit Function
End If
strSQL = "insert into IImage(I_Name,I_Introduce,I_TypeID,I_Label,I_MinX,I_MaxX,I_MinY,I_MaxY,I_Date,I_Resolution,I_Format,I_Projection)"
strSQL = strSQL & "values("
strSQL = strSQL & "'" & Me.IName & "'"
strSQL = strSQL & ",'" & Me.Introduce & "'"
strSQL = strSQL & ",'" & Me.TypeID & "'"
strSQL = strSQL & ",'" & Me.Label & "'"
strSQL = strSQL & ",'" & CStr(Me.MinX) & "'"
strSQL = strSQL & ",'" & CStr(Me.MaxX) & "'"
strSQL = strSQL & ",'" & CStr(Me.MinY) & "'"
strSQL = strSQL & ",'" & CStr(Me.MaxY) & "'"
strSQL = strSQL & ",'" & CStr(Me.IDate) & "'"
strSQL = strSQL & ",'" & Me.Res & "'"
strSQL = strSQL & ",'" & Me.IFormat & "'"
strSQL = strSQL & ",'" & Me.Proj & "'"
strSQL = strSQL & ")"
g_Conn.Execute strSQL
'如果发生错误,则返回AddNewFail,表示未成功添加
If Err.Number = 0 Then
Me.ID = MaxID("IImage", "I_ID")
AddNew = AddNewOK
Else
AddNew = AddNewFail
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -