code.
txt
' Here is the code from the [Link] class
module:
Imports [Link]
Public Class Patient
Private account_no_val As String
Private lastname_val As String
Private firstname_val As String
Private middlename_val As String
Private dob_val As Date
Private bedid_val As Integer
Private admitdate_val As Date
Private dischargedate_val As Date
Public Property AcctNo() As String
Get
Return account_no_val
End Get
Set(ByVal value As String)
account_no_val = value
End Set
End Property
Public Property LastName() As String
Get
Return lastname_val
End Get
Set(ByVal value As String)
lastname_val = value
End Set
End Property
Public Property FirstName() As String
Get
Page 1
[Link]
Return firstname_val
End Get
Set(ByVal value As String)
firstname_val = value
End Set
End Property
Public Property MiddleName() As String
Get
Return Middlename_val
End Get
Set(ByVal value As String)
Middlename_val = value
End Set
End Property
Public Property DOB() As Date
Get
Return dob_val
End Get
Set(ByVal value As Date)
If value < [Link] Then
dob_val = value
End If
End Set
End Property
Public ReadOnly Property BedID() As
Integer
Get
Return bedid_val
End Get
End Property
Public ReadOnly Property AdmitDate() As
Date
Get
Return admitdate_val
Page 2
[Link]
End Get
End Property
Public Property DischargeDate() As Date
Get
Return dischargedate_val
End Get
Set(ByVal value As Date)
dischargedate_val = value
End Set
End Property
Public Sub Admit()
Dim random_instance = New Random
bedid_val = Int(random_instance.next)
admitdate_val = Today
End Sub
Public Sub Discharge()
If [Link]() <= Today Then
[Link] = Today
End If
End Sub
End Class
' Here is the code from the [Link]
webform code file:
Protected Sub btnAdd_Click(ByVal sender As
Object, ByVal e As [Link]) Handles
[Link]
Dim is_it_a_date As DateTime
Dim aPatient As New Patient
[Link] = [Link]
[Link] = [Link]
[Link] = [Link]
Page 3
[Link]
[Link] = [Link]
Try
is_it_a_date =
[Link]([Link])
Catch ex As Exception
[Link] = "Your entry
does not appear to be a valid date."
[Link] = True
[Link] = [Link]
End Try
If is_it_a_date > Today Then
[Link] = " A date of
birth should be before today."
[Link] = True
[Link] = [Link]
End If
[Link] =
[Link]([Link])
[Link]()
[Link] = "A new patient is
being created with an account number of " &
[Link] _
& ", whose name is " &
[Link] & " " & [Link]
& " " & [Link] _
& ", and who was born " & [Link]
& ". The patient is being admitted today, " &
[Link] _
& " into bed #" & [Link] & "."
Session("Patient") = aPatient
End Sub
Protected Sub Page_Load(ByVal sender As
Object, ByVal e As [Link]) Handles
Page 4
[Link]
[Link]
If Not IsPostBack Then
[Link] = "3489052332"
[Link] = "Porky"
[Link] = "Pernicious"
[Link] = "Pigg"
[Link] = "11/08/1925"
End If
End Sub
' Here is the code from the
[Link] webform code file:
Protected Sub btnDischarge_Click(ByVal
sender As Object, ByVal e As [Link])
Handles [Link]
Dim aPatient As New Patient
aPatient = Session("Patient")
[Link]()
[Link] = "The current patient "
& [Link] & " " &
[Link] & " " & [Link]
_
& " was born " & [Link] & ".
This patient, with an account number of " &
[Link] _
& "was admitted on " &
[Link] & " into bed #" &
[Link] & ". The patient record will
now show a " _
& "discharge date of " &
[Link] & "."
Page 5
[Link]
End Sub
Page 6