diff --git a/App.config b/App.config
new file mode 100644
index 0000000..8e15646
--- /dev/null
+++ b/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FoodBuilding/Meal.cs b/FoodBuilding/Meal.cs
new file mode 100644
index 0000000..9b91ef5
--- /dev/null
+++ b/FoodBuilding/Meal.cs
@@ -0,0 +1,43 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.Ordering
+{
+ public class Meal
+ {
+ private List foodItems = new List();
+
+ public void AddFoodItem(List items)
+ {
+ foodItems.AddRange(items);
+ }
+
+ public double GetCost()
+ {
+ double cost = 0;
+
+ foreach (var item in foodItems)
+ {
+ cost += item.Rate;
+ }
+
+ return cost;
+ }
+
+ public void ShowItems()
+ {
+ foreach (var item in foodItems)
+ {
+ Console.WriteLine("Food Id: {0}", item.FoodId);
+ Console.WriteLine("Food Name: {0}", item.FoodName);
+ Console.WriteLine("Food Price: {0}", item.Rate);
+ Console.WriteLine("Food Rating: {0}", item.Rating);
+ Console.WriteLine("----------------------------");
+ }
+ }
+ }
+}
diff --git a/FoodBuilding/MealBuilder.cs b/FoodBuilding/MealBuilder.cs
new file mode 100644
index 0000000..f86b28d
--- /dev/null
+++ b/FoodBuilding/MealBuilder.cs
@@ -0,0 +1,19 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.Ordering
+{
+ public class MealBuilder
+ {
+ public Meal meal;
+ public void PrepareMeal(List foodMenu)
+ {
+ meal = new Meal();
+ meal.AddFoodItem(foodMenu);
+ }
+ }
+}
diff --git a/FoodDeliveryApp.csproj b/FoodDeliveryApp.csproj
new file mode 100644
index 0000000..fd55764
--- /dev/null
+++ b/FoodDeliveryApp.csproj
@@ -0,0 +1,89 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {9604FBD9-1FC0-4D33-87B1-5E9EED6E8402}
+ Exe
+ Properties
+ FoodDeliveryApp
+ FoodDeliveryApp
+ v4.5
+ 512
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FoodDeliveryApp.sln b/FoodDeliveryApp.sln
new file mode 100644
index 0000000..a358106
--- /dev/null
+++ b/FoodDeliveryApp.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.31101.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FoodDeliveryApp", "FoodDeliveryApp.csproj", "{9604FBD9-1FC0-4D33-87B1-5E9EED6E8402}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9604FBD9-1FC0-4D33-87B1-5E9EED6E8402}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9604FBD9-1FC0-4D33-87B1-5E9EED6E8402}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9604FBD9-1FC0-4D33-87B1-5E9EED6E8402}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9604FBD9-1FC0-4D33-87B1-5E9EED6E8402}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/FoodDeliveryApp.v12.suo b/FoodDeliveryApp.v12.suo
new file mode 100644
index 0000000..da28e67
Binary files /dev/null and b/FoodDeliveryApp.v12.suo differ
diff --git a/FoodDeliveryAppModel/FoodMenuModel.cs b/FoodDeliveryAppModel/FoodMenuModel.cs
new file mode 100644
index 0000000..3d006c3
--- /dev/null
+++ b/FoodDeliveryAppModel/FoodMenuModel.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.FoodDeliveryAppModel
+{
+ public class FoodMenuModel
+ {
+ private string restaurantId;
+ public string RestaurantId
+ {
+ get { return restaurantId; }
+ set { restaurantId = value; }
+ }
+
+ private string foodId;
+ public string FoodId
+ {
+ get { return foodId; }
+ set { foodId = value; }
+ }
+
+ private string foodname;
+ public string FoodName
+ {
+ get { return foodname; }
+ set { foodname = value; }
+ }
+
+ private string cuisine;
+ public string Cuisine
+ {
+ get { return cuisine; }
+ set { cuisine = value; }
+ }
+
+ private double rate;
+ public double Rate
+ {
+ get { return rate; }
+ set { rate = value; }
+ }
+
+ private int rating;
+ public int Rating
+ {
+ get { return rating; }
+ set { rating = value; }
+ }
+ }
+}
diff --git a/FoodDeliveryAppModel/RestaurantModel.cs b/FoodDeliveryAppModel/RestaurantModel.cs
new file mode 100644
index 0000000..bbc3767
--- /dev/null
+++ b/FoodDeliveryAppModel/RestaurantModel.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.FoodDeliveryAppModel
+{
+ public class RestaurantModel
+ {
+ private string restaurantId;
+ public string RestaurantId
+ {
+ get { return restaurantId; }
+ set { restaurantId = value; }
+ }
+
+ private string name;
+ public string Name
+ {
+ get { return name; }
+ set { name = value; }
+ }
+
+ private string address;
+ public string Address
+ {
+ get { return address; }
+ set { address = value; }
+ }
+
+ private int rating;
+ public int Rating
+ {
+ get { return rating; }
+ set { rating = value; }
+ }
+ }
+}
diff --git a/FoodDeliveryAppModel/UserModel.cs b/FoodDeliveryAppModel/UserModel.cs
new file mode 100644
index 0000000..64a18cc
--- /dev/null
+++ b/FoodDeliveryAppModel/UserModel.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.FoodDeliveryAppModel
+{
+ public class UserModel
+ {
+ public String UserId { get; set; }
+
+ public String UserName { get; set; }
+
+ public String PhoneNumber { get; set; }
+
+ public String Address { get; set; }
+
+ public double Amount { get; set; }
+ }
+}
diff --git a/FoodDeliveryDriver/MealBuilderDriver.cs b/FoodDeliveryDriver/MealBuilderDriver.cs
new file mode 100644
index 0000000..9c643d7
--- /dev/null
+++ b/FoodDeliveryDriver/MealBuilderDriver.cs
@@ -0,0 +1,26 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using FoodDeliveryApp.Ordering;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.FoodDeliveryDriver
+{
+ public class MealBuilderDriver
+ {
+ public double BuildMealForUser(List selectedMealItems)
+ {
+ Console.WriteLine();
+ Console.WriteLine("You Selected Below Meal Items");
+ Console.WriteLine("_______________________________");
+ MealBuilder mealBuilder = new MealBuilder();
+ mealBuilder.PrepareMeal(selectedMealItems);
+ mealBuilder.meal.ShowItems();
+ var totalCost = mealBuilder.meal.GetCost();
+ Console.WriteLine("Total Cost(Rs.): {0}", totalCost);
+ return totalCost;
+ }
+ }
+}
diff --git a/FoodDeliveryDriver/MealOrderDriver.cs b/FoodDeliveryDriver/MealOrderDriver.cs
new file mode 100644
index 0000000..24fdee0
--- /dev/null
+++ b/FoodDeliveryDriver/MealOrderDriver.cs
@@ -0,0 +1,67 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using FoodDeliveryApp.OrderAndCancellation;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.FoodDeliveryDriver
+{
+ public class MealOrderDriver
+ {
+ public char MealOrderByUser(List selectedMealItems, double totalCost, string restaurantId, out string orderId, out UserModel user)
+ {
+ Console.WriteLine(string.Empty);
+ Console.WriteLine("Do you want to place order(y/n)...?");
+ var wantsOrder = Console.ReadKey().KeyChar;
+ Console.WriteLine(string.Empty);
+
+ orderId = string.Empty;
+ user = null;
+
+ if (wantsOrder == 'y')
+ {
+ Console.WriteLine("_________________________");
+ Food food = new Food();
+ OrderFood orderFood = new OrderFood(food);
+ orderFood.FoodItems = selectedMealItems;
+ orderFood.User = new UserModel();
+ orderFood.User.UserId = "gul123";
+ orderFood.User.UserName = "Gul Ershad";
+ orderFood.User.Address = "JP Nangar, Bangalore - 5600076";
+ orderFood.User.PhoneNumber = "99998987";
+ orderFood.User.Amount = totalCost;
+ orderFood.RestaurantId = restaurantId;
+ user = orderFood.User;
+ Customer customer = new Customer();
+ customer.TakeOrder(orderFood);
+ customer.PlaceOrders();
+ orderId = orderFood.OrderId;
+ Console.WriteLine(string.Empty);
+ }
+
+ //Order Cancellation.
+ char cancel = 'n';
+ if (!string.IsNullOrEmpty(orderId))
+ {
+ Console.WriteLine("Do you want to cancel order(y/n)...?");
+ cancel = Console.ReadKey().KeyChar;
+ Console.WriteLine(string.Empty);
+
+ if (cancel == 'y')
+ {
+ Console.WriteLine(String.Empty);
+ Food food = new Food();
+ CancelFood cancelOrder = new CancelFood(food);
+ cancelOrder.OrderId = orderId;
+ Customer customer = new Customer();
+ customer.TakeOrder(cancelOrder);
+ customer.PlaceOrders();
+ }
+ }
+
+ return cancel;
+ }
+ }
+}
diff --git a/FoodDeliveryDriver/MealSelectorDriver.cs b/FoodDeliveryDriver/MealSelectorDriver.cs
new file mode 100644
index 0000000..1aef500
--- /dev/null
+++ b/FoodDeliveryDriver/MealSelectorDriver.cs
@@ -0,0 +1,50 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.FoodDeliveryDriver
+{
+ public class MealSelectorDriver
+ {
+ public List MealSelectionbyUser(List foodMenu)
+ {
+ //Meal Selector.
+
+ Console.WriteLine(string.Empty);
+ Console.WriteLine("Please select the food items");
+ Console.WriteLine("_________________________");
+
+ List selectedMealItems = new List();
+ char answer;
+ do
+ {
+ Console.WriteLine("Enter food Id:");
+ var foodId = Console.ReadLine();
+ var foodItem = foodMenu.Where(e => e.FoodId == foodId).FirstOrDefault();
+ if (foodItem != null)
+ {
+ Console.WriteLine("You Selected Below food Item:");
+ Console.WriteLine("------------------------------");
+ Console.WriteLine("Name: {0}", foodItem.FoodName);
+ Console.WriteLine("Rate(Rs.): {0}", foodItem.Rate);
+ Console.WriteLine("Rating: {0}", foodItem.Rating);
+ selectedMealItems.Add(foodItem);
+ }
+ else
+ Console.WriteLine("Invalid Food Id Selected. No food Item available with this Id.");
+
+ Console.WriteLine(string.Empty);
+
+ Console.WriteLine("Do you want to add more food item(y/n):...?");
+ answer = Console.ReadKey().KeyChar;
+ Console.WriteLine(string.Empty);
+
+ } while (answer != 'n');
+
+ return selectedMealItems;
+ }
+ }
+}
diff --git a/FoodDeliveryDriver/OrderTrackingDriver.cs b/FoodDeliveryDriver/OrderTrackingDriver.cs
new file mode 100644
index 0000000..b8fa0d5
--- /dev/null
+++ b/FoodDeliveryDriver/OrderTrackingDriver.cs
@@ -0,0 +1,37 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using FoodDeliveryApp.Tracking;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.FoodDeliveryDriver
+{
+ public class OrderTrackingDriver
+ {
+ public void OrderTrackingByUser(string restaurantId, string orderId, UserModel user, char cancel)
+ {
+ //Order Tracking.
+ if (cancel != 'y')
+ {
+ Console.WriteLine(string.Empty);
+ Console.WriteLine("Food Delivery Status");
+ Console.WriteLine("---------------------");
+
+ Restaurant restaurant = new Restaurant(restaurantId, orderId, "Order Received");
+ restaurant.Attach(new Customers(user));
+ Thread.Sleep(1000);
+ restaurant.DeliveryStatus = "Dispatched";
+ Thread.Sleep(1000);
+ restaurant.DeliveryStatus = "On the way.";
+ Thread.Sleep(1000);
+ restaurant.DeliveryStatus = "Near to your home";
+ restaurant.DeliveryStatus = "Delivered";
+ }
+
+ Console.ReadKey();
+ }
+ }
+}
diff --git a/OrderAndCancellation/CancelFood.cs b/OrderAndCancellation/CancelFood.cs
new file mode 100644
index 0000000..4132e3c
--- /dev/null
+++ b/OrderAndCancellation/CancelFood.cs
@@ -0,0 +1,25 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.OrderAndCancellation
+{
+ public class CancelFood : IFoodOrderCommands
+ {
+ private Food food;
+ public string OrderId;
+
+ public CancelFood(Food food)
+ {
+ this.food = food;
+ }
+
+ public void Execute()
+ {
+ food.CancelFood(OrderId);
+ }
+ }
+}
diff --git a/OrderAndCancellation/Customer.cs b/OrderAndCancellation/Customer.cs
new file mode 100644
index 0000000..abbb637
--- /dev/null
+++ b/OrderAndCancellation/Customer.cs
@@ -0,0 +1,29 @@
+using FoodDeliveryApp.Ordering;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.OrderAndCancellation
+{
+ public class Customer
+ {
+ List orderList = new List();
+
+ public void TakeOrder(IFoodOrderCommands order)
+ {
+ orderList.Add(order);
+ }
+
+ public void PlaceOrders()
+ {
+ foreach (var order in orderList)
+ {
+ order.Execute();
+ }
+
+ orderList.Clear();
+ }
+ }
+}
diff --git a/OrderAndCancellation/Food.cs b/OrderAndCancellation/Food.cs
new file mode 100644
index 0000000..be96eaf
--- /dev/null
+++ b/OrderAndCancellation/Food.cs
@@ -0,0 +1,30 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.OrderAndCancellation
+{
+ public class Food
+ {
+ public string OrderFood( string restaurantId, UserModel user)
+ {
+ var orderId = (restaurantId + Guid.NewGuid().ToString().Substring(0, 15)).ToUpper();
+ Console.WriteLine("Order ID: {0}", orderId);
+ Console.WriteLine("Customer Name : {0}", user.UserName);
+ Console.WriteLine("Mobile : {0}", user.PhoneNumber);
+ Console.WriteLine("User ID : {0}", user.UserId);
+ Console.WriteLine("Address : {0}", user.Address);
+ Console.WriteLine("Amount(Rs.): {0}", user.Amount);
+ Console.WriteLine("Food Ordered");
+ return orderId.ToString();
+ }
+
+ public void CancelFood(string orderId)
+ {
+ Console.WriteLine("Food Order with Order ID {0} has been cancelled.", orderId);
+ }
+ }
+}
diff --git a/OrderAndCancellation/IFoodOrderCommands.cs b/OrderAndCancellation/IFoodOrderCommands.cs
new file mode 100644
index 0000000..b35bfb1
--- /dev/null
+++ b/OrderAndCancellation/IFoodOrderCommands.cs
@@ -0,0 +1,14 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.OrderAndCancellation
+{
+ public interface IFoodOrderCommands
+ {
+ void Execute();
+ }
+}
diff --git a/OrderAndCancellation/OrderFood.cs b/OrderAndCancellation/OrderFood.cs
new file mode 100644
index 0000000..863ee4c
--- /dev/null
+++ b/OrderAndCancellation/OrderFood.cs
@@ -0,0 +1,28 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.OrderAndCancellation
+{
+ public class OrderFood : IFoodOrderCommands
+ {
+ private Food food;
+ public List FoodItems;
+ public UserModel User;
+ public string OrderId;
+ public string RestaurantId;
+
+ public OrderFood(Food food)
+ {
+ this.food = food;
+ }
+
+ public void Execute()
+ {
+ OrderId = food.OrderFood(RestaurantId,User);
+ }
+ }
+}
diff --git a/Program.cs b/Program.cs
new file mode 100644
index 0000000..d98aab4
--- /dev/null
+++ b/Program.cs
@@ -0,0 +1,75 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using FoodDeliveryApp.OrderAndCancellation;
+using FoodDeliveryApp.Ordering;
+using FoodDeliveryApp.RestaurantFoodMenu;
+using FoodDeliveryApp.RestaurantSearch;
+using FoodDeliveryApp.Tracking;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Threading;
+using FoodDeliveryApp.FoodDeliveryDriver;
+
+namespace FoodDeliveryApp
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+
+ #region User Searches Restaurant
+
+ //User Searches Restaurant.
+ RestaurantSearchDriver restaurantSearchDriver = new RestaurantSearchDriver();
+ var restaurantId = restaurantSearchDriver.RestaurantSearch();
+
+ #endregion
+
+ #region User Sees Food Menu
+
+ //User sees Food Menu Items based on the selected Restaurant Id.
+ Waitress waitress = new Waitress(restaurantId);
+ var foodMenu = waitress.PrintFoodMenu();
+
+ #endregion
+
+ #region User Selects Meal
+
+ //Meal Selector.
+ MealSelectorDriver mealSelectorDriver = new MealSelectorDriver();
+ var selectedMealItems = mealSelectorDriver.MealSelectionbyUser(foodMenu);
+
+ #endregion
+
+ #region Restaurant Builds Meal
+
+ //Calling Meal Builder
+ MealBuilderDriver mealBuilderDriver = new MealBuilderDriver();
+ var totalCost = mealBuilderDriver.BuildMealForUser(selectedMealItems);
+
+ #endregion
+
+ #region User Orders Food
+
+ //Order Food
+ string orderId = string.Empty;
+ UserModel user = null;
+ MealOrderDriver mealOrderDriver = new MealOrderDriver();
+ var cancel = mealOrderDriver.MealOrderByUser(selectedMealItems, totalCost, restaurantId, out orderId, out user);
+
+ #endregion
+
+ #region User Tracks Order
+
+ //Order Tracking.
+ OrderTrackingDriver orderTrackingDriver = new OrderTrackingDriver();
+ orderTrackingDriver.OrderTrackingByUser(restaurantId, orderId, user, cancel);
+
+ #endregion
+
+ Console.ReadKey();
+ }
+ }
+}
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..64a9967
--- /dev/null
+++ b/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("FoodDeliveryApp")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("FoodDeliveryApp")]
+[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("63aca083-0f53-4277-8428-d1d3369756b6")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/RestaurantFoodMenu/FoodMenu.cs b/RestaurantFoodMenu/FoodMenu.cs
new file mode 100644
index 0000000..86acd04
--- /dev/null
+++ b/RestaurantFoodMenu/FoodMenu.cs
@@ -0,0 +1,33 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using FoodDeliveryApp.FoodMenu;
+using FoodDeliveryApp.RestaurantWebService;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.RestaurantFoodMenu
+{
+ public class FoodMenu : IFoodMenu
+ {
+ private string restaurantId;
+ public FoodMenu(string restaurantId)
+ {
+ this.restaurantId = restaurantId;
+ }
+ public List GetFoodMenuItems()
+ {
+ FoodMenuService foodMenuService = new FoodMenuService(string.Empty, restaurantId);
+ var foodMenuItems = foodMenuService.getAllFoodMenu(restaurantId);
+
+ return foodMenuItems;
+ }
+
+ public IIterator CreateFoodMenuIterator()
+ {
+ var foodMenuItems = GetFoodMenuItems();
+ return new RestaurantFoodMenuIterator(foodMenuItems);
+ }
+ }
+}
diff --git a/RestaurantFoodMenu/IFoodMenu.cs b/RestaurantFoodMenu/IFoodMenu.cs
new file mode 100644
index 0000000..2840cf0
--- /dev/null
+++ b/RestaurantFoodMenu/IFoodMenu.cs
@@ -0,0 +1,14 @@
+using FoodDeliveryApp.FoodMenu;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.RestaurantFoodMenu
+{
+ public interface IFoodMenu
+ {
+ IIterator CreateFoodMenuIterator();
+ }
+}
diff --git a/RestaurantFoodMenu/IIterator.cs b/RestaurantFoodMenu/IIterator.cs
new file mode 100644
index 0000000..72d982a
--- /dev/null
+++ b/RestaurantFoodMenu/IIterator.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.FoodMenu
+{
+ public interface IIterator
+ {
+ bool HasNext();
+ Object Next();
+ }
+}
diff --git a/RestaurantFoodMenu/RestaurantFoodMenuIterator.cs b/RestaurantFoodMenu/RestaurantFoodMenuIterator.cs
new file mode 100644
index 0000000..9605908
--- /dev/null
+++ b/RestaurantFoodMenu/RestaurantFoodMenuIterator.cs
@@ -0,0 +1,36 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using FoodDeliveryApp.FoodMenu;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.RestaurantFoodMenu
+{
+ public class RestaurantFoodMenuIterator : IIterator
+ {
+ List items;
+ int position = 0;
+
+ public RestaurantFoodMenuIterator(List items)
+ {
+ this.items = items;
+ }
+
+ public bool HasNext()
+ {
+ if (position >= items.Count || items[position] == null)
+ return false;
+ else
+ return true;
+ }
+
+ public object Next()
+ {
+ FoodMenuModel menuItem = items[position];
+ position = position + 1;
+ return menuItem;
+ }
+ }
+}
diff --git a/RestaurantFoodMenu/Waitress.cs b/RestaurantFoodMenu/Waitress.cs
new file mode 100644
index 0000000..727ac2d
--- /dev/null
+++ b/RestaurantFoodMenu/Waitress.cs
@@ -0,0 +1,53 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using FoodDeliveryApp.FoodMenu;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.RestaurantFoodMenu
+{
+ public class Waitress
+ {
+ private string restaurantId;
+ FoodMenu foodMenu;
+ public Waitress(string restaurantId)
+ {
+ this.restaurantId = restaurantId;
+ }
+
+ public List PrintFoodMenu()
+ {
+ foodMenu = new FoodMenu(restaurantId);
+ IIterator restaurantFoodMenu = foodMenu.CreateFoodMenuIterator();
+ return PrintFoodMenu(restaurantFoodMenu);
+ }
+
+ private List PrintFoodMenu(IIterator iterator)
+ {
+ Console.WriteLine("Food Menu");
+ Console.WriteLine("**************************************");
+ Console.WriteLine();
+
+ List foodMenu = new List();
+
+ while (iterator.HasNext())
+ {
+ FoodMenuModel foodMenuItem = (FoodMenuModel)iterator.Next();
+ foodMenu.Add(foodMenuItem);
+
+ Console.WriteLine("Restaurant ID : {0}", foodMenuItem.RestaurantId);
+ Console.WriteLine("Food ID : {0}", foodMenuItem.FoodId);
+ Console.WriteLine("Food Name : {0}", foodMenuItem.FoodName);
+ Console.WriteLine("Couisine : {0}", foodMenuItem.Cuisine);
+ Console.WriteLine("Rate(Rs.) : {0}", foodMenuItem.Rate);
+ Console.WriteLine("Rating : {0}", foodMenuItem.Rating);
+ Console.WriteLine("____________________________");
+ Console.WriteLine();
+ }
+
+ return foodMenu;
+ }
+ }
+}
diff --git a/RestaurantSearch/AbstractExpression.cs b/RestaurantSearch/AbstractExpression.cs
new file mode 100644
index 0000000..505f5b7
--- /dev/null
+++ b/RestaurantSearch/AbstractExpression.cs
@@ -0,0 +1,15 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using FoodDeliveryApp.RestaurantSearch;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.RestaurantWebService
+{
+ public abstract class AbstractExpression
+ {
+ public abstract List Interpret(InterpreterContext context);
+ }
+}
diff --git a/RestaurantSearch/InterpreterContext.cs b/RestaurantSearch/InterpreterContext.cs
new file mode 100644
index 0000000..1b74ee9
--- /dev/null
+++ b/RestaurantSearch/InterpreterContext.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using FoodDeliveryApp.RestaurantWebService;
+using FoodDeliveryApp.FoodDeliveryAppModel;
+
+namespace FoodDeliveryApp.RestaurantSearch
+{
+ public class InterpreterContext
+ {
+ private RestaurantService restaurantService;
+
+ public InterpreterContext(String endpoint)
+ {
+ restaurantService = new RestaurantService(endpoint);
+ }
+
+ public List GetAllRestaurants()
+ {
+ return restaurantService.GetAllRestaurants();
+ }
+ }
+}
diff --git a/RestaurantSearch/RestaurantLocationExpression.cs b/RestaurantSearch/RestaurantLocationExpression.cs
new file mode 100644
index 0000000..9460afd
--- /dev/null
+++ b/RestaurantSearch/RestaurantLocationExpression.cs
@@ -0,0 +1,31 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using FoodDeliveryApp.RestaurantWebService;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.RestaurantSearch
+{
+ public class RestaurantLocationExpression : AbstractExpression
+ {
+ private String searchString;
+
+ public RestaurantLocationExpression(String searchString)
+ {
+ this.searchString = searchString;
+ }
+ public override List Interpret(InterpreterContext context)
+ {
+ List restaurants = context.GetAllRestaurants();
+
+ List restaurantResult = new List();
+ var result = restaurants.Where(e => e.Address.Contains(this.searchString));
+
+ if (result != null) restaurantResult = result.ToList();
+
+ return restaurantResult;
+ }
+ }
+}
diff --git a/RestaurantSearch/RestaurantSearchClient.cs b/RestaurantSearch/RestaurantSearchClient.cs
new file mode 100644
index 0000000..01a60b8
--- /dev/null
+++ b/RestaurantSearch/RestaurantSearchClient.cs
@@ -0,0 +1,41 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using FoodDeliveryApp.RestaurantWebService;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.RestaurantSearch
+{
+ public class RestaurantSearchClient
+ {
+ private InterpreterContext context;
+
+ public RestaurantSearchClient(InterpreterContext context)
+ {
+ this.context = context;
+ }
+
+ public List Intercept(string expression)
+ {
+ AbstractExpression queryExpression = null;
+ String[] stringParts = expression.Split(' ');
+ String searchType = stringParts[0];
+ String searchAttribute = stringParts[2];
+
+ var startIndex = expression.IndexOf("'");
+ var lastIndex = expression.LastIndexOf("'");
+ var length = expression.Length;
+ String query = expression.Substring(startIndex+1, lastIndex - startIndex-1);
+
+ if (searchType.Equals("restaurant") && searchAttribute.Equals("location"))
+ queryExpression = new RestaurantLocationExpression(query);
+
+ if (queryExpression != null)
+ return queryExpression.Interpret(this.context);
+
+ return null;
+ }
+ }
+}
diff --git a/RestaurantSearch/RestaurantSearchDriver.cs b/RestaurantSearch/RestaurantSearchDriver.cs
new file mode 100644
index 0000000..e37deac
--- /dev/null
+++ b/RestaurantSearch/RestaurantSearchDriver.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.RestaurantSearch
+{
+ public class RestaurantSearchDriver
+ {
+ public string RestaurantSearch()
+ {
+ InterpreterContext context = new InterpreterContext("Some API");
+ RestaurantSearchClient client = new RestaurantSearchClient(context);
+
+ var result = client.Intercept("restaurant by location 'JP Nagar'");
+ if (!result.Any()) Console.WriteLine("Sorry, No Restaurants available in this location.");
+
+ Console.WriteLine("List of Restaurants");
+ Console.WriteLine("*******************");
+
+ foreach (var item in result)
+ {
+ Console.WriteLine(" ");
+ Console.WriteLine("{0} {1}", item.RestaurantId, item.Name);
+ Console.WriteLine("{0}", item.Address);
+ int rating = item.Rating;
+ Console.Write("Rating: ");
+ while (rating > 0)
+ {
+ Console.Write("*");
+ rating--;
+ }
+
+ Console.WriteLine("");
+ Console.WriteLine("_________________________________");
+ }
+
+ Console.WriteLine();
+ Console.WriteLine("Please Select Restaurant by Id: ");
+ var restaurantId = Console.ReadLine();
+ return restaurantId;
+ }
+ }
+}
diff --git a/RestaurantWebService/FoodMenuService.cs b/RestaurantWebService/FoodMenuService.cs
new file mode 100644
index 0000000..11f2502
--- /dev/null
+++ b/RestaurantWebService/FoodMenuService.cs
@@ -0,0 +1,30 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.RestaurantWebService
+{
+ public class FoodMenuService
+ {
+ public FoodMenuService(string endPoint, string restaurantId)
+ {
+ //Initialize web service with the endpoint string.
+ //Data for food Menu items will fetch based on the Restaurant Id.
+ }
+
+ public List getAllFoodMenu(string restaurantId)
+ {
+ List foodMenu = new List();
+ foodMenu.Add(new FoodMenuModel { RestaurantId = "001", FoodId = "001", Cuisine = "Indian", FoodName = "Chicken Biryani" , Rating = 5, Rate = 250});
+ foodMenu.Add(new FoodMenuModel { RestaurantId = "001", FoodId = "002", Cuisine = "Indian", FoodName = "Chicken Korma", Rating = 4, Rate = 300 });
+ foodMenu.Add(new FoodMenuModel { RestaurantId = "001", FoodId = "003", Cuisine = "Indian", FoodName = "Shahi Paneer", Rating = 5, Rate = 250 });
+ foodMenu.Add(new FoodMenuModel { RestaurantId = "001", FoodId = "004", Cuisine = "Indian", FoodName = "Tandoori Roti", Rating = 3, Rate = 250 });
+ foodMenu.Add(new FoodMenuModel { RestaurantId = "001", FoodId = "005", Cuisine = "Indian", FoodName = "Choley Bhaturey", Rating = 5, Rate = 100 });
+
+ return foodMenu;
+ }
+ }
+}
diff --git a/RestaurantWebService/RestaurantService.cs b/RestaurantWebService/RestaurantService.cs
new file mode 100644
index 0000000..c26d6e7
--- /dev/null
+++ b/RestaurantWebService/RestaurantService.cs
@@ -0,0 +1,31 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.RestaurantWebService
+{
+ public class RestaurantService
+ {
+ public RestaurantService(string endPoint) {
+
+ //Initialize web service with the endpoint string.
+ }
+
+ ///
+ /// This method should expose Webservice to fetch all Restaurants.
+ ///
+ public List GetAllRestaurants()
+ {
+ List restaurants = new List();
+ restaurants.Add(new RestaurantModel { RestaurantId="001", Name="Barbequnation", Address="JP Nagar, Bangalore 56006", Rating = 5 });
+ restaurants.Add(new RestaurantModel {RestaurantId="002", Name = "Paradize", Address = "Kormangala", Rating = 3});
+ restaurants.Add(new RestaurantModel {RestaurantId="003", Name = "Thirteenth floor", Address = "Brigate Road", Rating = 4 });
+ restaurants.Add(new RestaurantModel {RestaurantId="004", Name = "Mango Tree", Address = "JP Nagar, Bangalore 560009", Rating =2 });
+ restaurants.Add(new RestaurantModel {RestaurantId="005", Name = "Brewsky", Address = "JP Nagar, Bangalore 564555", Rating = 4});
+ return restaurants;
+ }
+ }
+}
diff --git a/Tracking/Customers.cs b/Tracking/Customers.cs
new file mode 100644
index 0000000..82270a2
--- /dev/null
+++ b/Tracking/Customers.cs
@@ -0,0 +1,41 @@
+using FoodDeliveryApp.FoodDeliveryAppModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.Tracking
+{
+ public class Customers : ICustomers
+ {
+
+ #region Properties
+
+ private UserModel userModel;
+ private Restaurant restaurant;
+ public Restaurant Restaurant
+ {
+ get { return restaurant; }
+ set { restaurant = value; }
+ }
+
+ #endregion
+
+ public Customers(UserModel userModel)
+ {
+ this.userModel = userModel;
+ }
+
+ #region Methods
+ public void Update(FoodDelivery foodDelivery)
+ {
+ Console.WriteLine("Notified Restaurant ID {0} of Order ID {1}'s Food Delivery Status: {2}", foodDelivery.RestaurantId,
+ foodDelivery.OrderId, foodDelivery.DeliveryStatus);
+ Console.WriteLine("Date Time: {0}", foodDelivery.DeliveryTime);
+ }
+
+ #endregion
+
+ }
+}
diff --git a/Tracking/FoodDelivery.cs b/Tracking/FoodDelivery.cs
new file mode 100644
index 0000000..393c7d7
--- /dev/null
+++ b/Tracking/FoodDelivery.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.Tracking
+{
+ ///
+ /// Subject
+ ///
+ public abstract class FoodDelivery
+ {
+ #region Properties
+
+ private List _customers = new List();
+
+ private string orderId;
+ public string OrderId
+ {
+ get { return orderId; }
+ set { orderId = value; }
+ }
+
+ private string restaurantId;
+ public string RestaurantId
+ {
+ get { return restaurantId; }
+ set { restaurantId = value; }
+ }
+
+ private string deliveryStatus;
+ public string DeliveryStatus
+ {
+ get { return deliveryStatus; }
+ set
+ {
+ if (deliveryStatus != value)
+ {
+ deliveryStatus = value;
+ Notify();
+ }
+ }
+ }
+
+ public DateTime DeliveryTime
+ {
+ get { return DateTime.Now; }
+ }
+
+ #endregion
+
+ #region Constructor
+
+ public FoodDelivery(string restaurantId, string orderId, string deliveryStatus)
+ {
+ this.restaurantId = restaurantId;
+ this.orderId = orderId;
+ this.deliveryStatus = deliveryStatus;
+ }
+
+ #endregion
+
+ #region Methods
+
+ public void Attach(ICustomers customer)
+ {
+ _customers.Add(customer);
+ }
+
+ public void Notify()
+ {
+ foreach (ICustomers customer in _customers)
+ {
+ customer.Update(this);
+ }
+
+ Console.WriteLine(string.Empty);
+ }
+
+ #endregion
+ }
+}
diff --git a/Tracking/ICustomers.cs b/Tracking/ICustomers.cs
new file mode 100644
index 0000000..f95f410
--- /dev/null
+++ b/Tracking/ICustomers.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.Tracking
+{
+ public interface ICustomers
+ {
+ void Update(FoodDelivery foodDelivery);
+ }
+}
diff --git a/Tracking/Restaurant.cs b/Tracking/Restaurant.cs
new file mode 100644
index 0000000..c9da613
--- /dev/null
+++ b/Tracking/Restaurant.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FoodDeliveryApp.Tracking
+{
+ public class Restaurant : FoodDelivery
+ {
+ public Restaurant(string restaurantId, string orderId, string deliveryStatus) : base(restaurantId, orderId, deliveryStatus) { }
+ }
+}
diff --git a/bin/Debug/FoodDeliveryApp.exe b/bin/Debug/FoodDeliveryApp.exe
new file mode 100644
index 0000000..3aa347a
Binary files /dev/null and b/bin/Debug/FoodDeliveryApp.exe differ
diff --git a/bin/Debug/FoodDeliveryApp.exe.config b/bin/Debug/FoodDeliveryApp.exe.config
new file mode 100644
index 0000000..8e15646
--- /dev/null
+++ b/bin/Debug/FoodDeliveryApp.exe.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bin/Debug/FoodDeliveryApp.pdb b/bin/Debug/FoodDeliveryApp.pdb
new file mode 100644
index 0000000..f0f4a76
Binary files /dev/null and b/bin/Debug/FoodDeliveryApp.pdb differ
diff --git a/bin/Debug/FoodDeliveryApp.vshost.exe b/bin/Debug/FoodDeliveryApp.vshost.exe
new file mode 100644
index 0000000..666c0af
Binary files /dev/null and b/bin/Debug/FoodDeliveryApp.vshost.exe differ
diff --git a/bin/Debug/FoodDeliveryApp.vshost.exe.config b/bin/Debug/FoodDeliveryApp.vshost.exe.config
new file mode 100644
index 0000000..8e15646
--- /dev/null
+++ b/bin/Debug/FoodDeliveryApp.vshost.exe.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
new file mode 100644
index 0000000..f71337c
Binary files /dev/null and b/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/obj/Debug/FoodDeliveryApp.csproj.FileListAbsolute.txt b/obj/Debug/FoodDeliveryApp.csproj.FileListAbsolute.txt
new file mode 100644
index 0000000..278872e
--- /dev/null
+++ b/obj/Debug/FoodDeliveryApp.csproj.FileListAbsolute.txt
@@ -0,0 +1,6 @@
+E:\Study Library\Application Design\Design Patterns\FoodDeliveryApp\bin\Debug\FoodDeliveryApp.exe.config
+E:\Study Library\Application Design\Design Patterns\FoodDeliveryApp\bin\Debug\FoodDeliveryApp.exe
+E:\Study Library\Application Design\Design Patterns\FoodDeliveryApp\bin\Debug\FoodDeliveryApp.pdb
+E:\Study Library\Application Design\Design Patterns\FoodDeliveryApp\obj\Debug\FoodDeliveryApp.csprojResolveAssemblyReference.cache
+E:\Study Library\Application Design\Design Patterns\FoodDeliveryApp\obj\Debug\FoodDeliveryApp.exe
+E:\Study Library\Application Design\Design Patterns\FoodDeliveryApp\obj\Debug\FoodDeliveryApp.pdb
diff --git a/obj/Debug/FoodDeliveryApp.csprojResolveAssemblyReference.cache b/obj/Debug/FoodDeliveryApp.csprojResolveAssemblyReference.cache
new file mode 100644
index 0000000..3973d97
Binary files /dev/null and b/obj/Debug/FoodDeliveryApp.csprojResolveAssemblyReference.cache differ
diff --git a/obj/Debug/FoodDeliveryApp.exe b/obj/Debug/FoodDeliveryApp.exe
new file mode 100644
index 0000000..3aa347a
Binary files /dev/null and b/obj/Debug/FoodDeliveryApp.exe differ
diff --git a/obj/Debug/FoodDeliveryApp.pdb b/obj/Debug/FoodDeliveryApp.pdb
new file mode 100644
index 0000000..f0f4a76
Binary files /dev/null and b/obj/Debug/FoodDeliveryApp.pdb differ
diff --git a/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
new file mode 100644
index 0000000..e69de29
diff --git a/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
new file mode 100644
index 0000000..e69de29
diff --git a/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
new file mode 100644
index 0000000..e69de29