-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
gmershad
committed
Dec 28, 2016
1 parent
d0a92a4
commit 27dee7b
Showing
49 changed files
with
1,245 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<FoodMenuModel> foodItems = new List<FoodMenuModel>(); | ||
|
||
public void AddFoodItem(List<FoodMenuModel> 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("----------------------------"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<FoodMenuModel> foodMenu) | ||
{ | ||
meal = new Meal(); | ||
meal.AddFoodItem(foodMenu); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{9604FBD9-1FC0-4D33-87B1-5E9EED6E8402}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>FoodDeliveryApp</RootNamespace> | ||
<AssemblyName>FoodDeliveryApp</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="FoodDeliveryAppModel\FoodMenuModel.cs" /> | ||
<Compile Include="FoodDeliveryAppModel\RestaurantModel.cs" /> | ||
<Compile Include="FoodBuilding\Meal.cs" /> | ||
<Compile Include="FoodBuilding\MealBuilder.cs" /> | ||
<Compile Include="FoodDeliveryAppModel\UserModel.cs" /> | ||
<Compile Include="FoodDeliveryDriver\MealBuilderDriver.cs" /> | ||
<Compile Include="FoodDeliveryDriver\MealOrderDriver.cs" /> | ||
<Compile Include="FoodDeliveryDriver\MealSelectorDriver.cs" /> | ||
<Compile Include="FoodDeliveryDriver\OrderTrackingDriver.cs" /> | ||
<Compile Include="OrderAndCancellation\CancelFood.cs" /> | ||
<Compile Include="OrderAndCancellation\Customer.cs" /> | ||
<Compile Include="OrderAndCancellation\Food.cs" /> | ||
<Compile Include="OrderAndCancellation\IFoodOrderCommands.cs" /> | ||
<Compile Include="OrderAndCancellation\OrderFood.cs" /> | ||
<Compile Include="RestaurantFoodMenu\FoodMenu.cs" /> | ||
<Compile Include="RestaurantFoodMenu\IFoodMenu.cs" /> | ||
<Compile Include="RestaurantFoodMenu\IIterator.cs" /> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="RestaurantFoodMenu\RestaurantFoodMenuIterator.cs" /> | ||
<Compile Include="RestaurantFoodMenu\Waitress.cs" /> | ||
<Compile Include="RestaurantSearch\InterpreterContext.cs" /> | ||
<Compile Include="RestaurantSearch\AbstractExpression.cs" /> | ||
<Compile Include="RestaurantSearch\RestaurantLocationExpression.cs" /> | ||
<Compile Include="RestaurantSearch\RestaurantSearchClient.cs" /> | ||
<Compile Include="RestaurantSearch\RestaurantSearchDriver.cs" /> | ||
<Compile Include="RestaurantWebService\FoodMenuService.cs" /> | ||
<Compile Include="RestaurantWebService\RestaurantService.cs" /> | ||
<Compile Include="Tracking\Customers.cs" /> | ||
<Compile Include="Tracking\FoodDelivery.cs" /> | ||
<Compile Include="Tracking\ICustomers.cs" /> | ||
<Compile Include="Tracking\Restaurant.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
</ItemGroup> | ||
<ItemGroup /> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<FoodMenuModel> 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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<FoodMenuModel> 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; | ||
} | ||
} | ||
} |
Oops, something went wrong.