ASP.NET 2.0 Instant Results



Rather unsurprisingly,
DeleteContact
deletes a contact from the database. The naming convention
means the purpose of each stored procedure doesn't need a lot of explanation. As the code is discussed,
you look at the stored procedures in more detail where necessary.

The Business Layer
The business layer is organized into seven classes. The four main classes are as follows:

OnlineDiary

DiaryEntry

DiaryEvent

Contact
These classes do most of the work of temporarily holding diary-related data and retrieving and storing
it in the database. There are also three collection classes. The first order of business is the

OnlineDiary
class.
The OnlineDiary Class
This class contains only two shared public methods, detailed in the following table:
Method
Return Type
Description
InsertDiary(ByVal UserName As String,
None
Inserts a new diary user
ByVal FirstName As String, ByVal
into the OnlineDiary
LastName As String)
database.
GetDiaryIdFromUserName(ByVal
Integer
Looks up the UserName
UserName As String)
in the database and returns
the associated DiaryId.

The purpose of the
OnlineDiary
class is simply to provide a couple of handy shared methods relating
to an online diary as a whole. It could also be used to expand the diary system and add new functional-
ity that relates to the overall diary system, rather than a specific part such as contacts.

The Contact Class
The
Contact
class objectifies a single contact -- a person or thing for which you want to store contact
information. It encapsulates everything to do with contacts, including the storing and retrieving of con-
tact information in the database.

8
Chapter 1