Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gmershad committed Dec 29, 2016
1 parent 27be94a commit 4e14d68
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 48 deletions.
3 changes: 2 additions & 1 deletion FoodDeliveryApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<Compile Include="FoodBuilding\MealBuilder.cs" />
<Compile Include="FoodDeliveryAppModel\UserModel.cs" />
<Compile Include="FoodDeliveryDriver\MealBuilderDriver.cs" />
<Compile Include="FoodDeliveryDriver\MealMenuIteratorDriver.cs" />
<Compile Include="FoodDeliveryDriver\MealOrderDriver.cs" />
<Compile Include="FoodDeliveryDriver\MealSelectorDriver.cs" />
<Compile Include="FoodDeliveryDriver\OrderTrackingDriver.cs" />
Expand All @@ -66,7 +67,7 @@
<Compile Include="RestaurantSearch\AbstractExpression.cs" />
<Compile Include="RestaurantSearch\RestaurantLocationExpression.cs" />
<Compile Include="RestaurantSearch\RestaurantSearchClient.cs" />
<Compile Include="RestaurantSearch\RestaurantSearchDriver.cs" />
<Compile Include="FoodDeliveryDriver\RestaurantSearchDriver.cs" />
<Compile Include="RestaurantWebService\FoodMenuService.cs" />
<Compile Include="RestaurantWebService\RestaurantService.cs" />
<Compile Include="Tracking\Customers.cs" />
Expand Down
Binary file modified FoodDeliveryApp.v12.suo
Binary file not shown.
5 changes: 5 additions & 0 deletions FoodDeliveryDriver/MealBuilderDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ namespace FoodDeliveryApp.FoodDeliveryDriver
{
public class MealBuilderDriver
{
/// <summary>
/// This driver called that module which followed Builder Design Pattern
/// </summary>
/// <param name="selectedMealItems"></param>
/// <returns></returns>
public double BuildMealForUser(List<FoodMenuModel> selectedMealItems)
{
Console.WriteLine();
Expand Down
23 changes: 23 additions & 0 deletions FoodDeliveryDriver/MealMenuIteratorDriver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using FoodDeliveryApp.FoodDeliveryAppModel;
using FoodDeliveryApp.RestaurantFoodMenu;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FoodDeliveryApp.FoodDeliveryDriver
{
/// <summary>
/// This driver called - Iterator Pattern.
/// </summary>
public class MealMenuIteratorDriver
{
public List<FoodMenuModel> PrintMealMenu(string restaurantId)
{
Waitress waitress = new Waitress(restaurantId);
var foodMenu = waitress.PrintFoodMenu();
return foodMenu;
}
}
}
9 changes: 9 additions & 0 deletions FoodDeliveryDriver/MealOrderDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ namespace FoodDeliveryApp.FoodDeliveryDriver
{
public class MealOrderDriver
{
/// <summary>
/// This driver called Command Design Pattern
/// </summary>
/// <param name="selectedMealItems"></param>
/// <param name="totalCost"></param>
/// <param name="restaurantId"></param>
/// <param name="orderId"></param>
/// <param name="user"></param>
/// <returns></returns>
public char MealOrderByUser(List<FoodMenuModel> selectedMealItems, double totalCost, string restaurantId, out string orderId, out UserModel user)
{
Console.WriteLine(string.Empty);
Expand Down
7 changes: 7 additions & 0 deletions FoodDeliveryDriver/OrderTrackingDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ namespace FoodDeliveryApp.FoodDeliveryDriver
{
public class OrderTrackingDriver
{
/// <summary>
/// This Driver used Observer Design Pattern
/// </summary>
/// <param name="restaurantId"></param>
/// <param name="orderId"></param>
/// <param name="user"></param>
/// <param name="cancel"></param>
public void OrderTrackingByUser(string restaurantId, string orderId, UserModel user, char cancel)
{
//Order Tracking.
Expand Down
58 changes: 58 additions & 0 deletions FoodDeliveryDriver/RestaurantSearchDriver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FoodDeliveryApp.RestaurantSearch
{

/// <summary>
/// This driver called module developed in Interpreter design pattern
/// </summary>
public class RestaurantSearchDriver
{
public string RestaurantSearch()
{
InterpreterContext context = new InterpreterContext("Some API");
RestaurantSearchClient client = new RestaurantSearchClient(context);
Console.WriteLine("Search Restaurant(by Location)");
Console.WriteLine("Enter Location:");
var location = Console.ReadLine();
string searchSentence = string.Format("restaurant by location '{0}'", location);
var result = client.Intercept(searchSentence);
if (!result.Any()) Console.WriteLine("Sorry, No Restaurants available in this location.");

string restaurantId = string.Empty;

if (result.Any())
{
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: ");
restaurantId = Console.ReadLine();
}

return restaurantId;
}
}
}
4 changes: 2 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ static void Main(string[] args)
#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();
MealMenuIteratorDriver mealMenuIteratorDriver = new MealMenuIteratorDriver();
var foodMenu = mealMenuIteratorDriver.PrintMealMenu(restaurantId);

#endregion

Expand Down
45 changes: 0 additions & 45 deletions RestaurantSearch/RestaurantSearchDriver.cs

This file was deleted.

Binary file modified bin/Debug/FoodDeliveryApp.exe
Binary file not shown.
Binary file modified bin/Debug/FoodDeliveryApp.pdb
Binary file not shown.
Binary file modified obj/Debug/FoodDeliveryApp.exe
Binary file not shown.
Binary file modified obj/Debug/FoodDeliveryApp.pdb
Binary file not shown.

0 comments on commit 4e14d68

Please sign in to comment.