-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
607b292
commit a753252
Showing
37 changed files
with
2,021 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+231 KB
ExamPrep-10-December-2017/01. Model Definition_Problem Description.docx
Binary file not shown.
21 changes: 21 additions & 0 deletions
21
ExamPrep-10-December-2017/FastFood.App/FastFood.App.csproj
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 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Automapper" Version="6.2.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\FastFood.DataProcessor\FastFood.DataProcessor.csproj" /> | ||
<ProjectReference Include="..\FastFood.Data\FastFood.Data.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="ImportResults\" /> | ||
</ItemGroup> | ||
|
||
</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,18 @@ | ||
namespace FastFood.App | ||
{ | ||
using AutoMapper; | ||
using FastFood.DataProcessor.Dto.Import; | ||
using FastFood.Models; | ||
|
||
public class FastFoodProfile : Profile | ||
{ | ||
public FastFoodProfile() | ||
{ | ||
//CreateMap<EmployeeDto, Employee>() | ||
// .ForPath(dest => dest.Position.Name, opt => opt.MapFrom(src => src.Position)); | ||
|
||
//CreateMap<ItemDto, Item>() | ||
// .ForPath(dest => dest.Category.Name, opt => opt.MapFrom(src => src.Category)); | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
ExamPrep-10-December-2017/FastFood.App/ImportResults/CategoryStatistics.xml
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,27 @@ | ||
<?xml version="1.0" encoding="utf-16"?> | ||
<Categories> | ||
<Category> | ||
<Name>Chicken</Name> | ||
<MostPopularItem> | ||
<Name>Chicken Tenders</Name> | ||
<TotalMade>44.00</TotalMade> | ||
<TimesSold>11</TimesSold> | ||
</MostPopularItem> | ||
</Category> | ||
<Category> | ||
<Name>Toys</Name> | ||
<MostPopularItem> | ||
<Name>Minion</Name> | ||
<TotalMade>24.20</TotalMade> | ||
<TimesSold>11</TimesSold> | ||
</MostPopularItem> | ||
</Category> | ||
<Category> | ||
<Name>Drinks</Name> | ||
<MostPopularItem> | ||
<Name>Purple Drink</Name> | ||
<TotalMade>9.10</TotalMade> | ||
<TimesSold>7</TimesSold> | ||
</MostPopularItem> | ||
</Category> | ||
</Categories> |
55 changes: 55 additions & 0 deletions
55
ExamPrep-10-December-2017/FastFood.App/ImportResults/Employees.txt
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,55 @@ | ||
Invalid data format. | ||
Invalid data format. | ||
Invalid data format. | ||
Invalid data format. | ||
Invalid data format. | ||
Record Magda Bjork successfully imported. | ||
Record Erich Hennigan successfully imported. | ||
Record Shin Vallejos successfully imported. | ||
Record Avery Rush successfully imported. | ||
Record Coral Points successfully imported. | ||
Record Xiao Raley successfully imported. | ||
Record Kym Douse successfully imported. | ||
Record Kendra Stangl successfully imported. | ||
Record Lura Yeldell successfully imported. | ||
Record Mohammad Norton successfully imported. | ||
Record Tamika Thornsberry successfully imported. | ||
Record Nancie Mcquarrie successfully imported. | ||
Record Maxwell Shanahan successfully imported. | ||
Record Classie Mettler successfully imported. | ||
Record Denita Providence successfully imported. | ||
Record Jerica Rupe successfully imported. | ||
Record Nolan Jablonski successfully imported. | ||
Record Mikki Vasques successfully imported. | ||
Record Ariane Sloan successfully imported. | ||
Record Herta Balser successfully imported. | ||
Record Jacqualine Clune successfully imported. | ||
Record Mervin Langone successfully imported. | ||
Record Dorethea Mumford successfully imported. | ||
Record Connie Barbosa successfully imported. | ||
Record Katie Nilsen successfully imported. | ||
Record Camille Peller successfully imported. | ||
Record Annett Lewallen successfully imported. | ||
Record Iris Foushee successfully imported. | ||
Record Eric Toole successfully imported. | ||
Record Justin Brazil successfully imported. | ||
Record Felisa Frier successfully imported. | ||
Record Lakiesha Huffines successfully imported. | ||
Record Emory Lemos successfully imported. | ||
Record Lanita Palmore successfully imported. | ||
Record Janiece Owens successfully imported. | ||
Record Maryland Palm successfully imported. | ||
Record Sunday Eastep successfully imported. | ||
Record Lucius Rotz successfully imported. | ||
Record Stanton Dahl successfully imported. | ||
Record Carmon Sesco successfully imported. | ||
Record Willette Ugalde successfully imported. | ||
Record Rose Blizzard successfully imported. | ||
Record Caridad Cuenca successfully imported. | ||
Record Tran Bullion successfully imported. | ||
Record Fred Higby successfully imported. | ||
Record Elizabet Trentham successfully imported. | ||
Record Shirleen Vonruden successfully imported. | ||
Record Oscar Dolan successfully imported. | ||
Record Prince Betton successfully imported. | ||
Record Jolanda Discher successfully imported. |
41 changes: 41 additions & 0 deletions
41
ExamPrep-10-December-2017/FastFood.App/ImportResults/Items.txt
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,41 @@ | ||
Invalid data format. | ||
Invalid data format. | ||
Invalid data format. | ||
Invalid data format. | ||
Invalid data format. | ||
Invalid data format. | ||
Record Hamburger successfully imported. | ||
Invalid data format. | ||
Record Cheeseburger successfully imported. | ||
Record Quarter Pounder successfully imported. | ||
Record Double Cheeseburger successfully imported. | ||
Record Daily Double successfully imported. | ||
Record Ranger Burger successfully imported. | ||
Record BBQ Burger successfully imported. | ||
Record Bacon Deluxe successfully imported. | ||
Record Triple Cheeseburger successfully imported. | ||
Record Premium chicken sandwich successfully imported. | ||
Record Snack Wrap successfully imported. | ||
Record Premium Chicken Wrap successfully imported. | ||
Record Chicken Nuggets successfully imported. | ||
Record Crispy Chicken Deluxe successfully imported. | ||
Record Grilled Chicken Deluxe successfully imported. | ||
Record Tasty Basket successfully imported. | ||
Record Chicken Tenders successfully imported. | ||
Record Fries successfully imported. | ||
Record Crispy Fries successfully imported. | ||
Record Curly Fries successfully imported. | ||
Record Cola successfully imported. | ||
Record Orange Drink successfully imported. | ||
Record Purple Drink successfully imported. | ||
Record Ice Cream successfully imported. | ||
Record Cookie successfully imported. | ||
Record Cake successfully imported. | ||
Record Cesar Salad successfully imported. | ||
Record Tuna Salad successfully imported. | ||
Record Just Lettuce successfully imported. | ||
Record Minion successfully imported. | ||
Record Batman successfully imported. | ||
Record Mario successfully imported. | ||
Record Luigi successfully imported. | ||
Record Bowser successfully imported. |
20 changes: 20 additions & 0 deletions
20
ExamPrep-10-December-2017/FastFood.App/ImportResults/Orders.txt
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,20 @@ | ||
Order for Garry on 21/08/2017 13:22 added | ||
Order for Pablo on 23/11/2017 16:25 added | ||
Order for Enrique on 11/06/2017 14:08 added | ||
Order for Joann on 08/09/2017 23:19 added | ||
Order for Ray on 25/08/2017 20:13 added | ||
Order for Roberta on 02/03/2017 07:19 added | ||
Order for Daniel on 16/12/2017 20:13 added | ||
Order for Yolanda on 28/10/2017 04:25 added | ||
Order for Pablo on 26/03/2017 06:33 added | ||
Order for Ray on 11/03/2017 04:07 added | ||
Order for Bobbie on 09/02/2017 01:50 added | ||
Order for Miguel on 03/03/2017 21:41 added | ||
Order for Roberta on 26/09/2017 22:15 added | ||
Order for Leona on 06/02/2017 00:04 added | ||
Order for Stacey on 07/10/2017 06:00 added | ||
Order for Enrique on 19/07/2017 17:58 added | ||
Order for Guillermo on 23/08/2017 08:24 added | ||
Order for Darryl on 25/01/2017 13:02 added | ||
Order for Daniel on 24/05/2017 21:58 added | ||
Order for Bobbie on 08/04/2017 19:53 added |
85 changes: 85 additions & 0 deletions
85
ExamPrep-10-December-2017/FastFood.App/ImportResults/OrdersByEmployee.json
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,85 @@ | ||
{ | ||
"Name": "Avery Rush", | ||
"Orders": [ | ||
{ | ||
"Customer": "Stacey", | ||
"Items": [ | ||
{ | ||
"Name": "Cheeseburger", | ||
"Price": 6.00, | ||
"Quantity": 5 | ||
}, | ||
{ | ||
"Name": "Double Cheeseburger", | ||
"Price": 6.50, | ||
"Quantity": 3 | ||
}, | ||
{ | ||
"Name": "Luigi", | ||
"Price": 2.10, | ||
"Quantity": 5 | ||
}, | ||
{ | ||
"Name": "Bacon Deluxe", | ||
"Price": 9.00, | ||
"Quantity": 1 | ||
} | ||
], | ||
"TotalPrice": 69.00 | ||
}, | ||
{ | ||
"Customer": "Pablo", | ||
"Items": [ | ||
{ | ||
"Name": "Double Cheeseburger", | ||
"Price": 6.50, | ||
"Quantity": 3 | ||
}, | ||
{ | ||
"Name": "Bacon Deluxe", | ||
"Price": 9.00, | ||
"Quantity": 5 | ||
} | ||
], | ||
"TotalPrice": 64.50 | ||
}, | ||
{ | ||
"Customer": "Bobbie", | ||
"Items": [ | ||
{ | ||
"Name": "Tuna Salad", | ||
"Price": 3.00, | ||
"Quantity": 2 | ||
}, | ||
{ | ||
"Name": "Crispy Fries", | ||
"Price": 2.00, | ||
"Quantity": 5 | ||
}, | ||
{ | ||
"Name": "Fries", | ||
"Price": 1.50, | ||
"Quantity": 2 | ||
} | ||
], | ||
"TotalPrice": 19.00 | ||
}, | ||
{ | ||
"Customer": "Joann", | ||
"Items": [ | ||
{ | ||
"Name": "Minion", | ||
"Price": 2.20, | ||
"Quantity": 2 | ||
}, | ||
{ | ||
"Name": "Bacon Deluxe", | ||
"Price": 9.00, | ||
"Quantity": 1 | ||
} | ||
], | ||
"TotalPrice": 13.40 | ||
} | ||
], | ||
"TotalMade": 165.90 | ||
} |
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,76 @@ | ||
using System; | ||
using System.Data.SqlClient; | ||
using System.IO; | ||
using AutoMapper; | ||
using FastFood.Data; | ||
using FastFood.DataProcessor; | ||
using Microsoft.EntityFrameworkCore; | ||
using Newtonsoft.Json; | ||
|
||
namespace FastFood.App | ||
{ | ||
public class Startup | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
var context = new FastFoodDbContext(); | ||
|
||
ResetDatabase(context); | ||
|
||
Console.WriteLine("Database Reset."); | ||
|
||
Mapper.Initialize(cfg => cfg.AddProfile<FastFoodProfile>()); | ||
|
||
ImportEntities(context); | ||
|
||
ExportEntities(context); | ||
|
||
BonusTask(context); | ||
} | ||
|
||
private static void ImportEntities(FastFoodDbContext context, string baseDir = @"C:\Users\Petya\Desktop\SoftUniPavel\ExamPrep\FastFood.DataProcessor\Datasets\") | ||
{ | ||
const string exportDir = @"C:\Users\Petya\Desktop\SoftUniPavel\ExamPrep\FastFood.App\ImportResults\"; | ||
|
||
var employees = DataProcessor.Deserializer.ImportEmployees(context, File.ReadAllText(baseDir + "employees.json")); | ||
PrintAndExportEntityToFile(employees, exportDir + "Employees.txt"); | ||
|
||
var items = DataProcessor.Deserializer.ImportItems(context, File.ReadAllText(baseDir + "items.json")); | ||
PrintAndExportEntityToFile(items, exportDir + "Items.txt"); | ||
|
||
var orders = DataProcessor.Deserializer.ImportOrders(context, File.ReadAllText(baseDir + "orders.xml")); | ||
PrintAndExportEntityToFile(orders, exportDir + "Orders.txt"); | ||
} | ||
|
||
private static void ExportEntities(FastFoodDbContext context) | ||
{ | ||
const string exportDir = @"C:\Users\Petya\Desktop\SoftUniPavel\ExamPrep\FastFood.App\ImportResults\"; | ||
|
||
var jsonOutput = DataProcessor.Serializer.ExportOrdersByEmployee(context, "Avery Rush", "ToGo"); | ||
Console.WriteLine(jsonOutput); | ||
File.WriteAllText(exportDir + "OrdersByEmployee.json", jsonOutput); | ||
|
||
var xmlOutput = DataProcessor.Serializer.ExportCategoryStatistics(context, "Chicken,Drinks,Toys"); | ||
Console.WriteLine(xmlOutput); | ||
File.WriteAllText(exportDir + "CategoryStatistics.xml", xmlOutput); | ||
} | ||
|
||
private static void BonusTask(FastFoodDbContext context) | ||
{ | ||
var bonusOutput = DataProcessor.Bonus.UpdatePrice(context, "Cheeseburger", 6.50m); | ||
Console.WriteLine(bonusOutput); | ||
} | ||
|
||
private static void PrintAndExportEntityToFile(string entityOutput, string outputPath) | ||
{ | ||
Console.WriteLine(entityOutput); | ||
File.WriteAllText(outputPath, entityOutput.TrimEnd()); | ||
} | ||
|
||
private static void ResetDatabase(FastFoodDbContext context) | ||
{ | ||
context.Database.EnsureDeleted(); | ||
context.Database.EnsureCreated(); | ||
} | ||
} | ||
} |
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,7 @@ | ||
namespace FastFood.Data | ||
{ | ||
public static class Configuration | ||
{ | ||
public static string ConnectionString = @"Server=.;Database=FastFood;Trusted_Connection=True"; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
ExamPrep-10-December-2017/FastFood.Data/FastFood.Data.csproj
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,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\FastFood.Models\FastFood.Models.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.