Download as pdf or txt
Download as pdf or txt
You are on page 1of 127

Restaurant System

Jo
Ministry Of Higher Education
New Cairo Academy
Computer Science Department

Restaurant
o
System
Under The Leadership Of :

Dr / Kamal Hefny Hashem

Department of Computer Science


Restaurant System

2017/2018
Jo
We extend our thanks , appreciation
and gratitude to

Dr / Kamal Hefny Hashem

Thank you for teaching us all about


project
analysis, design and implementation,
o
and sharing your experience and
knowledge and your great advices
and guidance to facilitate and
shorten the way for the team to
complete the project with us

Really we can't thank you enough

Department of Computer Science


Restaurant System

 Mina Salah Hanen Gerges

 Rewis Rasmy Abdelkarim Gayed

 Beshoy Eshak Khames Saeid

 Saleh Saleh Mohamed Taher


Jo
 Zaher Ahmed Zaher Elghar

 Mohamed Ashref Abdelftah Abdelhady

 Ahmed Soliman Gbr Soliman

 Mahmoud Abdelhaliem Elsayed Mahmoud


o
 Ahmed Abdelmohsen Fathy

Department of Computer Science


Restaurant System

CONTENT

Chapter 1 ( Introduction ) 1

Chapter 2 ( Analysis ) 6
 Requirement 7
 Flow Chart 8
Jo
 Use-Case 9
 Sequence 10
 Activity 15
 Class Diagram 26

Chapter 3 ( DataBase Design ) 27


 ERD 28
 Mapping 30
o
 Data Dectionary 32
 DataBase Relation 46

Chapter 4 ( Forms ) 65

Chapter 5 ( Implementation ) 86
 Data Base Layer 87
 Data Access Layer 89
 Data Entity Layer 105

Department of Computer Science


Restaurant System 1

Jo
o
Department of Computer Science
Restaurant System 2

1. INTRODUCTION
The Restaurant System is an application which will help restaurant to
optimized and control over their restaurants. For the waiters, it is making life easier
because they don’t have to go kitchen and give the orders to chef easily. For the
management point of view, the manager will able able to control the restaurant by
having all the reports to hand and able to see the records of each employees and
orders.
The Restaurant Management System helps the restaurant manager to manage the
restaurant more effectively and efficiently by computerizing meal ordering, billing
and inventory control . The system processes transaction and stores the resulting
data. Reports will be generated from these data which help the manager to make
appropriate business decisions for the restaurant.
For example, knowing the number of customers for a particular time interval, the
manager can decide whether more waiters and chefs are required.
Jo
This application helps the restaurants to do all functionalities more accurately and
faster way. This application is helping to maintain the stock and cash flows and
there are many more functionalities, like.
 To store records.
 Control orders and services.
 Billings.
 Control staff and their shifting.
 Control multiple branches.
 Helps Manager to control each part of the restaurant.
o
The main goal is to maintain the restaurant’s functions in an effective and
accurate manner and also it is reducing the use of manual entries. This software helps
food orders to maintain day to day records in system. It is keeping a proper record of
the database.

How Restaurants Work :


Do you know what it takes for your food to get to your restaurant table? As a
restaurant guest, you simply order, wait, eat, and pay. But the work of many
different people is necessary to get your meal to the table-as well as computer
support to manage payments, track inventory, and create various types of
financial reports. In this unit, you will learn what it takes to make your meal
happen. Restaurant managers need to understand the function and

Department of Computer Science


Restaurant System 3

responsibilities of each of their employees and how these people work together
to accomplish tasks in the restaurant, whether it’s a fast food place or a fine
dining establishment

Learning Objectives:
• Identify the different roles in the resturant mangment.
• Understand how the point-of-sale system works.
• Explore how the restaurant manager functions .

Managing a Restaurant Staff:


One of a restaurant manager’s main tasks is managing the restaurant staff. In
this unit, you will learn how to handle hiring, manage problems, and even
terminate employees when needed. You’ll also learn how to make and manage
employee schedules and respond to employee needs and concerns. These
management skills are essential to keeping your restaurant running smoothly,
Jo
and these skills can help you to earn the respect, admiration, and friendship of
your staff. A good manager helps to create a happy and loyal staff that works
hard to create a pleasant experience for your guests.

Learning Objectives:
• Make good hiring decisions.
• Recognize the importance of teamwork.
• Understand how to make a work schedule.
• Manage employee problems and challenges.
o
Professional Communications and Ethics in Restaurant Management :
What do you do when a customer complains? Restaurant managers have to
to handle the tough conversations, whether it’s with an unhappy customer or an
employee you need to let go. In this unit, you’ll learn strategies for effectively
communicating with your customers directly and through your marketing
materials. You’ll also learn how to communicate with your employees and use
active listening skills to support your employees. This unit will provide you with
information about ethics in the restaurant management industry and about ways
to help and support both your employees and yourself.

Department of Computer Science


Restaurant System 4

Learning Objectives:
• Use active listening skills to hear and communicate effectively.
• Discuss the importance of nonverbal communication.
• Understand the ethical guidelines appropriate for a restaurant
manager.
• Recognize the importance of employee-friendly policies.

1.1 PROBLEM STATEMENT:


Many restaurants is storing all of their data in manual way. They have huge
number of customers daily. So because large number of customers, they need the help
of some features so they can maintain and stores the records accurately. For managers
it is difficult to view the tables, orders, kitchen, reception and the counter
simultaneously.
Jo
They need full-fledged software to maintain their day to day transactions,
orders and also regular update on records, cash transaction, daily staffs reports,
customers feedbacks etc. In the existing system, entering all the details are done
manually, it is taking lots of time and also there are chances for mistakes.

1.2 DOMAIN STUDY


Food Ordering is the profession of managing a restaurant. The management is
mainly divided into three broader section.
o
 Floor management: 'Floor management' includes managing staff who give
services to customers and allocate the duties of opening and closing restaurant.
The manager is responsible for making sure his or her staff is following the
service standards and health and safety regulations. The manager is the most
important person in the front-of-the-house environment, since it is up to him
or her to motivate the staff and give them job satisfaction. The manager also
looks after and guides the personal well-being of the staff, since it makes the
work force stronger and more profitable.

Department of Computer Science


Restaurant System 5

 Kitchen Management: 'Kitchen Management' includes the managing staff


working in the kitchen, especially the head chef. The kitchen is the most
important part of the business and the main reason customers patronize the
restaurant. Managing the kitchen staff helps to control food quality. As most
commercial kitchens are a closed environment, the staff may become bored or
tired from the work. Without proper management, this often results in an
inconsistent food product. Kitchen management involves most importantly,
cost control and budgeting. Meeting KPI's are a must for a restaurant to
survive. Head chefs must instill and teach money management to apprentices.
This is as important as teaching the art and skills of cookery.

 Administration: 'Administration' includes stock controlling, scheduling


rotations, budgeting the labor costs, balancing cost and profit according to
Jo
seasonality, surveying and hiring staff, and maintenance of the commercial
kitchen equipment.
o
Department of Computer Science
Restaurant System 6

Jo
o
Department of Computer Science
Restaurant System 7

1- REQUIREMENT

 Hardware :
Jo
 Software :
o
Department of Computer Science
Restaurant System 8

2-FLOW CHART

Jo
o
Department of Computer Science
Restaurant System 9

3-USE-CASE

Jo
o
Department of Computer Science
Restaurant System 10

4-SEQUENCE

 Manager - Departement :

Jo
o
Department of Computer Science
Restaurant System 11

 Manager - Employee :

Jo
o
Department of Computer Science
Restaurant System 12

 Manager - Reports :

Jo
o
Department of Computer Science
Restaurant System 13

 Casher - Order :

Jo
o
Department of Computer Science
Restaurant System 14

 Casher - Bill :

Jo
o
Department of Computer Science
Restaurant System 15

5-ACTIVITY

 Employee :-

1-Chef :
Jo
o
Department of Computer Science
Restaurant System 16

2-Casher :

Jo
o
Department of Computer Science
Restaurant System 17

3-Manager :

Jo
o
Department of Computer Science
Restaurant System 18

4-Waiter :

Jo
o
Department of Computer Science
Restaurant System 19

Jo
 Customer :-

o
Department of Computer Science
Restaurant System 20

 Department :-

Jo
o
Department of Computer Science
Restaurant System 21

Jo
 Table :-

o
Department of Computer Science
Restaurant System 22

 Item :-

Jo
o
Department of Computer Science
Restaurant System 23

 Meal :-

Jo
o
Department of Computer Science
Restaurant System 24

Jo
 Order :-

o
Department of Computer Science
Restaurant System 25

 Bill :-

Jo
o
Department of Computer Science
Restaurant System 26

6-CLASS-DIAGRAM

Jo
o
Department of Computer Science
Restaurant System 27

DATA BASE
Jo
DESIGN
o
Department of Computer Science
Restaurant System 28

Jo
o
Department of Computer Science
Restaurant System 29

Jo
o
Department of Computer Science
Restaurant System 30

Jo
o
Department of Computer Science
Restaurant System 31

Jo
o
Department of Computer Science
Restaurant System 32

Jo
o
DATA
DICTIONARY

Department of Computer Science


Restaurant System 33

Data Dictionary

A Data Dictionary provides information about each attributes ,


also referred to as fields , of a Data Model .

An attribute is a place in the DataBase that holds information .


Jo
Table Name :- the name of the table .
Primary Key:- the primary key (P.K) of the table .

Description :- the attributes and description of the table .


o
Department of Computer Science
Restaurant System
34

Table Name :- Login .


Primary Key:- User_Name .

Description :- This table Is use to store username and Password of


Jo Admin .

o
Department of Computer Science
Restaurant System 35

Table Name :- Employee .


Primary Key:- Id .

Description :- This table Is use to store there employee's information .


Jo
o
Department of Computer Science
Restaurant System 36

Table Name :- Employee_Phone .


Primary Key:- Employee_Id .

Description :- This table Is use to store there employee's Phone .


Jo
o
Department of Computer Science
Restaurant System 37

Table Name :- Department .


Primary Key:- Id .

Description :- This table Is use to store there Department name .


Jo
o
Department of Computer Science
Restaurant System 38

Table Name :- Table .


Primary Key:- Table_No .

Description :- This table Is use to store there Tables number


and information .
Jo
o
Department of Computer Science
Restaurant System 39

Table Name :- Item .


Primary Key:- Id .

Description :- This table Is use to store there Item information .


Jo
o
Department of Computer Science
Restaurant System 40

Table Name :- Meal .


Primary Key:- Id .

Description :- This table Is use to store there Meal information .


Jo
o
Department of Computer Science
Restaurant System 41

Table Name :- Meal_Item .


Primary Key:- Meal_Id .

Description :- This table Is use to store there Meal_Id and


Item_Id .
Jo
o
Department of Computer Science
Restaurant System 42

Table Name :- Customer .


Primary Key:- Id .

Description :- This table Is use to store there Customer's information .


Jo
o
Department of Computer Science
Restaurant System 43

Table Name :- Customer_Phone .


Primary Key:- Customer_Id .

Description :- This table Is use to store there Customer's Phone .


Jo
o
Department of Computer Science
Restaurant System 44

Table Name :- Order .


Primary Key:- Order_No.

Description :- This table Is use to store All the Information Which


Are Needed To Take Order .
Jo
o
Department of Computer Science
Restaurant System 45

Table Name :- Bill.


Primary Key:- Bill_No .

Description :- This table Is use to store the information about


Order List (Bill) .
Jo
o
Department of Computer Science
Restaurant System 46

DATABASE
RELATION
Jo
o
Department of Computer Science
Restaurant System 47

DataBase Relation
Jo
o
Department of Computer Science
Restaurant System 48

Jo
 Bill - Employee :

o
Department of Computer Science
Restaurant System 49

Jo
 Customer - Bill :

o
Department of Computer Science
Restaurant System 50

 Order - Bill :
Jo
o
Department of Computer Science
Restaurant System 51

Jo
 Table - Bill :

o
Department of Computer Science
Restaurant System 52

Jo
 Customer - Employee :

o
Department of Computer Science
Restaurant System 53

 Customer - Order :
Jo
o
Department of Computer Science
Restaurant System 54

Jo
 Customer_Phone - Customer :

o
Department of Computer Science
Restaurant System 55

Jo
 Department - Employee :

o
Department of Computer Science
Restaurant System 56

 Order - Employee :
Jo
o
Department of Computer Science
Restaurant System 57

 Employee_Phone - Employee :
Jo
o
Department of Computer Science
Restaurant System 58

Jo
 Item - Employee :

o
Department of Computer Science
Restaurant System 59

 Order - Item :
Jo
o
Department of Computer Science
Restaurant System 60

 Meal - Employee :
Jo
o
Department of Computer Science
Restaurant System 61

 Order - Meal :
Jo
o
Department of Computer Science
Restaurant System 62

Jo
 Meal - Meal_Item - Item :

o
Department of Computer Science
Restaurant System 63

 Order - Table :
Jo
o
Department of Computer Science
Restaurant System 64

 Table - Employee :
Jo
o
Department of Computer Science
Restaurant System 65

Jo
o
Department of Computer Science
Restaurant System 66

 Login :

From this page you can Login by our user-name and the password to access
in Restaurant System .

If admin insert wrong Username and Password , that display message


"invalid Username or Passward ... Try Agin" .
Jo
o
Department of Computer Science
Restaurant System 67

 Main Page :

This is Admin Side Home Page and display all Restaurant Forms .

Jo
o
Department of Computer Science
Restaurant System 68

Jo
o
Department of Computer Science
Restaurant System 69

 Department :

1-Add Department
Jo
o
Department of Computer Science
Restaurant System 70

2-Delete Department

Jo
o
Department of Computer Science
Restaurant System 71

 Item :

1-Add Item

Jo
o
Department of Computer Science
Restaurant System 72

2-Update Item

Jo
o
Department of Computer Science
Restaurant System 73

3-Delete Item

Jo
o
Department of Computer Science
Restaurant System 74

 Meal :

1-Add Meal
Jo
o
Department of Computer Science
Restaurant System 75

2-Update Meal

Jo
o
Department of Computer Science
Restaurant System 76

3-Delete Meal

Jo
o
Department of Computer Science
Restaurant System 77

 Employee :

1-Add Employee
Jo
o
Department of Computer Science
Restaurant System 78

2-Update Employee

Jo
o
Department of Computer Science
Restaurant System 79

3-Delete Employee

Jo
o
Department of Computer Science
Restaurant System 80

 Order :

1-Add Order
Jo
o
Department of Computer Science
Restaurant System 81

2-Update Order

Jo
o
Department of Computer Science
Restaurant System 82

3-Delete Order

Jo
o
Department of Computer Science
Restaurant System 83

 Bill :

1-Add Bill
Jo
o
Department of Computer Science
Restaurant System 84

2-Update Bill

Jo
o
Department of Computer Science
Restaurant System 85

3-Delete Bill

Jo
o
Department of Computer Science
Restaurant System 86

IMPLEMENTATION
Jo
o
Department of Computer Science
Restaurant System 87

DataBase Layer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DBLayer
{
static class DBL
{
// Conncted : Almost using with select Query . Retrive data
//, Disconnedted : Almost using to Modify the data .

static String Constring;

static DBL()
Jo
{

Constring = "Data Source=.;Initial Catalog=Resturant Prot;Integrated


Security=True";
}

// Disconnected Model
/// <summary>
/// Almost using to Retrive the data from DB.
/// </summary>
/// <param name="SelectCommand">Select Command</param>
/// <exception cref="throw Exeption for Null Table">.</exception>
/// <returns></returns>
o
public static DataTable ExecuteQuery(String SelectCommand) //
Method Name : ConnectExecuteQuery()
{

SqlConnection con = new SqlConnection(Constring);


SqlDataAdapter adapter = new SqlDataAdapter(SelectCommand,
con);
DataTable dt = new DataTable();
adapter.Fill(dt);
if (dt.Rows.Count > 0)
{
return dt;
}
else
{
throw new Exception("not Exepected to return Null Table...");
}

Department of Computer Science


Restaurant System 88

// Connected Model
/// <summary>
/// Almost using with insert , update , delete.
/// </summary>
/// <param name="Command">insert , update , delete Command </param>
/// <exception cref="throw Exeption no effected rows"> </exception>
/// <returns></returns>
public static int ExecuteNonQuery(String Command)
{

SqlConnection con = new SqlConnection(Constring);


SqlCommand cmd = new SqlCommand(Command, con);
con.Open();
int result = cmd.ExecuteNonQuery();
con.Close();
if (result > 0)
return result;
else
throw new Exception("No effected Row... ");

}
Jo
/// <summary>
/// Almost using to retriving one cell.
/// </summary>
/// <param name="selectCommand">select Command </param>
/// <exception cref="throw Exeption exepted one cell..."></exception>
/// <returns></returns>
public static object Executescaler(String selectCommand)
{

object Result = null;


DataTable dt = ExecuteQuery(selectCommand);
if (dt.Rows.Count > 0)
{
o
Result = dt.Rows[0][0];
return Result;
}
else
{
throw new Exception("Exepted One Cell...");
}

}
}

Department of Computer Science


Restaurant System 89

Data Access Layer


 Employee :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using Resturant_Prototype_2.DBLayer;
using Resturant_Prototype_2.DELayer;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Resturant_Prototype_2.DALayer
Jo
{
class EmployeeDAL
{
// GetAll , GetById , Insert , Update , Delete
public static List<Employee> GetAll()
{
// Connect to DB
DataTable dt = DBL.ExecuteQuery("select * from Employee");

List<Employee> emp = new List<Employee>();

for (int i = 0; i < dt.Rows.Count; i++)


{
emp.Add(new Employee(int.Parse(dt.Rows[i]["Id"].ToString()),
o
dt.Rows[i]["F_Name"].ToString(), dt.Rows[i]["L_Name"].ToString(),
dt.Rows[i]["BirthOfDate"].ToString(), dt.Rows[i]["Gender"].ToString(),
float.Parse(dt.Rows[i]["Salary"].ToString()),
dt.Rows[i]["Address"].ToString(), int.Parse(dt.Rows[i]["Dep_Id"].ToString()),
int.Parse(dt.Rows[i]["Manager_Id"].ToString())));
}
return emp;
}

public static Employee GetById(int id)


{
// connected with database
DataTable dt = DBL.ExecuteQuery(String.Format("select * from
Employee where Id = {0}", id));
Employee emp;

Department of Computer Science


Restaurant System 90

//Department d = new Department((int)dt.Rows[0]["Id"],


dt.Rows[0]["Name"].ToString());
emp = new Employee(int.Parse(dt.Rows[0]["Id"].ToString()),
dt.Rows[0]["F_Name"].ToString(), dt.Rows[0]["L_Name"].ToString(),
dt.Rows[0]["BirthOfDate"].ToString(), dt.Rows[0]["Gender"].ToString(),
float.Parse(dt.Rows[0]["Salary"].ToString()), dt.Rows[0]["Address"].ToString(),
int.Parse(dt.Rows[0]["Dep_Id"].ToString()),
int.Parse(dt.Rows[0]["Manager_Id"].ToString()));
return emp;
}

public static Boolean Update(int id, String f_name, String l_name, String
birthofdate, String gender, float salary, String address, int manager_id, int Dep_id)
{
int RowUpdate = DBL.ExecuteNonQuery(String.Format("update Employee set
F_Name = '{0}', L_Name = '{1}', BirthOfDate = '{2}', Gender = '{3}', Salary = {4},
Address = '{5}', Manager_ID = {6}, Dep_Id = {7} where Id = {8} ", f_name, l_name,
birthofdate, gender, salary, address, manager_id, Dep_id, id));
Boolean result = false;
if (RowUpdate > 0)
result = true;
else
Jo
result = false;
return result;
}

public static Boolean Delete(int id)


{
int DeletedRow = DBL.ExecuteNonQuery(String.Format("Delete from
Employee where Id = {0}", id));
Boolean result = false;
if (DeletedRow > 0)
result = true;
else
result = false;
return result;
o
}

public static Boolean insert(String f_name, String l_name, String birthofdate,


String gender, float salary, String address, int manager_id, int Dep_id)
{
int InsertedRow = DBL.ExecuteNonQuery(String.Format("insert into Employee
values('{0}','{1}','{2}','{3}',{4},'{5}',{6},{7})", f_name, l_name, birthofdate, gender,
salary, address, manager_id, Dep_id));
Boolean result = false;
if (InsertedRow > 0)
result = true;
else
result = false;
return result;

}
}
}

Department of Computer Science


Restaurant System 91

 Department :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using Resturant_Prototype_2.DBLayer;
using Resturant_Prototype_2.DELayer;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DALayer
{
class DepartmentDAL
{
// GetAll , GetById , Insert , Update , Delete
public static List<Department> GetAll()
{
// Connect to DB
Jo
DataTable dt = DBL.ExecuteQuery("select * from Department");
List<Department> dep = new List<Department>();

for (int i = 0; i < dt.Rows.Count; i++)


{
dep.Add(new Department(int.Parse(dt.Rows[i]["Id"].ToString()),
dt.Rows[i]["Name"].ToString()));
}
return dep;
}

public static Department GetById(int id)


{
// connected with database
o
DataTable dt = DBL.ExecuteQuery(String.Format("select * from Department
where Id = {0}", id));
Department dep;
dep = new Department(int.Parse(dt.Rows[0]["Id"].ToString()),
dt.Rows[0]["Name"].ToString());

return dep;
}

public static Department GetByIdOnlyId(int id)


{
// connected with database
DataTable dt = DBL.ExecuteQuery(String.Format("select Id from
Department where Id = {0}", id));
Department dep;
dep = new Department(int.Parse(dt.Rows[0]["Id"].ToString()),
dt.Rows[0]["Name"].ToString());
return dep;
}

Department of Computer Science


Restaurant System 92

public static Boolean Update(int id, String name)


{
int RowUpdate = DBL.ExecuteNonQuery(String.Format("update Department
set Name = '{0}' where Id = {1}", name, id));
Boolean result = false;
if (RowUpdate > 0)
result = true;
else
result = false;
return result;

public static Boolean Delete(int id)


{
int DeletedRow = DBL.ExecuteNonQuery(String.Format("Delete from
Department where Id = {0}", id));
Boolean result = false;
if (DeletedRow > 0)
result = true;
else
Jo
result = false;
return result;

public static Boolean insert(int id, String name)


{
int InsertedRow = DBL.ExecuteNonQuery(String.Format("insert into
Department values('{1}' )", name));
Boolean result = false;
if (InsertedRow > 0)
result = true;
else
result = false;
o
return result;

}
}
}

Department of Computer Science


Restaurant System 93

 Table :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using Resturant_Prototype_2.DBLayer;
using Resturant_Prototype_2.DELayer;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DALayer
{
class TableDAL
{
public static List<Table> GetAll()
{
// Connect to DB
DataTable dt = DBL.ExecuteQuery("select * from Table ");
Jo
List<Table> Table = new List<Table>();
for (int i = 0; i < dt.Rows.Count; i++)
{
Table.Add(new Table(int.Parse(dt.Rows[i]["Table_No"].ToString()),
int.Parse(dt.Rows[i]["Water_Id"].ToString())));

}
return Table;
}

public static Table GetById(int table_no)


{
DataTable dt = DBL.ExecuteQuery(String.Format("select * from Table where
o
Table_No = {0}", table_no));
Table tab = new Table((int)dt.Rows[0]["Table_No"],
int.Parse(dt.Rows[0]["Water_Id"].ToString()));
return tab;
}

public static Boolean Update(int Table_No, int Water_Id)


{
int RowUpdate = DBL.ExecuteNonQuery(String.Format("update Table set
Water_Id= {0} where Table_No = {1} ", Water_Id, Table_No));
Boolean result = false;
if (RowUpdate > 0)
result = true;
else
result = false;
return result;

Department of Computer Science


Restaurant System 94

public static Boolean Delete(int id)


{
int DeletedRow = DBL.ExecuteNonQuery(String.Format("Delete from
Table where Table_No = {0} ", id));
Boolean result = false;
if (DeletedRow > 0)
result = true;
else
result = false;
return result;

public static Boolean insert(int Table_no, int Water_Id)


{
int InsertedRow = DBL.ExecuteNonQuery(String.Format("insert into
Table values( {0}, {1} ", Water_Id, Water_Id));
Boolean result = false;
if (InsertedRow > 0)
Jo
result = true;
else
result = false;
return result;

}
}
o
Department of Computer Science
Restaurant System 95

 Item :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using Resturant_Prototype_2.DBLayer;
using Resturant_Prototype_2.DELayer;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DALayer
{
class ItemDAL
{
public static List<Meal> GetAll()
{
// Connect to DB
DataTable dt = DBL.ExecuteQuery("select * from Item ");
Jo
List<Meal> Meal = new List<Meal>();
for (int i = 0; i < dt.Rows.Count; i++)
{

Meal.Add(new Meal(int.Parse(dt.Rows[i]["Id"].ToString()),
dt.Rows[i]["Name"].ToString(), dt.Rows[i]["Description"].ToString(),
float.Parse(dt.Rows[i]["Price"].ToString()),
int.Parse(dt.Rows[i]["Cashire_Id"].ToString()),
int.Parse(dt.Rows[i]["Order_No"].ToString())));

}
return Meal;
}
o
public static Meal GetById(int id)
{
// connected with database
DataTable dt = DBL.ExecuteQuery(String.Format("select * from Item where
Id = {0}", id));
Meal Meal;
Meal = Meal = new Meal(int.Parse(dt.Rows[0]["Id"].ToString()),
dt.Rows[0]["Name"].ToString(), dt.Rows[0]["Description"].ToString(),
float.Parse(dt.Rows[0]["Price"].ToString()),
int.Parse(dt.Rows[0]["Cashire_Id"].ToString()),
int.Parse(dt.Rows[0]["Order_No"].ToString()));

return Meal;
}

Department of Computer Science


Restaurant System 96

public static Boolean Update(int id, String name, String description, int price, int
cashire, int order_No)
{
int RowUpdate = DBL.ExecuteNonQuery(String.Format("update Item set
Name = '{0}', Description = '{1}', Price = {2}, Cashire_Id = {3}, Order_No= {4}
where Id = {5} ", name, description, price, cashire, order_No, id));
Boolean result = false;
if (RowUpdate > 0)
result = true;
else
result = false;
return result;

public static Boolean Delete(int id)


{
int DeletedRow = DBL.ExecuteNonQuery(String.Format("Delete from Item
where Id = {0}", id));
Jo
Boolean result = false;
if (DeletedRow > 0)
result = true;
else
result = false;
return result;

public static Boolean insert(int id, String name, String description, int price, int
cashire, int order_No)
{
int InsertedRow = DBL.ExecuteNonQuery(String.Format("insert into Item
o
values('{0}','{1}',{2},{3},{4})", name, description, price, cashire, order_No));
Boolean result = false;
if (InsertedRow > 0)
result = true;
else
result = false;
return result;

}
}
}

Department of Computer Science


Restaurant System 97

 Meal :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using Resturant_Prototype_2.DBLayer;
using Resturant_Prototype_2.DELayer;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DALayer
{
class MealDAL
{
public static List<Meal> GetAll()
{
// Connect to DB
DataTable dt = DBL.ExecuteQuery("select * from Meal ");
Jo
List<Meal> Meal = new List<Meal>();
for (int i = 0; i < dt.Rows.Count; i++)
{

Meal.Add(new Meal(int.Parse(dt.Rows[i]["Id"].ToString()),
dt.Rows[i]["Name"].ToString(), dt.Rows[i]["Description"].ToString(),
float.Parse(dt.Rows[i]["Price"].ToString()),
int.Parse(dt.Rows[i]["Cashire_Id"].ToString()),
int.Parse(dt.Rows[i]["Order_No"].ToString())));

}
return Meal;
}
o
public static Meal GetById(int id)
{
// connected with database
DataTable dt = DBL.ExecuteQuery(String.Format("select * from Meal where
Id = {0}", id));
Meal Meal;

Meal = Meal = new Meal(int.Parse(dt.Rows[0]["Id"].ToString()),


dt.Rows[0]["Name"].ToString(), dt.Rows[0]["Description"].ToString(),
float.Parse(dt.Rows[0]["Price"].ToString()),
int.Parse(dt.Rows[0]["Cashire_Id"].ToString()),
int.Parse(dt.Rows[0]["Order_No"].ToString()));

return Meal;
}

Department of Computer Science


Restaurant System 98

public static Boolean Update(int id, String name, String description, int price, int
cashire, int order_No)
{
int RowUpdate = DBL.ExecuteNonQuery(String.Format("update Meal set
Name = '{0}', Description = '{1}', Price = {2}, Cashire_Id = {3}, Order_No= {4}
where Id = {5} ", name, description, price, cashire, order_No,id));
Boolean result = false;
if (RowUpdate > 0)
result = true;
else
result = false;
return result;

public static Boolean Delete(int id)


{
int DeletedRow = DBL.ExecuteNonQuery(String.Format("Delete from Meal
where Id = {0}", id));
Jo
Boolean result = false;
if (DeletedRow > 0)
result = true;
else
result = false;
return result;

public static Boolean insert(int id, String name, String description, int price, int
cashire, int order_No)
{
int InsertedRow = DBL.ExecuteNonQuery(String.Format("insert into Meal
o
values(,'{0}','{1}',{2},{3},{4})", name, description, price, cashire, order_No));
Boolean result = false;
if (InsertedRow > 0)
result = true;
else
result = false;
return result;

}
}

Department of Computer Science


Restaurant System 99

 Customer :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using Resturant_Prototype_2.DBLayer;
using Resturant_Prototype_2.DELayer;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DALayer
{
class CustomerDAL
{
public static List<Customer> GetAll()
{
// Connect to DB
DataTable dt = DBL.ExecuteQuery("select * from Customer ");
Jo
List<Customer> Cust = new List<Customer>();

for (int i = 0; i < dt.Rows.Count; i++)


{
//d = new Department((int)dt.Rows[i]["Id"],
dt.Rows[i]["Name"].ToString());
Cust.Add(new Customer(int.Parse(dt.Rows[i]["Id"].ToString()),
dt.Rows[i]["Name"].ToString(), dt.Rows[i]["Address"].ToString(),
int.Parse(dt.Rows[i]["Water_Id"].ToString())));
}
return Cust;
}

public static Customer GetById(int id)


o
{
DataTable dt = DBL.ExecuteQuery(String.Format("select * from Customer
where Id = {0} ", id));
Customer cust = new Customer(int.Parse(dt.Rows[0]["Id"].ToString()),
dt.Rows[0]["Name"].ToString(), dt.Rows[0]["Address"].ToString(),
int.Parse(dt.Rows[0]["Water_Id"].ToString()));
return cust;
}

public static Customer GetByName(String Name)


{
DataTable dt = DBL.ExecuteQuery(String.Format("select * from Customer
where Name = {0} ", Name));
Customer cust = new Customer(int.Parse(dt.Rows[0]["Id"].ToString()),
dt.Rows[0]["Name"].ToString(), dt.Rows[0]["Address"].ToString(),
int.Parse(dt.Rows[0]["Water_Id"].ToString()));
return cust;
}

Department of Computer Science


Restaurant System 100

public static Customer GetByAddress(String Address)


{
DataTable dt = DBL.ExecuteQuery(String.Format("select * from Customer
where Address = {0} ", Address));
Customer cust = new Customer(int.Parse(dt.Rows[0]["Id"].ToString()),
dt.Rows[0]["Name"].ToString(), dt.Rows[0]["Address"].ToString(),
int.Parse(dt.Rows[0]["Water_Id"].ToString()));
return cust;
}

public static Boolean Update(int id, String name, String Address, int Water_Id)
{
int RowUpdate = DBL.ExecuteNonQuery(String.Format("update Customer set
Name = '{0}', Address = '{1}', Water_Id= {2} where Id = {2} ", name, Address,
Water_Id, id));
Boolean result = false;
if (RowUpdate > 0)
result = true;
else
result = false;
Jo
return result;

public static Boolean Delete(int id)


{
int DeletedRow = DBL.ExecuteNonQuery(String.Format("Delete from
Customer where Id = {0}", id));
Boolean result = false;
if (DeletedRow > 0)
result = true;
else
result = false;
return result;
o
}

public static Boolean insert( String name, String Address, int Water_Id)
{
int InsertedRow = DBL.ExecuteNonQuery(String.Format("insert into Customer
values('{0}','{1}',{2})", name, Address, Water_Id));
Boolean result = false;
if (InsertedRow > 0)
result = true;
else
result = false;
return result;

}
}
}

Department of Computer Science


Restaurant System 101

 Order :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using Resturant_Prototype_2.DBLayer;
using Resturant_Prototype_2.DELayer;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DALayer
{
class OrderDAL
{
// GetAll , GetById , Insert , Update , Delete
public static List<Order> GetAll()
{
// Connect to DB
Jo
DataTable dt = DBL.ExecuteQuery("select * from Order");
List<Order> order = new List<Order>();
for (int i = 0; i < dt.Rows.Count; i++)
{
//Error To do That .
//d = new Department((int)dt.Rows[i]["Id"],
dt.Rows[i]["Name"].ToString());
//emp = new Employee((int)dt.Rows[i]["Id"],
dt.Rows[i]["F_Name"].ToString(), dt.Rows[i]["L_Name"].ToString(),
(DateTime)dt.Rows[i]["BirthOfDate"], (Gender)dt.Rows[i]["Gender"],
(float)dt.Rows[i]["Salary"], dt.Rows[i]["Address"].ToString(),
(uint)dt.Rows[i]["Manager_Id"], d);
//cust = new Customer((int)dt.Rows[i]["Id"],
dt.Rows[i]["Name"].ToString(), dt.Rows[i]["Address"].ToString(), emp);
o
order.Add(new Order(int.Parse(dt.Rows[i]["Order_No"].ToString()),
float.Parse(dt.Rows[i]["Price"].ToString()),
int.Parse(dt.Rows[i]["Casher_Id"].ToString()),
int.Parse(dt.Rows[i]["Table_No"].ToString()),
int.Parse(dt.Rows[i]["Customer_Id"].ToString()),
dt.Rows[i]["Customer_Name"].ToString(),
dt.Rows[i]["Customer_Address"].ToString()));

}
return order;
}

Department of Computer Science


Restaurant System 102

public static Order GetById(int order_no)


{

DataTable dt = DBL.ExecuteQuery(String.Format("select * from Order where


Order_No = {0}", order_no));
Order order = new Order(int.Parse(dt.Rows[0]["Order_No"].ToString()),
float.Parse(dt.Rows[0]["Price"].ToString()),
int.Parse(dt.Rows[0]["Casher_Id"].ToString()),
int.Parse(dt.Rows[0]["Table_No"].ToString()),
int.Parse(dt.Rows[0]["Customer_Id"].ToString()),
dt.Rows[0]["Customer_Name"].ToString(),
dt.Rows[0]["Customer_Address"].ToString());
return order;
}

public static Order GetByPrice(float Price)


{
DataTable dt = DBL.ExecuteQuery(String.Format("select * from Order where
Price = {0}", Price));
Order order = new Order(int.Parse(dt.Rows[0]["Order_No"].ToString()),
float.Parse(dt.Rows[0]["Price"].ToString()),
int.Parse(dt.Rows[0]["Casher_Id"].ToString()),
int.Parse(dt.Rows[0]["Table_No"].ToString()),
Jo
int.Parse(dt.Rows[0]["Customer_Id"].ToString()),
dt.Rows[0]["Customer_Name"].ToString(),
dt.Rows[0]["Customer_Address"].ToString());
return order;
}

public static Boolean Update(int order_no, float price, int cashre_Id, int
table_no, int customer_id, String customer_name, String customer_address)
{
int RowUpdate = DBL.ExecuteNonQuery(String.Format("update Order set
Price = {0}, Casher_Id= {1}, Table_No= {2}, Customer_Id= {3} , Customer_Name
= '{4}', Customer_Address = '{5}' where Order_No = {6} ", price, cashre_Id,
table_no, customer_id, customer_name, customer_address, order_no));
Boolean result = false;
o
if (RowUpdate > 0)
result = true;
else
result = false;
return result;
}

public static Boolean Delete(int Order_No)


{
int DeletedRow = DBL.ExecuteNonQuery(String.Format("Delete from Order
where Order_No = {0}", Order_No));
Boolean result = false;
if (DeletedRow > 0)
result = true;
else
result = false;
return result;
}

Department of Computer Science


Restaurant System 103

public static Boolean insert( float price, Int32 cashre_Id, Int32 table_no, Int32
customer_id, String customer_name, String customer_address)
{
int InsertedRow = DBL.ExecuteNonQuery(String.Format("insert into Order
values( {0} , {1} , {2} , {3} ,'{4}','{5}' )", price, cashre_Id, table_no, customer_id,
customer_name, customer_address));
Boolean result = false;
if (InsertedRow > 0)
result = true;
else
result = false;
return result;

}
}
Jo
o
Department of Computer Science
Restaurant System 104

 Bill :-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using Resturant_Prototype_2.DBLayer;
using Resturant_Prototype_2.DELayer;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DALayer
{
class BillDAL
{
// GetAll , GetById , Insert , Update , Delete
public static List<Bill> GetAll()
{
// Connect to DB
DataTable dt = DBL.ExecuteQuery("select * from Bill");
Jo
List<Bill> bill = new List<Bill>();

for (int i = 0; i < dt.Rows.Count; i++)


{
//d = new Department((int)dt.Rows[i]["Id"],
dt.Rows[i]["Name"].ToString());
bill.Add(new Bill((int)dt.Rows[i]["Bill_No"],
float.Parse(dt.Rows[i]["Total_Price"].ToString()), dt.Rows[i]["Deatils"].ToString(),
dt.Rows[i]["Date"].ToString(), dt.Rows[i]["Time"].ToString(),
int.Parse(dt.Rows[i]["Cashre_Id"].ToString()),
int.Parse(dt.Rows[i]["Order_No"].ToString()),
float.Parse(dt.Rows[i]["Order_Price"].ToString()),
int.Parse(dt.Rows[i]["Customer_Id"].ToString()),
dt.Rows[i]["Customer_Name"].ToString(),
o
dt.Rows[i]["Customer_Address"].ToString(),
int.Parse(dt.Rows[i]["Table_No"].ToString())));

}
return bill;
}

public static Bill GetById(int bill_no)


{
// connected with database
DataTable dt = DBL.ExecuteQuery(String.Format("select * from Bill where
Bill_No = {0}", bill_no));
Bill bill;
bill = new Bill((int)dt.Rows[0]["Bill_No"],
float.Parse(dt.Rows[0]["Total_Price"].ToString()), dt.Rows[0]["Deatils"].ToString(),
dt.Rows[0]["Date"].ToString(), dt.Rows[0]["Time"].ToString(),
int.Parse(dt.Rows[0]["Cashre_Id"].ToString()),

Department of Computer Science


Restaurant System 105

int.Parse(dt.Rows[0]["Order_No"].ToString()),
float.Parse(dt.Rows[0]["Order_Price"].ToString()),
int.Parse(dt.Rows[0]["Customer_Id"].ToString()), dt.Rows[0]["Customer_Name"].ToString(),
dt.Rows[0]["Customer_Address"].ToString(), int.Parse(dt.Rows[0]["Table_No"].ToString()));
return bill;
}

public static Boolean Update(int bill_no, float total_price, String deatils, String date, String
time, int cashie_id, int order_no, float order_price, int customer_id, String customer_naem, String
customer_address, int table_no)
{
int RowUpdate = DBL.ExecuteNonQuery(String.Format("update Bill set Total_Price =
{0}, Deatils= '{1}', Date = '{2}', Time = '{3}', Cashre_Id = {4}, Order_No = {5}, Order_Price =
{6}, Customer_Id = {7}, Customer_Name = '{8}' , Customer_Address '{9}' , Table_No = {10}
where Bill_No = {11} ", bill_no, total_price, deatils, date, time, cashie_id, order_no, order_price,
customer_id, customer_naem, customer_address, table_no, bill_no));
Boolean result = false;
if (RowUpdate > 0)
result = true;
else
result = false;
return result;
Jo
}

public static Boolean Delete(int bill_no)


{
int DeletedRow = DBL.ExecuteNonQuery(String.Format("Delete from Bill where Bill_No
= {0}", bill_no));
Boolean result = false;
if (DeletedRow > 0)
result = true;
else
result = false;
return result;

public static Boolean insert(int bill_no, float total_price, String deatils, String date, String
o
time, int cashie_id, int order_no, float order_price, int customer_id, String customer_naem, String
customer_address, int table_no)
{
int RowUpdate = DBL.ExecuteNonQuery(String.Format("insert into Bill
Values(Total_Price = {0}, Deatils= '{1}', Date = '{2}', Time = '{3}', Cashre_Id = {4}, Order_No
= {5}, Order_Price = {6}, Customer_Id = {7}, Customer_Name = '{8}' , Customer_Address '{9}' ,
Table_No = {10}) ", bill_no, total_price, deatils, date, time, cashie_id, order_no, order_price,
customer_id, customer_naem, customer_address, table_no));
Boolean result = false;
if (RowUpdate > 0)
result = true;
else
result = false;
return result;

}
}
}

Department of Computer Science


Restaurant System 106

Data Entity Layer


 Employee :-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DELayer
{
class Employee
{
// Variable, properites .
public int? Id { get; set; } // having get beacuse it take value in DB So, can
using .
public String F_Name { get; set; }
public String L_Name { get; set; }
public String BirhOFDate { get; set; }
Jo
public String Gender { get; set; }
public float? Salary { get; set; }
public String Address { get; set; }
public int? ManagerId { get; set; }
private int? dep_id;

public int? Dep_id


{ // Real relation
get { return dep_id; }
set { dep_id = value; }
}

// constructors ...
//do not using id , it's identical {Auto incremental in DB } in DataBase .
o
public Employee(int? id, String fname, String lname, String birthofdate,
String gender, float? salary, String Address, int? dep_ID, int? managerid)
{
this.Id = id;
this.F_Name = fname;
this.L_Name = lname;
this.BirhOFDate = birthofdate;
this.Gender = gender;
this.Salary = salary;
this.Address = Address;
this.ManagerId = managerid;
this.dep_id = dep_ID;
}
//
public Employee(int id, String fname, String lname, String gender, float
salary, int dep_Id, int managerId)
: this(id, fname, lname, null, gender, salary, null, dep_Id, managerId)
{
}

Department of Computer Science


Restaurant System 107

// Manager_Id, Department_Id
public Employee(int id, String fname, String Lname, String gender, float
salary)
: this(id, fname, Lname, null, gender, salary, null, null, null)
{
}

// Dpeartment
//public Employee(int id, String fname, String Lname, String gender, float
salary, int managerid)
// : this(id, fname, Lname, null, gender, salary, null, null, managerid)
//{
//}

//Manager_Id
public Employee(int id, String fname, String lname, String gender, float salary,
int dep_id)
: this(id, fname, lname, null, gender, salary, null, dep_id, dep_id)
{
}
Jo
//Copy Constructor
//public Employee(Employee emp) {
// // Employee emp = new Employee();
// // Employee emp1 = new Employee(emp);

// return new Employee(emp.Id, emp.F_Name, emp.L_Name,


emp.BirhOFDate, emp.Gender, emp.Salary, emp.Address, emp.ManagerId,
emp.dep_id);
//}

//methods

public override string ToString()


o
{
return String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", Id, F_Name,
L_Name, BirhOFDate, Gender, Salary, Address, ManagerId, dep_id);
}

public override bool Equals(object obj)


{
int id = (int)obj;
bool result = false;
if (this.Id == id)
result = true;
else
result = false;
return result;
}

}
}

Department of Computer Science


Restaurant System 108

 Department :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DELayer
{
class Department
{
// variables , properites
public int ID { get; set; }
public String Name { get; set; }

//private List<Employee> emp; // Fake Realation with Employee.


//public List<Employee> Emp
//{
// // Lazy Binding // need function in DAl To retrive All Employee
Jo
belongs
// get { return emp; } // to that's department .
//}

// Constructors
public Department(int id, String Name)
{
this.ID = id;
this.Name = Name;
}

//Methods
public override string ToString()
{
o
return String.Format("{0},{1}", ID, Name);
}

public override bool Equals(object obj)


{
int id = (int)obj;
Boolean Result = false;
if (this.ID == id)
Result = true;
else
Result = false;
return Result;
}

//Copy Constructor , Clone ();


}
}

Department of Computer Science


Restaurant System 109

 Table :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DELayer
{
class Table
{
public int Table_No { get; set; }

private int? water_Id;


Jo
public int? Water_Id
{
get { return water_Id; }
set { water_Id = value; }
}

public Table(int table_no, int water)


{
this.Table_No = table_no;
this.water_Id = water;
}
}
}
o
Department of Computer Science
Restaurant System 110

 Item :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DELayer
{
class Item
{
public int? Id { get; set; }
public String Name { get; set; }
public String Description { get; set; }
public float? Price { get; set; }

private int? cashire; //Real Realation


private int? order_no; //Real Realation
Jo
public int? Cashire
{
get { return cashire; }
set { cashire = value; }
}
public int? Order_No
{
get { return order_no; }
set { order_no = value; }
}

// constructor
public Item(int? id, String name, String description, float? price, int? cashire,
int? order_No)
o
{
this.Id = id;
this.Name = name;
this.Description = description;
this.Price = price;
this.cashire = cashire;
this.order_no = order_No;

public Item(String name, String description, float? price, int? cashire, int?
order_No)
: this(null, name, description, price, cashire, order_No)
{}

public Item(int id, String name, String description, float? price)


: this(id, name, description, price, null, null)
{
}

Department of Computer Science


Restaurant System 111

// Methods
public override string ToString()
{
return String.Format("{0},{1},{2},{3},{4},{5}", Id, Name, Description,
Price, cashire, order_no);
}

public override bool Equals(object obj)


{
int id = (int)obj;
Boolean result = false;
if (this.Id == id)
result = true;
else
result = false;
return result;
}

}
}
Jo
o
Department of Computer Science
Restaurant System 112

 Meal :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DELayer
{
class Meal
{
public int? Id { get; set; }
public String Name { get; set; }
public String Description { get; set; }
public float? Price { get; set; }

private int? cashire; //Real Relation .


private int? order_no; //Real Relation .
//private List<Item> items; //Fack Realation .
Jo
public int? Cashire
{
get { return cashire; }
set { cashire = value; }
}
public int? Order_No
{
get { return order_no; }
set { order_no = value; }
}

//public List<Item> Items


o
//{
// // Lazy Binding. // need method in ItemDAl to get all items
based on {meal Id }
// get { return items; }
//}

//Constructor
public Meal(int id, String name, String description, float price, int? cashire,
int? order_No)
{
this.Id = id;
this.Name = name;
this.Description = description;
this.Price = price;
this.cashire = cashire;
this.order_no = order_No;

Department of Computer Science


Restaurant System 113

public Meal(int id, String name, String description, float price)


: this(id, name, description, price, null, null)
{
}

// Methods
public override string ToString()
{
return String.Format("{0},{1},{2},{3},{4},{5}", Id, Name, Description,
Price, cashire, order_no);
}

public override bool Equals(object obj)


{
int id = (int)obj;
Boolean result = false;
if (this.Id == id)
result = true;
else
Jo
result = false;
return result;
}
}
}
o
Department of Computer Science
Restaurant System 114

 Customer :-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DELayer
{
class Customer
{
public int? ID { get; set; }
public String Name { get; set; }
public String Address { get; set; }

private int? water; // Real Realtion .

public int? Water


{
get { return water; }
set { water = value; }
}
Jo
// Constructors
public Customer(int id, String name, String address, int? water)
{
this.ID = id;
this.Name = name;
this.Address = address;
this.water = water;
}
public Customer(int id, String name, String address)
: this(id, name, address, null)
{
}
o
// Methods
public override string ToString()
{
return String.Format("{0},{1},{2},{3}", ID, Name, Address, water);
}

public override bool Equals(object obj)


{
int id = (int)obj;
Boolean resulr = false;
if (this.ID == id)
resulr = true;
else
resulr = false;
return resulr;
}
}
}

Department of Computer Science


Restaurant System 115

 Order :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DELayer
{
class Order
{
// variable & properites
public int? Order_No { get; set; } // order_No : { identity } Auto Incremental
public float? Price { get; set; }

private int? cashire; //Real Relation


private int? table_No; //Real Relation
private int? customer_Id; //Real Relation
Jo
private String customer_Name; //Real Relation
private String customer_Address; //Real Relation

public int? Cashire


{
get { return cashire; }
set { cashire = value; }
}
public int? Table_No
{
get { return table_No; }
set { table_No = value; }
}
public int? Customer_Id
o
{
get { return customer_Id; }
set { customer_Id = value; }
}
public String Customer_Name
{
get { return customer_Name; }
set { customer_Name = value; }
}
public String Customer_Address
{
get { return customer_Address; }
set { customer_Address = value; }
}

Department of Computer Science


Restaurant System 116

// Constructors
public Order(int order_no, float price, int? cashire, int? table_no, int?
customer_Id, String customer_name, String customer_Address)
{
this.Order_No = order_no;
this.Price = price;
this.cashire = cashire;
this.Table_No = table_no;
this.customer_Id = customer_Id;
this.customer_Name = customer_name;
this.customer_Address = customer_Address;
}

public Order(int order_no, float price, int table_No, int customer_Id, String
customer_name, String customer_Address)
: this(order_no, price, null, table_No, customer_Id, customer_name,
customer_Address)
{
}

public Order(int order_no, float price, int customer_Id, String customer_Name,


String customer_Address)
Jo
: this(order_no, price, null, null, customer_Id, customer_Name,
customer_Address) { }

public Order(int order_no, float price, int cashire, int tabel_no)


: this(order_no, price, cashire, tabel_no, null, null, null)
{
}

// method
public override string ToString()
{
return String.Format("{0},{1},{2},{3},{4},{5},{6}"
, Order_No, Price, cashire, table_No, customer_Id, customer_Name,
o
customer_Address);
}

public override bool Equals(object obj)


{
int order_No = (int)obj;
Boolean result = false;
if (this.Order_No == order_No)
result = true;
else
result = false;
return result;
}

}
}

Department of Computer Science


Restaurant System 117

 Bill :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Resturant_Prototype_2.DELayer
{
class Bill
{
public int? Bill_No { get; set; }
public float? Total_Price { get; set; }
public String Deatils { get; set; }
public String Date { get; set; }
public String Time { get; set; }

private int? cashire_Id; //Real Realation


private int? order_No; //Real Realation
Jo
private float? order_price; //Real Realation
private int? customer_Id; //Real Realation
private String customer_Name; //Real Realation
private String customer_Address; //Real Realation
private int? table_no; //Real Realation

public int? Cashire_Id


{
get { return cashire_Id; }
set { cashire_Id = value; }
}
public int? Order_No
{
get { return order_No; }
o
set { order_No = value; }
}
public float? Order_price
{
get { return order_price; }
set { order_price = value; }
}
public int? Customer_Id
{
get { return customer_Id; }
set { customer_Id = value; }
}
public String Customer_Name
{
get { return customer_Name; }
set { customer_Name = value; }
}

Department of Computer Science


Restaurant System 118

public String Customer_Address


{
get { return customer_Address; }
set { customer_Address = value; }
}
public int? Table_NO
{
get { return table_no; }
set { table_no = value; }
}

//Constructor
public Bill(int? bill_no, float? total_price, String deatils, String date, String
time, int? cashie_id, int? order_no, float? order_price, int? customer_id, String
customer_naem, String customer_address, int? table_no)
{

this.Bill_No = bill_no;
Jo
this.Total_Price = total_price;
this.Deatils = deatils;
this.Date = date;
this.Time = time;
this.cashire_Id = cashie_id;
this.order_No = order_no;
this.order_price = order_price;
this.customer_Id = customer_id;
this.customer_Name = customer_naem;
this.customer_Address = customer_address;
this.table_no = table_no;
}

public Bill(int bill_no, int total_price, String deatils, String date, String time)
o
: this(bill_no, total_price, deatils, date, time, null, null, null, null, null,
null, null)
{

// Methods
public override string ToString()
{
return
String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}",
Bill_No, Total_Price, Deatils, Date, Time, cashire_Id, order_No,
order_price, customer_Id, Customer_Name, customer_Address, table_no);
}

Department of Computer Science


Restaurant System 119

public override bool Equals(object obj)


{
int bill_no = (int)obj;
Boolean result = false;
if (this.Bill_No == bill_no)
result = true;
else
result = false;
return result;
}

// Copy Constructor & Clone ();


}
}
Jo
o
Department of Computer Science
Restaurant System

INDEX
Jo
o
Department of Computer Science
Restaurant System

CONTENT

Chapter 1 ( Introduction ) 1

Chapter 2 ( Analysis ) 6
 Requirement 7
 Flow Chart 8
Jo
 Use-Case 9
 Sequence 10
 Activity 15
 Class Diagram 26

Chapter 3 ( DataBase Design ) 27


 ERD 28
 Mapping 30
o
 Data Dectionary 32
 DataBase Relation 46

Chapter 4 ( Forms ) 65

Chapter 5 ( Implementation ) 86
 Data Base Layer 87
 Data Access Layer 89
 Data Entity Layer 105

Department of Computer Science


Restaurant System

 Rewis Rasmy Abdelkarem Gayed

 Beshoy Eshak Khames Saeid

 Zaher Ahmed Zaher Elghar


Jo
 Ahmed Soliman Gbr Soliman

 Mohamed Ashref Abdelftah Abdelhady


o
 Mahmoud Abdelhaliem Elsayed
 Mina Salah Hanen Gerges

 Saleh Saleh Mohamed Taher  Ahmed Abdelmohsen Fathy

Department of Computer Science


Restaurant System

Jo
Ministry Of Higher Education
New Cairo Academy
Computer Science Department

Restaurant
o
System
Under The Leadership Of :

Dr / Kamal Hefny Hashem

Department of Computer Science

You might also like