Draft Recovered

Embed Size (px)

Citation preview

  • 7/29/2019 Draft Recovered

    1/43

    Bangalore 560 029

    Resort Management System

    (Draft)

    Sept 02, 2009 Submitted By

    Arun Joseph PPreetiranjan

    1. INTODUCTION

  • 7/29/2019 Draft Recovered

    2/43

    Existing SystemThe system which is being used in the resort in is not completely automated. They still rel

    on registers and other papers to allocate rooms and prepare bills for the customers. Lots

    paper works are required to keep the information in the existing system. They have found

    difficult to maintain all the records of customers. Contacting the customers for retaining t

    customer relationship is not possible in the existing system easily. The existing system doesn

    have option to provide additional facilities like locker, transportation etc. The customers alfound it difficult to find the services available in the resort.

    The housekeeping system is not efficient in the existing system. The room cleaning servi

    gets delayed sometime. The receptionist has to go through the records when a call has be

    placed to find a room as per the request of the customer, while the customer would like to g

    the response immediately. The report making is done manually which are prone to hum

    errors.

    DISADVANTAGES OF EXISTING SYSTEM

    1. Manual entry of details,

    2. Lots of paper works

    3. Chances for human errors

    4. Employee management is not efficient

    Proposed SystemThe proposed system will take care of almost all the activities that are carried out in a resort. This makes the work

    the management easy to keep track of the services provided for the guest and the income earned. This will automate t

    task of allocating rooms, sending cabs to pick up guests, conducting tour packages etc. The system will be capable

    give the management detailed report about how the services in the resort are being used and which service is most us

    by the customers and which are the least used services. This will help to generate detailed report of every services us

    by the guests along with its corresponding charges. There will be a database kept for keep track of all the activities

    the customer starting from the day one he booked the resort till the date he vacate the room

    Apart from facilitating the guest, the proposed system will take care of the details os the staffs working in the reso

    under many departments like house keeping, restaurants, laundry, tour operators, cab drivers etc. The payr

    generation also can be done with the help of the system. This will ease the work of the management to a greater exten

    The payroll generation can even be automated as the project progress so that the generation would happen on

    particular day of every month. All the particulars will be shown with much clarity in each payroll generated.

  • 7/29/2019 Draft Recovered

    3/43

    The management can use the report section of the proposed system to generate reports as and when required. T

    report can be generated on monthly basis or even between any given dates. This will help the management to know t

    cash flowed into the business, which will play a vital role in future operations of the resort.

    The data which are stored in the system is not accessible to all. It is protected with username and password. Th

    receptionist will be able to view or modify certain data and access to some data will be denied for them like sta

    details. The administrators will be able to do any modifications to any databases as and when required. Anyone oth

    than the administrators will be forbidden from accessing the strategic financial data dealing to the resort.

    The different modules in the proposed system are as follows:

    Staff Details

    Services / Facilities for the guests

    Transportation

    Accommodation

    Guest Details

    Report Generation

    Modules in the proposed system are described in detail below

    Staff DetailsThe staffs database will contain all the details about the staffs who are working in various departments of the reso

    They may belong to any sections like, laundry, housekeeping, transportation etc. This module will allow t

    administrator to add or remove the user as when required. The database can be searched and needed modifications calso be made. The different functions that would come under this module will be, add, remove or modify the details.

    Services / FacilitiesThis lists out all the services and facilities that the guest can opt for. This will contain services like airport pickup, to

    packages, locker facility, laundry service, spa, accommodation, medical assistance, car rentals etc. The guest c

    reserve all these services before hand itself. While making the room reservation he can reserve the services he wante

    Locker facilities will be useful to keep the valuables. Keys will be provided to guests and they can use the locker un

    they vacate. Laundry services will be available for all the guests. Accommodation can be reserved before hand. A

    these facilities are value added services. The guest can avail these services by making a phone call and they will

    receiving a bill for the service. The bill will be signed and sent back to the corresponding departments by which th

    management can make sure that the guest has received the service he had asked for.

    TransportationThe resort will provide pick up service to bring the guests from the airport. They can even go for the tour packag

    which will be conducted in and around the resort area for sight seeing. Cars or cycles can be rented for the personal u

    of the guests. The guests can reserve these services even before they reach the resort.

  • 7/29/2019 Draft Recovered

    4/43

    AccommodationAccording to the requirements of the guests the resort will provide three suites. Guests can avail any of the suites. T

    housekeeping department takes care of the cleanliness of the room. The guests will be able to place order for food fro

    the room itself and food will be brought to their room.

    Guest DetailsThis module deals with the data related to the guests who stayed in the resort. This will act as a record and also if th

    guest is a regular visitor, as per the managements decision discounts can be given to the guests. The data stored will

    searchable to the unique id given to each guests will help to identify everyone uniquely and also to retrieve all th

    services he had used.

    Report GenerationThe report generation section of the proposed system will be of great use to the management. This will be of great u

    to the management to get the statistical data of the activities of the resort. Financial reports showing the inflow a

    outflow of cash will help the management to take decisions. The reports can be requested for any particular month

    year or even between any specific dates.

    ANALYSIS

    2.1 Literature SurveyTo gather information about how a normal resort would work, we consulted our friends a

    other relatives who have been to resorts many times. Most of the information about t

    resorts and the facilities available in resorts were gathered from various websites. I had got

    chance to visit Periyar Resort in Thekkady, Kerala. There they allowed me to have a look at th

    services and facilities they provide. This visit was made one month ago and that would help

    add more features to the proposed system.

    2.2 MINIMUM HARDWARE REQUIREMENTS

    Processor : Intel Pentium III

  • 7/29/2019 Draft Recovered

    5/43

    Ram : Minimum 256 MB RAM

    Speed : 500MHZ processor

    Hard disk : 10 GB Hard Disk Memory

    Monitor : 15 color monitor

    Key board : 104 windows 98 keyboard

    2.3 MINIMUM SOFTWARE REQUIREMNTS

    Packages and tools used

    Operating System : Windows XP Professional

    Documentation Packaging : MS WORD

    2.4 Database Need

    Front end : VB.Net 2005

    Back End : SQL Server 2005

    3.3 DFDS

    1. RESERVATION

  • 7/29/2019 Draft Recovered

    6/43

    Level 1

    2. ROOM FOOD SERVICE

    If not

    available

    No of rooms,

    dateuser

    Validating.

    Retrieving

    from

    database

    Rooms

    database

    Process.

    Generate

    ReservationID

    Check for roomPreferenc

    escustome

    r

    1.0

    Verify

    preferences

    1.1

    Check date

    feasibility

    Reserved

    1.2

    Upda

    teAllRooms1.3

    Collect

    Customer

    data

    CustDetails

    If not

    available

  • 7/29/2019 Draft Recovered

    7/43

    3. HOUSEKEEPING CHECKING STATUS OF ROOM

    4. Rent A Car

    Remove from

    temp

    Back to

    HK dept

    Fwd

    request to

    kitchen

    Phone call to

    House

    Keeping Dept

    GuestReceivi

    ng

    order

    Store

    request intemp

    database

    Process

    request

    Prepare bill 2

    copies

    Get the

    bill signed

    from guestUpdate

    databas

    e

    CustBilldatabase

    Retrieved result

    Request for

    checking

    status

    staff

    Accessing

    databas

    e

    Rooms

    databas

    e

    Showingresult

    on the

    screen

  • 7/29/2019 Draft Recovered

    8/43

    Sight SeeingLevel 0

    If not available

    Placing

    requestcusto

    mer

    Front

    office

    mgr chksdb

    CarDB

    Prepare

    bill

    Updatadatabse

    CustBill

    DB

    Paymnt

    Details

    Custom

    er

    Updat

    e

    CustPaymnt

    No.of

    ppl

    Vechile

    Details

    Conduct

    the tripVerify

  • 7/29/2019 Draft Recovered

    9/43

    Level 1

    Taking lockerLevel 0

    Custom

    erNo. of

    people

    1.0

    If no. of

    people is

    enough

    1.1

    Get the

    customer

    details

    1.2

    Update

    CustpaymentSightseeing

    1.3

    Assign

    vehicle and

    driver

    1.4

    Show

    report

    employee

    Vehicle

    Locker DetailsRequestCustomer AssignLocker

    Give

    Receip

    t

    CustLock

    er

  • 7/29/2019 Draft Recovered

    10/43

    Level 1

    7. Handling Request:

    Level -1

    Room no Room no.

    Request

    Room request

    1

    Locker

    Size

    Custom

    er

    Customer

    ID

    1.0

    Searchin

    g in

    locker

    table

    Locker

    Locker ID1.1

    Acceptin

    g

    Advance

    Amount

    1.2

    UpdateLockCust

    UserPosting

    Request

    Update

    Notify

    until it is

    served

  • 7/29/2019 Draft Recovered

    11/43

    8. Returning Locker:

    Level -1

    Locker Cust.

    Locker receipt table

    9. Laundry:

    Level-0

    1

    User1.0

    Get the

    Receipt

    1.1Verify theDatabase

    1.2Payback therest amount

    1.3

    Update

    Customer

    Laundry

    Employee Washing

    Customer

  • 7/29/2019 Draft Recovered

    12/43

    Level-1

    Laundry table

    Customer payment

    1

    Laundry

    1.0

    Verification ofNo. of clothes

    and Room no.

    1.1Washing

    1.2Bill

    generation

    1.3Delivery of washed

    clothes

    Customer

  • 7/29/2019 Draft Recovered

    13/43

    If

    All Room Table Rental Room Table

    Rental Room

    All Room Table

    Customer Details

    10. Renting:

    Level-0

    ALL Rooms Customer Details

    Rental table

    Level-1

    1

    User Reservation

    Process

    customer

    Rental id.

    User1.0

    Verify

    Preferences

    1.1Check for Room

    1.2Check DateCompatibilit

    y

    Update

    Not Available

    Collect

    Customer

    Details

    Update

  • 7/29/2019 Draft Recovered

    14/43

    ReservationProcedures

    Reserve a new room.

    Rent a new room.

    Rent a reserved room.

    Take a package.

    Rent a New Room

    If a guest come and ask for renting a room then

    Search for a non occupied room.

    If it is not found then display a text message sorry not found and go back to form

    If the room is available get the Room No. and again search that room in reserved roomtable.

    If the available room is found in reserved room table, it means it is reserved bysomeone else for a different date

    Then calculate for the check out date for that particular guest i.e.

    Checkout_Date = Current_Date + No. of days mentioned by customer (NOD)

    Again, if the Checkout_Date is equal to starting date of that room reservation i.e.

    Checkout_Date = Starting_Date of reserved room

    Then mention that guest you can stay only for (NOD-1) days means one day less than theno. of days he/she mentioned at that time of renting. If that guest agrees according to thiscondition then rent that room.

    And if the searched room not found in reserved room table then it means the room is notoccupied then also renting of that particular room can be done.

    1

  • 7/29/2019 Draft Recovered

    15/43

    Flow Chart

    No Yes

    yes No

    No Yes

    1

    Search Room No. in All Room

    If

    vacant

    vaa

    Msgbox(Sorry No Get the Room No.

    (RN)

    Check RN in

    ReserveRoom

    Table

    If RN is there

    inReserveRoo

    m

    Chkout=Curr_Date +

    NOD (he wants to stay)

    Rent it

    If

    Cust_Chkout

    =Cust_Chkin

    date of RN in

    reservation

    Database

    Rent it Tell only NOD-1

    days you can stay

    A

    B

    START

    C

  • 7/29/2019 Draft Recovered

    16/43

    No B

    1

    STOP

    C

    yes

    A

    If

    willing

    Msgbox(Sorry No

    Rent it

    B

  • 7/29/2019 Draft Recovered

    17/43

    3.4 TABLES

    RoomTypeDetails

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    RoomType[P

    K]

    Varchar 20 No Mention the type of room

    Rent Int 4 No Rent per day

    ExtraBed Int 1 No Number of extra beds

    allowed

    NoPersons Int 2 No Number of people allowed

    Extrabedcost Int 2 No Cost of extra bed

    Refreshment

    cost

    Int 3 Yes Cost to keep refreshments

    in room

    This table will contain the details related to each type of rooms

    AllRooms

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    RoomNo [PK] Int 3 No Room Number

    RoomType Varchar 20 No Mention the type of room

    Floor Int 2 No Location of room

    Status Varchar 5 No Resrv / Free / Rented

    RoomStatusDetails

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    StatusID [PK] Varchar 15 No ID given for each

    reservation / rental

    CustID Varchar 15 No Customer ID

    RoomNo Int 3 No Room number

    DateStart Datetime No Check in date

    DateEnd Datetime No Check out date

    CustomerBill

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    1

  • 7/29/2019 Draft Recovered

    18/43

    CustID Varchar 15 No Customer Id

    BillNo Varchar 15 No Bill Number

    Billtype Varchar 15 No Restaurant / car rental /

    sightseeing etc..

    BillDate Datetime Time at which the bill is

    generated.

    Status Varchar 15 No Paid or not paid can be the

    status

    This table will keep in track of the payment details of the customers. While checking out, the

    customer has to pay ( NOD x Rent/day ) Roomadvance + all other expenses in the table.

    CustomerDetails

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    CustID [FK] Varchar 15 No ID given for each customer

    StatusID Varchar 15 No Reserve or rental id

    RoomNo Int 3 Yes Room Number (stored only

    when the room is rented)

    Name Varchar 30 No Name of the customer

    Address1 Varchar 50 No Address Line 1

    Address2 Varchar 50 Yes Address Line 2

    City Varchar 20 No City of the customer

    State Varchar 20 No State from which he/she

    has come

    Country Varchar 20 No Nationality

    PhoneNum Int 12 Yes Phone number

    Email Varchar 20 Yes Email id

    RoomAdvanc

    e

    Int 4 Yes Amount paid as advance

    NOD Int 2 Yes Number of days stayed

    Room Request Status

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    1

  • 7/29/2019 Draft Recovered

    19/43

    RoomNo [FK] Int 3 No Room Number

    RequestID Varchar 10 No Request id

    Requesttype Varchar 10 No Extra bed / refreshment /

    bedding / food service / etc

    Description Varchar 30 Yes More details about request

    ReceivdTime Datetime Time at which the request

    is made

    Served Varchar 3 No Request served or not

    (yes/no)

    Priority Int 1 No 1 high 2 medium 3

    low

    This table will contain the details of all the requests that the housekeeping department would

    get. The guest would phone in, and the necessary details are fed into the table, by the user,

    based on the information given over phone by the guest.

    Room Cleaning Status

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    RoomNo [FK] Int 3 No Room Number

    Refreshment

    s

    Varchar 3 No Served refreshments or

    not

    Fixtures Varchar 3 No Fixtures are proper or not

    Bedding Varchar 3 No Bedding is done or not

    RestaurantStock

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    1

  • 7/29/2019 Draft Recovered

    20/43

    Itemid Varchar 5 No Item id

    ItemName Varchar 15 No Name of the item

    ItemType Varchar 15 No Mailcourse / soup /

    sidedish

    VegNonVeg Varchar 5 No NonV / Veg

    Instock Int 5 No Stock left

    Reorderlevel Int 4 No Minimum amt needed in

    stcok

    Cost Int 4 No Cost for making an item

    SellingPrice Int 4 No Price at which it is sold

    RestBillDate

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    BillNo

    [PK]

    Varchar 15 No Bill Number

    CustNo

    [PK]

    Varchar 15 No Customer Id

    Date Datetime Time at which the bill is

    generated

    BillNo : Generated automatically at the time of bill preparation

    CustNo: Refers to the customer who has to pay the bill

    Date : Shows the time at which the bill is generated.

    BillNo will refers to another table, RestBill table, which contains more details about that

    particular bill.

    Restaurant Bill

    2

  • 7/29/2019 Draft Recovered

    21/43

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    BillNo [FK] Varchar 15 No Bill Number

    Itemid [FK] Varchar 20 No Item ordered

    Qty Int 4 No Number of item ordered

    Extra Int 4 Yes Room service charge

    There can be many items bought under a single bill id. So bill id can be repeated butcombination of bill id and item cant be repeated

    Locker size

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    Lockerid [PK] Varchar 5 No Locker id

    Size Int 2 No Size of the locker

    Locker Price

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    Size [FK] Int 3 No Size of the locker

    Price Int 3 No Price of the locker

    Lockerprice(size) refers to lockersize(size)

    Locker Cust

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    LockerId [FK] Varchar 5 No Locker id

    CustID [PK] Varchar 15 No Customer Id

    Date Datetime No Time at which the locker is

    taken

    AdvancePay

    ment

    Int 3 No Amount paid as advance

    ActualAmt Int 3 No Actual amount of the

    locker

    Advance payment will be higher than the actual amount

    Locker Receipt

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    LockerID [FK] Varchar 15 No Locker Id

    2

  • 7/29/2019 Draft Recovered

    22/43

    ReciptID Varchar 15 No Reciept id

    CustID Varchar 15 No Customer id

    Amtpaid Int 3 No Amount to be paid after

    using locker

    Vehicle Details

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    Vechicleid

    [pk]

    Varchar 5 No Uniquely identify each

    vehicle

    VehicleType Varchar 10 No Type of vehicle

    Name Varchar 15 No Name of the vehicle

    Availability Varhcar 2 No Available or not

    Fare Int 3 No Fare per kilometer

    This table has the details of all the vehicle that the resort has

    Tour Place

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    Placeid Varchar 5 No Place id

    Place Varchar 15 No Name of the place

    This table will contain the list of the name of the places that can be visited and cost to visit

    that place

    Sight Seeing

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    TripID [pk] Varchar 15 No Trip id

    2

  • 7/29/2019 Draft Recovered

    23/43

    BillID Varcha 15 No Bill Id

    Vehicleid [fk] Varchar 5 No Id of the vehicle

    Driverid Varchar 15 No Id of driver (employee)

    Meterreading

    1

    Int 4 Yes Meter starting reading

    Meterreading

    2

    Int 4 Yes Meter end reading

    Fare Int 4 Yes Cost of the trip (calculater

    after the trip)

    Date Datetime No Trip Date

    This will contain the details of all the travels made from the resort

    10-15 are needed to conduct a sight seeing trip. Places to visit are fixed. Fare is calculated

    based on the km traveled and the bill is stored in customerbill database

    TripGuests

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    TripID [pk] Varchar 15 No Trip id

    CustmoerID

    [fk]

    Varchar 15 No Customer id

    This table will contain the customer ids of those who are going for a particular trip.

    Pick drop

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    Picksrvid [pk] Varchar 15 No Pickupservice id

    Cust id [fk] Varchar 15 No Customerid

    BillId Varchar 15 No Bill Id

    2

  • 7/29/2019 Draft Recovered

    24/43

    Date Datetime No Time at which the bill is

    generated

    Pickuppt Varchar 15 No Place from where to pickup

    Droppt Varchar 15 No Place to drop

    Minchrg Int 3 No Minimum charge

    Drivername Varchar 15 No Driver name

    This table will contain the details of all the pickup and drop services carried out by the resort

    The bill details will be added to customer bill table.

    Pick Drop Places

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    LocationNam

    e

    Varchar 20 No Name of the location

    Fare Int 4 No Fare for that location

    Laundry

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    Lbagno [pk] Varchar 5 No Laundry bag number

    Roomno [fk] Int 3 No Room number

    Noofclo Int 2 No Number of clothes

    Pickuptime Datetime No Time at which the bag is

    taken

    Deliverytime Datetime No Time at which the clothes

    are delivered

    Takenby [fk] Varchar 15 No Person who took the bag

    [id]

    Givenby [fk] Varchat 15 Yes Person who deliver it back

    [id]

    This will store the details of all the laundry services. Following tables are not yet finalized

    Employee

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    Employeeid

    [pk]

    Varchar 15 No Employee ID

    Name Varchar 15 No Name of the employee

    2

  • 7/29/2019 Draft Recovered

    25/43

    Designation Varchar 15 No Type of job

    Address Varchar 100 No Contact details of

    employee

    Phone Varchar 15 Yes Contact number of

    employee

    Status Varchar 3 No Busy or free

    Pay scale

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    Designation

    [pk]

    Varhcar 15 No Job type

    Basicsal Int 4 No Basic salary for

    designation

    HRA Int 2 Yes Percentage of hra

    DA Int 2 Yes Percentage of da

    TA Int 2 Yes Percentage of ta

    Paidleaves Int 2 No No of casual leaves per

    month

    Payrolls

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    Employee id

    [fk]

    Varchat 15 No Employee id

    Month Varchar 10 No Month of payment

    Slipid [pk] Varchar 15 No Slip id

    Emp Absence

    NAME DATA TYPE SIZE ALLOWS NULL DESCRIPTION

    Employee id

    [fk]

    Varchar 15 No Employee id

    Month Varchar 10 No Month of payment

    Nod Int 2 No No. of days of absence

    2

  • 7/29/2019 Draft Recovered

    26/43

    4. IMPLEMENTATION

    4.1 SCREEN SHOTSRent A Room

    Enter Customer data

    2

  • 7/29/2019 Draft Recovered

    27/43

    Add Employee

    View Guest Details

    2

  • 7/29/2019 Draft Recovered

    28/43

    Rent A Reserved Room

    Submit Request

    2

  • 7/29/2019 Draft Recovered

    29/43

    Serve A request

    Booking Sight Seeing Trip

    2

  • 7/29/2019 Draft Recovered

    30/43

    Take A Locker

    4.2CODE

    Find a room to Rent

    Private Sub FindRentableReservedRoom(ByVal qry As String)

    RentableReservedRoomNo = 0

    conn.ConnectionString = "Data Source=hurricane\sqlexpress;Initial

    Catalog=Resort01;Integrated Security=True"

    If conn.State = ConnectionState.Open Then

    conn.Close()

    Else

    conn.Open()

    End If

    query = qry

    cmd = New SqlCommand(query, conn)

    dr = cmd.ExecuteReader

    dr.Read()

    3

  • 7/29/2019 Draft Recovered

    31/43

    If dr.HasRows Then

    If ComboBox5.SelectedIndex = 0 Then

    MsgBox("there are reserved rooms that can be rented")

    Else

    MsgBox("there are reserved rooms that can be reserved")

    End If

    RentableReservedRoomNo = dr(0).ToString

    Else

    If ComboBox5.SelectedIndex = 0 Then

    MsgBox("None of the reserved rooms can be rented.. try with differnt room types")

    Else

    MsgBox("None of the reserved rooms can be reserved.. try with differnt room types")

    End If

    Exit Sub

    End If

    End Sub

    Private Sub PopulateComboboxes()

    conn.ConnectionString = "Data Source=hurricane\sqlexpress;Initial

    Catalog=Resort01;Integrated Security=True"

    If conn.State = ConnectionState.Open Then

    conn.Close()

    Else

    conn.Open()

    End If

    3

  • 7/29/2019 Draft Recovered

    32/43

    query = "select RoomType from RoomTypeDetails"

    cmd = New SqlCommand(query, conn)

    dr = cmd.ExecuteReader

    If dr.HasRows Then

    While dr.Read

    ComboBox1.Items.Add(dr(0))

    End While

    End If

    dr.Close()

    'query = "select distinct floor from AllRooms"

    'cmd = New SqlCommand(query, conn)

    'dr = cmd.ExecuteReader

    'If dr.HasRows Then

    ' While dr.Read

    ' ComboBox2.Items.Add(dr(0))

    ' End While

    'End If

    'ComboBox1.Sorted = True

    conn.Close()

    End Sub

    Private Function CheckPreferencesSet() As Boolean

    If RoomTypeSelected = True And FloorSelected = True And AdultSelected = True And

    chilSelected = True And DateSelected = True Then

    3

  • 7/29/2019 Draft Recovered

    33/43

    Return True

    End If

    End Function

    Private Function CheckReservationDateValidity() As Boolean

    If DateTimePicker1.Value < DateTimePicker2.Value Then

    MsgBox("Check out date cant be before check in date!", MsgBoxStyle.Exclamation)

    End If

    End Function

    'Public Sub New(ByVal BookingType As String)

    ' InitializeComponent()

    ' Button5.Enabled = False

    ' DateTimePicker2.Enabled = False

    'End Sub

    Private Sub RentRoom_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles MyBase.Load

    RoomTypeSelected = False

    FloorSelected = False

    PopulateComboboxes() 'to populate roomtype and floor check boxes

    Button3.Enabled = False

    Button5.Enabled = False

    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As

    System.EventArgs) Handles ComboBox1.SelectedIndexChanged

    RoomTypeSelected = True

    End Sub

    3

  • 7/29/2019 Draft Recovered

    34/43

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As

    System.EventArgs) Handles ComboBox2.SelectedIndexChanged

    FloorSelected = True

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles Button1.Click

    Dim PersonCount As Integer

    Dim SearchResult As String

    Dim nod As TimeSpan

    PersonCount = 0

    CheckReservationDateValidity()

    If Not CheckPreferencesSet() Then

    MsgBox("Please mention your preferences", MsgBoxStyle.Exclamation)

    Else

    PersonCount = Convert.ToInt32(ComboBox3.SelectedItem.ToString) +

    Convert.ToInt32(ComboBox4.SelectedItem.ToString)

    If conn.State = ConnectionState.Open Then

    conn.Close()

    End If

    conn.Open()

    query = "select NumPersons from RoomTypeDetails where RoomType = '" +

    ComboBox1.SelectedItem.ToString + "'"

    cmd = New SqlCommand(query, conn)

    dr = cmd.ExecuteReader

    dr.Read()

    If PersonCount > Convert.ToInt32(dr(0)) Then

    3

  • 7/29/2019 Draft Recovered

    35/43

    MsgBox("Number of guests should be less than or equal to " + dr(0).ToString,

    MsgBoxStyle.Exclamation)

    Exit Sub

    End If

    dr.Close()

    conn.Close()

    If (ComboBox2.SelectedItem.ToString "Any") Then

    'query = "select RoomNo from AllRooms where RoomType = '" +

    ComboBox1.SelectedItem.ToString + "'" + " AND floor = " + ComboBox2.SelectedItem.ToString

    " AND Status = 'Free'"

    'below, both in if and else part the code is same.. hee hee!!!

    If ComboBox5.SelectedIndex = 0 Then

    'rent

    query = "select RoomNo from AllRooms where RoomType = '" +

    ComboBox1.SelectedItem.ToString + "'" + " AND floor = " + ComboBox2.SelectedItem.ToString

    " AND RoomNo NOT IN (select roomno from RoomStatus)"

    Else

    'reserve

    query = "select RoomNo from AllRooms where RoomType = '" +ComboBox1.SelectedItem.ToString + "'" + " AND floor = " + ComboBox2.SelectedItem.ToString

    " AND RoomNo NOT IN (select roomno from RoomStatus)"

    End If

    Else

    'query = "select RoomNo, Floor from AllRooms where RoomType = '" +

    ComboBox1.SelectedItem.ToString + "' AND Status = 'Free'"

    'below, both in if and else part the code is same.. hee hee!!!

    If ComboBox5.SelectedIndex = 0 Then

    query = "select RoomNo, Floor from AllRooms where RoomType = '" +

    ComboBox1.SelectedItem.ToString + "' AND RoomNo NOT IN (select roomno from RoomStatus)

    3

  • 7/29/2019 Draft Recovered

    36/43

    Else

    query = "select RoomNo, Floor from AllRooms where RoomType = '" +

    ComboBox1.SelectedItem.ToString + "' AND RoomNo NOT IN (select roomno from RoomStatus)

    End If

    End If

    MsgBox(query)

    SearchResult = FindRoom(query)

    MsgBox("'" + SearchResult + "'")

    If (SearchResult "NA") Then

    ShowRoomDetails(SearchResult)

    Else

    'search reserved rooms which can be given now.

    MsgBox("No Free rooms" + vbCrLf + "Searching among already reserved/rented rooms"

    'big chunk of commented code is removed from here.

    'SEARCH FOR A RESERVED ROOM WHICH CAN BE RENTED TILL THE

    SPECIFIED DATE

    'query = "select RoomNo from RoomStatus where StatusId like 'RSV%' and DateStart > '

    + GetOnlyDate(DateTimePicker1.Value.ToString) + "'"

    If ComboBox5.SelectedIndex = 0 Then

    'renting.. finding any roomnumbers which will start using only after the chkout date

    specified by the user

    query = "select RoomStatus.roomno, AllRooms.roomtype from roomstatus, Allrooms

    where roomstatus.statusid like 'RSV%' and roomstatus.DateStart > '" +

    GetOnlyDate(DateTimePicker1.Value.ToString) + "' and Allrooms.roomtype = '" +

    ComboBox1.SelectedItem.ToString + "' and RoomStatus.roomno = Allrooms.roomno"

    Else

    'datetimepicker1 is ChekIout

    3

  • 7/29/2019 Draft Recovered

    37/43

    'query = "select RoomStatus.roomno, AllRooms.roomtype from roomstatus, Allrooms

    where roomstatus.statusid like 'RSV%' and roomstatus.DateStart > '" +

    GetOnlyDate(DateTimePicker1.Value.ToString) + "' and Allrooms.roomtype = '" +

    ComboBox1.SelectedItem.ToString + "' and RoomStatus.roomno = Allrooms.roomno"

    'reserving. FIND A ROOM NUMBER WHERE THE USER SPECIFIED CHKIN AND

    CHKOUT DATE DONOT FALL IN BETWEEN THE STORED RESERVATION PERIOD.

    query = "select RoomStatus.roomno, AllRooms.roomtype from roomstatus, Allroomswhere DateStart not between'" + GetOnlyDate(DateTimePicker2.Value.ToString) + "' and '" +

    GetOnlyDate(DateTimePicker1.Value.ToString) + "' and date2 not between '" +

    GetOnlyDate(DateTimePicker2.Value.ToString) + "' and '" +

    GetOnlyDate(DateTimePicker1.Value.ToString) + "'"

    End If

    MsgBox("earching a rentable reserved room...")

    MsgBox(query)

    FindRentableReservedRoom(query) 'THE SAME FUNCTION CAN BE USED TO FIND

    THE ROOM NUMBER OF A RESERVED ROOM WHICH IS ALREADY RESERVED

    'after this function call.. RentableResevedRoomNo wil have a value. otherwise not.

    query = "select allrooms.roomtype, allrooms.floor, RoomTypeDetails.Rent,

    RoomTypeDetails.NumPersons from AllRooms, RoomTypeDetails where AllRooms.RoomNo = "

    RentableReservedRoomNo + " AND RoomTypeDetails.RoomType = '" +

    ComboBox1.SelectedItem.ToString + "'"

    If RentableReservedRoomNo = 0 Then

    Exit Sub

    End If

    'MsgBox(query)

    If conn.State = ConnectionState.Open Then

    conn.Close()

    End If

    conn.Open()

    3

  • 7/29/2019 Draft Recovered

    38/43

    cmd = New SqlCommand(query, conn)

    dr = cmd.ExecuteReader

    dr.Read()

    If (dr.HasRows) Then

    Label11.Text = RentableReservedRoomNo.ToString

    Label18.Text = dr(0).ToString

    Label12.Text = dr(1).ToString

    Label13.Text = "Rs." + dr(2).ToString + "/-"

    Label14.Text = dr(3).ToString

    If ComboBox5.SelectedIndex = 0 Then

    nod = DateTimePicker1.Value.Date - Today.Date

    Else

    nod = DateTimePicker1.Value.Date - DateTimePicker2.Value.Date

    MsgBox("inside else" + nod.Days.ToString)

    End If

    Label16.Text = nod.Days.ToString '.Substring(0, nod.Days.ToString.IndexOf(":"))

    MsgBox("before using nod for calculation " + nod.Days.ToString)

    Label20.Text = "Rs." + Convert.ToString(nod.Days * Convert.ToInt32(dr(2).ToString

    + "/-"

    dr.Close()

    Else

    MsgBox("error in retrieving details about " + RentableReservedRoomNo)

    dr.Close

    Exit Sub

    3

  • 7/29/2019 Draft Recovered

    39/43

    End If

    End If

    If (Label11.Text "" And ComboBox5.SelectedIndex = 0) Then

    Button3.Enabled = True

    Button5.Enabled = False

    End If

    If (Label11.Text "" And ComboBox5.SelectedIndex = 1) Then

    Button5.Enabled = True

    Button3.Enabled = False

    End If

    End If

    End sub

    =================================================================

    ================================================================

    Rent Room to Customer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles Button1.Click

    3

  • 7/29/2019 Draft Recovered

    40/43

    Dim ValidationResult As String

    ValidationResult = ""

    If ValidateName(TextBox1.Text) Then

    'MsgBox("valid name")

    Else

    ValidationResult = ValidationResult + "Invalid Customer Name"

    End If

    If ValidatePhone(TextBox7.Text) Then

    'MsgBox("Valid phone")

    Else

    ValidationResult = ValidationResult + "Invalid Phone Number"

    End If

    If ValidateEmail(TextBox8.Text) Then

    'MsgBox("Valid phone")

    Else

    ValidationResult = ValidationResult + "Invalid Email Id"

    End If

    If RadioButton2.Checked = True Then

    If TextBox9.Text = "" Then

    ValidationResult = ValidationResult + vbCrLf + "Please enter a credit card number"

    End If

    End If

    If ValidationResult "" Then

    MsgBox(ValidationResult)

    Else

    4

  • 7/29/2019 Draft Recovered

    41/43

    Dim trans As SqlTransaction

    Dim cmd As SqlCommand

    trans = Nothing

    Try

    'query = "insert into RoomStatus values('" + Label20.Text + "'," + "'" + Label19.Text + "'

    + Label5.Text + "," + GetOnlyDate(Now.Date.ToString) + "," + Label8.Text + "," + na.ToString +

    "," + nc.ToString + "," + GetOnlyDate(Now.Date.ToString) + ")"

    query = "insert into customer values ('" + Label19.Text + "'," + Label5.Text + ",'" +

    TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" +

    TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "')"

    conn.ConnectionString = "Data Source=hurricane\sqlexpress;Initial

    Catalog=Resort01;Integrated Security=True"

    If conn.State = ConnectionState.Open Then

    conn.Close()

    End If

    conn.Open()

    cmd = conn.CreateCommand

    trans = conn.BeginTransaction("RentARoom")

    cmd.Connection = conn

    cmd.Transaction = trans

    cmd.CommandText = query

    cmd.ExecuteNonQuery()

    Dim billid As String

    billid = "RMTL" + GenerateBillid()

    query = "insert into CustomerBill values('" + Label19.Text + "','" + billid + "','Room

    Rental','" + GetOnlyDate(Now.Date.ToString) + "'," + amt + "," + adv + ")"

    'MsgBox(query)

    cmd.Connection = conn

    4

  • 7/29/2019 Draft Recovered

    42/43

    cmd.Transaction = trans

    cmd.CommandText = query

    cmd.ExecuteNonQuery()

    'query = "insert into customer values ('" + Label19.Text + "'," + Label5.Text + ",'" +

    TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" +

    TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "')"

    query = "insert into RoomStatus values('" + Label20.Text + "'," + "'" + Label19.Text + "',

    + Label5.Text + ",'" + GetOnlyDate(Now.Date.ToString) + "','" + Label8.Text + "'," + na.ToString

    "," + nc.ToString + ",'" + GetOnlyDate(Now.Date.ToString) + "')"

    cmd.Connection = conn

    cmd.Transaction = trans

    cmd.CommandText = query

    cmd.ExecuteNonQuery()

    If RadioButton2.Checked = True Then

    query = "select CreditCardNumber from CreditCard where CreditCardNumber = " +

    TextBox9.Text

    MsgBox(query)

    cmd.Connection = conn

    cmd.Transaction = trans

    cmd.CommandText = query

    dr = cmd.ExecuteReader

    dr.Read()

    If dr.HasRows Then

    dr.Close()

    trans.Commit()

    MsgBox("Room has been rented", MsgBoxStyle.Information)

    Else

    dr.Close()

    4

  • 7/29/2019 Draft Recovered

    43/43

    MsgBox("Invalid Card number. Please swipe again", MsgBoxStyle.Exclamation)

    trans.Rollback("RentARoom")

    Exit Sub

    End If

    End If

    If RadioButton1.Checked = True Then

    trans.Commit()

    MsgBox("Room has been rented", MsgBoxStyle.Information)

    End If

    Catch ex As Exception

    MsgBox("An Error Occured while Renting this room" + vbCrLf + ex.Message.ToString +

    vbCrLf + "Undoing the changes", MsgBoxStyle.Critical)

    trans.Rollback("RentARoom")

    Finally

    conn.Close()

    End Try

    End If

    End Sub