Skip to content

Commit

Permalink
Adding Project
Browse files Browse the repository at this point in the history
  • Loading branch information
gmershad committed Dec 28, 2016
1 parent d0a92a4 commit 27dee7b
Show file tree
Hide file tree
Showing 49 changed files with 1,245 additions and 0 deletions.
6 changes: 6 additions & 0 deletions App.config
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>
43 changes: 43 additions & 0 deletions FoodBuilding/Meal.cs
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("----------------------------");
}
}
}
}
19 changes: 19 additions & 0 deletions FoodBuilding/MealBuilder.cs
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);
}
}
}
89 changes: 89 additions & 0 deletions FoodDeliveryApp.csproj
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>
22 changes: 22 additions & 0 deletions FoodDeliveryApp.sln
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 added FoodDeliveryApp.v12.suo
Binary file not shown.
53 changes: 53 additions & 0 deletions FoodDeliveryAppModel/FoodMenuModel.cs
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; }
}
}
}
39 changes: 39 additions & 0 deletions FoodDeliveryAppModel/RestaurantModel.cs
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; }
}
}
}
21 changes: 21 additions & 0 deletions FoodDeliveryAppModel/UserModel.cs
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; }
}
}
26 changes: 26 additions & 0 deletions FoodDeliveryDriver/MealBuilderDriver.cs
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;
}
}
}
67 changes: 67 additions & 0 deletions FoodDeliveryDriver/MealOrderDriver.cs
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;
}
}
}
Loading

0 comments on commit 27dee7b

Please sign in to comment.