Вы находитесь на странице: 1из 73

1|Page

2|Page

Acknowledgment
I would like to express my special thanks to Mr.U.H.Samarawickrama, the lecture of object oriented
programming.

As well as I would like to thank my Parents and my friends who help me to do this wonderful Assignment
on the topic, ‘object oriented programming.’ which also helped me in doing a lot of Research and I came
to know about so many new things and helped me to complete this assignment within the limited time
frame.

I am really thankful to them.


3|Page

Table of Contents

Task1 2

1.1 What are the Main characteristics and Features of Object Oriented Programming? Explain with
suitable diagrams…………………………………………………………………………………………………………………………. 2

1.2 Explain the Difference between Class & Object with in Object Oriented Programming with
Examples……………………………………………………………………………………………………………………………….. 6

Task 2………………………………………………………………………………………………………………………………....... 12

2.1Draw Class Responsibility Collaboration (CRC) cards keeps the complexity of the design at a
minimum………………………………………………………………………………………………………………………………. 12

2.2Draw a class diagram which can show the relationship between


classes…………………………………………………………………………………………………………………………………… 18

Task 3…………………………………………………………………………………………………………………………………….. 26

3.1Implement above classes using preferred object oriented programming


language…………………………………………………………………………………………………………………………………. 26

3.2Implement a client class with a main(), that calls operations in the Systems Manger
class……………………………………………………………………………………………………………………………………………… 31

Task 4………………………………………………………………………………………………………………………………………….. 32

4.1 Test implemented object oriented solution by using test mechanisms (valid declarations, debugging
code, and comment code) and types (range testing, input testing, load testing, and system
compatibility)………………………………………………………………………………………………………………………… 32

4.2 Error handling during software testing and give a feedback to improve the developed object
oriented solution…………………………………………………………………………………………………………………………..37

4.3 Include simple help menu to assist clients………………………………………………………………………..30

4.4 Create technical documentation to include designs, delivery system, platform, environment, file
structures, coding, constraints, and maintenance
requirements……………………………………………………………………………………………………………………………….. 39

Task 5…………………………………………………………………………………………………………………………………………… 45

5.1 Create a documentation according to the standards which covers all tasks Task 1 –Task 5…65

References…………………………………………………………………………………………………………………………………… 73
4|Page
5|Page

Task 1
1.1 What are the Main characteristics and Features of Object Oriented
Programming? Explain with suitable diagrams.

What is Object-Oriented Programming?

Object-Oriented Programming (OOP) is different from procedural programming languages (C,


Pascal, etc.) in several ways. Everything in OOP is grouped as "objects" (see data abstraction). OOP,
defined in the purest sense, is implemented by sending messages to objects. . All the objects in
OOPS are based on real world having a specific state and behavior.

OOPS consists of the following features

1. Encapsulation
2. Abstraction
3. Inheritance
4. Polymorphism
5. Data hiding

1. Encapsulation

 Encapsulation implies that the non-essential details of an object are hidden from the user
and an access is provided to its essential details. Therefore, encapsulation is also called
information hiding. For example, when you plug in the cord of a vacuum cleaner and switch
it on, the vacuum cleaner starts functioning. An end-user need not know the working
principle of a vacuum cleaner to convert electricity into suction power. The switch of th6
vacuum cleaner encapsulates the complex process of conversion of electricity into suction
power. The complexity of an object is hidden as a result of encapsulation.

 Computer games also use the feature of encapsulation. The user only needs to know how
to play the game. However, the complex working of game is hidden from the user.
6|Page

 In object-oriented methodology, need of encapsulation arises because the emphasis is on


designing classes in such a manner that the classes share data and methods among
themselves. Encapsulation is the feature that provides security to the data and the methods
of a class.
 An anytime money (ATM) that you use to withdraw money also has an encapsulated
function. You insert an ATM card in the machine and provide the pin code. The only access
that you have to the ATM is to provide the pin code for your account and not to the process
of validating the password. If the pin code is correct, you can make the desired transaction.
The backend transaction process is encapsulated. In addition, if you try to access another
account, access is denied, as you are not authorized to access any account other than your
account.

2. Abstraction

 Abstraction refers to the attributes of an object that clearly demarcates it from other
objects. For example, while developing an online shopping site for books, you use objects of
various items, such as books, compact disks (CDs), and cassettes. All these objects have a
well-defined set of attributes that distinguish these objects from each other. For example, a
book has page numbers, type of binding, and subject. However, a CD has type of media,
such as audio or visual, duration, and storage capacity of the CD.

 The concept of abstraction is implemented in object-oriented programming by creating


classes. All the attributes of the objects of the classes are defined in the class. However, you
cannot store any data in a class because creating a class does not allocate any memory
space to the class. To store data, you need to create objects of the class, which have
memory allocated as soon as it is created. Classes form the templates for creating objects.

 In addition to the well-defined characteristics of an object, abstraction enables you to


provide a restricted access to data. You come across hundreds of advertising messages
every day through magazines or newspapers. You do not read, understand, and respond to
all of these because these are not of your interest. Instead, you concentrate only on
messages that are of your specific interest. For example, if you want to buy a refrigerator,
you will concentrate on the advertisements featuring refrigerators. You will not
concentrate on the advertisements of other products, such as vacuum cleaner, washing
machine, and air conditioner.

 In object-oriented programming, abstraction means ignoring the non-essential details of an


object and concentrating on its essential details. As discussed earlier, in an ATM, the user is
not required to know the entire process of a transaction and how the data is stored.
However, the program provides a restricted access to the user's account.
7|Page

 Similarly, when you want to send e-mail messages, you should know the processes of
writing e-mail messages and sending it to the receiver. However, it is not necessary for you
to know the entire process of sending the e-mail messages across the network.
 To implement abstraction, you also use the encapsulation feature. Encapsulation hides the
irrelevant details of an object and abstraction makes only the relevant details of an object
visible. For example, the operation of a washing machine is hidden or encapsulated from
the user. The details, like switching on and off the washing machine are the only details
relevant for the user to know. This is implemented by abstraction. Rest of the working of
the washing machine is encapsulated from the user.

3. Inheritance

 In object-oriented methodology, inheritance enables you to extend the


functionality of an existing class. You create a class that inherits the attributes and
behavior of another class. In addition, the new class can consist of a few new
attributes and behaviors that are specific to the class. In terms of classes and
objects, attributes refer to the data and behavior refers to the methods.

 For example, you might have the Student class that consists of the basic
characteristics of students, such as name, date of birth, and gender. You can extend
the functions of the student class to a day scholar, who in addition to
characteristics of the Student class contains its own features, such as locker
number and residential address.

 Inheritance enables you to add new features and functionality to an existing class
without modifying the existing class. Inheritance also enables you to share data and
methods among multiple classes.

4. Polymorphism
 Polymorphism is derived from two Latin words-Poly, which means many, and morph, which
means forms. Anything that exists in more than one form is known as a polymorph. You might
have noticed that a person assumes different roles in different scenarios. For example, a person
assumes various roles when he interacts with the members of his family. He is a father to his
children, child to his parents, and husband to his wife. Although, the person is same, he behaves
differently with the family members as per his relation with the member.
8|Page

 In object-oriented methodology, polymorphism is the feature that enables you to assign a


different meaning or usage to an entity in different contexts. The entity can be a variable,
method, or an object. In other words, Polymorphism allows a programmer to make use of an
entity in several different forms without affecting the original identity of the entity.

5. Data hiding

 Data hiding is a method used in OOP to hide information within computer code. Objects within a
code are not privy to information considered hidden. It presents several advantages for
programmers, because objects are unable to connect to irrelevant data and hackers are less
likely to be able to access data. At the same time, hiding data can make it harder for a
programmer, who may need to use more code to create effects in hidden data than would be
necessary if the data were public.

 Object-oriented programming is a type of programming in which parts of the code are split into
objects. Each of these objects is programmed in capsules, so each object has its own coding that
applies only to that object. Without specifying data as hidden, all the data is open to the objects.

 Data hiding takes certain parts of code and hides those parts from the objects. The objects
cannot directly access any data that is hidden. If an object does access hidden data, it will return
an error. This is because the object cannot see the data, so any functions or data that are
labeled as hidden will look invisible to the object. Most of the time, the data being hidden are
the internal components that are not needed by the user and can prove dangerous if the data
are laid open for the user.

1.2 Explain the Difference between Class & Object with in Object Oriented Programming with
Examples
Object-Oriented Characteristics

Abstraction - “Eliminate the Irrelevant, Amplify the Essential”


9|Page

 Abstraction is to focus on the essential and discard the irrelevant. In a way this does
not make sense unless you have a scope. Example in the image above the vet is a
doctor of animals her view of the cat that is important to her would be the parts of
the cat while thing like the cat favorite toy might not be of relevance to her.
Whereas for the owner of the cat her view of the cat is different from the Vet.

Encapsulation "Hiding the Unnecessary"

Encapsulation is hiding the unnecessary. Meaning things that you do not want other
people/classes to know are to be hidden. For example in the image the professor do not need
to know how a student does her assignment. He is more interested in the end product.In a way
encapsulation protect the system, since it hides stuff that can be vulnerable to malicious attack.
There are also many other drawbacks to create a system without encapsulation. You can find it
out in our book chapter.

Inheritance "Modeling the Similarity"


10 | P a g e

 Similarities often exist in the world. As shown in image above, one could easily see
that there are some similarities between the two President of United States, George
H.W Bush (41st President) and George W. Bush (43rd President).

 George W. Bush is a son of George H.W Bush. He inherits biological features from
his father, at the same time, has his own unique feature that one could identify him
as George W. Bush. This bring us to the idea of inheritance that models a “is a”
relationship between objects.

Polymorphism “Same Function different behavior"

Source http://technofriends.in/2008/02/06/polymorphism-in-java-part-1/.

 The word “Polymorphism” comes from two Greek words, “many” and “form”. We can
illustrate the idea of polymorphism easily using the scenario where different animals are
asked to “speak”. As you can see from the image above, each animal has their own way
11 | P a g e

of “speaking”. So, when the person asks all the animals to “speak”, every animal
responds in their own way. This illustrates the power of polymorphism where different
instances can be treated the same way.

Example diagram for show the difference between of class and object

Class Object

Class is mechanism Instance of class or


Definition of binding data variable of class
members and
associated methods
in a single unit

Existence It is logical existence It is physical


existence

Memory space is Memory space is


Memory Allocation not allocated , when allocated, when it is
it is created. created.

Declaration/Definition Definition is created it is created many


once. time as you require.
12 | P a g e

Task 02
2.1 Draw Class Responsibility Collaboration (CRC) cards keeps the complexity of the design at a
minimum.

Systems Manager

Manager ID City

Manager Name Hotel

Create City Room Type

Create Room Type Room

Create Room

Find Available
Rooms

Book Room

Display System
Details
13 | P a g e

City

Name Systems Manager

Hotel

Systems
Name Manager

City

Room

Room

Room ID Systems Manager

Type Room Type

Hotel
14 | P a g e

Room Type

Type Services Manager

2.2 Draw a class diagram which can show the relationship between classes.
Class Diagram
15 | P a g e

Hotel M 1 City
-hotelName -cityName : string = 5
M

M M M
M 1

Systems Manager
Room M 1
-ManagerID : int
-roomID : int
-ManagerName : string
-roomType : int
1 +createCity()
+createHotel()
+createRoomType()
M M +createRoom() : any(idl)
+findAvailableRoom()
+bookRoom()
1 Room Type +displaySystemDetails()
-typeID : int

Delux DoubleBed SingleBed


-ID : int -ID : int -ID : int

Task 03
16 | P a g e

3.1 Implement above classes using preferred object oriented programming


language
Room reservation check in

FriendClassfrmReservation
Inherits System.Windows.Forms.Form

Dim daReservation AsNewOleDbDataAdapter()


Dim dsReservation AsNewDataSet()

Public State AsmodGlobal.FormState


Public ReservationNo AsString

Private IsInitializing AsBoolean


PrivateblnSavedAsBoolean

PrivateSub frmReservation_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) HandlesMyBase.Load
Dim cnHotel AsOleDbConnection

cnHotel = NewOleDbConnection

Try
17 | P a g e

With cnHotel
If .State = ConnectionState.Open Then .Close()

.ConnectionString = cnString
.Open()
EndWith
Catch ex AsOleDbException
MsgBox(ex.ToString)
EndTry

IsInitializing = True

FillCombobox(cboCountry, "SELECT * FROM Countries", "Countries", "Country", "CountryID")


FillCombobox(cboIDType, "SELECT * FROM [ID_Type]", "ID_Type", "IDType", "IDTypeID")
FillCombobox(cboRoomNumber, "SELECT * FROM qry_Available_Rooms", "qry_Available_Rooms",
"AvailableRoom", "RoomNumber")
FillCombobox(cboRateType, "SELECT RateTypeID, RateType FROM [Rate_Type]", "Rate_Type",
"RateType", "RateTypeID")
FillCombobox(cboBusinessSource, "SELECT * FROM [Business_Source]", "Business_Source",
"BusinessSource", "BusinessSourceID")
FillCombobox(cboVehicle, "SELECT * FROM [Vehicles]", "Vehicles", "Vehicle", "VehicleID")

cboVehicle.Text = ""

If State = modGlobal.FormState.adStateAddMode Then


dtpDateIn.Value = Today
dtpDateOut.Value = DateTime.Now.AddDays(1)

GeneratePK()

Dim sqlQRY AsString = "SELECT * FROM [Room_Rates] WHERE RoomNumber = "&


cboRoomNumber.SelectedValue &" AND RateTypeID = "& cboRateType.SelectedValue
Dim cmd AsOleDbCommand = NewOleDbCommand(sqlQRY, cnHotel)
Dim RecordCount AsInteger

RecordCount = CountRows("SELECT Count(*) FROM [Room_Rates]")

Try
Dim rdr AsOleDbDataReader = cmd.ExecuteReader
18 | P a g e

While (rdr.Read)
If RecordCount > 0 Then
txtRate.Text = rdr("RoomRate").ToString()
txtAdults.Text = rdr("NoofPerson").ToString()
hsAdults.Minimum = rdr("NoofPerson").ToString()
hsAdults.Value = rdr("NoofPerson").ToString()
txtAdults.Tag = rdr("ExtraAdultRate").ToString()
txtChildrens.Tag = rdr("ExtraChildRate").ToString()
EndIf
EndWhile

cboBusinessSource.SelectedValue = 2

Dim qryReservation AsString = "SELECT * FROM Reservation WHERE ReservationNo = '"&


ReservationNo &"'"

daReservation.SelectCommand = NewOleDbCommand(qryReservation, cnHotel)

Dim cb AsOleDbCommandBuilder = NewOleDbCommandBuilder(daReservation)

daReservation.Fill(dsReservation, "Reservation")
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()
EndTry

CallComputeRate()
ElseIf State = modGlobal.FormState.adStateEditMode Then
Dim sqlQRY As String = "SELECT * FROM [Room_Rates] WHERE Room Number = "&
cboRoomNumber.SelectedValue &" AND RateTypeID = "& cboRateType.SelectedValue
Dim cmd AsOleDbCommand = NewOleDbCommand(sqlQRY, cnHotel)
Dim Record Count As Integer

Record Count = Count Rows ("SELECT Count (*) FROM [Room Rates]")

Try
Dim rdr AsOleDbDataReader = cmd.ExecuteReader
19 | P a g e

While (rdr.Read)
If RecordCount > 0 Then
txtRate.Text = toMoney(rdr("RoomRate").ToString)
hsAdults.Minimum = rdr("NoofPerson").ToString
txtAdults.Tag = rdr("ExtraAdultRate").ToString
txtChildrens.Tag = rdr("ExtraChildRate").ToString
EndIf
EndWhile

Dim qryReservation AsString = "SELECT * FROM Reservation WHERE ReservationNo = '"&


ReservationNo &"'"

daReservation.SelectCommand = NewOleDbCommand(qryReservation, cnHotel)

Dim cb AsOleDbCommandBuilder = NewOleDbCommandBuilder(daReservation)

daReservation.Fill(dsReservation, "Reservation")

Dim dt AsDataTable = dsReservation.Tables("Reservation")

txtReservationNo.Text = dt.Rows(0)("ReservationNo")
txtLastName.Text = GetFieldValue("SELECT LastName FROM Customers WHERE
CustomerID = "& dt.Rows(0)("CustomerID"), "LastName")
txtFirstName.Text = GetFieldValue("SELECT FirstName FROM Customers WHERE
CustomerID = "& dt.Rows(0)("CustomerID"), "FirstName")
txtAddress.Text = dt.Rows(0)("Address")
cboCountry.SelectedValue = dt.Rows(0)("CountryID")
IfNotIsDBNull(dt.Rows(0)("CompanyID")) Then txtCompany.Text = GetFieldValue("SELECT
Company FROM Company WHERE CompanyID = "& dt.Rows(0)("CompanyID"), "Company")
cboIDType.SelectedValue = dt.Rows(0)("IDTypeID")
txtIDNumber.Text = dt.Rows(0)("IDNumber")
cboRoomNumber.SelectedValue = dt.Rows(0)("RoomNumber")
dtpDateIn.Value = dt.Rows(0)("DateIn")
If State = modGlobal.FormState.adStateAddMode Or State =
modGlobal.FormState.adStateEditMode Then
Ifdt.Rows(0)("DateOut") >= Today Then
dtpDateOut.Value = dt.Rows(0)("DateOut")
20 | P a g e

ElseIfdt.Rows(0)("DateIn") = Today Then


dtpDateOut.Value = dtpDateIn.Value.AddDays(1)
Else
dtpDateOut.Value = Today
EndIf

Else
dtpDateOut.Value = dt.Rows(0)("DateOut")
EndIf
cboRateType.SelectedValue = dt.Rows(0)("RateType")
txtRate.Text = toMoney(dt.Rows(0)("Rate"))
txtOtherCharges.Text = toMoney(dt.Rows(0)("OtherCharges"))
txtDiscount.Text = dt.Rows(0)("Discount")
txtAmountPaid.Text = toMoney(dt.Rows(0)("AmountPaid"))
txtAdults.Text = dt.Rows(0)("Adults")
txtChildrens.Text = dt.Rows(0)("Childrens")
txtDays.Text = dtpDateOut.Value.Subtract(dtpDateIn.Value).Days.ToString
' dtpDateOut.Value - dtpDateIn.Value 'dt.Rows(0)("Days")
cboBusinessSource.SelectedValue = dt.Rows(0)("BusinessSourceID")
cboVehicle.SelectedValue = dt.Rows(0)("VehicleID")
txtVehicleModel.Text = dt.Rows(0)("VehicleModel")
txtPlateNo.Text = dt.Rows(0)("PlateNo")
txtNotes.Text = dt.Rows(0)("Notes")

hsDays.Value = txtDays.Text
hsAdults.Value = txtAdults.Text
hsChildrens.Value = txtChildrens.Text

StatusBar1.Items.Item(1).Text = "Reserved By: "& GetFieldValue("SELECT UserID FROM Users


WHERE PK = "& dt.Rows(0)("ReservedBy"), "UserID")
StatusBar1.Items.Item(2).Text = "Cancelled By: "& GetFieldValue("SELECT UserID FROM Users
WHERE PK = "& dt.Rows(0)("CancelledBy"), "UserID")

btnCheckIn.Visible = True
btnPrint.Visible = True
btnCancel.Visible = True

'Call txtDays_TextChanged(sender, e)
21 | P a g e

CallComputeRate()
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()
EndTry
EndIf

IsInitializing = False
EndSub

'Procedure used to generate PK


PrivateSubGeneratePK()
ReservationNo = GetIndex("Reservation")
txtReservationNo.Text = GenerateID(CStr(ReservationNo), Format(Today, "yy") &"-",
"00000")
EndSub

PrivateSub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles btnCancel.Click
Me.Close()
EndSub

PrivateSub btnCheckIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles btnCheckIn.Click
If cboRoomNumber.Text = ""Then
MsgBox("Please select Room number.", MsgBoxStyle.Critical)

Exit Sub
EndIf

CallSaveRecord(sender, e)

If blnSaved = FalseThenExit Sub

Dim FolioNumber AsString


22 | P a g e

IfMsgBox("Are you sure?", MsgBoxStyle.YesNo + MsgBoxStyle.Information) = MsgBoxResult.Yes


Then

FolioNumber = CStr(GetIndex("Reservation"))
FolioNumber = GenerateID(FolioNumber, Format(Today, "yy") &"-", "00000")

ExecNonQuery("INSERT INTO Reservation ( FolioNumber, CustomerID, Address,


CountryID, CompanyID, IDTypeID, IDNumber, RoomNumber, DateIn, DateOut, RateType, Rate,
Days, Adults, Childrens, BusinessSourceID, VehicleID, VehicleModel, PlateNo, Status,
Notes, ReservedBy, CheckInBy, AddedByFK ) "&"SELECT '"& FolioNumber &"' AS Folio,
CustomerID, Address, CountryID, CompanyID, IDTypeID, IDNumber, "&
cboRoomNumber.SelectedValue &", DateIn, DateOut, RateType, Rate, Days, Adults, Childrens,
BusinessSourceID, VehicleID, VehicleModel, PlateNo, 'Check In' AS CheckIn,

Notes, ReservedBy, "& CurrUser.USER_PK &", "& CurrUser.USER_PK &" "&"FROM Reservation
"&"WHERE ReservationNo='"& txtReservationNo.Text &"'")

CallAddRatePerPeriod(FolioNumber)

ExecNonQuery("UPDATE Rooms SET RoomStatusID =2 WHERE RoomNumber = "&


cboRoomNumber.SelectedValue)
ExecNonQuery("UPDATE Reservation SET Status = 'Check In' WHERE ReservationNo = '"&
txtReservationNo.Text &"'")
ExecNonQuery("UPDATE [Inventory] SET Status = 'Check In', ID = '"& FolioNumber &"'
"&"WHERE ID= '"& txtReservationNo.Text &"' AND RoomNumber= "& cboRoomNumber.SelectedValue
&" AND Status='Reservation'")
EndIf
EndSub

PrivateSubComputeRate()
If txtAdults.Tag = ""ThenExit Sub

Dim intAdults AsShort

IfCDbl(txtAdults.Text) = hsAdults.Minimum Then


intAdults = 0
Else
intAdults = CShort(txtAdults.Text) - hsAdults.Minimum
EndIf
23 | P a g e

txtTotalCharges.Text = CStr((CDbl(toMoney(txtRate.Text)) *
toNumber(txtDays.Text)) + (CDbl(toMoney(txtAdults.Tag)) * intAdults) +
(CDbl(toMoney(txtChildrens.Tag)) * toNumber(txtChildrens.Text)))
txtTotalCharges.Text = toMoney(txtTotalCharges.Text)
txtSubTotal.Text = toMoney(CStr(toNumber(txtTotalCharges.Text) +
toNumber(txtOtherCharges.Text)))
txtTotal.Text = toMoney(CStr(toNumber(txtSubTotal.Text) -
(toNumber(txtSubTotal.Text) * toNumber(txtDiscount.Text) / 100)))
txtBalance.Text = toMoney(CStr(toNumber(txtTotal.Text) -
toNumber(txtAmountPaid.Text)))
EndSub

PublicSub dtpDateOut_ValueChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles dtpDateOut.ValueChanged
If dtpDateOut.Value <= dtpDateIn.Value Then
dtpDateOut.Value = dtpDateIn.Value.AddDays(1)

EndIf

txtDays.Text = dtpDateOut.Value.Subtract(dtpDateIn.Value).Days.ToString
hsDays.Value = txtDays.Text

CallComputeRate()
EndSub

PrivateSubSaveRecord(ByVal sender As System.Object, ByVal e As System.EventArgs)


Dim CustomerID AsShort
Dim CompanyID AsShort

IfTrim(txtLastName.Text) = ""Or Trim(txtFirstName.Text) = ""Then


MsgBox("Please complete the name of a guest.", MsgBoxStyle.Information)

Exit Sub
EndIf

CustomerID = GetFieldValue("SELECT CustomerID FROM Customers WHERE LastName = '"&


txtLastName.Text &"' AND FirstName = '"& txtFirstName.Text &"'", "CustomerID")
24 | P a g e

If CustomerID = 0 Then
CustomerID = GetIndex("Customers")

ExecNonQuery("INSERT INTO Customers (CustomerID, LastName, FirstName) Values ("&


CustomerID &", '"& txtLastName.Text &"', '"& txtFirstName.Text &"')")
EndIf

CompanyID = GetFieldValue("SELECT CompanyID FROM Company WHERE Company = '"&


txtCompany.Text &"' ", "CompanyID")
If CompanyID = 0 Then
If CompanyID = 0 Then
CompanyID = GetIndex("Company")

ExecNonQuery("INSERT INTO Company (CompanyID, Company) Values ("& CompanyID &", '"&
txtCompany.Text &"')")
EndIf
EndIf

Dim dt AsDataTable = dsReservation.Tables("Reservation")

If State = modGlobal.FormState.adStateAddMode Then


' add a row

newRow = dt.NewRow()
newRow("ReservationNo") = txtReservationNo.Text
newRow("Status") = "Reserved"
newRow("DateAdded") = Now()
'newRow("ReservedBy") = CurrUser.USER_PK
'newRow("AddedByFK") = CurrUser.USER_PK

dt.Rows.Add(newRow)
Else
dt.Rows(0)("DateModified") = Now
'dt.Rows(0)("LastUserFK") = CurrUser.USER_PK
EndIf

Withdt
.Rows(0)("CustomerID") = CustomerID
25 | P a g e

.Rows(0)("Address") = txtAddress.Text
.Rows(0)("CountryID") = cboCountry.SelectedValue
.Rows(0)("CompanyID") = CompanyID
.Rows(0)("IDTypeID") = cboIDType.SelectedValue
.Rows(0)("IDNumber") = txtIDNumber.Text
.Rows(0)("RoomNumber") = IIf(cboRoomNumber.Text = "", System.DBNull.Value,
cboRoomNumber.SelectedValue)
.Rows(0)("DateIn") = dtpDateIn.Value
.Rows(0)("DateOut") = dtpDateOut.Value
.Rows(0)("RateType") = cboRateType.SelectedValue
.Rows(0)("Rate") = txtRate.Text
.Rows(0)("OtherCharges") = txtOtherCharges.Text
.Rows(0)("Discount") = txtDiscount.Text
.Rows(0)("AmountPaid") = txtAmountPaid.Text
.Rows(0)("Days") = txtDays.Text
.Rows(0)("Adults") = txtAdults.Text
.Rows(0)("Childrens") = txtChildrens.Text
.Rows(0)("Total") = txtTotal.Text
.Rows(0)("BusinessSourceID") = cboBusinessSource.SelectedValue
.Rows(0)("VehicleID") = IIf(cboVehicle.Text = "", System.DBNull.Value,
cboVehicle.SelectedValue)
.Rows(0)("VehicleModel") = txtVehicleModel.Text
.Rows(0)("PlateNo") = txtPlateNo.Text
.Rows(0)("Notes") = txtNotes.Text

daReservation.Update(dsReservation, "Reservation")
EndWith

'Delete record from Inventory and add a new check in/out date
ExecNonQuery("DELETE ID, Status "&"From [Inventory] "&"WHERE ID='"& txtReservationNo.Text
&"' AND Status='Reservation'")

Dim dtpStartDate AsDate

dtpStartDate = dtpDateIn.Value

DoUntil dtpStartDate = Format(dtpDateOut.Value, "Short Date")


26 | P a g e

ExecNonQuery("INSERT INTO [Inventory] ( ID, RoomNumber, [Date], CustomerID, Status )


"&"VALUES ('"& txtReservationNo.Text &"', "& cboRoomNumber.SelectedValue &", #"&
dtpStartDate &"#, "& txtLastName.Tag &", 'Reservation')")

dtpStartDate = System.DateTime.FromOADate(dtpStartDate.ToOADate + 1)
Loop

blnSaved = True
EndSub

PrivateSub hsDays_ValueChanged(ByVal sender AsObject, ByVal e As System.EventArgs)


Handles hsDays.ValueChanged
dtpDateOut.Value = dtpDateIn.Value.AddDays(hsDays.Value.ToString)

txtDays.Text = hsDays.Value.ToString

CallComputeRate()
EndSub

PrivateSub hsAdults_ValueChanged(ByVal sender AsObject, ByVal e As System.EventArgs)


Handles hsAdults.ValueChanged
txtAdults.Text = hsAdults.Value.ToString

CallComputeRate()
EndSub

PrivateSub hsChildrens_ValueChanged(ByVal sender AsObject, ByVal e As System.EventArgs)


Handles hsChildrens.ValueChanged
txtChildrens.Text = hsChildrens.Value.ToString

CallComputeRate()
EndSub

PrivateSub btnLookupCust_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnLookupCust.Click
With frmCustomerLookup
.ShowDialog()
27 | P a g e

txtLastName.Text = CurrCust.Lastname
txtFirstName.Text = CurrCust.Firstname
EndWith
EndSub

PrivateSub btnLookupComp_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnLookupComp.Click
With frmCompanyLookup
.ShowDialog()

txtCompany.Text = CurrCust.Company
EndWith
EndSub

PrivateSub txtAmountPaid_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txtAmountPaid.TextChanged
txtBalance.Text = toMoney(CStr(toNumber(txtTotal.Text) -
toNumber(txtAmountPaid.Text)))
EndSub

PrivateSub dtpDateIn_ValueChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles dtpDateIn.ValueChanged
IfMe.IsInitializing = TrueThen
Exit Sub
Else
Call dtpDateOut_ValueChanged(sender, e)
EndIf
EndSub

PrivateSub txtDiscount_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txtDiscount.TextChanged
CallComputeRate()
EndSub

PrivateSubAddRatePerPeriod(ByRef FolioNumber AsString)


Dim tmpDate AsDate

tmpDate = dtpDateIn.Value
28 | P a g e

If txtAdults.Tag = ""ThenExit Sub

Dim intAdults AsShort

IfCDbl(txtAdults.Text) = hsAdults.Minimum Then


intAdults = 0
Else
intAdults = CShort(txtAdults.Text) - hsAdults.Minimum
EndIf

Dim qry AsString = "SELECT * FROM Rate_Per_Period WHERE FolioNumber = '"& FolioNumber &"'
ORDER BY DateIn"

Dim cnHotel AsOleDbConnection = NewOleDbConnection(cnString)

Try
Dim da AsNewOleDbDataAdapter()
da.SelectCommand = NewOleDbCommand(qry, cnHotel)

Dim cb AsOleDbCommandBuilder = NewOleDbCommandBuilder(da)

Dim ds AsNewDataSet()
da.Fill(ds, "Rate_Per_Period")

Dim dt AsDataTable = ds.Tables("Rate_Per_Period")

Dim newRow AsDataRow

DoUntil tmpDate >dtpDateOut.Value.AddDays(-1)


newRow = dt.NewRow()

newRow("FolioNumber") = FolioNumber
newRow("DateIn") = tmpDate
newRow("RoomNumber") = cboRoomNumber.SelectedValue
newRow("RateTypeID") = cboRateType.SelectedValue
newRow("Rate") = txtRate.Text
newRow("Adults") = CDbl(txtAdults.Tag) * intAdults
newRow("Childrens") = CDbl(toMoney(txtChildrens.Tag)) * toNumber(txtChildrens.Text)
29 | P a g e

dt.Rows.Add(newRow)

tmpDate = System.DateTime.FromOADate(tmpDate.ToOADate + 1)
Loop

da.Update(ds, "Rate_Per_Period")
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()
EndTry
EndSub

PrivateSub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles btnClose.Click
Me.Close()
EndSub

PrivateSub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles btnSave.Click
CallSaveRecord(sender, e)

If State = modGlobal.FormState.adStateAddMode And blnSaved = TrueThen


MsgBox("New record has been successfully saved.", MsgBoxStyle.Information)

'Me.Close()
ElseIf State = modGlobal.FormState.adStateEditMode And blnSaved = TrueThen
MsgBox("Changes in record has been successfully saved.", MsgBoxStyle.Information)

'Me.Close()
EndIf
EndSub

PrivateSub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles btnPrint.Click
With frmReports
.strReport = "Reservation"
30 | P a g e

.strWhere = "{qry_rpt_Reservation.ReservationNo} = '"& txtReservationNo.Text


&"'"

frmReports.ShowDialog()
EndWith
EndSub
EndClass

Room reservation check out

Option Strict Off


Option Explicit On

Imports System.Data.OleDb

PublicClassfrmCheckOut
Inherits System.Windows.Forms.Form

Dim daTransactions AsNewOleDbDataAdapter()


Dim dsTransactions AsNewDataSet()

Public RoomNumber AsShort


Public AmountPaid AsDecimal'Amount paid from frmPayment
31 | P a g e

Public OtherCharges AsDecimal


Public AutoCheckOut AsBoolean

PrivateSub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles btnCancel.Click
ExecNonQuery("DELETE FolioNumber "&"From [Rate Per Period] "&"WHERE FolioNumber='"&
txtGuestName.Tag &"'")

ExecNonQuery("INSERT INTO [Rate Per Period] "&"SELECT [Rate Per Period Temp].*
"&"FROM [Rate Per Period Temp] "&"Where ((([Rate Per Period Temp].FolioNumber) = '"&
txtGuestName.Tag &"')) "&"ORDER BY [Rate Per Period Temp].Date;")

Me.Close()
EndSub

PrivateSub cmdCheckOut_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles btnCheckOut.Click
If txtBalance.Text <>"0.00"Then
MsgBox("There's still remaining balance for this guest.", MsgBoxStyle.Exclamation)

Exit Sub
EndIf

IfMsgBox("Are you sure you want to Check Out?", MsgBoxStyle.YesNo +


MsgBoxStyle.Information) = MsgBoxResult.No ThenExit Sub

ExecNonQuery("UPDATE Rooms SET RoomStatusID =3 WHERE RoomNumber = "& txtRoomNumber.Text)

CallfrmPayments.SaveRecord()
CallfrmOtherCharges.SaveRecord()

Dim dt AsDataTable = dsTransactions.Tables("Transactions")

Withdt
'Delete record from Inventory
ExecNonQuery("DELETE ID, Status "&"From [Inventory] "&"WHERE ID='"&
.Rows(0)("FolioNumber") &"' AND Status='Check In'")

.Rows(0)("DateOut") = dtpDateOut.Value
32 | P a g e

.Rows(0)("OtherCharges") = txtOtherCharges.Text
.Rows(0)("Discount") = txtDiscount.Text
.Rows(0)("AmountPaid") = txtAmountPaid.Text
.Rows(0)("Days") = txtDays.Text
Debug.Print(.Rows(0)("Status"))

.Rows(0)("Status") = "Check Out"


Debug.Print(.Rows(0)("FolioNumber"))
'.Rows(0)("CheckOutBy") = CurrUser.USER_PK
daTransactions.Update(dsTransactions, "Transactions")
EndWith

CallPrintFolio()

Me.Close()
EndSub

PrivateSubPrintFolio()
'With frmReports
' .strReport = "Folio"

' .strWhere = "{qry_RPT_Customers.FolioNumber} = '" & txtGuestName.Tag & "' AND


{qry_RPT_Customers.Status} = 'Check Out'"

' frmReports.ShowDialog()
'End With
EndSub

PrivateSub dtpDateOut_Leave(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles dtpDateOut.Leave
IfCDate(dtpDateIn.Text) > dtpDateOut.Value Then
MsgBox("Check In date must be below check out date. Please enter another check out
date.",MsgBoxStyle.Information)

dtpDateOut.Focus()
EndIf
EndSub
33 | P a g e

PrivateSub frmCheckOut_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As


System.Windows.Forms.KeyPressEventArgs) HandlesMyBase.KeyPress
Dim KeyAscii AsShort = Asc(eventArgs.KeyChar)
If KeyAscii = 13 Then
System.Windows.Forms.SendKeys.Send("{TAB}")
EndIf
eventArgs.KeyChar = Chr(KeyAscii)
If KeyAscii = 0 Then
eventArgs.Handled = True
EndIf

EndSub

PrivateSub frmCheckOut_Load(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) HandlesMyBase.Load
Dim cnHotel AsOleDbConnection

cnHotel = NewOleDbConnection

Try
With cnHotel
If .State = ConnectionState.Open Then .Close()

.ConnectionString = cnString
.Open()
EndWith
Catch ex AsOleDbException
MsgBox(ex.ToString)
EndTry

FillCombobox(cboRateType, "SELECT * FROM Rate_Type", "Rate_Type", "RateType",


"RateTypeID")

txtRoomNumber.Text = CStr(RoomNumber)

dsTransactions.Clear()

Dim qryTransactions AsString = "SELECT * FROM Transactions WHERE RoomNumber = "&


RoomNumber &" AND Status = 'Check In'"
34 | P a g e

daTransactions.SelectCommand = NewOleDbCommand(qryTransactions, cnHotel)

Dim cb AsOleDbCommandBuilder = NewOleDbCommandBuilder(daTransactions)

daTransactions.Fill(dsTransactions, "Transactions")

Dim dt AsDataTable = dsTransactions.Tables("Transactions")

Try
txtGuestName.Tag = dt.Rows(0)("FolioNumber")
txtGuestName.Text = GetFieldValue("SELECT [Name] FROM qry_CheckIn WHERE
FolioNumber = '"& dt.Rows(0)("FolioNumber") &" '", "Name")
dtpDateIn.Text = dt.Rows(0)("DateIn")

If AutoCheckOut = TrueThen
Ifdt.Rows(0)("DateOut") >= Today Then
dtpDateOut.Value = dt.Rows(0)("DateOut")
Else
dtpDateOut.Value = Today
EndIf
Else
dtpDateOut.Value = dt.Rows(0)("DateOut")
EndIf
cboRateType.SelectedValue = dt.Rows(0)("RateType")
txtDays.Text = dtpDateOut.Value.Subtract(dtpDateIn.Text).Days.ToString
txtAdults.Text = dt.Rows(0)("Adults")
txtChildrens.Text = dt.Rows(0)("Childrens")
txtRate.Text = dt.Rows(0)("Rate")
txtOtherCharges.Text = toMoney(dt.Rows(0)("OtherCharges"))
txtDiscount.Text = toMoney(dt.Rows(0)("Discount"))
txtAmountPaid.Text = toMoney(dt.Rows(0)("AmountPaid"))
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()
EndTry

cboRateType.Enabled = False
35 | P a g e

CallComputeAddRate()
CallComputeRate()

ExecNonQuery("DELETE FolioNumber "&"From [Rate_Per_Period_Temp] "&"WHERE FolioNumber='"&


txtGuestName.Tag &"'")

ExecNonQuery("INSERT INTO [Rate_Per_Period_Temp] "&"SELECT [Rate_Per_Period].* "&"From


[Rate_Per_Period] "&"WHERE FolioNumber='"& txtGuestName.Tag &"'")
EndSub

PrivateSubComputeRate()
txtTotalCharges.Text = toMoney(CStr(ComputeRatePerPeriod()))
txtSubTotal.Text = toMoney(CStr(toNumber(txtTotalCharges.Text) +
toNumber(txtOtherCharges.Text)))
txtTotal.Text = toMoney(CStr(toNumber(txtSubTotal.Text) -
(toNumber(txtSubTotal.Text) * toNumber(txtDiscount.Text) / 100)))

txtBalance.Text = toMoney(CStr(toNumber(txtTotal.Text) -
toNumber(txtAmountPaid.Text)))
EndSub

'Compute additional rate (no. of days & childrens)


PrivateSubComputeAddRate()
Dim cnHotel AsOleDbConnection

cnHotel = NewOleDbConnection

Try
With cnHotel
If .State = ConnectionState.Open Then .Close()

.ConnectionString = cnString
.Open()
EndWith
Catch ex AsOleDbException
MsgBox(ex.ToString)
EndTry
36 | P a g e

Dim sqlQRY AsString = "SELECT * FROM [Room_Rates] WHERE RoomNumber = "& RoomNumber &" AND
RateTypeID = "& cboRateType.SelectedValue
Dim cmd AsOleDbCommand = NewOleDbCommand(sqlQRY, cnHotel)
Dim RecordCount AsInteger

RecordCount = CountRows("SELECT Count(*) FROM [Room_Rates]")

Try
Dim rdr AsOleDbDataReader = cmd.ExecuteReader

While (rdr.Read)
If RecordCount > 0 Then
txtRate.Text = toMoney(rdr("RoomRate"))
txtAdults.Tag = rdr("ExtraAdultRate")
txtChildrens.Tag = rdr("ExtraChildRate")
EndIf
EndWhile
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()

EndTry
EndSub

PrivateSub frmCheckOut_FormClosed(ByVal eventSender As System.Object, ByVal eventArgs As


System.Windows.Forms.FormClosedEventArgs) HandlesMe.FormClosed
frmPayments.Close()

frmPayments = Nothing
EndSub

PrivateSub lblAmountPaid_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles lblAmountPaid.Click
With frmPayments
.FolioNumber = txtGuestName.Tag
.GuestName = txtGuestName.Text
.Balance = CDec(txtBalance.Text)
.RefreshBalance()
37 | P a g e

.RefForm = Me.Name

.ShowDialog()

txtAmountPaid.Text = toMoney(CStr(AmountPaid))
EndWith
EndSub

PrivateFunctionComputeRatePerPeriod() AsDecimal
Dim cnHotel AsOleDbConnection
cnHotel = NewOleDbConnection

Dim sqlQRY AsString = "SELECT * FROM [Rate_Per_Period] WHERE FolioNumber = '"&


txtGuestName.Tag &"'"

Try
With cnHotel
If .State = ConnectionState.Open Then .Close()

.ConnectionString = cnString
.Open()
EndWith

Dim cmd AsOleDbCommand = NewOleDbCommand(sqlQRY, cnHotel)

Dim rdr AsOleDbDataReader = cmd.ExecuteReader

While (rdr.Read)
ComputeRatePerPeriod = ComputeRatePerPeriod + CDbl(toMoney(rdr("Rate")))
+ CDbl(toMoney(rdr("Adults"))) + CDbl(toMoney(rdr("Childrens")))
EndWhile
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()
EndTry
EndFunction
38 | P a g e

PrivateSub lblOtherCharges_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles lblOtherCharges.Click
With frmOtherCharges
.FolioNumber = txtGuestName.Tag
.GuestName = txtGuestName.Text

.RefForm = Me.Name

.ShowDialog()

txtOtherCharges.Text = toMoney(CStr(OtherCharges))
EndWith
EndSub

PrivateSub lblRatePerPeriod_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles lblRatePerPeriod.Click
With frmRatePerPeriod
.FolioNumber = txtGuestName.Tag

.ShowDialog()

CallComputeRate()
EndWith
EndSub

PrivateSub txtAmountPaid_TextChanged(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles txtAmountPaid.TextChanged

txtBalance.Text = toMoney(toNumber(txtTotal.Text) - toNumber(txtAmountPaid.Text))


EndSub

PrivateSub txtDays_TextChanged(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles txtDays.TextChanged
Dim tmpDate AsDate
Dim minNoofPerson AsShort

tmpDate = CDate(dtpDateIn.Text)
39 | P a g e

If txtAdults.Tag.ToString = ""ThenExit Sub

ExecNonQuery("DELETE [Date] "&"FROM [Rate Per Period] "&"WHERE [DateIn]>#"&


dtpDateOut.Value.AddDays(-1) &"#")

Dim intAdults AsShort

minNoofPerson = CShort(GetFieldValue("SELECT * FROM [Room_Rates] WHERE RoomNumber = "&


RoomNumber &" AND RateTypeID = "& cboRateType.SelectedValue, "NoofPerson"))

IfCDbl(txtAdults.Text) = minNoofPerson Then


intAdults = 0
Else
intAdults = CShort(txtAdults.Text) - minNoofPerson
EndIf

Dim qry AsString = "SELECT * FROM Rate_Per_Period WHERE FolioNumber = '"&


txtGuestName.Tag &"' ORDER BY DateIn"

Dim cnHotel AsOleDbConnection = NewOleDbConnection(cnString)

Try
Dim da AsNewOleDbDataAdapter()
da.SelectCommand = NewOleDbCommand(qry, cnHotel)

Dim cb AsOleDbCommandBuilder = NewOleDbCommandBuilder(da)

Dim ds AsNewDataSet()
da.Fill(ds, "Rate_Per_Period")

Dim dt AsDataTable = ds.Tables("Rate_Per_Period")

Dim newRow AsDataRow

DoUntil tmpDate >dtpDateOut.Value.AddDays(-1)


Dim rows AsDataRow() = dt.Select("[DateIn] = #"& tmpDate &"#")
If rows.Count = 0 Then
newRow = dt.NewRow()
40 | P a g e

newRow("FolioNumber") = txtGuestName.Tag
newRow("DateIn") = tmpDate
newRow("RoomNumber") = txtRoomNumber.Text
newRow("RateTypeID") = cboRateType.SelectedValue
newRow("Rate") = txtRate.Text
newRow("Adults") = CDbl(txtAdults.Tag) * intAdults
newRow("Childrens") = CDbl(toMoney(txtChildrens.Tag)) * toNumber(txtChildrens.Text)

dt.Rows.Add(newRow)
EndIf
tmpDate = System.DateTime.FromOADate(tmpDate.ToOADate + 1)
Loop

da.Update(ds, "Rate_Per_Period")
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()
EndTry
EndSub

PrivateSub dtpDateOut_ValueChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles dtpDateOut.ValueChanged
txtDays.Text = CStr(System.DateTime.FromOADate(dtpDateOut.Value.ToOADate -
CDate(dtpDateIn.Text).ToOADate))

CallComputeRate()
EndSub
EndClass
41 | P a g e

Payments Info

PublicClassfrmPayments
Public FolioNumber AsString
Public GuestName AsString
Public Balance AsDouble
Public RefForm AsString

Dim AmountPaid AsDouble

PublicSubSaveRecord()
Me.Validate()
Me.PaymentsBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.HotelDataSet)

Me.Close()
EndSub

PrivateSub frmPayments_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


HandlesMyBase.Load
Me.Payment_TypeTableAdapter.Fill(Me.HotelDataSet.Payment_Type)
Me.PaymentsTableAdapter.FillBy(Me.HotelDataSet.Payments, FolioNumber)

txtTotal.Text = Total().ToString("c")
42 | P a g e

EndSub

PrivateSub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles btnClose.Click
Me.Hide()

If RefForm = "frmCheckIn"Then
frmCheckIn.AmountPaid = txtTotal.Text
Else
frmCheckOut.AmountPaid = txtTotal.Text
EndIf
EndSub

PublicSubRefreshBalance()
EndSub

PrivateSub PaymentsDataGridView_CellValueChanged(ByVal sender AsObject, ByVal e As


System.Windows.Forms.DataGridViewCellEventArgs) Handles
PaymentsDataGridView.CellValueChanged
If e.ColumnIndex = 6 And PaymentsDataGridView.Rows.Count > 0 Then
txtTotal.Text = Total().ToString("c")
EndIf
EndSub

PrivateSub PaymentsDataGridView_DefaultValuesNeeded(ByVal sender AsObject, ByVal e As


System.Windows.Forms.DataGridViewRowEventArgs) Handles
PaymentsDataGridView.DefaultValuesNeeded
With e.Row
.Cells(0).Value = FolioNumber
EndWith
EndSub

PrivateFunctionTotal() AsDouble
Dim tot AsDouble = 0
Dim i AsInteger = 0

For i = 0 To PaymentsDataGridView.Rows.Count - 1
tot = tot + Convert.ToDouble(PaymentsDataGridView.Rows(i).Cells("Amount").Value)
43 | P a g e

Next i

Return tot
EndFunction
EndClass

Room info change room

PublicClassfrmChangeRoom
Dim sSql AsString

PrivateSub frmChangeRoom_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


HandlesMyBase.Load
dtpStartDate.Value = Today

sSql = "SELECT RoomNumber, RoomType, Status FROM qry_Rooms_Window ORDER BY RoomNumber


ASC"

CallFillList()
EndSub

PublicSubFillList()
With lvList
.Clear()
44 | P a g e

.View = View.Details
.FullRowSelect = True
.GridLines = True
.Columns.Add("Room Number", 90)
.Columns.Add("Room Type", 120)
.Columns.Add("Status", 90)

FillListView(lvList, GetData(sSql))
EndWith
EndSub

PrivateSub CmdChangeRoom_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles CmdChangeRoom.Click
With frmCheckIn
If dtpStartDate.Value < .dtpDateIn.Value Then
MsgBox("Start date must be higher than the 'Date In' from Check in form",
MsgBoxStyle.Information)

Exit Sub
EndIf

If dtpStartDate.Value > .dtpDateOut.Value Then


.dtpDateOut.Value = dtpStartDate.Value
ElseIf dtpStartDate.Value = .dtpDateOut.Value Then
.dtpDateOut.Value = dtpStartDate.Value.AddDays(1)
EndIf

.txtRoomNumber.Text = txtTo.Text
.txtRate.Text = toMoney(GetFieldValue("SELECT RoomRate FROM [Room_Rates]
WHERE RoomNumber = "& .txtRoomNumber.Text &" AND RateTypeID = "&
.cboRateType.SelectedValue, "RoomRate"))

Call .dtpDateOut_ValueChanged(sender, e)

.blnChangeRoom = True
Me.Close()
EndWith
EndSub
45 | P a g e

PrivateSub CmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles CmdCancel.Click
Me.Close()
EndSub

PrivateSub lvList_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles


lvList.Click
ForEach sItem As ListViewItem In lvList.SelectedItems
txtTo.Text = sItem.Text
Next
EndSub

EndClass

Room info room status

PublicClassfrmRoomStatus

PrivateSub Room_StatusBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles Room_StatusBindingNavigatorSaveItem.Click
Me.Validate()
Me.Room_StatusBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.HotelDataSet)
46 | P a g e

EndSub

PrivateSub frmRoomStatus_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


HandlesMyBase.Load
Me.Room_StatusTableAdapter.Fill(Me.HotelDataSet.Room_Status)

EndSub
EndClass

Company/Hotel Information

PublicClassfrmCompany

PrivateSub CompanyBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles CompanyBindingNavigatorSaveItem.Click
Me.Validate()
Me.CompanyBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.HotelDataSet)

EndSub
47 | P a g e

PrivateSub frmCompany_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


HandlesMyBase.Load
Me.CompanyTableAdapter.Fill(Me.HotelDataSet.Company)

EndSub
EndClass

Payment details

PublicClassfrmAccountReceivableList
Dim sSql AsString

PrivateSub frmAccountReceivableList_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) HandlesMyBase.Load
sSql = "SELECT AccRecID,Company,FolioNumber,Total,AmountPaid,Balance FROM
qry_Account_Receivable ORDER BY Company ASC"

CallFillList()
EndSub

PrivateSub lvList_DoubleClick(ByVal sender AsObject, ByVal e As System.EventArgs) Handles


lvList.DoubleClick
48 | P a g e

With frmCheckIn
.State = modGlobal.FormState.adStatePopupMode
.FolioNumber = lvList.SelectedItems(0).Text

.ShowDialog()

CallFillList()
EndWith

frmCheckIn = Nothing
EndSub

PrivateSub frmAccountReceivableList_Resize(ByVal sender AsObject, ByVal e As


System.EventArgs) HandlesMe.Resize
IfMe.WindowState <>FormWindowState.Minimized Then
IfMe.Width < 550 ThenMe.Width = 550
IfMe.Height < 250 ThenMe.Height = 250

lvList.Height = Me.Height - 96
lvList.Width = Me.Width - 10
EndIf
EndSub

PublicSubFillList()
With lvList
.Clear()

.View = View.Details
.FullRowSelect = True
.GridLines = True
.Columns.Add("AccRecID", 90)
.Columns.Add("Company", 130)
.Columns.Add("FolioNumber", 90, HorizontalAlignment.Right)
.Columns.Add("Total", 100, HorizontalAlignment.Right)
.Columns.Add("AmountPaid", 100, HorizontalAlignment.Right)
.Columns.Add("Balance", 100, HorizontalAlignment.Right)

FillListView(lvList, GetData(sSql))
49 | P a g e

EndWith
EndSub
EndClass

Vehicle info

PublicClassfrmVehicles

PrivateSub VehiclesBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles VehiclesBindingNavigatorSaveItem.Click
Me.Validate()
Me.VehiclesBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.HotelDataSet)

EndSub

PrivateSub frmVehicles_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


HandlesMyBase.Load
Me.VehiclesTableAdapter.Fill(Me.HotelDataSet.Vehicles)

EndSub
EndClass
50 | P a g e

3.2 Implement a client class with a main (), that calls operations in the Systems Manger class.

Implementation of main class

Imports System.Windows.Forms

PublicClassmdiMain
PrivateblnActiveAsBoolean

PrivateFunctionIsOpen(ByVal nameForm AsString) AsBoolean


Dim childfrm AsForm
Dim strName AsString
Dim intLastIndex AsInteger

ForEach childfrm InMe.MdiChildren


strName = childfrm.GetType.ToString
intLastIndex = strName.LastIndexOf(".")
strName = Mid(strName, intLastIndex + 2, Len(strName) - intLastIndex)
IfLCase(strName) = LCase(nameForm) Then
childfrm.BringToFront()
ReturnTrue
51 | P a g e

EndIf
Next
ReturnFalse

'If nameForm.Visible Then


' nameForm.Focus()
' Return True
'End If
'Return False
EndFunction

PrivateSubShowNewForm(ByVal sender AsObject, ByVal e AsEventArgs) Handles


NewToolStripButton.Click, NewWindowToolStripMenuItem.Click
Dim ChildForm AsNew System.Windows.Forms.Form
ChildForm.MdiParent = Me

m_ChildFormNumber += 1
ChildForm.Text = "Window "& m_ChildFormNumber

ChildForm.Show()
EndSub

PrivateSub ExitToolsStripMenuItem_Click(ByVal sender AsObject, ByVal e AsEventArgs)


Handles ExitToolStripMenuItem.Click
Me.Close()
EndSub

PrivateSub CutToolStripMenuItem_Click(ByVal sender AsObject, ByVal e AsEventArgs)


EndSub

PrivateSub CopyToolStripMenuItem_Click(ByVal sender AsObject, ByVal e AsEventArgs)


EndSub

PrivateSub PasteToolStripMenuItem_Click(ByVal sender AsObject, ByVal e AsEventArgs)


EndSub

Privatem_ChildFormNumberAsInteger
52 | P a g e

PrivateSub mnuGuests_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles mnuGuests.Click
If blnActive = IsOpen("frmGuest") Then
Dim Guest AsNewfrmGuest

'Guest.MdiParent = Me
Guest.StartPosition = FormStartPosition.CenterScreen
Guest.ShowDialog()
EndIf
EndSub

PrivateSub mnuCompany_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles mnuCompany.Click
If blnActive = IsOpen("frmCompany") Then
Dim Company AsNewfrmCompany

'Company.MdiParent = Me
Company.StartPosition = FormStartPosition.CenterScreen
Company.ShowDialog()
EndIf
EndSub

PrivateSub frmBusinessSource_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles frmBusinessSource.Click
If blnActive = IsOpen("frmBusinessSource") Then
Dim BusinessSource AsNewfrmBusinessSource

'BusinessSource.MdiParent = Me
BusinessSource.StartPosition = FormStartPosition.CenterScreen
BusinessSource.ShowDialog()
EndIf
EndSub

PrivateSub frmChargeType_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles frmChargeType.Click
If blnActive = IsOpen("frmChargeType") Then
Dim ChargeType AsNewfrmChargeType
53 | P a g e

'ChargeType.MdiParent = Me
ChargeType.StartPosition = FormStartPosition.CenterScreen
ChargeType.ShowDialog()
EndIf
EndSub

PrivateSub frmCountries_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles frmCountries.Click
If blnActive = IsOpen("frmCountries") Then
Dim Countries AsNewfrmCountries

'Countries.MdiParent = Me
Countries.StartPosition = FormStartPosition.CenterScreen
Countries.ShowDialog()
EndIf
EndSub

PrivateSub frmIDType_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles frmIDType.Click
If blnActive = IsOpen("frmIDType") Then
Dim IDType AsNewfrmIDType

'IDType.MdiParent = Me
IDType.StartPosition = FormStartPosition.CenterScreen
IDType.ShowDialog()
EndIf

EndSub

PrivateSub frmPaymentType_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles frmPaymentType.Click
If blnActive = IsOpen("frmPaymentType") Then
Dim PaymentType AsNewfrmPaymentType

'PaymentType.MdiParent = Me
PaymentType.StartPosition = FormStartPosition.CenterScreen
PaymentType.ShowDialog()
EndIf
54 | P a g e

EndSub

PrivateSub frmRateType_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles frmRateType.Click
If blnActive = IsOpen("frmRateType") Then
Dim RateType AsNewfrmRateType

'RateType.MdiParent = Me
RateType.StartPosition = FormStartPosition.CenterScreen
RateType.ShowDialog()
EndIf
EndSub

PrivateSub frmRoomStatus_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles frmRoomStatus.Click
If blnActive = IsOpen("frmRoomStatus") Then
Dim RoomStatus AsNewfrmRoomStatus

'RoomStatus.MdiParent = Me
RoomStatus.StartPosition = FormStartPosition.CenterScreen
RoomStatus.ShowDialog()
EndIf
EndSub

PrivateSub frmRoomType_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles frmRoomType.Click
If blnActive = IsOpen("frmRoomType") Then
Dim RoomType AsNewfrmRoomType

RoomType.StartPosition = FormStartPosition.CenterScreen
RoomType.ShowDialog()
55 | P a g e

EndIf
EndSub

PrivateSub frmVehicles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles frmVehicles.Click
If blnActive = IsOpen("frmVehicles") Then
Dim Vehicles AsNewfrmVehicles

'Vehicles.MdiParent = Me
Vehicles.StartPosition = FormStartPosition.CenterScreen
Vehicles.ShowDialog()
EndIf
EndSub

PrivateSub mnuAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles mnuAbout.Click
If blnActive = IsOpen("frmAbout") Then
DimAbout AsNewfrmAbout

'About.MdiParent = Me
About.StartPosition = FormStartPosition.CenterScreen
About.ShowDialog()
EndIf
EndSub

PrivateSub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles ToolStripMenuItem3.Click
If blnActive = IsOpen("frmCheckInHistory") Then
Dim CheckInHistory AsNewfrmCheckInHistory

CheckInHistory.MdiParent = Me
CheckInHistory.StartPosition = FormStartPosition.CenterScreen
CheckInHistory.Show()
EndIf
EndSub

PrivateSub mnuRoomWindow_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles mnuRoomWindow.Click
If blnActive = IsOpen("frmRoomWindow") Then
56 | P a g e

Dim RoomWindow AsNewfrmRoomWindow

RoomWindow.MdiParent = Me

RoomWindow.StartPosition = FormStartPosition.CenterScreen
RoomWindow.Show()
EndIf
EndSub

PrivateSub mnuReservations_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles mnuReservations.Click
If blnActive = IsOpen("frmReservationList") Then
Dim ReservationList AsNewfrmReservationList

ReservationList.MdiParent = Me
ReservationList.StartPosition = FormStartPosition.CenterScreen
ReservationList.Show()
EndIf
EndSub

PrivateSub mnuInventoryView_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles mnuInventoryView.Click
If blnActive = IsOpen("frmInventoryView") Then
Dim InventoryView AsNewfrmInventoryView

InventoryView.MdiParent = Me
InventoryView.StartPosition = FormStartPosition.CenterScreen
InventoryView.Show()
EndIf
EndSub

PrivateSub mdiMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


HandlesMyBase.Load
frmLogin.Close()

If blnActive = IsOpen("frmRoomWindow") Then


Dim RoomWindow AsNewfrmRoomWindow
57 | P a g e

RoomWindow.MdiParent = Me
RoomWindow.StartPosition = FormStartPosition.CenterScreen
RoomWindow.Show()
RoomWindow.WindowState = FormWindowState.Maximized
EndIf
EndSub

PrivateSub AccountReceivablesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles AccountReceivablesToolStripMenuItem.Click
If blnActive = IsOpen("frmAccountReceivableList") Then
Dim AccountReceivableList AsNewfrmAccountReceivableList

AccountReceivableList.MdiParent = Me
AccountReceivableList.StartPosition = FormStartPosition.CenterScreen
AccountReceivableList.Show()
AccountReceivableList.WindowState = FormWindowState.Maximized
EndIf
EndSub

PrivateSub mnuRPTAccRec_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles mnuRPTAccRec.Click
frmRPTAccRec.ShowDialog()
EndSub

PrivateSub mnuRPTOtherCharges_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles mnuRPTOtherCharges.Click
frmRPTOtherCharges.ShowDialog()
EndSub

PrivateSub mnuRPTCheckedInGuest_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles mnuRPTCheckedInGuest.Click
With frmReports
.strReport = "CheckIn Guest"

frmReports.ShowDialog()
EndWith
EndSub
58 | P a g e

PrivateSub mnuRPTCheckOut_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles mnuRPTCheckOut.Click
frmRPTCheckOut.ShowDialog()
EndSub

PrivateSub mnuDueReservation_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles mnuDueReservation.Click
frmRPTDueReservation.ShowDialog()
EndSub

PrivateSub mnuRPTGuestList_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles mnuRPTGuestList.Click
With frmReports
.strReport = "Guest List"

frmReports.ShowDialog()
EndWith
EndSub

PrivateSub mnuRPTRoomHistory_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles mnuRPTRoomHistory.Click
frmRPTRoomHistory.ShowDialog()
EndSub
EndClass
59 | P a g e

Task 04
4.1 Test implemented object oriented solution by using test mechanisms (valid declarations,
debugging code, and comment code) and types (range testing, input testing, load testing, and
system compatibility).

Testing mechanisms
Testing is any activity aimed at evaluating an attribute or capability of a program or system and
determining that it meets its required results.The development process of Hotel Management System
involved various types of testing. Each test type addresses a specific testing requirement.

In order to deliver a good product I have used following testing techniques in the product.

• System compatibility testing


• Unit testing
• Integration testing
• Load testing
• Installation testing

System compatibility testing

 It is a type of non-functional testing which is used to ensure compatibility of the


system/application/website built with various other objects such as other web browsers,
hardware platforms, users (in case if it’s very specific type of requirement, such as a user who
speaks and can read only a particular language), operating systems etc.

 This type of testing helps find out how well a system performs in a particular environment that
includes hardware, network, operating system and other software etc. Thus I have used this
basically for testing of the application or the product built with the computing environment. It
aided me in testing whether the application or the software product built is compatible with the
hardware, operating system, database or other system software or no

Unit testing

 The primary goal of unit testing is to take the smallest piece of testable software in the
application, isolate it from the remainder of the code, and determine whether it
behaves exactly as you expect. Each unit is tested separately before integrating them
into modules to test the interfaces between modules. Unit testing has proven its value
in that a large percentage of defects are identified during its use.
60 | P a g e

 I have used the most common approach to unit testing which requires drivers and stubs
to be written. The driver simulates a calling unit and the stub simulates a called unit. The
investment of developer time in this activity sometimes results in demoting unit testing
to a lower level of priority and that is almost always a mistake. It allows for automation
of the testing process, reduces difficulties of discovering errors contained in more
complex pieces of the application, and test coverage is often enhanced because
attention is given to each unit.

 In this system I have defined primary artifacts (use cases). If the user agreed with those
artifacts, then it was going through the testing (unit testing) process. Coding & testing
are carried out in parallel. This is done to determine if individual modules/units meet
their specifications and if they are correctly coded & that it carries out the functions it is
supposed to carry out.As the developer of this system I have to carry out the unit
testing. It was very easy task for me because I was the person who is responsible for
programming & also testing. But this has some bad effects. If the programmer is the
tester of the system, some bugs could not be uncovered. If the tester is an individual
person, he can see some aspects which the programmer cannot see. But the difficult
thing is an independent tester should have learned the system entirely.

Integration testing

 Integration testing is a logical extension of unit testing. In its simplest form, two
units that have already been tested are combined into a component and the
interface between them is tested. A component, in this sense, refers to an
integrated aggregate of more than one unit. In my scenario, many units are
combined into components, which are in turn aggregated into even larger parts
of the program. Eventually all the modules making up a process are tested
together.

 Integration testing identifies problems that occur when units are combined. By
this I have known that any errors discovered when combining units are likely
related to the interface between units. This method reduces the number of
possibilities to a far simpler level of analysis.

Load testing

 Load testing is performed to determine a system’s behavior under both normal


and at peak conditions. This helps me to identify the maximum operating
capacity of an application as well as any bottlenecks and determine which
element is causing degradation.
61 | P a g e

The primary goal of load testing is to define the maximum amount of work a system can
handle without significant performance degradation. I have used the method writing
and reading data to and from a hard disk continuously to check this on Hotel
Management system.

Installation testing

 Finally this testing was carried out not to find software errors but to find
installation errors. When the system was installed, files were created, the
hardware is configured, and the program itself may have to interconnect with
an operating system.

 When the hardware was configuring some configuration errors were appeared.
At that time I had to take assistance from the technician.

Apart from this I have

 Made sure all variables are initialized before use.


 Initialized constants in the DATA DIVISION; initialize variableswith executable code.
 Watched for off-by-one errors.
 Tested programs at their boundary values.
 Programed defensively.

4.2 Error handling during software testing and give a feedback to improve the developed object oriented
solution. (Provide Suitable Screenshots)

Error handling during testing

 Error handling refers to the anticipation, detection, and resolution of programming, application,
and communications errors. Specialized programs, called error handlers, are available for some
applications.In programming, a development error is one that can be prevented. Such an error
can occur in syntax or logic. Syntax errors, which are typographical mistakes or improper use of
special characters, are handled by rigorous proofreading. Logic errors, also called bugs, occur
when executed code does not produce the expected or desired result. Logic errors are best
handled by meticulous program debugging. This can be an ongoing process that involves, in
addition to the traditional debugging routine, beta testing prior to official release and customer
feedback after official release.

 A run-time error takes place during the execution of a program, and usually happens because of
adverse system parameters or invalid input data. An example is the lack of sufficient memory to
run an application or a memory conflict with another program. On the Internet, run-time errors
can result from electrical noise, various forms of malware or an exceptionally heavy demand on
62 | P a g e

a server. Run-time errors can be resolved, or their impact minimized, by the use of error handler
programs, by vigilance on the part of network and server administrators, and by reasonable
security countermeasures on the part of Internet users.

Methods followed during error handling testing on Hotel Management System

 Before proceeding I have identified each test case uniquely and explicitly associated with the
class to be tested

A list of testing steps should be developed for each test and should contain:

 a list of specified states for the object that is to be tested


 a list of messages and operations that will be exercised as a consequence of the test
 a list of exceptions that may occur as the object is tested
 a list of external conditions (i.e., changes in the environment external
 to the software that must exist in order to properly conduct the test)
 Supplementary information that will aid in understanding or implementing the test.

There are two methods of test case design I have used for error handling testing approach, they
are;

 Black box
 White box

Black box uses specifications to produce test cases (functional testing). White box
testing uses the internal logical structure of a module to produce test cases.

Test cases using black box approach


63 | P a g e

Equivalence Classes

Case1 user ID = numeric invalid

Case2 user ID = character valid

Case3 Password = numeric (predefined) valid

Case4 Password =character (predefined) valid

Values
From Case1 ex: Admin, admin

From Case2 ex: User, 123

Test no User ID Password size Expected Comment


Result

T1 Admin admin 6 Admin User C2,C4

T2 User 123 3 Login failed C2,C3


64 | P a g e

Error handlingtest strategy with detail test plans and usability tests

Interface User

Login Administrator of the Hotelshould use this login and check whether
it is having enough restriction.

Menu Administrator of the Hotel should use this form and check whether
it is linking to the current interface or not.

Room Details Administrators of the Hotelshould use this Interface when dealing
with rooms’ details as well as adding new information so they have
to check the functionality of this interface.

Payments Details Administrator is using this interface and normally he/she should
use this part to add payment details.

Reports Normally users of the Hotel are using this Interface when dealing
with Hotel details, so they have to check the functionality of this
interface.

Test cases for each testing with sample data

Test Data Steps


65 | P a g e

Login User name= {Valid username, invalid visit Login interface


username, empty}
enter username
password = {valid, invalid, empty}
enter password

click login

see menu interface

if it is invalid a pop up message


will be displayed.

Menu Correct functioning of buttons visit menu interface

click the relevant button that


wanted to see

getting the relevant inter face

Records Correct functioning of buttons and visit records interface


ability to SERACH, ADD, DELETE,
enter clubid
UPDATE details
see the details

or

if there is not such a record


,enter the new record
66 | P a g e

add new record and delete

Monitoring Correct functioning of buttons and visit monitoring interface


ability to SERACH, ADD, DELETE,
see the details
UPDATE details
or

if there is not such a record


,enter the new record

add new record and delete

Reports Correct functioning of reports with visit reports interface


correct details
see the details

check the reports

 The test data should include the minimum & maximum values of all data items (which
should be acceptable)

 Minimum minus one, maximum plus one (which should be rejected)

 The system should only accept valid and specified data. All other data should be
reported and rejected, or totally ignored. Not only invalid inputs, but also illegal inputs
should be rejected.

Validation & Verification in error handling


67 | P a g e

This is a checking process which ensures that the software meets its requirements & that the
requirements meet the needs of the customer.

This V & V process has two objectives;

 The discovery of defects in the system


 The assessment of whether or not the system is usable in an operational situation.

Verification refers to the set of activities that ensure that a product emerging from any phase of
the software engineering process (ex: a program) meets its specification.

Ex: unit/module testing (to ensure that it conforms to its specification)

Validation refers to a different set of activities that ensure that the phase product which has been
built is traceable to customer requirements. (It satisfies customer requirements)

Ex: acceptance testing (users check whether the system satisfies their needs)

Reviews are a special kind of verification technique. Reviews are organized manual approaches
to checking and analyzing software (ex: code, design specification, requirement specification,
etc.)

There are two broad classes of review; inspections and walkthroughs.

In a walkthrough, I used reselected test data to simulate execution of the analyzed program
(code, design, etc.)

In an inspection I have used a checklist of faults/errors to determine whether they occur in the
analyzed program (ex: code, design, etc.)

Privilage access to admin users only


68 | P a g e

A scalable and secure solution to authenticate users has been given through this which aids in
error handling. This is a decision on what access privilege to grant to the users based on various
user and security attributes.

4.3 Include simple help menu to assist clients.

Inclusion of help menus

 It seems that developing a good Help system is as important a part of software


development as coding. Thus few helping menus and options have been implemented
on Hotel Management system, in order to aid users with their day-to-day tasks.

 Deditaced help menu has been created with index and search options to naviagate
through system
69 | P a g e

Dedicated windows options have been created in order to aid in viewing according to the user
preference

Reports to generate results easily have been created to assit users.


70 | P a g e

4.4 Create technical documentation to include designs, delivery system, platform, environment,
file structures, coding, constraints, and maintenance requirements.

Hardware cost

Numbers of units to be bought are 4 PC computers and 1 server.

Processor PC with a Pentium IV-class processor, 900 MHz

RAM Windows 7 Professional; Windows 2010 Server — ;

Windows 7 Home; Windows 7 Professional & Windows Server 2010

Available Hard 500GB on system drive,


Disk Space

CD-ROM Drive or Required


DVD-ROM

Video 1024 x 900,


Recommended: High Color 64-bit
71 | P a g e

Mouse Microsoft Mouse or compatible pointing device

Hardware Cost

Item

server with all the components Rs: 400,000

Software Cost

Cost for Networking Rs:48,500

The quotations of the software are shown below

 Windows 7
 Visual Basic .Net 2010
 SQL 2010 Server
 Crystal Reports

The Total Software cost Rs.255, 000

The essential software can be taken with the hardware, in free of charge or can be obtained
from the specific web sites.
72 | P a g e

System Analysis and Designing Rates

Task

Rates (per man-day)

System analysis and Designing Cost Rs.54, 000

System analysis & designing rates

Training rates

Type of training Rate (per man-day)

User training Rs.18, 000

Administrator training Rs.23, 000

Training rates

Summary of the total cost

Item Cost

Hardware Cost Rs.400,000

Cost for laying Networking Rs:4 8,500

Software Cost Rs.255,000

System Analysis and designing Cost Rs.54, 000

Training Cost Rs.41, 000

Overall Total Cost Rs1,213,500

Summary of the total cost


73 | P a g e

References

Websites

1. http://objectplus.blogspot.com/2011/02/basic-characteristics-of-oop.html

2. http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-
object-oriented-programming/

3. http://www.differencebetween.net/technology/difference-between-class-and-
object/

Вам также может понравиться