Professional Documents
Culture Documents
SYSTEM
By
Project Title
ii
Declaration
Declaration
The project submitted herewith is a result of my own efforts in totality and in every
aspects of the project works. All information that has been obtained from other
sources had been fully acknowledged. I understand that any plagiarism, cheating or
collusion or any sorts constitutes a breach of College rules and regulations and would
be subjected to disciplinary actions.
__________________________
Students Name: Wong Xiao Yen
Programme : Advances Diploma in Business Information System Year 2
iii
Abstract
Abstract
The main purpose of carrying this project is partial fulfilment of the Bachelor of
Science Degree (Campbell University, U.S.A.) and Advanced Diploma in Business
Information System. This project is required to submitted as a Final Year project in
order to graduate.
This project is about Restaurant Management System. This is frond-end system.
The front-end system is used by customer and staff. Customer and staff can be login
to update their personal information through this web site. They also are able to make
order for take away and delivery. Besides that, member also is able to make reserve
table and meal on specific date and time. Furthermore, they can make the payment
online without needed to travel to counter to make payment. This system also allow
administrator to manage table, staff, member, reservation, delivery order
and
delivery to customer.
This scope of the project covers Maintenances modules, Payment modules, Platform
Design modules, Meal order modules, Reservation modules, and Report modules.
The project of methodology is used UML (Unified Model Language) to design the
System such as use case diagram, sequence diagram and activity diagram. The
system flow and the actor are being drawn to understand how the system works does
and who the actors that interact with the system are. Besides that, Visual Studio 2010,
MySQL, C # and asp.net programming language, Adobe Flash, Microsoft Office that
are used as development phases of the project. Besides that, there are various phase
of development used when develop this project. We have gone through the every
stage of the software life cycle, such as system planning, requirements, analysis,
design and implementation.
In developing in this web application, team work and communication was important
for a project team to complete the whole system. Brainstorming with team member
may get better idea and improvement for the system.
iv
Acknowledgement
Acknowledgement
I would like to express my sincere gratitude to project supervisor, Ms. Chin Chai Lim,
for her guidance, constant support and encouragement throughout the completion of
this final year project. I would also like to convey my appreciation to Ms. Chin to her
advice, knowledge and time to guide me throughout this final year project. Without
the help and guidance from Ms. Chin Chai Lim, I would not able to complete this
project successfully.
A warm thank is extended to Tan Yoke Yen for sharing her resources, opinions,
knowledge, experience and skills in programming and development methodology, so
generously. I would also like to personally thank my family, friends in TAR College
and my fellow course-mates who have one way or another extended their assistance in
completing this project.
Last, but not least, I wishes to acknowledge the unwavering support shown by Ms
Chin, and my project moderator, Ms Chan Kwai Mui.
vi
Table of Contents
Table of Contents
Declaration.............................................................................................................................. iii
Abstract .................................................................................................................................... iv
Acknowledgement ................................................................................................................... vi
1. System Planning ................................................................................................................ 1
1.1 Introduction .......................................................................................................................... 2
1.2Project Aims and Objectives ................................................................................................. 2
1.3 Company Background .......................................................................................................... 4
1.4 Project Scope ........................................................................................................................ 7
1.5 ProjectTeam .......................................................................................................................... 7
1.6 Project Schedule ................................................................................................................. 10
1.7 Outline of approach/Methodology Used ............................................................................. 11
1.8 Chapter Summary ............................................................................................................... 11
Introduction ....................................................................................................................... 13
Fact Gathering..................................................................................................................... 13
Fact Recording .................................................................................................................... 14
Development Environment ................................................................................................. 14
Operation Environment....................................................................................................... 14
System Architecture ............................................................................................................ 15
Functional Requirement ...................................................................................................... 16
Non-Functional Requirement ............................................................................................. 23
Chapter Summary ............................................................................................................... 24
Introduction......................................................................................................................... 26
Use Case Diagram .............................................................................................................. 26
Use Case Description .......................................................................................................... 31
Activity Diagram ................................................................................................................ 38
Sequence Diagram .............................................................................................................. 49
Entity Relationship Diagram .............................................................................................. 57
Data Dictionary ................................................................................................................... 58
User Interface Design ......................................................................................................... 64
Normalization .........................................................................................................................
Chapter Summary ............................................................................................................... 88
4. Programming ................................................................................................................... 89
4.1
4.2
4.3
4.2
Introduction......................................................................................................................... 90
Programming Language Used............................................................................................. 90
Sample of Programming Code ............................................................................................ 91
Chapter Summary ............................................................................................................. 139
Introduction....................................................................................................................... 131
Validation and Verification .............................................................................................. 131
Test Plan ........................................................................................................................... 136
vii
Table of Contents
Introduction....................................................................................................................... 142
Evaluation of Project ........................................................................................................ 141
Suggestion for Furture Improvement ................................................................................ 122
Evaluation Against The Project Objectives ..................................................................... 143
Linking With Seminar ...................................................................................................... 144
Personal Reflection ........................................................................................................... 145
Chater Summary ............................................................................................................... 145
viii
Chapter 1
System Planning
1.
System Planning
1.1
Introduction
This chapter will discuss about the aims and objectives of this project. Then it will
followed by a brief description of the company background and the organization chart
of the restaurant. Furthermore, this chapter also includes the project scope that will be
carried out with the description of each module. Lastly, the project schedules with a
Gantt chart are shown.
1.2
The main purpose of this project is to provide an ease and convenience online order
meal and make table and meal reservation to the member. Firstly, the system can be
benefit to customer. The system allow customer to make meal delivery, take away
and reservation using computers by viewing the available table on specific date and
time without spent traveling cost going to the restaurant and spent a lot of time and
for the waiting time of meal order or the reservation.
Besides that, the project objective is to provide convenient, tangible and intangible
benefits to organisation.
Tangible Benefits to Organisation
The system can be help organisation by achieving quicker processing and
turnaround of document or transaction. For example, in current system, they may
use calculator to total up items of food order, it is need some time to make calculation,
in contrast, and the system will do it automatically.
The system can help restaurant in capturing stock availability management, so
eliminate staffs job to keep record of the stock availability. And then the systems
able to analysis how much the stock of raw material are spoil and fresh. The spoil
raw material of food will be as capturing lost on money management. So the decision
maker can make decision to adjust when to restock of raw material, reduce money lost
potential.
1.3
Company Background
Nature of business : The TwinsYens Restaurant, at No 13, jalan 2/28 Wangsa Maju,
Kuala Lumpur, Malaysia , was opened in 2008. The restaurant is opened by two
sisters. In this few years, they have a good business because they were supported by
college student and those stay in Wangsa Maju. Today, the restaurant has expanded
the business and increase the staff until 50 employees, they are Financial Manager,
Purchasing and Quality Assurance Manager, Operation Manager, Training Manager,
Marketing Manager, Front End Director, Kitchen Manager, Shipment Manager, one
receptionist, one bar tender, ten waitress, one head of cook, three assistant cook, and
the others under different manager.
Products and services: TwinsYens restaurant of main customers is Malaysian. In
Malaysia, people like different kind of food, such as Westerns foods, Chineses foods,
Malays foods, Thailands Foods, Italian foods and healthier food. In better words to
say, the restaurant provides services and products are focusing on different level and
different kind of consumer. Meals are generally served and eaten on premises, but
also offer take-out and food delivery services. In the morning, TwinsYens restaurant
prepares variety flavour breakfast and coffee or tea to the rushing business man and
student. After 12.00 pm, the restaurant will prepare service and foods delight. In
additional, the stage, stage lights, and dressing rooms are complete for customer
having some events, or sing song on the stage. the restaurant help customer to hold a
special events, such as free birthday cake and sing a birthday song, farewell party, and
others celebration services with limited person. In a special day, the restaurant may
promote season menu or specialty item to its menu.
Business environment:
The restaurant is double level premise. Inside the restaurant, at the first level include a
bar for bar tender and receptionist use, one kitchen, and 20 different size of set of
tables. At the second level of restaurant, has a balcony which was decorated with
plants, you also can view outside from balcony, if see far a bit, Twin-tower building is
over there, and the place 25 unit of difference size of set of tables. Outside of
restaurant has well-lit parking will be available. The front and back of restaurants
premise are others restaurant and other business operation. Walking 20 minutes will
reach TwinsYens restaurant from LRT station. No market nearest. But have many
company and one TARC and UTAR college nearest to restaurant.
Size of operation
50 employees, they are
Vision
TwinsYens Restaurant aims to the best of restaurant in Kuala Lumpur, especially to
serve people who are busy.
Organisation structure :
1.4
Project Scope
Online
Ordering
Subsystem
Online Table
Reservation
Subsystem
SMS Customer
Online Payment
Subsystem
Platform
Party Design
Subsystem
Maintenance
Subsystem
Online Customer
Order Detail
Feedback /Survey
Subsystem
Subsystem
Redeem free
gift
Subsystem
Report
Subsystem
customer pay deposit with 70 % of total amount of charge. If customer pay by cash,
the customer is not required to pay deposit first, unless meet the restaurant staff.
1.5
Project Team
Module
1
Responsible by
i. SMS Integration
Maintenance:
i . Customer, Staff, Table
9. Report :
i.
1.6
Project Schedule
10
1.7
For this project, I use two tier approaches (c #, asp.net ) to apply in the system
development.. The two tier design means that client program (interfaces) as first tier
and database server as second tier. The first tier is client program accesses database
directly, however second tier is used when client program executes application logic
(run SQL program with database).
Besides that,
advantage of this approach is business logic and database is physically close, which
provides higher performance. Mean that the coding run on client side, it will be more
faster response to user. As the result, I apply two tier approaches for this project.
1.8
Chapter Summary
In this chapter, we had face some problems in project scope, defining module of the
system, what module that we need to include and what function and features need to
include in each module.
We use the internet search engine, which is Google search to research the information
which is related to our project as our references such as Domino web site and Mc
Donald web site, TVG (cinema) website, based on those references, we can decide the
main module and function in each module.
Besides that, in project schedule planning, we need to estimate the date that we need
to done our task, but the actual date for the task may have different to planning date,
some tasks may be done earlier than the planning date and some tasks are over the due
date.
Base on the problem of project schedule, we need to have a proper distribution and
arrangement of the task to each project member for ensuring the task can complete on
time. We had a meeting in each week to ensure the progress of members and
brainstorming the problems that we faced.
11
Chapter 2
Requirements Analysis
12
2.
Requirements Analysis
2.1
Introduction
This chapter will include requirement analysis to the project. Requirement analysis is
the process of understanding the customer requirement and expectation from a
proposed system or application. It was including functional requirements, design
requirements and performance requirements.
2.2
Fact Gathering
2.2.1 Research
When I started to develop this project, I had done some online research for restaurant
website in Malaysia. I used Google search engine to search the category of website. I
found that, the entire restaurant website does not provide table reservation, meal
reservation and platform party design service. So I decided to do this system in my
final year project. The system is providing online meal order for delivery, take away
and reservation, so it make easy as possible to customer select more preference
service of restaurant.
2.2.2 Interview
Interview is one of fact-finding method to gather information during the system
analysis phases to develop a system. I have contact my friend who as receptionist in a
Vietnam restaurant, she has experience using restaurant system, so she can provide
more details about the websites needs and knowledge to improve our website.
The following information is the interview question that had been asked.
1. What is the nature of business of your restaurant?
2. What do you think the services that provided by using current system? Are you
satisfying your current system function? If no, what are the current system
problems?
3. What are the functions or services needs for the new system?
4. After implement Restaurant Management System, do you think that it will bring
profit to your restaurant?
Final Year Project
13
2.3
Fact Recording
In the system, user can view the webpage and get restaurants product and service
information. Customer must register as a member, and then the customer only can
make meal order, make table reservation, design platform party and provide feedback.
After submit meal order details, the system will calculate the payment and staff will
send message to user. The purpose of message is used to inform customer when the
meal will be delivered or the meal will be done of cook. If customers submit table
reservation with reserve meal together, the system will calculate the payment and
allow customer design the platform party.
2.4
Development Environment
Programming
C#.Net, Asp.net
languages
Databases
MySQL express
Development tools
Hardware
Software
2.5
Operation Environment
Hardware
Software
DBMS
MySQL express
14
2.6
System Architecture
15
2.7
Functional Requirement
Maintenance
Maintenance
Subsystem
Meal
Maintenance
Module
Customer
Maintenance
Module
Staff
Maintenance
Module
Table
Maintenance
Module
User management control, it will automatic detect who login then specify
them using different module.
Validation the input box to make sure user has fill up all the information
properly.
16
Table Maintenance
Table
Maintenance
Add New Table
Edit / Update
Table Details
Delete Table
Feature:
1. Add and Delete Table:
location and different number of seat. This function allow staff to add new table
information if a new table is purchase, otherwise can delete the table information,
once the table is not use.
2. Edit : Staff to modify table details.
3. View Table Details: Keep track table information.
Staff Maintenance
Staff Maintenance
Module
Feature :
1. Add New Staff: New employees profile include personal details information such
as Name, IC, Address, position, salary and status.
2. Edit Staff Details : Modify staffs profile details. For example, a waitress staff promote to receptionist.
But staff has no authorised to modify own salary and status information.
17
Customer Maintenance
Customer
Maintenance
Module
Register /
Add
Edit /
Update
Profile
View
Profile
Forgot
Password
Feature:
1. Add :
Record customer information. Such as MemberID, MemberPoints and Gender.
Auto generates member ID number to customer when customer register as new
member. If customer is not a member, he or she must register as member then only
can use restaurants service. The system will automatically store 100 points to
member after customer register as member.
2. Edit : Staff to modify or Member himself or herself to modify their own profile
details. On the other hand, update members points is based on payment module.
From the payment module, the total amount charge as members point calculation
which mean one ringgit as one point For example, total amount is RM 100.00, then
members point 100 will be added into database.
3. View Profile : Keep track whole member profile information.
18
Add
Reservation
Edit
Reservation
Cancel
Reservation
View
Reservation
Print Reservation
Feature:
1.
Add Reservation :
Date Reservation - It is allow customer select which day to reserve table in restaurant. The
date reservation cannot be reserve earlier than today.
Time Reservation - it is allow customer select which time to reserve table in restaurant. The
customer must earlier reach and before time and date reserve, if late, the system will
automatically make table available to others customer.
Table reservation The table can be reserve in non-smoking place and smoking place. They
also can choose how many seat. The system should provide a button or link that allow
member to check what their table reservation detail. Besides that, when starting the
reservation page, member information is already showed, but it must allow member to
modify their name and contact number. In additional, If member only reserve table, then the
system will not include any payment charges and not allow member design party platform.
Meal Reservation - After table reserved, customer will be allowed to make meal reservation.
2.
Cancel the reservation can be cancel by staff through member permission, but the
Edit For events included, the reservation cannot be edit by member after the deposit
is paid.
4.
5.
Print Customer able to print the reservation detail and payment detail after confirm
reservation. It will provide an reservation ID for proving to restaurant.
19
Platform Design
Module
Customize Party
Platform
Print Platform
Features :
1.
Customize Platform : Enable customer use the to drag the item by selecting
function such as change color of stage, add baby chair, and add color balls.
2.
View Sample Platform: module that similar look TwinsYens restaurant decoration.
3.
20
Payment Module
Payment Module
Print Payment
Add Payment
View Payment
Feature:
Add Payment : Record the payment information. After confirm order and reservation, the
payment will be added.
1.
View Payment :
Display - This function is used to display the total payment calculation after make order.
Display the payment charge must be included government tax 5 %, service charge 10 % of
total amount charge. If payment with delivery must include transport fees of RM 5, no matter
far or near.
Payment Method Enable it has two types, whether the payment is pay by credit card or
cash. If member pay credit card through online, the member must pay 70% of total payment.
Enable user print receipt.
Formula
o GrandTotal = Total Price_of_Item added ;
o TotalGovTax = Grand Total x 0.05;
o TotalServiceCharge = GrandTotal x 0.10;
o TotalAmount = GrandTotal + TotalGovTax + TotalServiceCharge;
o Deposit = (TotalAmount x 70) / 100;
o Balance = TotalAmount Deposit ;
2.
Print receipt the receipt printed that is included tax charges, service charges, delivery
charges, total price of quantity item, total price, subtotal, and date of payment.
21
Report Module
Report Module
Daily Reservation
Report
Report
manager. This report can be used for determining which time is earn less, and which time can
earn more, so they can do some promotion when business is not frequent.
View Daily Reservation Report - This report is created for supervisor and kitchen manager.
They can use this report to determine how many of meal require to prepare on specific date
and well prepare the table to customer before the customer is coming.
View Daily Member Payment Report This report is created for financial manager. The
purpose is used to view total money is received .
22
2.8
Non-Functional Requirement
The user interface must be user friendly where using graphic picture to
present information to customer.
System will run logically when user hit some error. Example, not allows enter
a character to numeric field, and would not terminate the system directly when
error message is displayed.
The system should have security function such as provides a protection of the
information to the user, users password should be protected by encrypted it
and if the staff forgot password, need contact admin to reset the password as
security. If the member, need to answer certain question to login.
The system should provide the best performance function, such as the system
must quicker response process after user click a button and the system is not
easy down.
Legislative Requirement the software that use in the system, all must be
original and obtain the license from the manufacturer.
Ethical Requirement the system must be acceptable for the user and the
general public.
23
24
Chapter 3
System Design
25
3.
System Design
3.1
Introduction
After we analyze the requirement of the system, the next is to process system design.
The system design is important because it transform information that ultimately
results in software. With the system design, it can help us to create a design physical
model. In this chapter we will discuss about the database design, sequence diagrams
and the design of system user interface.
3.2
System Overview
26
Maintain Staff
27
Maintain Table
28
29
Generate Report
30
3.3
Maintain Staff
Brief Description
This use case allows staff add, edit and search staff
information.
Actor
Adminsitrator
Main Flow
Actor Action
System Response
1. Display Main Menu
Subflows:
S-1 Add New Staff
System auto generate staff ID when form load. Administrator key in new staff
details. System validate key in new staff details. Adminsitrator press save button,
then the system will add member record into database.
S-2 Update Staff
Administrator key in staff ID or username. System varify staff ID or username
status and display staff details. Administrator press edit button and edit details.
Staff press save button, system validate edited details and update staff database.
Alternative flows :
A-1 Step S-1 and S2 : if the data enter is invalid
A-3 Step S1: if the staff does not select Done button option
A-3 Step S2: if the staff does not select Done button option
31
Maintain Member
Brief Description
This use case allows member add, edit and search member
information.
Actor
Member
Main Flow
Actor Action
System Response
1. Display Main Menu
Alternative flows :
A-1 Step 3 : if the username is exist
A-3 Step 15: if the member not select Done button option
32
Maintain Staff
Brief Description
This use case allows staff add, edit, delete and search table
information.
Actor
Adminsitrator
Main Flow
Actor Action
System Response
1. Display Main Menu
Subflows:
S-1 Add New Table
Administrator key in new table details. Administrator press Done button to
save new table information. The system validate staff key in details and add a
record into table database
S-2 Update Table
Administrator key in table number, press search button. System diplays table
information. Administrator press edit button and edit table information. System
validate input data and update the table information into database.
S-2 Delete Table
Administrator key in table number and press search button, System display table
information. Administrator press delete button. System prompt up a comfrimation
massage are you sure want to delete the table. Administrator were chosen
confirm to delete the table. System will delete the table from database.
Alternative flows :
A-1 Step S-1 and S2 : if the data enter is invalid
A-5 Step S-2: if the administrator does not select Done button option
33
Party
Brief Description
Actor
Member
Main Flow
Actor Action
System Response
1. Reservation form
34
print receipt
21. Display back home page button,
and go to design platform party
button
22. Select go to design platform party
button.
23. Display platform design page
24. Customize platform design
25. Select print platform design
26. Prompt up print window
Alternative flows :
A-1 Step S-4: if system have not generate reservation id
A-1 Step S-16: if member select confirm delete meal item button
A-1 Step S-6 and S-16: if member select does not add any item or delete all item
System display error message and not save data into database
35
Payment Module
Use case name
Pay Payment
Brief Description
Actor
Member
Main Flow
Actor Action
System Response
1. Display payment form after user
comfirm about meal order with
delivery or take away.
2.Display payment method option,
which are credit card and cash
Alternative flows :
A-1 Step 4 : if member select payment option is credit card
A-4 Step 1: if the member select order meal with take away
36
Generate Report
Use case name
Generate Report
Brief Description
Actor
Member
Main Flow
Actor Action
System Response
1. Display main menu
Subflow:
If the sub menu selected is annual sales report, the S-1: annual sales report
If the sub menu selected is daily member payment report, the S-2: daily member
payment report
If the sub menu selected is a daily reservation report, the S-3: daily reservation
report
Alternative flows :
S-1 Annual sales report
Administrator can view the report to know whole year of sale profit and know
which month is better sales. When administrator clicks the print option, system will
print the report.
S-2 Daily member payment report
Administrator can select specific date to view report, purpose is to know which
member is havent pay payment and the day total payment collect and total
balance is havent collect. . When administrator clicks the print option, system will
print the report.
S-3 Daily reservation report
Administrator can view the report to know what is the table, what is the time,
what is the meal and member detail on specific day. . When administrator clicks
the print option, system will print the report.
37
3.4
Activity Diagram
Figure 3.4.1 : Maintain Staff for Update and View Activity Diagram
38
Figure 3.4.2 : Maintain Staff for Add New Staff Activity Diagram
39
Figure 3.4.3 : Maintain Member for Add New Member Activity Diagram
40
Figure 3.4.4 : Maintain Member for Update and View Member Activity Diagram
41
Figure 3.4.5 : Maintain Table for Add New Table Activity Diagram
42
Figure 3.4.6 : Maintain Table for Update,View and Delete Table Activity Diagram
43
Reservation Module
44
45
46
47
Report Module
48
3.5
Sequence Diagram
Figure 3.5.1 : Maintain Staff for Add New Staff Sequence Diagram
Figure 3.5.2 : Maintain Staff for Update Staff and View Staff Detail Sequence Diagram
49
Figure 3.5.3 : Maintain Member for Update Member and View Member Detail Sequence
Diagram
50
Figure 3.5.6 : Maintain Table for Add New Table Sequence Diagram
51
Figure 3.5.7 : Maintain Table for Update and View Table Sequence Diagram
52
Reservation Module
Figure 3.5.8 : Reservation for View and Delete Reservation Sequence Diagram
53
54
Figure 3.5.10 : Reservation module for Add New Payment Sequence Diagram
55
Platform Design
56
3.6
57
Data Type
int Identity(1,1)
nvarchar(10)
nvarchar(50)
int
decimal(18,2)
decimal(18,2)
nvarchar(50)
Data Description
Cart Number
Meal Number
Meal Name
Order quantity
Meal Price
Subtotal of Meal
Member ID
Key
PK
FK
Reference
FK
Staff
Meal
Data Type
nvarchar(20)
nvarchar(10)
nvarchar(50)
date
Data Description
Credit Card Number
Card Name
Card Type
Cards Expire Date
Key
PK
Reference
Key
PK
Reference
FK
FK
Staff
Order
Data Type
Int Identity(1,1)
date
nvarchar(30)
nvarchar(12)
nvarchar(50)
time(0)
nvarchar(50)
nvarchar(10)
nvarchar(10)
Data Description
Delivery Number
Delivery Date
Receiver Name
Receiver Phone Number
Delivery Address
Delivery Time
Remark
Staff ID
Order Number
Data Type
int Identity(1,1)
nvarchar(50)
nvarchar(10)
int
nvarchar(50)
nvarchar(50)
Data Description
Key
Feedback Number
PK
Subject/Criteria
Vote (eg:Excellent, Good)
Values (eg:5,4,3,2,1)
Members Favorite Meal
Feedback Comment
58
Reference
FDate
MemberID
date
nvarchar(10)
Feedbacks Date
Member ID
Data Type
nvarchar(10)
nvarchar(50)
nvarchar(50)
nvarchar(30)
decimal(8,2)
nvarchar(10)
Data Description
Meal Number
Meal Name
Meal Description
Meal Image
Meal Price
Meal Category ID
FK
Member
Key
PK
Reference
FK
MealCategory
Data Type
nvarchar(10)
nvarchar(30)
Data Description
Meal Category ID
Meal Category Name
Key
PK
Reference
Data Type
nvarchar(10)
nvarchar(20)
nvarchar(12)
nvarchar(30)
nvarchar(30)
nvarchar(6)
nvarchar(15)
nvarchar(10)
nvarchar(10)
nvarchar(20)
nvarchar(20)
nvarchar(10)
nvarchar(10)
nvarchar(10)
nvarchar(30)
nvarchar(30)
Int
nvarchar(30)
Data Description
Member ID
Member Card Number
Member IC
First Name
Last Name
Gender
Office Number
Member Contact No.
Member Home Tel.
Surburb
Block
Level
Unit
City
State
Zip Code
Member Email
59
Key
PK
Reference
MPoint
EntryDate
MUserName
MPassword
MSecurityQuestion
MSecurityAnswer
MDOB
Int
date
nvarchar(30)
nvarchar(30)
nvarchar(50)
nvarchar(50)
date
Members Point
Entry Date
User Name
Password
Security Question
Security Password
Date of Birth
Data Type
nvarchar(10)
decimal(10,2)
nvarchar(6)
date
time(0)
nvarchar(10)
nvarchar(10)
nvarchar(10)
nvarchar(10)
Data Description
Order Number
Total Amount
Payment Status
Order Date
Order Time
Delivery Status
Cook Status
Member ID
Staff ID
Key
PK
Reference
FK
FK
Member
Staff
Data Type
nvarchar(10)
nvarchar(10)
int
decimal(8,2)
Data Description
Order Number
Meal Number
Order Quantity
Order Subtotal
Key
PK, FK
PK, FK
Reference
Order
Meal
Key
PK
Reference
FK
Member
Data Type
int IDENTITY(1,1)
nvarchar(10)
int
RateDate
MemberID
date
nvarchar(10)
Data Description
Rating ID
Meal number
Rating
Values(eg:1,2,3,4,5)
Rate Date
Member ID
Data Type
nvarchar(10)
int
Data Description
Redeem Number
Point
60
Key
PK
Reference
RItem
RImage
nvarchar(30)
nvarchar(30)
Redeem Items
Item Image
Data Type
int
nvarchar(50)
int
int
date
int
int
nvarchar(20)
nvarchar(20)
Data Description
Key
Redeem Item Number
PK
Member Card Number
Point Require for redeem
Quantity Redemption
Redemption Date
Balance Point
FK
Data Description
Table Number
Number of
seat(eg:2,3,4,8,10)
Zone(eg:non-smoking)
Status Available
Reference
Redeem
Key
PK
Reference
Key
PK
FK
FK
Reference
Key
PK
Reference
FK
FK
Staff
Member
Data Type
int
nvarchar(10)
nvarchar(10)
Data Description
Auto Generate ID
Table Number
Reservation ID
Data Type
nvarchar(10)
nvarchar(30)
ResICNo
ResContactNo
ResDate
ResTime
StaffID
MemberID
nvarchar(12)
nvarchar(10)
date
time
nvarchar(10)
nvarchar(10)
Data Description
Reservation ID
People who make
reservation
IC Number
Contact Number
Reservation Date
Reservation Time
Staff ID
Member ID
61
Field Name
ResID
MealNo
Qty
Subtotal
Data Type
nvarchar(10)
nvarchar(10)
int
decimal(10,2)
Data Description
Reservation ID
Meal Number
Reserve Quantity
Reserve Subtotal
Key
PK, FK
PK, FK
Reference
Key
PK
Reference
FK
ReserMeal
FK
Member
Key
PK
Reference
FK
FK
FK
FK
Order
Member
Reservation
Staff
Data Type
int IDENTITY(1,1)
MealNo
RQty
Subtotal
nvarchar(10)
int
decimal(10,2)
MemberID
nvarchar(10)
Data Description
Reservation Cart
Number
Meal Number
Quantity Reserve
Meal Subtotal in
reservation
Member ID
Data Type
int
nvarchar(20)
nvarchar(20)
nvarchar(10)
nvarchar(10)
date
decimal(10,2)
decimal(10,2)
decimal(10,2)
decimal(10,2)
decimal(10,2)
decimal(10,2)
decimal(10,2)
nvarchar(10)
nvarchar(10)
nvarchar(10)
nvarchar(50)
Data Description
Receipt Number
Credit Card Number
Member Card Number
Payment Method
Card Type
Pay Date
Total Charge
Service Charge
Government Tax
Grand Total
Delivery Fees
Balance
Deposit
Order Number
Member ID
Reservation ID
Staff ID
62
Data Description
Staff ID
Staff First Name
Staff Last Name
Address
City
State
Zip Code
IC Number
Contact Number
Gender
Position
Salary
Free Status
User Name
Password
Email
Date of Birth
63
Key
PK
Reference
3.8
64
Member Registration
65
Member Login
66
67
Member Profile
68
Reservation
69
70
71
Reservation Payment
Platform Design
72
73
74
Reservation Information
75
About Us
76
Staff Login
77
Staff Registration
78
79
80
Staff Maintenance
81
Member Maintenance
82
Staff Profile
83
Table Maintenance
Report Page
84
85
86
87
3.10
Chapter Summary
The database design is the most important part to develop a system. It is very critical
because it can influence the whole system function and operation. Each data tables, data
fields, data types and relationship of the table must proper implement. Therefore, the
problem will be minimized during the development of the system.
The interface design also important part to develop the system, because poor design will
affect the overall quality of the system. A user interface must be user friendly and
attractive, because it allow user easy understand how the system process. It is possible
save cost and save time from system learning curve.
88
Chapter 4 : Programming
Chapter 4
Programming
89
4.
Chapter 4 : Programming
Programming
4.1
Introduction
After the system design, the next step is programming . Programming is the processes of
writing the program instruction that implement the program specification, using a
suitable language. In this chapter will discuss about the programming method used. .
4.2
This is the front end application, so C # , Asp.net, JavaScript and Flash Action Script
programming language to code it. C sharp and Asp.net are Microsoft office product.
Asp.net is a web application framework developed. Asp.net mostly use for built
dynamic web site and built on the Common Language Runtime (CLR). On the other
hand, C # is able to provide simplicity of coding and ease of understanding and high
performance. Besides that, JavaScript and Flash Acton Script are scripting language, )
are used to generate a dynamic, interactive, functionality and more responsive web
page or system. Flash is an authoring tools which is including features such as drag
and drop user interface components, make some effects to the object and built in
behaviours that add Action Script.
Action Script is written behind of Flash animation, sound, picture, movie and special
effect applications, and much more. (Prayaga et al, p10, 2007)
JavaScript is a dynamic scripting language that allow website programmer to build
interactivity into static HTML pages. This is done by embedding blocks of JavaScript
code, which can be found anywhere from any Web page. JavaScript is a scripting
language that is created by Netscape Communication and Sun Microsystems.
JavaScript allows web browser to produce dynamic documents and enables
programmers to call routines written in Java, C and C++ (Sutar et al, p134,2008). The
speed of JavaScript run on client sites code function is faster than server when
waiting for server response back. It also advantage to the servers burden, because
reduce demand from client site.
90
4.3
Chapter 4 : Programming
This function is easy for me to call out the connection and no need to create the
connection in each form every time.
91
Chapter 4 : Programming
92
Chapter 4 : Programming
maintenance module.
This part of coding is taking from the StaffTableMaintainace.aspx.cs. It show
how Search Table working in the system.
voidButtonSearch()
{
if(btnSearch.Text=="Search")
{
txtSize.Enabled=false;
txtStatus.Enabled=false;
txtTableNo.Enabled=false;
txtTableNo.Enabled=false;
btnDelete.Enabled=true;
//btnCancel.Enabled=true;
btnNew.Enabled=true;
btnSearch.Enabled=true;
btnUpdate.Enabled=true;
//btnSearch.Enabled=true;
Initialize();
ArrayListarrCollect=newArrayList();
SqlDataAdapterdaHotel;
DataSetdsHotel=newDataSet();
stringsqlHotel="Select*from[Table]whereTableNo='"+
txtSearch.Text+"'";
daHotel=newSqlDataAdapter(sqlHotel,con);
daHotel.Fill(dsHotel,"Table");
foreach(DataRowrowindsHotel.Tables[0].Rows)
{
txtTableNo.Text=
dsHotel.Tables["Table"].Rows[0]["TableNo"].ToString();
txtSize.Text=
dsHotel.Tables["Table"].Rows[0]["Size"].ToString();
txtStatus.Text=
dsHotel.Tables["Table"].Rows[0]["Status"].ToString();
ddlZone.DataSource=dsHotel;
ddlZone.DataValueField="TableNo";
ddlZone.DataTextField="Zone";
ddlZone.DataBind();
}
Terminate();
93
Chapter 4 : Programming
if(btnSearch.Text=="NewSearch")
{
//ddlSearch.Enabled=true;
txtSize.Enabled=false;
txtStatus.Enabled=false;
txtTableNo.Enabled=false;
txtTableNo.Enabled=false;
btnCancel.Enabled=false;
btnNew.Enabled=true;
btnSearch.Enabled=true;
btnUpdate.Enabled=false;
//ddlSearch.Enabled=true;
txtSize.Enabled=false;
btnNew.Text="New";
btnSearch.Text="Search";
txtTableNo.Enabled=false;
ddlZone.Enabled=false;
txtSize.Text="";
txtStatus.Text="";
txtTableNo.Text="";
lblmsg1.Text="";
lblmsg2.Text="";
lblmsg3.Text="";
}
voidButtonUpdate()
{
if(txtSize.Text=="")
{
txtSize.Focus();lblmsg3.Text="*";
}
else
{
if(btnUpdate.Text=="Done")
{
btnCancel.Enabled=false;
btnNew.Enabled=true;
//btnSearch.Enabled=true;
btnUpdate.Enabled=true;
btnUpdate.Text="Update";
//ddlSearch.Enabled=true;
94
Chapter 4 : Programming
ddlZone.Enabled=false;
txtSize.Enabled=false;
txtStatus.Enabled=false;
txtTableNo.Enabled=false;
Initialize();
stringstrSQL2="UPDATE[Table]SET[Size]=@Size,
[Zone]=@ZonewhereTableNo='"+txtTableNo.Text+"'";
SqlCommandcmd=newSqlCommand(strSQL2,con);
cmd.Parameters.AddWithValue("@Size",txtSize.Text);
cmd.Parameters.AddWithValue("@Zone",
ddlZone.SelectedItem.Value);
cmd.ExecuteNonQuery();
Terminate();
txtSize.Text="";
txtStatus.Text="";
txtTableNo.Text="";
lblmsg1.Text="";
lblmsg2.Text="";
lblmsg3.Text="";
}
else
{
btnCancel.Enabled=true;
btnNew.Enabled=false;
//btnSearch.Enabled=true;
btnUpdate.Enabled=true;
btnUpdate.Text="Done";
//ddlSearch.Enabled=false;
ddlZone.Enabled=true;
txtSize.Enabled=true;
txtStatus.Enabled=true;
txtTableNo.Enabled=false;
btnDelete.Enabled=false;
}
}
}
This part of coding is taking from the StaffTableMaintainace.cs. It show how Delete
Table working in the system.
protectedvoidPage_Load(objectsender,EventArgse)
{
btnDelete.Attributes.Add("onclick","return
confirm_delete()");
95
Chapter 4 : Programming
5. protectedvoidbtnDelete_Click1(objectsender,EventArgse)
6. {
7.
8. Initialize();
9.
10. stringstrSQL2="DeleteFrom[Table]WhereTableNo
='"+txtTableNo.Text+"'";
11.
12. SqlCommandcmd=newSqlCommand(strSQL2,con);
13.
14. cmd.ExecuteNonQuery();
15.
16. Terminate();
17.
18.
19. btnCancel.Enabled=true;
20. btnNew.Enabled=false;
21.
22. btnUpdate.Enabled=false;
23. btnSearch.Text="NewSearch";
24. btnDelete.Text="Delete";
25. btnDelete.Enabled=false;
26. btnNew.Enabled=true;
27.
28. ddlZone.Enabled=true;
29. txtSize.Enabled=true;
30. txtStatus.Enabled=false;
31. txtTableNo.Enabled=false;
32. txtSize.Text="";
33. txtStatus.Text="";
34. txtTableNo.Text="";
35.
36. lblmsg1.Text="";
37. lblmsg2.Text="";
38. lblmsg3.Text="";
39.
40. Terminate();
41. lblmsg1.Text="DeleteSucessfully";
42.
43. }
<scripttype="text/javascript">
functionwait(){
if(confirm("Areyousureyouwanttodeletethisrecord?")==
true)
returntrue;
elsereturnfalse;
}
</script>
96
Chapter 4 : Programming
if(btnNew.Text=="New")
{
btnCancel.Enabled=true;
btnNew.Enabled=true;
btnUpdate.Enabled=false;
btnNew.Text="Done";
btnDelete.Enabled=false;
ddlZone.Enabled=true;
txtSize.Enabled=true;
txtStatus.Enabled=true;
txtTableNo.Enabled=true;
btnSearch.Text="NewSearch";
txtSize.Text="";
txtStatus.Text="";
txtTableNo.Text="";
lblmsg1.Text="";
lblmsg2.Text="";
lblmsg3.Text="";
else
{
if(txtTableNo.Text=="")
{
txtTableNo.Focus();lblmsg3.Text="*requirefill";
}
elseif(txtSize.Text=="")
{
txtSize.Focus();lblmsg2.Text="*requirefill";
}
elseif(txtSize.Text==""||txtTableNo.Text=="")
{
txtSize.Focus();
lblmsg2.Text="*requirefill";
txtTableNo.Focus();
lblmsg3.Text="*requirefill";
}
else
try
{
97
Chapter 4 : Programming
Initialize();
SqlCommandcmdSearch2=newSqlCommand(strSQL2,con);
cmdSearch2.Parameters.AddWithValue("@no",txtTableNo.Text);
cmdSearch2.Parameters.AddWithValue("@s",txtSize.Text);
cmdSearch2.Parameters.AddWithValue("@z",
ddlZone.SelectedItem.Value);
cmdSearch2.Parameters.AddWithValue("@st","Available");
cmdSearch2.ExecuteNonQuery();
Terminate();
txtTableNo.Enabled=false;
txtSize.Enabled=false;
btnNew.Text="New";
txtSize.Text="";
txtStatus.Text="";
txtTableNo.Text="";
lblmsg1.Text="Tablerecordisadded";
lblmsg2.Text="";
lblmsg3.Text="";
}
catch(Exceptionex)
{
lblmsg1.Text="Thetableisalreadyexist.";
<scripttype="text/javascript">
functionwait(){
if(confirm("Areyousureyouwanttodeletethisrecord?")==true)
returntrue;
elsereturnfalse;
}
</script>
...
</head>
<body...>
<asp:ButtonID="btnDelete"runat="server"Text="Delete"
OnClientClick="javascript:returnwait();"OnClick="btnDelete_Click1"/>
98
Chapter 4 : Programming
99
Chapter 4 : Programming
49. "(SELECTTableNo"+
50. "FROMReserTableASReserTable_1"
+
51. "WHERE(ResID='"+lblResID.Text+
"')))AND(TableNoNOTIN"+
52. "(SELECTTable_1.TableNo"+
53. "FROM[Table]ASTable_1INNER
JOIN"+
54. "ReserTableON
Table_1.TableNo=ReserTable.TableNoINNERJOIN"+
55. "ReservationON
ReserTable.ResID=Reservation.ResID"+
56. "WHERE(Reservation.ResDate='"+
txtReserveDate.Text+"')AND(Reservation.ResTime<='"+
ddlHours.SelectedItem.Value+"')))",conNwind);
57.
58. dtrEmployees=cmdSelectEmployees.ExecuteReader();
59.
60.
61. GridView1.DataSourceID=null;
62. GridView1.DataSource=dtrEmployees;
63. GridView1.DataBind();
64.
65.
66. dtrEmployees.Close();
67. conNwind.Close();
68.
69. Session["theRID"]=lblResID.Text;
70. }
71. //loadtableinformation,butnotshowtodaytableisreservedandnot
available
72. voidReloadTableTable
73. voidTodayReservation()
74. {
75.
76. SqlConnectionconNwind;
77. SqlCommandcmdSelectEmployees;
78. SqlDataReaderdtrEmployees;
79.
80. stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionStr
ing;
81. conNwind=newSqlConnection(connStr);
82. conNwind.Open();
83.
84.
85.
86. cmdSelectEmployees=newSqlCommand("SELECTDISTINCTTableNo,Size,
Zone,Status,{fnCURDATE()}ASExpr1"+
87. "FROM[Table]"+
88. "WHERE(TableNoNOTIN"+
89. "(SELECTTableNo"+
90. "FROMReserTableASReserTable_1"
+
91. "WHERE(ResID='"+lblResID.Text+
"')))AND(TableNoNOTIN"+
92. "(SELECTTable_1.TableNo"+
93. "FROM[Table]ASTable_1INNER
JOIN"+
94. "ReserTableON
Table_1.TableNo=ReserTable.TableNoINNERJOIN"+
95. "ReservationON
100
Chapter 4 : Programming
ReserTable.ResID=Reservation.ResID"+
96. "WHERE(Reservation.ResDate='"+
txtReserveDate.Text+"')AND(Reservation.ResTime<='"+
ddlHours.SelectedItem.Value+"')))AND(TableNoNOTIN"+
97. "(SELECTTableNo"+
98. "FROM[Table]ASTable_2"+
99. "WHERE(Status='NotAvailable')AND
({fnNOW()}={fnNOW()})))",conNwind);
100.
101.
dtrEmployees=cmdSelectEmployees.ExecuteReader();
102.
103.
104.
GridView1.DataSourceID=null;
105.
GridView1.DataSource=dtrEmployees;
106.
GridView1.DataBind();
107.
108.
109.
dtrEmployees.Close();
110.
conNwind.Close();
111.
112.
Session["theRID"]=lblResID.Text;
113.
114.
}
115.
//makedecisiontodisplaytableinformation,baseontodayor
otherday
voidReloadTableTable
116.
voidDateValidation()
117.
{
118.
DateTimemydate=Convert.ToDateTime(txtReserveDate.Text);
119.
120.
if(mydate<System.DateTime.Today)
121.
{
122.
Response.Write("Cannotreservetablebeforetoday");
123.
}
124.
elseif(mydate==System.DateTime.Today)
125.
126.
{
127.
if(Zone.Checked==true)
128.
{
129.
if(chkSize.Checked==true)
130.
{
131.
TodayZoneSize();
132.
}
133.
else
134.
{
135.
TodayZone();
136.
}
137.
}
138.
elseif(chkSize.Checked==true)
139.
{
140.
TodaySize();
141.
}
142.
143.
else
144.
{
145.
146.
TodayReservation();
147.
148.
}
149.
}
150.
else
151.
{
101
Chapter 4 : Programming
152.
153.
154.
if(Zone.Checked==true)
155.
156.
{
157.
if(chkSize.Checked==true)
158.
{
159.
OtherDayZoneSize();
160.
161.
}
162.
else
163.
164.
{
165.
OtherDayZone();
166.
}
167.
}
168.
elseif(chkSize.Checked==true&&Zone.Checked==
false)
169.
{
170.
OtherDaySize();
171.
172.
}
173.
174.
else
175.
{
176.
177.
ReloadTableTable();
178.
179.
}
180.
}
181.
182.
183.
}
184.
//loadtableinformation,baseontodayandzone(locationseat)
185.
voidTodayZone()
{
186.
187.
188.
189.
SqlConnectionconNwind;
190.
SqlCommandcmdSelectEmployees;
191.
SqlDataReaderdtrEmployees;
192.
193.
stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionStr
ing;
194.
conNwind=newSqlConnection(connStr);
195.
conNwind.Open();
196.
197.
198.
199.
cmdSelectEmployees=newSqlCommand("SELECTDISTINCT
TableNo,Size,Zone,Status,{fnCURDATE()}ASExpr1"+
200.
"FROM[Table]"+
201.
"WHERE(TableNoNOTIN"+
202.
"(SELECTTableNo"+
203.
"FROMReserTableAS
ReserTable_1"+
204.
"WHERE(ResID='"+
lblResID.Text+"')))AND(TableNoNOTIN"+
205.
"(SELECTTable_1.TableNo"+
206.
"FROM[Table]ASTable_1
INNERJOIN"+
102
Chapter 4 : Programming
207.
"ReserTable
ONTable_1.TableNo=ReserTable.TableNoINNERJOIN"+
208.
"Reservation
ONReserTable.ResID=Reservation.ResID"+
209.
"WHERE(Reservation.ResDate=
'"+txtReserveDate.Text+"')AND(Reservation.ResTime<='"+
ddlHours.SelectedItem.Value+"')))AND(TableNoNOTIN"+
210.
"(SELECTTableNo"+
211.
"FROM[Table]ASTable_2"
+
212.
"WHERE(Status='Not
Available')AND({fnNOW()}={fnNOW()})))And(Zone='"+
ddlZone.SelectedItem.Value+"')",conNwind);
213.
214.
dtrEmployees=cmdSelectEmployees.ExecuteReader();
215.
216.
217.
GridView1.DataSourceID=null;
GridView1.DataSource=dtrEmployees;
218.
219.
GridView1.DataBind();
220.
221.
222.
dtrEmployees.Close();
223.
conNwind.Close();
224.
225.
Session["theRID"]=lblResID.Text;
226.
227.
228.
}
229.
230.
//loadtableinformation,baseontodaydate,time,zoneandno.
ofpeople
231.
voidReloadTableTable
232.
voidTodayZoneSize()
233.
{
234.
235.
SqlConnectionconNwind;
236.
SqlCommandcmdSelectEmployees;
237.
SqlDataReaderdtrEmployees;
238.
239.
stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionStr
ing;
240.
conNwind=newSqlConnection(connStr);
241.
conNwind.Open();
242.
243.
244.
245.
cmdSelectEmployees=newSqlCommand("SELECTDISTINCT
TableNo,Size,Zone,Status,{fnCURDATE()}ASExpr1"+
246.
"FROM[Table]"+
247.
"WHERE(TableNoNOTIN"+
248.
"(SELECTTableNo"+
249.
"FROMReserTableAS
ReserTable_1"+
250.
"WHERE(ResID='"+
lblResID.Text+"')))AND(TableNoNOTIN"+
"(SELECTTable_1.TableNo"+
251.
252.
"FROM[Table]ASTable_1
INNERJOIN"+
253.
"ReserTable
ONTable_1.TableNo=ReserTable.TableNoINNERJOIN"+
103
Chapter 4 : Programming
254.
"Reservation
ONReserTable.ResID=Reservation.ResID"+
255.
"WHERE(Reservation.ResDate=
'"+txtReserveDate.Text+"')AND(Reservation.ResTime<='"+
ddlHours.SelectedItem.Value+"')))AND(TableNoNOTIN"+
256.
"(SELECTTableNo"+
257.
"FROM[Table]ASTable_2"
+
258.
"WHERE(Status='Not
Available')AND({fnNOW()}={fnNOW()})))And(Zone='"+
ddlZone.SelectedItem.Value+"')AND(Size='"+
ddlSize.SelectedItem.Value+"')",conNwind);
259.
260.
dtrEmployees=cmdSelectEmployees.ExecuteReader();
261.
262.
263.
GridView1.DataSourceID=null;
264.
GridView1.DataSource=dtrEmployees;
265.
GridView1.DataBind();
266.
267.
268.
dtrEmployees.Close();
269.
conNwind.Close();
270.
271.
Session["theRID"]=lblResID.Text;
272.
273.
274.
}
275.
//loadtableinformation,baseontodayno.ofppl
276.
voidReloadTableTable
277.
voidTodaySize()
278.
{
279.
SqlConnectionconNwind;
280.
SqlCommandcmdSelectEmployees;
SqlDataReaderdtrEmployees;
281.
282.
283.
stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionStr
ing;
284.
conNwind=newSqlConnection(connStr);
285.
conNwind.Open();
286.
287.
288.
289.
cmdSelectEmployees=newSqlCommand("SELECTDISTINCT
TableNo,Size,Zone,Status,{fnCURDATE()}ASExpr1"+
290.
"FROM[Table]"+
291.
"WHERE(TableNoNOTIN"+
292.
"(SELECTTableNo"+
293.
"FROMReserTableAS
ReserTable_1"+
294.
"WHERE(ResID='"+
lblResID.Text+"')))AND(TableNoNOTIN"+
295.
"(SELECTTable_1.TableNo"+
296.
"FROM[Table]ASTable_1
INNERJOIN"+
297.
"ReserTable
ONTable_1.TableNo=ReserTable.TableNoINNERJOIN"+
298.
"Reservation
ONReserTable.ResID=Reservation.ResID"+
299.
"WHERE(Reservation.ResDate=
'"+txtReserveDate.Text+"')AND(Reservation.ResTime<='"+
104
Chapter 4 : Programming
ddlHours.SelectedItem.Value+"')))AND(TableNoNOTIN"+
300.
"(SELECTTableNo"+
301.
"FROM[Table]ASTable_2"
+
302.
"WHERE(Status='Not
Available')AND({fnNOW()}={fnNOW()})))And(Size='"+
ddlSize.SelectedItem.Value+"')",conNwind);
303.
304.
dtrEmployees=cmdSelectEmployees.ExecuteReader();
305.
306.
307.
GridView1.DataSourceID=null;
308.
GridView1.DataSource=dtrEmployees;
309.
GridView1.DataBind();
310.
311.
312.
dtrEmployees.Close();
313.
conNwind.Close();
314.
315.
Session["theRID"]=lblResID.Text;
316.
317.
318.
319.
}
320.
//loadtableinformation,butnottoday
voidReloadTableTable
321.
322.
voidOtherDaySize()
323.
{
324.
DateTimeGetToday=
DateTime.Parse(DateTime.Now.ToShortTimeString());
325.
SqlConnectionconNwind;
326.
SqlCommandcmdSelectEmployees;
327.
SqlDataReaderdtrEmployees;
328.
329.
stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionStr
ing;
330.
conNwind=newSqlConnection(connStr);
331.
conNwind.Open();
332.
333.
334.
335.
cmdSelectEmployees=newSqlCommand("SELECTDISTINCT
TableNo,Size,Zone,Status,{fnCURDATE()}ASExpr1"+
336.
"FROM[Table]"+
337.
"WHERE(TableNoNOTIN"+
338.
"(SELECTTableNo"+
339.
"FROMReserTableAS
ReserTable_1"+
340.
"WHERE(ResID='"+
lblResID.Text+"')))AND(TableNoNOTIN"+
341.
"(SELECTTable_1.TableNo"+
342.
"FROM[Table]ASTable_1
INNERJOIN"+
343.
"ReserTable
ONTable_1.TableNo=ReserTable.TableNoINNERJOIN"+
344.
"Reservation
ONReserTable.ResID=Reservation.ResID"+
345.
"WHERE(Reservation.ResDate=
'"+txtReserveDate.Text+"')AND(Reservation.ResTime<='"+
ddlHours.SelectedItem.Value+"')))AND(Size='"+
ddlSize.SelectedItem.Text+"')",conNwind);
105
Chapter 4 : Programming
346.
347.
dtrEmployees=cmdSelectEmployees.ExecuteReader();
348.
349.
350.
GridView1.DataSourceID=null;
351.
GridView1.DataSource=dtrEmployees;
352.
GridView1.DataBind();
353.
354.
355.
dtrEmployees.Close();
356.
conNwind.Close();
357.
358.
Session["theRID"]=lblResID.Text;
359.
}
360.
361.
//loadtableinformationwithspecificdate,timeandtypeof
location
362.
voidOtherDayZone()
363.
{
364.
DateTimeGetToday=
DateTime.Parse(DateTime.Now.ToShortTimeString());
365.
SqlConnectionconNwind;
366.
SqlCommandcmdSelectEmployees;
367.
SqlDataReaderdtrEmployees;
368.
369.
stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionStr
ing;
370.
conNwind=newSqlConnection(connStr);
371.
conNwind.Open();
372.
373.
374.
375.
cmdSelectEmployees=newSqlCommand("SELECTDISTINCT
TableNo,Size,Zone,Status,{fnCURDATE()}ASExpr1"+
376.
"FROM[Table]"+
377.
"WHERE(TableNoNOTIN"+
378.
"(SELECTTableNo"+
379.
"FROMReserTableAS
ReserTable_1"+
380.
"WHERE(ResID='"+
lblResID.Text+"')))AND(TableNoNOTIN"+
381.
"(SELECTTable_1.TableNo"+
382.
"FROM[Table]ASTable_1
INNERJOIN"+
383.
"ReserTable
ONTable_1.TableNo=ReserTable.TableNoINNERJOIN"+
384.
"Reservation
ONReserTable.ResID=Reservation.ResID"+
385.
"WHERE(Reservation.ResDate=
'"+txtReserveDate.Text+"')AND(Reservation.ResTime<='"+
ddlHours.SelectedItem.Value+"')))And(Zone='"+
ddlZone.SelectedItem.Value+"')",conNwind);
386.
387.
dtrEmployees=cmdSelectEmployees.ExecuteReader();
388.
389.
390.
GridView1.DataSourceID=null;
391.
GridView1.DataSource=dtrEmployees;
392.
GridView1.DataBind();
393.
394.
106
Chapter 4 : Programming
395.
dtrEmployees.Close();
396.
conNwind.Close();
397.
398.
Session["theRID"]=lblResID.Text;
399.
400.
}
401.
//loadtableinformationwithspecificdate,time,typeof
locationandnumberofseatd
402.
403.
404.
voidOtherDayZoneSize()
405.
{
406.
DateTimeGetToday=
DateTime.Parse(DateTime.Now.ToShortTimeString());
407.
SqlConnectionconNwind;
408.
SqlCommandcmdSelectEmployees;
409.
SqlDataReaderdtrEmployees;
410.
411.
stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionStr
ing;
412.
conNwind=newSqlConnection(connStr);
413.
conNwind.Open();
414.
415.
416.
417.
cmdSelectEmployees=newSqlCommand("SELECTDISTINCT
TableNo,Size,Zone,Status,{fnCURDATE()}ASExpr1"+
418.
"FROM[Table]"+
419.
"WHERE(TableNoNOTIN"+
420.
"(SELECTTableNo"+
421.
"FROMReserTableAS
ReserTable_1"+
422.
"WHERE(ResID='"+
lblResID.Text+"')))AND(TableNoNOTIN"+
423.
"(SELECTTable_1.TableNo"+
424.
"FROM[Table]ASTable_1
INNERJOIN"+
425.
"ReserTable
ONTable_1.TableNo=ReserTable.TableNoINNERJOIN"+
426.
"Reservation
ONReserTable.ResID=Reservation.ResID"+
427.
"WHERE(Reservation.ResDate=
'"+txtReserveDate.Text+"')AND(Reservation.ResTime<='"+
ddlHours.SelectedItem.Value+"')))And(Zone='"+
ddlZone.SelectedItem.Value+"')AND(Size='"+
ddlSize.SelectedItem.Text+"')",conNwind);
428.
429.
dtrEmployees=cmdSelectEmployees.ExecuteReader();
430.
431.
432.
GridView1.DataSourceID=null;
433.
GridView1.DataSource=dtrEmployees;
434.
GridView1.DataBind();
435.
436.
437.
dtrEmployees.Close();
438.
conNwind.Close();
439.
440.
Session["theRID"]=lblResID.Text;
441.
442.
}
107
Chapter 4 : Programming
This part of coding is taking from the Reservation.aspx.cs. It show how Add
Reservation working in the system.
protectedvoidbtnSelectDateTime_Click(objectsender,EventArgse)
{
tbSearchTableResult.Visible=true;
if(lblResID.Text=="")
{
last=GetLastID();
theResID=AutoGeneratedID(last);
lblResID.Text=theResID;
Session["theRID"]=lblResID.Text;
DateValidation();
SqlConnectionconNwind;
stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
conNwind=newSqlConnection(connStr);
conNwind.Open();
stringSql=("InsertIntoReservation(ResID,MemberID)"+
"Values(@rid,@mid)");
using(SqlCommandcmd=newSqlCommand(Sql,conNwind))
{
cmd.Parameters.AddWithValue("@rid",theResID);
cmd.Parameters.AddWithValue("@mid",theMemberID);
cmd.ExecuteNonQuery();
Terminate();
DateValidation();
}
}
else
{
DateValidation();
108
Chapter 4 : Programming
This part of coding is taking from the Reservation.aspx.cs. It show how Add
Reserved Table working in the system.
protectedvoidbtnAdd_Click1(objectsender,EventArgse)
{
try
{
stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnectionconNwind;
foreach(GridViewRowrowinGridView1.Rows)
{
CheckBoxcheckbox=(CheckBox)row.FindControl("ckAdd");
{
if(checkbox.Checked)
{
LabellTableNo=
(Label)row.FindControl("lblTableNo");
LabellSize=(Label)row.FindControl("lblSize");
LabellZone=(Label)row.FindControl("lblZone");
{
conNwind=newSqlConnection(connStr);
conNwind.Open();
stringSql6="InsertInto
ReserTable(TableNo,ResID)values(@tno,@rid)";
using(SqlCommanddCmd=newSqlCommand(Sql6,
conNwind))
{
dCmd.Parameters.AddWithValue("@tno",
lTableNo.Text.Trim());
dCmd.Parameters.AddWithValue("@rid",
lblResID.Text);
dCmd.ExecuteNonQuery();
}
conNwind.Close();
. . .
109
Chapter 4 : Programming
StringTODAY=DateTime.Today.ToShortDateString();
StringTOTIME=DateTime.Today.ToShortTimeString();
if(lblResID.Text!="")
{
if(txtContactName.Text=="")
{
lblmsg.Text="*";
lblmsg3.Text="The'*'placethatyourarerequireto
fillup.";
if(txtContact.Text=="")
{
lblmsg.Text="*";
lblmsg3.Text="The'*'placethatyourarerequireto
fillup.";
}
if(txtICNo.Text=="")
{
lblmsg.Text="*";
lblmsg3.Text="The'*'placethatyourarerequireto
fillup.";
}
else
theReserveTime=
DateTime.Parse(ddlHours.SelectedItem.Value);
Initialize();
stringSql="Update[Reservation]Set[ResDate]=@rdate,
[ResTime]=@rtime,[ResName]=@rname,[ResICNo]=@ric,
[ResContactNo]=@rcontact,[ReserType]=@rtype,[SysDateTime]=
@sysdatetime,[Remark]=@rmrkWhereResID='"+lblResID.Text+"'";
using(SqlCommandcmd=newSqlCommand(Sql,con))
{
cmd.Parameters.AddWithValue("@rdate",
txtReserveDate.Text);
cmd.Parameters.AddWithValue("@rtime",theReserveTime);
cmd.Parameters.AddWithValue("@rname",
txtContactName.Text);
cmd.Parameters.AddWithValue("@ric",txtICNo.Text);
cmd.Parameters.AddWithValue("@rtype",theRestype);
110
Chapter 4 : Programming
cmd.Parameters.AddWithValue("@sysdatetime",
DateTime.Today);
cmd.Parameters.AddWithValue("@rmrk",txtRemark.Text);
cmd.Parameters.AddWithValue("@rcontact",
txtContact.Text);
cmd.ExecuteNonQuery();
Terminate();
Terminate();
Initialize();
stringstrSQL2="InsertIntoPayment(ResID,
MemberID,StaffID,"+
"Date,Time,Balance,Pmethod)Values(@rid,@mid,@sid,
@Date,@time,@balance,@Pmethod)";
SqlCommandcmd1=newSqlCommand(strSQL2,con);//
cmd1.Parameters.AddWithValue("@rid",lblResID.Text);
cmd1.Parameters.AddWithValue("@mid",theMemberID);
cmd1.Parameters.AddWithValue("@sid","");
cmd1.Parameters.AddWithValue("@Date",TODAY);
cmd1.Parameters.AddWithValue("@time",TOTIME);
cmd1.Parameters.AddWithValue("@balance","0");
cmd1.Parameters.AddWithValue("@Pmethod","None");
cmd1.ExecuteNonQuery();
Terminate();
Response.Redirect("Rbasic.aspx");
}
}
This part of coding is taking from the Reservation.aspx.cs. It show how Cancel
Table Reservation working in the system.
protectedvoidbtnCancel_Click(objectsender,EventArgse)
{
System.Threading.Thread.Sleep(5000);
lblmsg.Text="Pleasewait........";
conNwind=newSqlConnection(connStr);
conNwind.Open();
stringSql="DELETEFROMReserTablewhereResID
=@rid";
111
Chapter 4 : Programming
using(SqlCommanddCmd=newSqlCommand(Sql,
conNwind))
{
dCmd.Parameters.AddWithValue("@rid",
lblResID.Text);
dCmd.ExecuteNonQuery();
conNwind.Close();
conNwind=newSqlConnection(connStr);
conNwind.Open();
stringSql1="DELETEFROMReservationwhereResID
=@rid";
using(SqlCommanddCmd=newSqlCommand(Sql1,
conNwind))
{
dCmd.Parameters.AddWithValue("@rid",
lblResID.Text);
dCmd.ExecuteNonQuery();
conNwind.Close();
DateValidation();
lblmsg.Text="";
//*****Gobacktomainpage******
Response.Redirect("Membermainpage.aspx");
}
This part of coding is taking from the Rbasic.aspx.cs. It show how Delete
Selected Reserve Table Item working in the system.
protectedvoidbtnRemove_Click(objectsender,EventArgse)
{
stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnectionconNwind;
foreach(GridViewRowrowinGridView2.Rows)
{
CheckBoxcheckbox1=(CheckBox)row.FindControl("ckRemove");
{
if(checkbox1.Checked)
{
LabellCartNo=(Label)row.FindControl("lCartNo");
112
Chapter 4 : Programming
{
conNwind=newSqlConnection(connStr);
conNwind.Open();
//stringSql="DeleteFrom[ReserTable]where
CartID=@tcid";
stringSql="DELETEFROMReserTableWHERE(CartID
=@tcid)";
//stringSql="InsertInto
ReserTable(TableNo,ResID)values(@tno,@rid)";
using(SqlCommanddCmd=newSqlCommand(Sql,
conNwind))
{
dCmd.Parameters.AddWithValue("@tcid",
lCartNo.Text.Trim());
dCmd.ExecuteNonQuery();
conNwind.Close();
Refresh();
}
stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
conNwind=newSqlConnection(connStr);
conNwind.Open();
cmdSelectEmployees=newSqlCommand("Select*FromMealWhere
MealNameLIKE'%"+txtSearch.Text+"%'",conNwind);
//cmdSelectEmployees=newSqlCommand("Selectcount(mealNo)from
meal,MeaCategorywhereMeaCategory.MCName=@name");
dtrEmployees=cmdSelectEmployees.ExecuteReader();
ListView1.DataSourceID=null;
ListView1.DataSource=dtrEmployees;
ListView1.DataBind();
dtrEmployees.Close();
conNwind.Close();
113
Chapter 4 : Programming
stringid=ListView1.DataKeys[e.NewSelectedIndex].Value.ToString();
Response.Write(id);
ListViewItemitem=
(ListViewItem)ListView1.Items[e.NewSelectedIndex];
DropDownListddlQty=(DropDownList)item.FindControl("ddlQty");
TextBoxtRemark=(TextBox)item.FindControl("txtRemark");
LabellMealNo=(Label)item.FindControl("lMealNo");
LabellMealName=(Label)item.FindControl("lMealName");
LabellPrice=(Label)item.FindControl("lPrice");
stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
conNwind=newSqlConnection(connStr);
conNwind.Open();
{
stringSql="InsertIntoResCart(RMealNo,RMealName,RQty,
Price,Subtotal,MemberID)values(@mno,@mname,@qty,@price,@sub,@mid)";
using(SqlCommanddCmd=newSqlCommand(Sql,conNwind))
{
dCmd.Parameters.AddWithValue("@mno",lMealNo.Text.Trim());
dCmd.Parameters.AddWithValue("@mname",
lMealName.Text.Trim());
dCmd.Parameters.AddWithValue("@qty",
Convert.ToInt32(ddlQty.Text.Trim()));
dCmd.Parameters.AddWithValue("@price",
Convert.ToDouble(lPrice.Text.Trim()));
tRemark.Text.Trim());
dCmd.Parameters.AddWithValue("@sub",
Convert.ToInt32(ddlQty.Text.Trim())*Convert.ToDouble(lPrice.Text.Trim()));
dCmd.Parameters.AddWithValue("@mid",
Session["MemberID"].ToString());
dCmd.ExecuteNonQuery();
}
}
Response.Write("NewRecordsInsertedSuccessfully.");
conNwind.Close();
114
Chapter 4 : Programming
protectedvoidbtnMultipleRowDelete_Click(objectsender,EventArgse)
{
stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnectionconNwind;
foreach(GridViewRowrowinGridView1.Rows)
{
CheckBoxcheckbox1=(CheckBox)row.FindControl("cbRows");
{
if(checkbox1.Checked)
{
LabellCartNo=(Label)row.FindControl("lblCartNo");
{
conNwind=newSqlConnection(connStr);
conNwind.Open();
";
stringSql="DELETEFROMResCartWHERE(RCartNO=
@tcid)";
using(SqlCommanddCmd=newSqlCommand(Sql,
conNwind))
{
dCmd.Parameters.AddWithValue("@tcid",
lCartNo.Text.Trim());
dCmd.ExecuteNonQuery();
conNwind.Close();
}
}
}
Refresh();
}
115
Chapter 4 : Programming
stringconnStr=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
conNwind5=newSqlConnection(connStr);
conNwind5.Open();
stringSql2="InsertInto[ReserMeal](ResID,MealNo,Qty,Subtotal,
Remark,MealName,Price)values(@rid,@mno,@qty,@sub,@remark,@mname,
@price)";
using(SqlCommanddCmd=newSqlCommand(Sql2,conNwind5))
{
foreach(GridViewRowrowinGridView1.Rows)
{
LabellMealNo=(Label)row.FindControl("lblMealNo");
LabellMealName=(Label)row.FindControl("lblMealName");
LabellQty=(Label)row.FindControl("lblQty");
LabellPrice=(Label)row.FindControl("lblPrice");
LabellSubtotal=(Label)row.FindControl("lblSubtotal");
Session["ReservationGrantotal"]=lSubtotal.Text.Trim();
dCmd.Parameters.AddWithValue("@rid",lblID.Text);
dCmd.Parameters.AddWithValue("@mno",lMealNo.Text.Trim());
dCmd.Parameters.AddWithValue("@mname",
lMealName.Text.Trim());
dCmd.Parameters.AddWithValue("@qty",lQty.Text.Trim());
dCmd.Parameters.AddWithValue("@price",lPrice.Text.Trim());
dCmd.Parameters.AddWithValue("@sub",lSubtotal.Text.Trim());
dCmd.Parameters.AddWithValue("@remark","");
dCmd.ExecuteNonQuery();
dCmd.Parameters.Clear();
}
}
conNwind5.Close();
SqlConnectionconNwind8;
SqlCommandcmdSelectEmployees8;
stringconnStr8=
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
conNwind8=newSqlConnection(connStr8);
conNwind8.Open();
cmdSelectEmployees8=newSqlCommand("DeleteFromResCartWhere
MemberID='"+Session["MemberID"]+"'",conNwind8);
cmdSelectEmployees8.ExecuteNonQuery();
GridView1.DataSource=null;
GridView1.DataBind();
conNwind8.Close();
Response.Redirect("ReservationPayment2.aspx");
116
4.3.5
Chapter 4 : Programming
Payment Module
protectedvoidPage_Load(objectsender,EventArgse)
{
//getfrompreviouspage
theDisplayTotal=
Convert.ToDecimal(Session["ReservationGrantotal"].ToString());
lblGrandTotal.Text=theDisplayTotal.ToString();
//Session["ReservationGrantotal"]
lblRID.Text=Session["furtherRID"].ToString();
mid=Session["MemberID"].ToString();
if(!IsPostBack)
{
Initialize();
SqlDataAdapterdaHotel;
DataSetdsHotel=newDataSet();
stringsqlHotel="Select*from[Payment]whereResID='"+
lblRID.Text+"'";
daHotel=newSqlDataAdapter(sqlHotel,con);
daHotel.Fill(dsHotel,"Order");
foreach(DataRowrowindsHotel.Tables[0].Rows)
{
strPid=
dsHotel.Tables["Order"].Rows[0]["ReceiptNo"].ToString();
}
}
PaySuggestion();//displaycalculationofpayment
}
voidPaySuggestion()
{
//stringround=TotalSales.ToString("d");
if(lblGrandTotal.Text!="")
{
decimalGetLabelGrandTotal=
decimal.Parse(lblGrandTotal.Text);
117
Chapter 4 : Programming
totalServiceCharge=GetLabelGrandTotal*SvCharge;
totalGovTax=GetLabelGrandTotal*GovTax;
theSuggestion=(GetLabelGrandTotal*70)/100;
lblDeposit.Text=theSuggestion.ToString("F");
lblGTax.Text=totalGovTax.ToString("F");
lblServiceCharge.Text=totalServiceCharge.ToString("F");
TheCalculation=totalServiceCharge+totalGovTax+
GetLabelGrandTotal;
lblTotalAmt.Text=TheCalculation.ToString("F");
thebalance=TheCalculationtheSuggestion;
lblBalance.Text=thebalance.ToString("F");
stringthenum=lblTotalAmt.Text;
}
else
{
Response.Write("Norecordofmealadded");
}
if(txtExpireDate.Text!=""||txtName.Text!=""||
CardNo.Text!="")
{
Initialize();//openconnection
stringthenum=CardNo.Text;
//visaCardValidation
if(ddlCardType.SelectedIndex==0)
{
if(CardNo.Text.Length==13||CardNo.Text.Length==
16)
{
if(thenum.Substring(0,1)=="4")
{
Label14.Text="Valid";
}
else
{
Label14.Text="Invalid";
}
}
else
118
Chapter 4 : Programming
{
Label14.Text="Invalid";
}
}
//MasterCard
if(ddlCardType.SelectedIndex==1)
{
if(CardNo.Text.Length==16)
{
if(thenum.Substring(0,1)=="5")
{
Label14.Text="Valid";
}
else
{
Label14.Text="Invalid";
}
}
else
{
Label14.Text="Invalid";
}
}
//Americanexpress
if(ddlCardType.SelectedIndex==2)
{
if(CardNo.Text.Length==15)
{
if(thenum.Substring(0,2)=="37")
{
Label14.Text="Valid";
}
else
{
Label14.Text="Invalid";
}
}
else
{
Label14.Text="Invalid";
}
}
stringstrSQL1="Select*fromCreditCarddatawhereCCNO
='"+CardNo.Text+"'";
SqlDataAdapterda1=newSqlDataAdapter(strSQL1,con);
DataSetdsPlayers1=newDataSet();
da1.Fill(dsPlayers1,"Reservation").ToString();
if(dsPlayers1.Tables["Reservation"].Rows.Count>0)
119
Chapter 4 : Programming
{
strName=
dsPlayers1.Tables["Reservation"].Rows[0]["Name"].ToString();
strCardT=
dsPlayers1.Tables["Reservation"].Rows[0]["CardType"].ToString();
strDate=
dsPlayers1.Tables["Reservation"].Rows[0]["ExpireDate"].ToString();
theCardNO=
dsPlayers1.Tables["Reservation"].Rows[0]["CCNO"].ToString();
}
Terminate();
DateTimedtExpire=Convert.ToDateTime(txtExpireDate.Text);
DateTimedtEpire2=Convert.ToDateTime(strDate);
if(txtName.Text==strName)
{
Label9.Text="Checked";
}
else
{
Label9.Text="Invalid";
}
if(ddlCardType.SelectedItem.Value==strCardT)
{
Label12.Text="Checked";
}
else
{
Label12.Text="Invalid";
}
if(dtExpire==dtEpire2)
{
Label11.Text="Checked";
}
else
{
Label11.Text="Invalid";
}
if(CardNo.Text==theCardNO)
{
Label10.Text="Checked";
}
else
{
Label10.Text="Invalid";
}
if(Label9.Text=="Invalid"||Label10.Text=="Invalid"||
Label11.Text=="Invalid"||Label12.Text=="Invalid")
{
Label13.Text="Sorry,yourcreaditcardisnot
exceptable.";
}
if(Label9.Text=="Checked"&&Label10.Text=="Checked"&&
Label11.Text=="Checked"&&Label12.Text=="Checked")
{
Initialize();
stringstrSQL2="UpdatePaymentSet
[CreditCardNo]=@ccno,[MemberCardNo]=@mcn,[ResID]=@rid,
120
Chapter 4 : Programming
[MemberID]=@mid,[StaffID]=@sid,[Pmethod]=@pmethod,[TotalCharge]=@tc,
[CardType]=@cardtyp,"+
"[Date]=@date,[Time]=@time,[Deposit]
=@deposit,[Balance]=@balance,[GovTax]=@tax,[ServiceCharge]=@svchrg,
[GrandTotal]=@totalamountwhereResID='"+lblRID.Text+"'";
SqlCommandcmd=newSqlCommand(strSQL2,con);//
cmd.Parameters.AddWithValue("@ccno",CardNo.Text);
cmd.Parameters.AddWithValue("@mcn","CreaditCard");
cmd.Parameters.AddWithValue("@rid",lblRID.Text);
cmd.Parameters.AddWithValue("@mid",mid);
cmd.Parameters.AddWithValue("@sid","");
cmd.Parameters.AddWithValue("@time",
DateTime.Now.TimeOfDay);
decimaldecTotalCharg=
Convert.ToDecimal(lblGrandTotal.Text);
cmd.Parameters.AddWithValue("@pmethod","CreaditCard");
cmd.Parameters.AddWithValue("@tc",decTotalCharg);
cmd.Parameters.AddWithValue("@cardtyp",
ddlCardType.SelectedItem.Value);
cmd.Parameters.AddWithValue("@date",DateTime.Today);
decimaldecDeposit=Convert.ToDecimal(lblDeposit.Text);
cmd.Parameters.AddWithValue("@deposit",decDeposit);
decimaldecBalance=Convert.ToDecimal(lblBalance.Text);
cmd.Parameters.AddWithValue("@balance",decBalance);
decimaldecGtax=Convert.ToDecimal(lblGTax.Text);
cmd.Parameters.AddWithValue("@tax",decGtax);
decimaldecSv=
Convert.ToDecimal(lblServiceCharge.Text);
cmd.Parameters.AddWithValue("@svchrg",decSv);
decimaldecTotal=Convert.ToDecimal(lblTotalAmt.Text);
cmd.Parameters.AddWithValue("@totalamount",decTotal);
cmd.Parameters.AddWithValue("@omthd","Reservation");
cmd.ExecuteNonQuery();
Terminate();
btnCheckOut.Visible=false;
Button1.Visible=true;
Button2.Visible=true;
Label13.Text="Thanks,wishyoucomeagain";
}
121
Chapter 4 : Programming
totalServiceCharge=GetLabelGrandTotal*SvCharge;
totalGovTax=GetLabelGrandTotal*GovTax;
if(lblOrderMethod.Text=="Delivery")
{
lblTransportFees.Text="5.00";
TheCalculation=totalServiceCharge+totalGovTax+
GetLabelGrandTotal+5;
theSuggestion=(TheCalculation*70)/100;
thebalance=TheCalculationtheSuggestion;
lblTotal.Text=TheCalculation.ToString("F");
//caculation
lblBalance.Text=thebalance.ToString("F");
lblDeposit.Text=theSuggestion.ToString("F");
lblGTax.Text=totalGovTax.ToString("F");
lblServiceCharge.Text=
totalServiceCharge.ToString("F");
lblTransportFees.Text="0.00";
TheCalculation=totalServiceCharge+totalGovTax+
GetLabelGrandTotal;
thebalance=TheCalculationtheSuggestion;
lblTotal.Text=TheCalculation.ToString("F");
//caculation
lblBalance.Text=thebalance.ToString("F");
lblDeposit.Text=theSuggestion.ToString("F");
lblGTax.Text=totalGovTax.ToString("F");
lblServiceCharge.Text=totalServiceCharge.ToString("F");
122
Chapter 4 : Programming
Initialize();
SqlDataAdapterdaHotel;
DataSetdsHotel=newDataSet();
stringsqlHotel="select*fromMemberswhere
MemberID='"+Session["MemberID"].ToString()+"'";
daHotel=newSqlDataAdapter(sqlHotel,con);
daHotel.Fill(dsHotel,"Members");
foreach(DataRowrowindsHotel.Tables[0].Rows)
{
strPoint=
dsHotel.Tables["Members"].Rows[0]["MPoint"].ToString();
decAmount=Convert.ToDecimal(lblTotal.Text);
originalPoint=Convert.ToInt32(strPoint);
intAmount=Convert.ToInt32(decAmount);
intAddUppoint=intAmount+originalPoint;
stringstrSQL5="UpdateMembersSet
[MPoint]=@pointwhereMemberID='"+Session["MemberID"].ToString()+
"'";
SqlCommandcmd5=newSqlCommand(strSQL5,con);
//
cmd5.Parameters.AddWithValue("@point",
intAddUppoint);
cmd5.ExecuteNonQuery();
123
Chapter 4 : Programming
on (press) {
startDrag( this, false, 0, 0, 400,400);
}
on (release, releaseOutside)
{
stopDrag();
}
124
Chapter 4 : Programming
125
Chapter 4 : Programming
PrintHelper.PrintWebControl(Tab10);
Session["ctrl"]=Tab10;
ClientScript.RegisterStartupScript(this.GetType(),"onclick","<script
language=javascript>window.open('Print.aspx','PrintMe',
'height=300px,width=300px,scrollbars=1');</script>");
This part of coding is taking from the Print.aspx.cs.Below is showing how Page load
the print function after Opayment form call the print function working in the
system.
protectedvoidPage_Load(objectsender,EventArgse)
{
lbldate.Text=DateTime.Now.ToShortDateString();
Controlctrl=(Control)Session["ctrl"];
PrintHelper.PrintWebControl(ctrl);
btnPrint1.Attributes.Add("onclick","window.print();");
126
Chapter 4 : Programming
<%@RegisterAssembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"TagPrefix="asp"%>
<!DOCTYPEhtmlPUBLIC"//W3C//DTDXHTML1.0Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title></title>
<scripttype="text/javascript">
functioncheckDate(sender,args){
if(sender._selectedDate<newDate()){
alert("Youcannotselectadayearlierthantoday!");
sender._selectedDate=newDate();
//setthedatebacktothecurrentdate
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
}
</script>
<styletype="text/css">
......
...
</style>
</head>
<form>.
<asp:CalendarExtenderID="CalendarExtender1"
OnClientDateSelectionChanged="checkDate"
TargetControlID="txtReserveDate"
PopupButtonID="Image1"
runat="server">
</asp:CalendarExtender>
This part of coding is taking from the Staff Registration.aspx. It show how
Text Field Require Feild validation working in the system.
<asp:TextBoxID="txtPassword"runat="server"TextMode="Password"
AutoPostBack="false"></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator4"runat="server"Display="Dynamic"
ControlToValidate="txtPassword"ErrorMessage="Thetextboxcannotbe
empty!"/>
127
Chapter 4 : Programming
This part of coding is taking from the Staff Registration.aspx. It show how Text
Field Require Key In start with letter working in the system.
<asp:TextBoxID="txtFirstName"runat="server"Height="25px"
Width="309px"></asp:TextBox>
<asp:RegularExpressionValidator
ID="RegularExpressionValidator1"runat="server"
ControlToValidate="txtFirstName"ValidationExpression="^[azAZ].*"
ErrorMessage="Inputmuststartwithaletter"/>
This part of coding is taking from the Staff Registration.aspx. It show how
Email Validation working in the system.
<asp:RegularExpressionValidatorID="emailValidator"runat="server"
Display="Dynamic"
ErrorMessage="Please,entervalidemailaddress.(e.g
twistYen@twistYen.com)"ValidationExpression="^[\w\.\]+@[azAZ09\
]+(\.[azAZ09\]{1,})*(\.[azAZ]{2,3}){1,2}$"
ControlToValidate="txtUMemail">
</asp:RegularExpressionValidator>
This part of coding is taking from the Staff Registration.aspx. It show how
Masked Validation working in the system.
<asp:TextBoxID="txtSalary"runat="server"ValidationGroup="MKE">
</asp:TextBox>
<asp:MaskedEditExtenderid="MaskedEditExtender2"runat="server"
TargetControlID="txtSalary"
Mask="99,999.99"
MessageValidatorTip="true"
OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError"
MaskType="Number"
InputDirection="RightToLeft"
AcceptNegative="Left"
ErrorTooltipEnabled="True"/>
<asp:MaskedEditValidatorID="MaskedEditValidator1"runat="server"
ControlExtender="MaskedEditExtender2"
ControlToValidate="txtSalary"
IsValidEmpty="False"
MaximumValue="12000"
EmptyValueMessage="Numberisrequired"
InvalidValueMessage="Numberisinvalid"
MaximumValueMessage="Number>12000"
MinimumValueMessage="Number<600"
MinimumValue="600"
Display="Dynamic"
TooltipMessage="Inputanumberfrom600to12000"
EmptyValueBlurredText="*"
InvalidValueBlurredMessage="*"
MaximumValueBlurredMessage="*"
MinimumValueBlurredText="*"
ValidationGroup="MKE"/>
</td>
128
4.4
Chapter 4 : Programming
Chapter Summary
In programming section, I faced a lot problem when system develops, such as syntax
error, run time error and logic of the programming. I am using Visual Studio 2010 C #.
Net and Asp.net language to develop online restaurant management system. I have most
experience on VB programming language than C sharp, however, I will try to learn and
get solution from web site or try to debug the every line of code for confirming each line
of coding does not have any error.
129
Chapter 5
Software Testing
130
5.
Software Testing
5.1
Introduction
System testing was important to a project, testing is to validate the system whether
meet the requirement of the system. Software testing is used to test the functionality
of each application. Software testing enables to investigate the quality of the system.
Software testing able to verify whether does the system meets the business and
technical requirements has been request in the objective. Software testing can be also
stated as a process to validate and verify the software programs. The software testing
is being carried out by using a testing methodology.
5.2
131
The administrator need to enter the all field data before add the new staff record. An
empty field is not allowed before click the register button.
Login Validation
This is the login validation for the front-end system. The system will validate the
Username and Password key in by the member . Unauthorized user is not allow to the
login into the system either Username or password is incorrect.
Email Validation
132
The message is displayed when user key in improper e-mail address, such as @ and
dot com (. Com)
Confirmation Verification
The message box will prompt out for the user to make comfirmation whether want to
delete the table record. If the user selection is Ok, the the system will delete the
record.
Range Validation
133
This is range validation for salary field, the administrator must key in between the
salary between 1800 to 9999, if less than, the system not add new staff record into
database.
Date Validation
This is date validation for selecting date to reserve table The message will prompt up
when the user is to select the date is earlier today.
134
The staff must enter same password on the password field and confirm password
field. If confirm password is not match with the password, the message label will
display.
This is creadit card validation, if user key in improper credit card details, the the
system will display not accept user credit card payment transaction.
135
5.3
Test Plan
Test
Data
Expected
Output
Actual
Output
Conclusion
1.
error Successful
An error An
Validate user input : Leave
message
empty field
text box message
display
display
blank
2.
3.
error Successful
Validate user input : Enter less An error An
message
message
number range
than
display
display
epected
value
4.
error Successful
Validate user input : Enter not An error An
message
message
email format
standard
display
format of display
email
address
error Successful
An error An
message
message
display
display
Test
Data
Expected
Output
Actual
Output
Conclusion
1.
error Successful
An error An
Validate user input : Leave
message
empty field
text box message
display
display
blank
2.
3.
error Successful
Validate user input : Enter less An error An
message
message
number range
than
display
display
epected
value
136
error Successful
An error An
message
message
display
display
Test Data
Expected
Output
Actual
Output
Conclusion
1.
2.
Login Page
No. Test Domain
Test
Data
Expected
Output
Actual
Output
Conclusion
1.
error Successful
An error An
Validate user input : Leave
message
empty field
text box message
display
display
blank
2.
An error An
error Successful
message
message
display
display
Payment Page
No. Test Domain
Test
Data
Expected
Output
Actual
Output
Conclusion
1.
error Successful
An error An
Validate user input : Leave
message
empty field
text box message
display
display
blank
2.
137
error Successful
An error An
message
message
display
display
Test
Data
Expected
Output
Actual
Output
Conclusion
1.
error Successful
An
error An
Validate user input : Leave
message
empty field
text box message
display
display
blank
2.
138
An
An
Successful
confirmation confirmation
message
message
5.4
Chapter Summary
A well design system should able to provide an error free and well function for
the user. If a system has well tested then the system may produce understandable
output, not always terminate during run-time. Through the software testing, every
modules and fields in the system had been tested carefully, otherwise the
adequate message box will present to the user for each input. Though the
message box or message display, the user can understand what the action is
require to be taken by following the instruction of the system.
139
Chapter 6 : Conclusion
Chapter 6
Conclusion
140
6.
Chapter 6 : Conclusion
Conclusion
6.1
Introduction
This chapter will conclude about Final Year Project documentation. Evaluation
against project objectives, strengths and weakness and suggestions will be
discussed in this chapter.
6.2
Evaluation of Project
6.2.1 Strengths
Improved Validation and Error Control
With the online Restaurant Management System is developed, the rate of
error from occurring can be prevented. With the function validation,
incorrect format can be reduced.
Improved Security
With the function enabling user to login and logout, user can have a
better security in booking their table, meal, make order as user needs to
enter their personal information such as credit card number,
Identification card number and so on.
Generate Unique Identification Number (ID)
This system provides a function called auto-generate ID, which means
ID such as order ID, Resrvation ID, Member ID, Staff ID and payment
ID are auto-generated. This is to prevent from entering the redundant ID
number.
Increase Efficiency and Effectiness
This system had brought a new improvement to restaurant orgainsation.
This allow customer make delivery and make reservation via online.
This can save customer time for traveling to the restaurant. Another
advantage of this system is customer can always get the latest
information such as which date of table is available and what promotion
is advertised from the restaurant.
141
Chapter 6 : Conclusion
6.2.2 Limitation
User Interface
The user interface of the system is less attractive, because the application
is very hard to adjust.
Member only able to book table, meal and design platform for
themselves
The website make reservation function only able to member to reserve
the table, reserve meal and design platform.
User add meal function
The add meal function is unable auto add up the quantity of meal item.
Everytime add a same meal item, the meal item will display at next row
of girdview in order list form.
6.3
142
6.4
Chapter 6 : Conclusion
The user interface must be user friendly where using graphic picture to
present information to customer.
System will run logically when user hit some error. Example, not allows enter
a character to numeric field, and would not terminate the system directly when
error message is displayed.
The system should have security function such as provides a protection of the
information to the user, users password should be protected by encrypted it
and if the staff forgot password, need contact admin to reset the password as
security. If the member, need to answer certain question to login.
The system should provide the best performance function, such as the system
must quicker response process after user click a button and the system is not
easy down.
143
6.5
Chapter 6 : Conclusion
My seminar project is Flash Action Script versus JavaScript. I recommend flash action
script and java script apply into my FYP (Final Year Project) because both are useful to
develop the system.
Firstly, I used flash action script drag and drop method to apply
differences objects have own function and specific position to be allocated. For example,
painting object s function is changing the background color of platform, the balloon
only able to drag to top position of stages wall. On the other hand, I also use flash to
design the main page of the system, such as advertisement and slide show.
Secondly, I used java script that apply together with asp.net and c sharp. For example,
table maintenance module, I used javascript to display pop up message for asking user to
confirm deletion then the delete SQL will be perform from c sharp coding when user
response .
144
6.6
Chapter 6 : Conclusion
Personal Reflection
From the planning stage until the testing stage, it took me one year preparation and
finishing this final year project. During the time doing this project, I am so worry I
affect my partner performance and I unable finish this project.
Wish so many
problem I faced, I try to solve it and go to library to refer more book. I found I have
improved a lot and learned to manage my time.
During develop this system, I faced a lot problem, such as survey how asp.net
connect to flash, install crystal report into Microsoft visual studio 2010 and project
programming. Since I get use to using VB programming to develop a system,
however we use c sharp, scripting language and asp.net in this project, so I have
spent a lot of time to find solution through library, web site and asking my friend. K
With the help and support from my friends, I solve the problem and complete the
project in time. I also would like to thanks my partner, Tan Yoke Yen who is always
motivate me to complete the project. I would like to express my sincere gratitude to
my project supervisor, Ms Chin who is very kind and considerate to me. She was
always giving me opinions and feedback to my project. Thanks to her patient and
kindly to guide me to finish this project.
6.7
Chapter Summary
After completing the system, I had gained a lot of extra knowledge that I did not
learn from college. I am happily to enjoy working with my friends, as we are able to
push each other, brainstorming together and help each other. I am so happy I able to
complete this final year project on time as this will be the last project for me in
college.
145
7.
References
References
E-Book
Prayaga, Lakshmi; Suri, Hamsa, 2007. Beginning Game Programming with Flash, viewed
2010, <http://books.google.com.my/books?id=ORMINQAACAAJ&dq>
Journal
Sutar, Shashikant, S 2008. Web Design and ASP.Net. Daryaganj, Delhi, IND, p134.
E-Publication
Domino
2010.
Member
Registration,
Viewed
10
October
2010
<
2010
<
http://www.dominos.com.my/frmUserRegistration1.aspx >
Internet.Com,
2010.
Credit
Card
Validation,
Viewed
Feb
http://javascript.internet.com/forms/valcreditcard.html>
Patrickcauley, 2010. Flash-Drag and Drop, Viewed 5 Feb 2010 < http://www.youtube.com
http://javascript.internet.com/forms/valcreditcard.html>
Others
XiaoYen,Wong. Restaurant Management Systems Project Specification, Feb 2010, p1-p21.
146
8.
Appendices
Appendices
147
9.
User Guide
User Guide
9.1 Member User Guide
9.1.1 Non-Member Main Page
148
User Guide
After click sign up option, display registration form. There are require you to fill up
three basic category , included your login information, personal imformation and
delivery information.
Note :
The delivery information is allowed TwinYens Restaurant staff able delivers the
meal to your specific address.
149
9.1.3
User Guide
Member Login
After you sign up as a member, you can direct go to login page . From here, you are
requiring to key in your username and your password, then click login.
Note :
Remember Me option the system will remember user s username, if you next
time go to this page, you are no need to retype your username..
Forgot Password option - if you do not remember your password, here has option to
allow you find back your password..
150
9.1.4
User Guide
If you login successfully, the member main page is look like this.
Menu Bar
Home Back to member main page
Menu Enable user to view TwinsYen s Restaurant Meal Menu and make order.
Promotion Enable user to view TwinsYen s Restaurant latest promotion product
news
Reservation
Contact Us
151
User Guide
If you click forgot password, this page is displayed. There has 3 step
Step 1 - select what you remember
Step 2 key in what you remember
Step 3 the system will show your security question, and you require to answer it. If
your answer is correct, the system will show your password.
152
User Guide
You can view your profile by select Others from menu bar select My profile
Your option :
Edit enable member change details
Cancel cancel edit your profile details
Print print your profile
Change password enable you to change your password for login purpose
153
User Guide
If you click change password from my profile page, then this page will be
displayed. There have three empty fields where you are require to fill up. The old
password field is requiring you to key in your current password in use. The new
password means fill up the new password to replace previous password in use. The
confirm password means that make sure you are not simply to key in the password.
Your Option :
Done button - confirm to change the password
Clean All empty all the field
Cancel stop continue to change the password
154
User Guide
9.1.8 Reservation
If you want reserve table from TwinsYen s Restaurant, you can click from menu bar
Reservation --> Reservation.
Date and time - allow you select which date and time to reserve your table
Search button- you can find the table requirem base to date, time, zone ( smoking or nonsmoking) and number of size ( how many seat of table)
155
User Guide
Check Table Reserved button - allow you to check what table you have selected for the
reservation. Below is example of check table reservation page
156
9.1.9
User Guide
MemberReservation Information
After you click finish button from table reservation page, this page is displayed.
Your Option
Back To Reserve Table button go back to table reservation page to add your table
Go To Reserve Meal if you want reserve meal into your reservation
Remove Remove your table item selected
Print Print your reservation information
157
User Guide
From this page, you can select your favourite meal item.
Your Option
Search button - Search your preference choice of meal category
Add button -
Quantity selection -
Order List button - allow you to view your meal added details
158
User Guide
After you press order list button from reservation meal menu page, this page is displayed.
Your Option
Continue Reserve Meal go back to reservation meal menu page for add more quantity of
meal item.
Done go to make payment
Confirm Delete - select your meal item that you want to remove
159
User Guide
After you click Done button from MemberMeal Reservation Information page, this page is
displayed. . Your payment details is display and you require to fill up your credit card details.
You Option :
Done button - click this button after you fill up all the field for make transaction.
Back Home page button - enable you to back home page
Design Platform design -
Restaurant.
160
User Guide
161
User Guide
162
User Guide
After your add your order meal from Menu -> confirm Order list -> select order
with delivery or order with collect myself -> payment
Your Option
Step 1 : Payment Method selection - enable you select pay by cash or credit card. If
you pay by credit card, then you are require to fill up the credit card details.
Step 2 : Key in credit card details ( if select credit card payment method)
Step 3: Press Done button
163
User Guide
After administrator generate a new staff from sign up form, then the new staff has
authorize go to login from this login page . From here, users are requiring to key in
their username and your password,and then click login.
Note :
Remember Me option the system will remember user s username, if you next
time go to this page, you are no need to retype your username..
Forgot Password option - if you do not remember your password, here has option to
allow you find back youre your password..
164
User Guide
If the customer does not remember their reservation id, then staff can help member
check reservation id, reservation date and reservation time by clicking search button
in this page.
165
9.2.3
User Guide
If member remember their reservation id, then staff can click serch button to check their
reservation detail, include table reserved, meal reserved, payment status, and member
personal information.
If member want to cancel reservation, then can click the cancel reservation after get the
reservation detail.
Final Year Project
166
9.2.4
User Guide
Staff Profile
Staff can view their own profile by select Others ( menu bar) -> my profile
You can view your profile by select Others from menu bar select My profile
Your option :
Edit enable staff change details
Cancel cancel edit staff profile details
Change password enable you to change your password for login purpose.
167
User Guide
Your Option
Registration button - Administrator can help new staff sign up for using this system,. There
are require you to fill up three basic category , included your login information, personal
imformation and address information.
Cancel - back to home page without add new reservation record.
Print print new staff profiled.
168
User Guide
169
User Guide
170
User Guide
171
User Guide
9.3.5 Report
Administrator can select Report from menu bar to create an useful report.
Note :
You must go to D drive to create a folder, name it as Report before you generate a new
report. Because this action to be taken for storing report purpose.
172