📄 customer.vb
字号:
Public Class Customer
Private intCustomerID As Integer
Private strFName As String
Private strLName As String
Private strEmail As String
Private strPassword As String
Private strAddress As String
Private strCompany As String
Public ReadOnly Property CustomerID() As Integer
Get
Return intCustomerID
End Get
End Property
Public Property FirstName() As String
Get
Return strFName
End Get
Set(ByVal Value As String)
strFName = Value
End Set
End Property
Public Property LastName() As String
Get
Return strLName
End Get
Set(ByVal Value As String)
strLName = Value
End Set
End Property
Public Property Email() As String
Get
Return strEmail
End Get
Set(ByVal Value As String)
strEmail = Value
End Set
End Property
Public Property Password() As String
Get
Return strPassword
End Get
Set(ByVal Value As String)
strPassword = Value
End Set
End Property
Public Property Address() As String
Get
Return strAddress
End Get
Set(ByVal Value As String)
strAddress = Value
End Set
End Property
Public Property Company() As String
Get
Return strCompany
End Get
Set(ByVal Value As String)
strCompany = Value
End Set
End Property
Public Sub LogOn(ByVal strEmail As String, ByVal strPassword As String)
Email = strEmail
Password = strPassword
'retrieval of data is hardcoded for testing purposes only
If UCase(strEmail) = "KAREN@WINGTIPTOYS.MSN.COM" And UCase(strPassword) = "PASSWORD" Then
intCustomerID = 1119
FirstName = "Karen"
LastName = "Berge"
Address = "5678 Valley Road," & vbCrLf & "New York," & vbCrLf & "NY 98077"
Company = "Wingtip Toys"
Else
Throw New Exception("E-mail or password incorrect")
End If
End Sub
Public Sub GetDetails(ByVal intID As Integer)
intCustomerID = intID
'retrieval of data is hardcoded for testing purposes only
If CustomerID = 1119 Then
Email = "karen@wingtiptoys.msn.com"
Password = "password"
FirstName = "Karen"
LastName = "Berge"
Address = "5678 Valley Road," & vbCrLf & "New York," & vbCrLf & "NY 98077"
Company = "Wingtip Toys"
Else
Throw New Exception("Invalid CustomerID")
End If
End Sub
Public Function AddCustomer(ByVal strEmail As String, ByVal strPassword As String, _
ByVal strFName As String, ByVal strLName As String, ByVal strAddress As String, _
ByVal strCompany As String) As Integer
intCustomerID = 1200 'next available id number
Email = strEmail
Password = strPassword
FirstName = strFName
LastName = strLName
Address = strAddress
Company = strCompany
Return CustomerID
End Function
Public Sub New()
intCustomerID = -1
End Sub
Public Sub New(ByVal intCustomerID As Integer)
GetDetails(intCustomerID)
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -