From da1519bc1ba5e27c40a102c9ed2ae4da4eae2d4c Mon Sep 17 00:00:00 2001 From: Katanaa Die Date: Sun, 21 Apr 2024 16:04:37 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=203=20=D1=84=D1=83=D0=BB=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bar/Bar.sln | 8 +- Bar/BarBusinessLogic/BarBusinessLogic.csproj | 6 + .../CocktailLogic.cs | 2 +- .../ComponentLogic.cs | 2 +- .../OrderLogic.cs | 2 +- Bar/BarContracts/BarContracts.csproj | 10 ++ Bar/BarDataModels/BarDataModels.csproj | 15 +- Bar/BarDataModels/{ => Enums}/IId.cs | 2 +- Bar/BarDataModels/Enums/OrderStatus.cs | 12 +- Bar/BarDataModels/Models/ICocktailModel.cs | 1 + Bar/BarDataModels/Models/IComponentModel.cs | 4 +- .../{IOrderModel .cs => IOrderModel.cs} | 1 + Bar/BarDatabaseImplement/BarDatabase.cs | 30 ++++ .../BarDatabaseImplement.csproj | 24 +++ .../Implements/CocktailStorage.cs | 95 ++++++++++ .../Implements/ComponentStorage.cs | 77 ++++++++ .../Implements/OrderStorage.cs | 97 ++++++++++ .../20240308222742_InitialCreate.Designer.cs | 169 ++++++++++++++++++ .../20240308222742_InitialCreate.cs | 125 +++++++++++++ .../Migrations/BarDatabaseModelSnapshot.cs | 166 +++++++++++++++++ Bar/BarDatabaseImplement/Models/Cocktail.cs | 88 +++++++++ .../Models/CocktailComponent.cs | 22 +++ Bar/BarDatabaseImplement/Models/Component.cs | 60 +++++++ Bar/BarDatabaseImplement/Models/Order.cs | 68 +++++++ Bar/BarFileImplement/BarFileImplement.csproj | 10 ++ .../Implements/OrderStorage.cs | 9 +- Bar/BarListImplement/BarListImplement.csproj | 10 ++ .../Implements/CocktailStorage.cs | 6 +- Bar/BarView/BarView.csproj | 15 +- Bar/BarView/FormCreateOrder.Designer.cs | 2 +- Bar/BarView/FormMain.Designer.cs | 4 +- Bar/BarView/Program.cs | 4 +- 32 files changed, 1112 insertions(+), 34 deletions(-) rename Bar/BarBusinessLogic/{BusinessLogic => BusinessLogics}/CocktailLogic.cs (99%) rename Bar/BarBusinessLogic/{BusinessLogic => BusinessLogics}/ComponentLogic.cs (98%) rename Bar/BarBusinessLogic/{BusinessLogic => BusinessLogics}/OrderLogic.cs (98%) rename Bar/BarDataModels/{ => Enums}/IId.cs (86%) rename Bar/BarDataModels/Models/{IOrderModel .cs => IOrderModel.cs} (99%) create mode 100644 Bar/BarDatabaseImplement/BarDatabase.cs create mode 100644 Bar/BarDatabaseImplement/BarDatabaseImplement.csproj create mode 100644 Bar/BarDatabaseImplement/Implements/CocktailStorage.cs create mode 100644 Bar/BarDatabaseImplement/Implements/ComponentStorage.cs create mode 100644 Bar/BarDatabaseImplement/Implements/OrderStorage.cs create mode 100644 Bar/BarDatabaseImplement/Migrations/20240308222742_InitialCreate.Designer.cs create mode 100644 Bar/BarDatabaseImplement/Migrations/20240308222742_InitialCreate.cs create mode 100644 Bar/BarDatabaseImplement/Migrations/BarDatabaseModelSnapshot.cs create mode 100644 Bar/BarDatabaseImplement/Models/Cocktail.cs create mode 100644 Bar/BarDatabaseImplement/Models/CocktailComponent.cs create mode 100644 Bar/BarDatabaseImplement/Models/Component.cs create mode 100644 Bar/BarDatabaseImplement/Models/Order.cs diff --git a/Bar/Bar.sln b/Bar/Bar.sln index dae86ec..fc8cdc7 100644 --- a/Bar/Bar.sln +++ b/Bar/Bar.sln @@ -13,7 +13,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BarView", "BarView\BarView. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BarDataModels", "BarDataModels\BarDataModels.csproj", "{DCE9F610-B4A7-4BF8-9A09-517847F0C00B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BarFileImplement", "BarFileImplement\BarFileImplement.csproj", "{B5FD7DE0-B624-4775-BA13-B0E10504B397}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BarFileImplement", "BarFileImplement\BarFileImplement.csproj", "{B5FD7DE0-B624-4775-BA13-B0E10504B397}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BarDatabaseImplement", "BarDatabaseImplement\BarDatabaseImplement.csproj", "{F90A5C3D-BBFF-4C84-8CA2-A5F29297DAAA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -45,6 +47,10 @@ Global {B5FD7DE0-B624-4775-BA13-B0E10504B397}.Debug|Any CPU.Build.0 = Debug|Any CPU {B5FD7DE0-B624-4775-BA13-B0E10504B397}.Release|Any CPU.ActiveCfg = Release|Any CPU {B5FD7DE0-B624-4775-BA13-B0E10504B397}.Release|Any CPU.Build.0 = Release|Any CPU + {F90A5C3D-BBFF-4C84-8CA2-A5F29297DAAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F90A5C3D-BBFF-4C84-8CA2-A5F29297DAAA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F90A5C3D-BBFF-4C84-8CA2-A5F29297DAAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F90A5C3D-BBFF-4C84-8CA2-A5F29297DAAA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Bar/BarBusinessLogic/BarBusinessLogic.csproj b/Bar/BarBusinessLogic/BarBusinessLogic.csproj index 9653150..5f24571 100644 --- a/Bar/BarBusinessLogic/BarBusinessLogic.csproj +++ b/Bar/BarBusinessLogic/BarBusinessLogic.csproj @@ -7,6 +7,12 @@ + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Bar/BarBusinessLogic/BusinessLogic/CocktailLogic.cs b/Bar/BarBusinessLogic/BusinessLogics/CocktailLogic.cs similarity index 99% rename from Bar/BarBusinessLogic/BusinessLogic/CocktailLogic.cs rename to Bar/BarBusinessLogic/BusinessLogics/CocktailLogic.cs index 434d429..5ee6342 100644 --- a/Bar/BarBusinessLogic/BusinessLogic/CocktailLogic.cs +++ b/Bar/BarBusinessLogic/BusinessLogics/CocktailLogic.cs @@ -10,7 +10,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BarBusinessLogic.BusinessLogic +namespace BarBusinessLogic.BusinessLogics { public class CocktailLogic : ICocktailLogic { diff --git a/Bar/BarBusinessLogic/BusinessLogic/ComponentLogic.cs b/Bar/BarBusinessLogic/BusinessLogics/ComponentLogic.cs similarity index 98% rename from Bar/BarBusinessLogic/BusinessLogic/ComponentLogic.cs rename to Bar/BarBusinessLogic/BusinessLogics/ComponentLogic.cs index 2a05366..b9230a8 100644 --- a/Bar/BarBusinessLogic/BusinessLogic/ComponentLogic.cs +++ b/Bar/BarBusinessLogic/BusinessLogics/ComponentLogic.cs @@ -7,7 +7,7 @@ using System; using System.Collections.Generic; using Microsoft.Extensions.Logging; -namespace BarBusinessLogic.BusinessLogic +namespace BarBusinessLogic.BusinessLogics { public class ComponentLogic : IComponentLogic { diff --git a/Bar/BarBusinessLogic/BusinessLogic/OrderLogic.cs b/Bar/BarBusinessLogic/BusinessLogics/OrderLogic.cs similarity index 98% rename from Bar/BarBusinessLogic/BusinessLogic/OrderLogic.cs rename to Bar/BarBusinessLogic/BusinessLogics/OrderLogic.cs index 841eb60..9382dcd 100644 --- a/Bar/BarBusinessLogic/BusinessLogic/OrderLogic.cs +++ b/Bar/BarBusinessLogic/BusinessLogics/OrderLogic.cs @@ -11,7 +11,7 @@ using System.Text; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -namespace BarBusinessLogic.BusinessLogic +namespace BarBusinessLogic.BusinessLogics { public class OrderLogic : IOrderLogic { diff --git a/Bar/BarContracts/BarContracts.csproj b/Bar/BarContracts/BarContracts.csproj index a9f6568..a6c45ed 100644 --- a/Bar/BarContracts/BarContracts.csproj +++ b/Bar/BarContracts/BarContracts.csproj @@ -7,6 +7,16 @@ + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/Bar/BarDataModels/BarDataModels.csproj b/Bar/BarDataModels/BarDataModels.csproj index 27ac386..4bff927 100644 --- a/Bar/BarDataModels/BarDataModels.csproj +++ b/Bar/BarDataModels/BarDataModels.csproj @@ -1,9 +1,18 @@ - + - net6.0 - enable + net6.0-windows enable + true + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/Bar/BarDataModels/IId.cs b/Bar/BarDataModels/Enums/IId.cs similarity index 86% rename from Bar/BarDataModels/IId.cs rename to Bar/BarDataModels/Enums/IId.cs index 3eeaf46..091511c 100644 --- a/Bar/BarDataModels/IId.cs +++ b/Bar/BarDataModels/Enums/IId.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BarDataModels +namespace BarDataModels.Enums { public interface IId { diff --git a/Bar/BarDataModels/Enums/OrderStatus.cs b/Bar/BarDataModels/Enums/OrderStatus.cs index acc2feb..3327077 100644 --- a/Bar/BarDataModels/Enums/OrderStatus.cs +++ b/Bar/BarDataModels/Enums/OrderStatus.cs @@ -1,13 +1,13 @@ -using System; +using System; namespace BarDataModels.Enums { public enum OrderStatus { - Неизвестен = -1, - Принят = 0, - Выполняется = 1, - Готов = 2, - Выдан = 3 + = -1, + = 0, + = 1, + = 2, + = 3 } } diff --git a/Bar/BarDataModels/Models/ICocktailModel.cs b/Bar/BarDataModels/Models/ICocktailModel.cs index 0866afb..7188acf 100644 --- a/Bar/BarDataModels/Models/ICocktailModel.cs +++ b/Bar/BarDataModels/Models/ICocktailModel.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using BarDataModels.Enums; namespace BarDataModels.Models { diff --git a/Bar/BarDataModels/Models/IComponentModel.cs b/Bar/BarDataModels/Models/IComponentModel.cs index 7b3c761..c554aae 100644 --- a/Bar/BarDataModels/Models/IComponentModel.cs +++ b/Bar/BarDataModels/Models/IComponentModel.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; +using BarDataModels.Enums; namespace BarDataModels.Models { @@ -12,4 +12,4 @@ namespace BarDataModels.Models string ComponentName { get; } double Cost { get; } } -} \ No newline at end of file +} diff --git a/Bar/BarDataModels/Models/IOrderModel .cs b/Bar/BarDataModels/Models/IOrderModel.cs similarity index 99% rename from Bar/BarDataModels/Models/IOrderModel .cs rename to Bar/BarDataModels/Models/IOrderModel.cs index 21ab347..39cb6af 100644 --- a/Bar/BarDataModels/Models/IOrderModel .cs +++ b/Bar/BarDataModels/Models/IOrderModel.cs @@ -17,3 +17,4 @@ namespace BarDataModels.Models DateTime? DateImplement { get; } } } + diff --git a/Bar/BarDatabaseImplement/BarDatabase.cs b/Bar/BarDatabaseImplement/BarDatabase.cs new file mode 100644 index 0000000..4820998 --- /dev/null +++ b/Bar/BarDatabaseImplement/BarDatabase.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BarDatabaseImplement.Models; +using Microsoft.EntityFrameworkCore; + +namespace BarDatabaseImplement +{ + public class BarDatabase : DbContext + { + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + if (optionsBuilder.IsConfigured == false) + { + optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=BarDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True", + options => options.EnableRetryOnFailure( + maxRetryCount: 5, + maxRetryDelay: System.TimeSpan.FromSeconds(30), + errorNumbersToAdd: null)); + } + base.OnConfiguring(optionsBuilder); + } + public virtual DbSet Components { get; set; } + public virtual DbSet Cocktails { get; set; } + public virtual DbSet CocktailComponents { get; set; } + public virtual DbSet Orders { get; set; } + } +} diff --git a/Bar/BarDatabaseImplement/BarDatabaseImplement.csproj b/Bar/BarDatabaseImplement/BarDatabaseImplement.csproj new file mode 100644 index 0000000..022fc07 --- /dev/null +++ b/Bar/BarDatabaseImplement/BarDatabaseImplement.csproj @@ -0,0 +1,24 @@ + + + + net6.0-windows + enable + enable + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + diff --git a/Bar/BarDatabaseImplement/Implements/CocktailStorage.cs b/Bar/BarDatabaseImplement/Implements/CocktailStorage.cs new file mode 100644 index 0000000..9dffc29 --- /dev/null +++ b/Bar/BarDatabaseImplement/Implements/CocktailStorage.cs @@ -0,0 +1,95 @@ +using BarContracts.BindingModels; +using BarContracts.SearchModels; +using BarContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BarContracts.StoragesContracts; +using BarDatabaseImplement.Models; +using Microsoft.EntityFrameworkCore; + + +namespace BarDatabaseImplement.Implements +{ + public class CocktailStorage : ICocktailStorage + { + public List GetFullList() + { + using var context = new BarDatabase(); + return context.Cocktails.Include(x => x.Components).ThenInclude(x => x.Component).ToList().Select(x => x.GetViewModel).ToList(); + } + public List GetFilteredList(CocktailSearchModel model) + { + if (string.IsNullOrEmpty(model.CocktailName)) + { + return new(); + } + using var context = new BarDatabase(); + return context.Cocktails.Include(x => x.Components).ThenInclude(x => x.Component).Where(x => x.CocktailName.Contains(model.CocktailName)).ToList().Select(x => x.GetViewModel).ToList(); + + } + public CocktailViewModel? GetElement(CocktailSearchModel model) + { + if (string.IsNullOrEmpty(model.CocktailName) && + !model.Id.HasValue) + { + return null; + } + using var context = new BarDatabase(); + return context.Cocktails.Include(x => x.Components).ThenInclude(x => x.Component) + .FirstOrDefault(x => (!string.IsNullOrEmpty(model.CocktailName) && x.CocktailName == model.CocktailName) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; + } + public CocktailViewModel? Insert(CocktailBindingModel model) + { + using var context = new BarDatabase(); + var newCocktail = Cocktail.Create(context, model); + if (newCocktail == null) + { + return null; + } + context.Cocktails.Add(newCocktail); + context.SaveChanges(); + return newCocktail.GetViewModel; + } + public CocktailViewModel? Update(CocktailBindingModel model) + { + using var context = new BarDatabase(); + using var transaction = context.Database.BeginTransaction(); + try + { + var cocktail = context.Cocktails.FirstOrDefault(rec => + rec.Id == model.Id); + if (cocktail == null) + { + return null; + } + cocktail.Update(model); + context.SaveChanges(); + cocktail.UpdateComponents(context, model); + transaction.Commit(); + return cocktail.GetViewModel; + } + catch + { + transaction.Rollback(); + throw; + } + } + public CocktailViewModel? Delete(CocktailBindingModel model) + { + using var context = new BarDatabase(); + var element = context.Cocktails + .Include(x => x.Components) + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Cocktails.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + } +} diff --git a/Bar/BarDatabaseImplement/Implements/ComponentStorage.cs b/Bar/BarDatabaseImplement/Implements/ComponentStorage.cs new file mode 100644 index 0000000..9239913 --- /dev/null +++ b/Bar/BarDatabaseImplement/Implements/ComponentStorage.cs @@ -0,0 +1,77 @@ +using BarContracts.BindingModels; +using BarContracts.SearchModels; +using BarContracts.StoragesContracts; +using BarContracts.ViewModels; +using BarDatabaseImplement.Models; +using System.Collections.Generic; +using System; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace BarDatabaseImplement.Implements +{ + public class ComponentStorage : IComponentStorage + { + public List GetFullList() + { + using var context = new BarDatabase(); + return context.Components.Select(x => x.GetViewModel).ToList(); + } + public List GetFilteredList(ComponentSearchModel model) + { + if (string.IsNullOrEmpty(model.ComponentName)) + { + return new(); + } + using var context = new BarDatabase(); + return context.Components.Where(x => x.ComponentName.Contains(model.ComponentName)).Select(x => x.GetViewModel).ToList(); + } + public ComponentViewModel? GetElement(ComponentSearchModel model) + { + if (string.IsNullOrEmpty(model.ComponentName) && !model.Id.HasValue) + { + return null; + } + using var context = new BarDatabase(); + return context.Components.FirstOrDefault(x => (!string.IsNullOrEmpty(model.ComponentName) && x.ComponentName == model.ComponentName) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; + } + public ComponentViewModel? Insert(ComponentBindingModel model) + { + var newComponent = Component.Create(model); + if (newComponent == null) + { + return null; + } + using var context = new BarDatabase(); + context.Components.Add(newComponent); + context.SaveChanges(); + return newComponent.GetViewModel; + } + public ComponentViewModel? Update(ComponentBindingModel model) + { + using var context = new BarDatabase(); + var component = context.Components.FirstOrDefault(x => x.Id == model.Id); + if (component == null) + { + return null; + } + component.Update(model); + context.SaveChanges(); + return component.GetViewModel; + } + public ComponentViewModel? Delete(ComponentBindingModel model) + { + using var context = new BarDatabase(); + var element = context.Components.FirstOrDefault(rec => rec.Id == model.Id); + if (element == null) + { + return null; + } + context.Components.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + } +} \ No newline at end of file diff --git a/Bar/BarDatabaseImplement/Implements/OrderStorage.cs b/Bar/BarDatabaseImplement/Implements/OrderStorage.cs new file mode 100644 index 0000000..9b1b1ef --- /dev/null +++ b/Bar/BarDatabaseImplement/Implements/OrderStorage.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using BarContracts.BindingModels; +using BarContracts.SearchModels; +using BarContracts.ViewModels; +using BarContracts.StoragesContracts; +using BarDatabaseImplement.Models; +using System.Text; +using System.Threading.Tasks; + + +namespace BarDatabaseImplement.Implements +{ + public class OrderStorage : IOrderStorage + { + public List GetFullList() + { + using var context = new BarDatabase(); + return context.Orders.Select(x => AcessCocktailsStorage(x.GetViewModel)).ToList(); + } + public List GetFilteredList(OrderSearchModel model) + { + if (!model.Id.HasValue) + { + return new(); + } + using var context = new BarDatabase(); + return context.Orders.Where(x => x.Id == model.Id).Select(x => AcessCocktailsStorage(x.GetViewModel)).ToList(); + } + public OrderViewModel? GetElement(OrderSearchModel model) + { + if (!model.Id.HasValue) + { + return null; + } + using var context = new BarDatabase(); + return AcessCocktailsStorage(context.Orders.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel); + } + public OrderViewModel? Insert(OrderBindingModel model) + { + var order = Order.Create(model); + if (order == null) + { + return null; + } + using var context = new BarDatabase(); + context.Orders.Add(order); + context.SaveChanges(); + return AcessCocktailsStorage(order.GetViewModel); + + } + public OrderViewModel? Update(OrderBindingModel model) + { + + using var context = new BarDatabase(); + var order = context.Orders.FirstOrDefault(x => x.Id == model.Id); + if (order == null) + { + return null; + } + order.Update(model); + context.SaveChanges(); + return AcessCocktailsStorage(order.GetViewModel); + + } + public OrderViewModel? Delete(OrderBindingModel model) + { + using var context = new BarDatabase(); + var element = context.Orders.FirstOrDefault(x => x.Id == model.Id); + if (element == null) + { + return null; + } + context.Orders.Remove(element); + context.SaveChanges(); + return AcessCocktailsStorage(element.GetViewModel); + } + public static OrderViewModel? AcessCocktailsStorage(OrderViewModel? model) + { + if (model == null) + { + return null; + } + using var context = new BarDatabase(); + foreach (var cocktail in context.Cocktails) + { + if (cocktail.Id == model.CocktailId) + { + model.CocktailName = cocktail.CocktailName; + break; + } + } + return model; + } + } +} diff --git a/Bar/BarDatabaseImplement/Migrations/20240308222742_InitialCreate.Designer.cs b/Bar/BarDatabaseImplement/Migrations/20240308222742_InitialCreate.Designer.cs new file mode 100644 index 0000000..9105b95 --- /dev/null +++ b/Bar/BarDatabaseImplement/Migrations/20240308222742_InitialCreate.Designer.cs @@ -0,0 +1,169 @@ +// +using System; +using BarDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace BarDatabaseImplement.Migrations +{ + [DbContext(typeof(BarDatabase))] + [Migration("20240308222742_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.16") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("BarDatabaseImplement.Models.Cocktail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CocktailName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Cocktails"); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.CocktailComponent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CocktailId") + .HasColumnType("int"); + + b.Property("ComponentId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CocktailId"); + + b.HasIndex("ComponentId"); + + b.ToTable("CocktailComponents"); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.Component", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Cost") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Components"); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CocktailId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("CocktailId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.CocktailComponent", b => + { + b.HasOne("BarDatabaseImplement.Models.Cocktail", "Cocktail") + .WithMany("Components") + .HasForeignKey("CocktailId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BarDatabaseImplement.Models.Component", "Component") + .WithMany("CocktailComponents") + .HasForeignKey("ComponentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cocktail"); + + b.Navigation("Component"); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.Order", b => + { + b.HasOne("BarDatabaseImplement.Models.Cocktail", null) + .WithMany("Orders") + .HasForeignKey("CocktailId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.Cocktail", b => + { + b.Navigation("Components"); + + b.Navigation("Orders"); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.Component", b => + { + b.Navigation("CocktailComponents"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Bar/BarDatabaseImplement/Migrations/20240308222742_InitialCreate.cs b/Bar/BarDatabaseImplement/Migrations/20240308222742_InitialCreate.cs new file mode 100644 index 0000000..ef10374 --- /dev/null +++ b/Bar/BarDatabaseImplement/Migrations/20240308222742_InitialCreate.cs @@ -0,0 +1,125 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace BarDatabaseImplement.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Cocktails", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CocktailName = table.Column(type: "nvarchar(max)", nullable: false), + Price = table.Column(type: "float", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Cocktails", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Components", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ComponentName = table.Column(type: "nvarchar(max)", nullable: false), + Cost = table.Column(type: "float", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Components", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Orders", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CocktailId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false), + Sum = table.Column(type: "float", nullable: false), + Status = table.Column(type: "int", nullable: false), + DateCreate = table.Column(type: "datetime2", nullable: false), + DateImplement = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Orders", x => x.Id); + table.ForeignKey( + name: "FK_Orders_Cocktails_CocktailId", + column: x => x.CocktailId, + principalTable: "Cocktails", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "CocktailComponents", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CocktailId = table.Column(type: "int", nullable: false), + ComponentId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CocktailComponents", x => x.Id); + table.ForeignKey( + name: "FK_CocktailComponents_Cocktails_CocktailId", + column: x => x.CocktailId, + principalTable: "Cocktails", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CocktailComponents_Components_ComponentId", + column: x => x.ComponentId, + principalTable: "Components", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_CocktailComponents_CocktailId", + table: "CocktailComponents", + column: "CocktailId"); + + migrationBuilder.CreateIndex( + name: "IX_CocktailComponents_ComponentId", + table: "CocktailComponents", + column: "ComponentId"); + + migrationBuilder.CreateIndex( + name: "IX_Orders_CocktailId", + table: "Orders", + column: "CocktailId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CocktailComponents"); + + migrationBuilder.DropTable( + name: "Orders"); + + migrationBuilder.DropTable( + name: "Components"); + + migrationBuilder.DropTable( + name: "Cocktails"); + } + } +} diff --git a/Bar/BarDatabaseImplement/Migrations/BarDatabaseModelSnapshot.cs b/Bar/BarDatabaseImplement/Migrations/BarDatabaseModelSnapshot.cs new file mode 100644 index 0000000..85978d3 --- /dev/null +++ b/Bar/BarDatabaseImplement/Migrations/BarDatabaseModelSnapshot.cs @@ -0,0 +1,166 @@ +// +using System; +using BarDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace BarDatabaseImplement.Migrations +{ + [DbContext(typeof(BarDatabase))] + partial class BarDatabaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.16") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("BarDatabaseImplement.Models.Cocktail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CocktailName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Cocktails"); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.CocktailComponent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CocktailId") + .HasColumnType("int"); + + b.Property("ComponentId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CocktailId"); + + b.HasIndex("ComponentId"); + + b.ToTable("CocktailComponents"); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.Component", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Cost") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Components"); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CocktailId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("CocktailId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.CocktailComponent", b => + { + b.HasOne("BarDatabaseImplement.Models.Cocktail", "Cocktail") + .WithMany("Components") + .HasForeignKey("CocktailId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BarDatabaseImplement.Models.Component", "Component") + .WithMany("CocktailComponents") + .HasForeignKey("ComponentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cocktail"); + + b.Navigation("Component"); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.Order", b => + { + b.HasOne("BarDatabaseImplement.Models.Cocktail", null) + .WithMany("Orders") + .HasForeignKey("CocktailId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.Cocktail", b => + { + b.Navigation("Components"); + + b.Navigation("Orders"); + }); + + modelBuilder.Entity("BarDatabaseImplement.Models.Component", b => + { + b.Navigation("CocktailComponents"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Bar/BarDatabaseImplement/Models/Cocktail.cs b/Bar/BarDatabaseImplement/Models/Cocktail.cs new file mode 100644 index 0000000..1a640e4 --- /dev/null +++ b/Bar/BarDatabaseImplement/Models/Cocktail.cs @@ -0,0 +1,88 @@ +using BarContracts.BindingModels; +using BarContracts.ViewModels; +using BarDataModels.Models; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BarDatabaseImplement.Models +{ + public class Cocktail : ICocktailModel + { + public int Id { get; set; } + [Required] + public string CocktailName { get; set; } = string.Empty; + [Required] + public double Price { get; set; } + private Dictionary? _cocktailComponents = null; + [NotMapped] + public Dictionary CocktailComponents + { + get + { + if (_cocktailComponents == null) + { + _cocktailComponents = Components.ToDictionary(recDC => recDC.ComponentId, recDC => (recDC.Component as IComponentModel, recDC.Count)); + } + return _cocktailComponents; + } + } + [ForeignKey("CocktailId")] + public virtual List Components { get; set; } = new(); + [ForeignKey("CocktailId")] + public virtual List Orders { get; set; } = new(); + public static Cocktail Create(BarDatabase context, CocktailBindingModel model) + { + return new Cocktail() + { + Id = model.Id, + CocktailName = model.CocktailName, + Price = model.Price, + Components = model.CocktailComponents.Select(x => new CocktailComponent + { + Component = context.Components.First(y => y.Id == x.Key), + Count = x.Value.Item2 + }).ToList() + }; + } + public void Update(CocktailBindingModel model) + { + CocktailName = model.CocktailName; + Price = model.Price; + } + public CocktailViewModel GetViewModel => new() + { + Id = Id, + CocktailName = CocktailName, + Price = Price, + CocktailComponents = CocktailComponents + }; + public void UpdateComponents(BarDatabase context, CocktailBindingModel model) + { + var cocktailComponents = context.CocktailComponents.Where(rec => rec.CocktailId == model.Id).ToList(); + if (cocktailComponents != null && cocktailComponents.Count > 0) + { + context.CocktailComponents.RemoveRange(cocktailComponents.Where(rec => !model.CocktailComponents.ContainsKey(rec.ComponentId))); + context.SaveChanges(); + foreach (var updateComponent in cocktailComponents) + { + updateComponent.Count = model.CocktailComponents[updateComponent.ComponentId].Item2; + model.CocktailComponents.Remove(updateComponent.ComponentId); + } + context.SaveChanges(); + } + var cocktail = context.Cocktails.First(x => x.Id == Id); + foreach (var pc in model.CocktailComponents) + { + context.CocktailComponents.Add(new CocktailComponent + { + Cocktail = cocktail, + Component = context.Components.First(x => x.Id == pc.Key), + Count = pc.Value.Item2 + }); + context.SaveChanges(); + } + _cocktailComponents = null; + } + + } +} diff --git a/Bar/BarDatabaseImplement/Models/CocktailComponent.cs b/Bar/BarDatabaseImplement/Models/CocktailComponent.cs new file mode 100644 index 0000000..45cac4b --- /dev/null +++ b/Bar/BarDatabaseImplement/Models/CocktailComponent.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarDatabaseImplement.Models +{ + public class CocktailComponent + { + public int Id { get; set; } + [Required] + public int CocktailId { get; set; } + [Required] + public int ComponentId { get; set; } + [Required] + public int Count { get; set; } + public virtual Component Component { get; set; } = new(); + public virtual Cocktail Cocktail { get; set; } = new(); + } +} diff --git a/Bar/BarDatabaseImplement/Models/Component.cs b/Bar/BarDatabaseImplement/Models/Component.cs new file mode 100644 index 0000000..96e9017 --- /dev/null +++ b/Bar/BarDatabaseImplement/Models/Component.cs @@ -0,0 +1,60 @@ +using BarContracts.BindingModels; +using BarContracts.ViewModels; +using BarDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BarDatabaseImplement.Models +{ + public class Component : IComponentModel + { + public int Id { get; private set; } + [Required] + public string ComponentName { get; private set; } = string.Empty; + [Required] + public double Cost { get; set; } + [ForeignKey("ComponentId")] + public virtual List CocktailComponents { get; set; } = + new(); + public static Component? Create(ComponentBindingModel model) + { + if (model == null) + { + return null; + } + return new Component() + { + Id = model.Id, + ComponentName = model.ComponentName, + Cost = model.Cost + }; + } + public static Component Create(ComponentViewModel model) + { + return new Component + { + Id = model.Id, + ComponentName = model.ComponentName, + Cost = model.Cost + }; + } + public void Update(ComponentBindingModel model) + { + if (model == null) + { + return; + } + ComponentName = model.ComponentName; + Cost = model.Cost; + } + public ComponentViewModel GetViewModel => new() + { + Id = Id, + ComponentName = ComponentName, + Cost = Cost + }; + } + +} diff --git a/Bar/BarDatabaseImplement/Models/Order.cs b/Bar/BarDatabaseImplement/Models/Order.cs new file mode 100644 index 0000000..be8694e --- /dev/null +++ b/Bar/BarDatabaseImplement/Models/Order.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BarContracts.BindingModels; +using BarContracts.ViewModels; +using BarDataModels.Models; +using BarDataModels.Enums; +using System.Xml.Linq; +using System.ComponentModel.DataAnnotations; + + +namespace BarDatabaseImplement.Models +{ + public class Order : IOrderModel + { + public int Id { get; private set; } + [Required] + public int CocktailId { get; private set; } + [Required] + public int Count { get; private set; } + [Required] + public double Sum { get; private set; } + [Required] + public OrderStatus Status { get; private set; } + [Required] + public DateTime DateCreate { get; private set; } = DateTime.Now; + public DateTime? DateImplement { get; private set; } + + public static Order? Create(OrderBindingModel model) + { + if (model == null) + { + return null; + } + return new Order() + { + Id = model.Id, + CocktailId = model.CocktailId, + Count = model.Count, + Sum = model.Sum, + Status = model.Status, + DateCreate = model.DateCreate + }; + } + public void Update(OrderBindingModel model) + { + if (model == null) + { + return; + } + Status = model.Status; + DateImplement = model.DateImplement; + } + public OrderViewModel GetViewModel => new() + { + Id = Id, + CocktailId = CocktailId, + Count = Count, + Sum = Sum, + Status = Status, + DateCreate = DateCreate, + DateImplement = DateImplement + }; + } +} + diff --git a/Bar/BarFileImplement/BarFileImplement.csproj b/Bar/BarFileImplement/BarFileImplement.csproj index c55e9fc..022fc07 100644 --- a/Bar/BarFileImplement/BarFileImplement.csproj +++ b/Bar/BarFileImplement/BarFileImplement.csproj @@ -6,9 +6,19 @@ enable + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/Bar/BarFileImplement/Implements/OrderStorage.cs b/Bar/BarFileImplement/Implements/OrderStorage.cs index 48c308d..73c56a2 100644 --- a/Bar/BarFileImplement/Implements/OrderStorage.cs +++ b/Bar/BarFileImplement/Implements/OrderStorage.cs @@ -73,15 +73,8 @@ namespace BarFileImplement.Implements } public OrderViewModel AcessCocktailsStorage(OrderViewModel model) { - if (model == null) - { - return null; - } var component = source.Cocktails.FirstOrDefault(x => x.Id == model.CocktailId); - if (component != null) - { - model.CocktailName = component.CocktailName; - } + model.CocktailName = component.CocktailName; return model; } } diff --git a/Bar/BarListImplement/BarListImplement.csproj b/Bar/BarListImplement/BarListImplement.csproj index a7b6073..68cd851 100644 --- a/Bar/BarListImplement/BarListImplement.csproj +++ b/Bar/BarListImplement/BarListImplement.csproj @@ -7,6 +7,16 @@ + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/Bar/BarListImplement/Implements/CocktailStorage.cs b/Bar/BarListImplement/Implements/CocktailStorage.cs index 84035b6..4e88877 100644 --- a/Bar/BarListImplement/Implements/CocktailStorage.cs +++ b/Bar/BarListImplement/Implements/CocktailStorage.cs @@ -53,9 +53,9 @@ namespace BarListImplement.Implements } foreach (var cocktail in _source.Cocktails) { - if (!string.IsNullOrEmpty(model.CocktailName) && - cocktail.CocktailName == model.CocktailName || - model.Id.HasValue && cocktail.Id == model.Id) + if ((!string.IsNullOrEmpty(model.CocktailName) && + cocktail.CocktailName == model.CocktailName) || + (model.Id.HasValue && cocktail.Id == model.Id)) { return cocktail.GetViewModel; } diff --git a/Bar/BarView/BarView.csproj b/Bar/BarView/BarView.csproj index 8dff10e..b764f3f 100644 --- a/Bar/BarView/BarView.csproj +++ b/Bar/BarView/BarView.csproj @@ -9,6 +9,16 @@ + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -21,8 +31,9 @@ - - + + + diff --git a/Bar/BarView/FormCreateOrder.Designer.cs b/Bar/BarView/FormCreateOrder.Designer.cs index 35e5ce7..c4d8c10 100644 --- a/Bar/BarView/FormCreateOrder.Designer.cs +++ b/Bar/BarView/FormCreateOrder.Designer.cs @@ -43,7 +43,7 @@ label1.AutoSize = true; label1.Location = new Point(40, 30); label1.Name = "label1"; - label1.Size = new Size(61, 15); + label1.Size = new Size(56, 15); label1.TabIndex = 0; label1.Text = "Коктейль:"; // diff --git a/Bar/BarView/FormMain.Designer.cs b/Bar/BarView/FormMain.Designer.cs index 9602194..0ecf790 100644 --- a/Bar/BarView/FormMain.Designer.cs +++ b/Bar/BarView/FormMain.Designer.cs @@ -121,14 +121,14 @@ // компонентыToolStripMenuItem1 // компонентыToolStripMenuItem1.Name = "компонентыToolStripMenuItem1"; - компонентыToolStripMenuItem1.Size = new Size(180, 22); + компонентыToolStripMenuItem1.Size = new Size(145, 22); компонентыToolStripMenuItem1.Text = "Компоненты"; компонентыToolStripMenuItem1.Click += КомпонентыToolStripMenuItem_Click; // // коктейлиToolStripMenuItem // коктейлиToolStripMenuItem.Name = "коктейлиToolStripMenuItem"; - коктейлиToolStripMenuItem.Size = new Size(180, 22); + коктейлиToolStripMenuItem.Size = new Size(145, 22); коктейлиToolStripMenuItem.Text = "Коктейли"; коктейлиToolStripMenuItem.Click += КоктейлиToolStripMenuItem_Click; // diff --git a/Bar/BarView/Program.cs b/Bar/BarView/Program.cs index 3bdf428..63b7464 100644 --- a/Bar/BarView/Program.cs +++ b/Bar/BarView/Program.cs @@ -2,11 +2,11 @@ using BarBusinessLogic; using BarContracts.BusinessLogicsContracts; using BarContracts.StoragesContracts; using Microsoft.Extensions.DependencyInjection; -using BarFileImplement.Implements; +using BarDatabaseImplement.Implements; using Microsoft.Extensions.Logging; using NLog.Extensions.Logging; using BarDataModels; -using BarBusinessLogic.BusinessLogic; +using BarBusinessLogic.BusinessLogics; namespace BarView {