From a355deeb560fd5457c5170ca4836c5238b9d90e8 Mon Sep 17 00:00:00 2001 From: dasha Date: Tue, 28 Mar 2023 21:24:52 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D1=85=D1=80=D0=B0=D0=BD=D0=B8=D0=BB=D0=B8?= =?UTF-8?q?=D1=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BindingModels/OrderBindingModel.cs | 6 +- .../BindingModels/ServiceBindingModel.cs | 2 +- .../SearchModels/OrderSearchModel.cs | 2 +- .../StoragesContracts/IOrderStorage.cs | 1 - .../ViewModels/OrderViewModel.cs | 8 +- .../BeautySaloonDataModels/IOrderModel.cs | 6 +- .../BeautySaloonDataModels/IServiceModel.cs | 2 +- .../BeautySaloonDatabase.cs | 29 --- .../BeautySaloonDatabaseImplement.csproj | 5 +- .../BeautySaloonDatabaseImplement/Client.cs | 67 ++++++ .../BeautySaloonDatabaseImplement/Employee.cs | 88 +++++++ .../Implements/ClientStorage.cs | 86 +++++++ .../Implements/EmployeeStorage.cs | 86 +++++++ .../Implements/OrderStorage.cs | 76 +++++++ .../Implements/PositionStorage.cs | 86 +++++++ .../Implements/ServiceStorage.cs | 86 +++++++ .../Models/Client.cs | 52 ----- .../Models/Employee.cs | 70 ------ .../Models/Order.cs | 38 ---- .../Models/Position.cs | 36 --- .../Models/Service.cs | 41 ---- .../Models/ServiceOrder.cs | 24 -- .../NewdbContext.cs | 215 ++++++++++++++++++ .../BeautySaloonDatabaseImplement/Order.cs | 93 ++++++++ .../BeautySaloonDatabaseImplement/Position.cs | 42 ++++ .../BeautySaloonDatabaseImplement/Service.cs | 52 +++++ .../ServiceOrder.cs | 36 +++ .../BeautySaloonView/BeautySaloonView.csproj | 5 + .../BeautySaloonView/FormMain.Designer.cs | 120 +++++++++- BeautySaloon/BeautySaloonView/FormMain.resx | 65 +----- 30 files changed, 1155 insertions(+), 370 deletions(-) delete mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/BeautySaloonDatabase.cs create mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Client.cs create mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Employee.cs create mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Implements/ClientStorage.cs create mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Implements/EmployeeStorage.cs create mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Implements/OrderStorage.cs create mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Implements/PositionStorage.cs create mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Implements/ServiceStorage.cs delete mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Models/Client.cs delete mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Models/Employee.cs delete mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Models/Order.cs delete mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Models/Position.cs delete mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Models/Service.cs delete mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Models/ServiceOrder.cs create mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/NewdbContext.cs create mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Order.cs create mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Position.cs create mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/Service.cs create mode 100644 BeautySaloon/BeautySaloonDatabaseImplement/ServiceOrder.cs diff --git a/BeautySaloon/BeautySaloonContracts/BindingModels/OrderBindingModel.cs b/BeautySaloon/BeautySaloonContracts/BindingModels/OrderBindingModel.cs index fdd8ce7..5b637a7 100644 --- a/BeautySaloon/BeautySaloonContracts/BindingModels/OrderBindingModel.cs +++ b/BeautySaloon/BeautySaloonContracts/BindingModels/OrderBindingModel.cs @@ -5,12 +5,12 @@ namespace BeautySaloonContracts.BindingModels public class OrderBindingModel : IOrderModel { public int Id { get; set; } - public DateTime Date { get; set; } = DateTime.Now; - public double Sum { get; set; } + public DateOnly Date { get; set; } = DateOnly.FromDateTime(DateTime.Now); + public decimal Sum { get; set; } public int ClientId { get; set; } public int EmployeeId { get; set; } - public Dictionary OrderServices + public Dictionary OrderServices { get; set; diff --git a/BeautySaloon/BeautySaloonContracts/BindingModels/ServiceBindingModel.cs b/BeautySaloon/BeautySaloonContracts/BindingModels/ServiceBindingModel.cs index de25086..dab3f2d 100644 --- a/BeautySaloon/BeautySaloonContracts/BindingModels/ServiceBindingModel.cs +++ b/BeautySaloon/BeautySaloonContracts/BindingModels/ServiceBindingModel.cs @@ -6,6 +6,6 @@ namespace BeautySaloonContracts.BindingModels { public int Id { get; set; } public string Name { get; set; } = string.Empty; - public double Price { get; set; } + public decimal Price { get; set; } } } diff --git a/BeautySaloon/BeautySaloonContracts/SearchModels/OrderSearchModel.cs b/BeautySaloon/BeautySaloonContracts/SearchModels/OrderSearchModel.cs index b9d4838..dd13ce5 100644 --- a/BeautySaloon/BeautySaloonContracts/SearchModels/OrderSearchModel.cs +++ b/BeautySaloon/BeautySaloonContracts/SearchModels/OrderSearchModel.cs @@ -3,7 +3,7 @@ public class OrderSearchModel { public int? Id { get; set; } - public DateTime? Date { get; set; } + public DateOnly? Date { get; set; } public int? ClientId { get; set; } public int? EmployeeId { get; set; } } diff --git a/BeautySaloon/BeautySaloonContracts/StoragesContracts/IOrderStorage.cs b/BeautySaloon/BeautySaloonContracts/StoragesContracts/IOrderStorage.cs index 62d474c..55c8981 100644 --- a/BeautySaloon/BeautySaloonContracts/StoragesContracts/IOrderStorage.cs +++ b/BeautySaloon/BeautySaloonContracts/StoragesContracts/IOrderStorage.cs @@ -10,7 +10,6 @@ namespace BeautySaloonContracts.StoragesContracts List GetFilteredList(OrderSearchModel model); OrderViewModel? GetElement(OrderSearchModel model); OrderViewModel? Insert(OrderBindingModel model); - OrderViewModel? Update(OrderBindingModel model); OrderViewModel? Delete(OrderBindingModel model); } } diff --git a/BeautySaloon/BeautySaloonContracts/ViewModels/OrderViewModel.cs b/BeautySaloon/BeautySaloonContracts/ViewModels/OrderViewModel.cs index 460c753..9222628 100644 --- a/BeautySaloon/BeautySaloonContracts/ViewModels/OrderViewModel.cs +++ b/BeautySaloon/BeautySaloonContracts/ViewModels/OrderViewModel.cs @@ -8,15 +8,19 @@ namespace BeautySaloonContracts.ViewModels [DisplayName("Номер")] public int Id { get; set; } [DisplayName("Дата заказа")] - public DateTime Date { get; set; } = DateTime.Now; + public DateOnly Date { get; set; } = DateOnly.FromDateTime(DateTime.Now); [DisplayName("Сумма")] - public double Sum { get; set; } + public decimal Sum { get; set; } public int ClientId { get; set; } [DisplayName("Клиент")] public string ClientName { get; set; } = string.Empty; + [DisplayName("Номер клиента")] + public string ClientPhone { get; set; } = string.Empty; public int EmployeeId { get; set; } [DisplayName("Продавец")] public string EmployeeName { get; set; } = string.Empty; + [DisplayName("Номер продавца")] + public string EmployeePhone { get; set; } = string.Empty; public Dictionary OrderServices { get; diff --git a/BeautySaloon/BeautySaloonDataModels/IOrderModel.cs b/BeautySaloon/BeautySaloonDataModels/IOrderModel.cs index 810ff4c..9310644 100644 --- a/BeautySaloon/BeautySaloonDataModels/IOrderModel.cs +++ b/BeautySaloon/BeautySaloonDataModels/IOrderModel.cs @@ -3,10 +3,10 @@ public interface IOrderModel { int Id { get; } - DateTime Date { get; } - double Sum { get; } + DateOnly Date { get; } + decimal Sum { get; } int ClientId { get; } int EmployeeId { get; } - Dictionary OrderServices { get; } + Dictionary OrderServices { get; } } } diff --git a/BeautySaloon/BeautySaloonDataModels/IServiceModel.cs b/BeautySaloon/BeautySaloonDataModels/IServiceModel.cs index a02a44b..a618b08 100644 --- a/BeautySaloon/BeautySaloonDataModels/IServiceModel.cs +++ b/BeautySaloon/BeautySaloonDataModels/IServiceModel.cs @@ -4,6 +4,6 @@ { int Id { get; } string Name { get; } - double Price { get; } + decimal Price { get; } } } diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/BeautySaloonDatabase.cs b/BeautySaloon/BeautySaloonDatabaseImplement/BeautySaloonDatabase.cs deleted file mode 100644 index 5401ded..0000000 --- a/BeautySaloon/BeautySaloonDatabaseImplement/BeautySaloonDatabase.cs +++ /dev/null @@ -1,29 +0,0 @@ -using BeautySaloonDatabaseImplement.Models; -using Microsoft.EntityFrameworkCore; - -namespace BeautySaloonDatabaseImplement -{ - public class BeautySaloonDatabase : DbContext - { - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - if (optionsBuilder.IsConfigured == false) - { - optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-D8KMQQU\SQLEXPRESS;Initial Catalog=SushiBarDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); - } - base.OnConfiguring(optionsBuilder); - } - - public virtual DbSet Employees { set; get; } - - public virtual DbSet Positions { set; get; } - - public virtual DbSet Services { set; get; } - - public virtual DbSet Orders { set; get; } - - public virtual DbSet Clients { set; get; } - - public virtual DbSet OrderServices { set; get; } - } -} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/BeautySaloonDatabaseImplement.csproj b/BeautySaloon/BeautySaloonDatabaseImplement/BeautySaloonDatabaseImplement.csproj index 8f45690..148ce06 100644 --- a/BeautySaloon/BeautySaloonDatabaseImplement/BeautySaloonDatabaseImplement.csproj +++ b/BeautySaloon/BeautySaloonDatabaseImplement/BeautySaloonDatabaseImplement.csproj @@ -6,10 +6,6 @@ enable - - - - @@ -17,6 +13,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Client.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Client.cs new file mode 100644 index 0000000..edea7da --- /dev/null +++ b/BeautySaloon/BeautySaloonDatabaseImplement/Client.cs @@ -0,0 +1,67 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.ViewModels; +using BeautySaloonDataModels; + +namespace BeautySaloonDatabaseImplement; + +/// +/// Сущность клиенты +/// +public partial class Client : IClientModel +{ + /// + /// Уникальный идентификатор + /// + public int Id { get; set; } + + /// + /// Имя + /// + public string Name { get; set; } = null!; + + /// + /// Фамилия + /// + public string Surname { get; set; } = null!; + + /// + /// Отчество + /// + public string? Patronymic { get; set; } + + /// + /// Номер телефона + /// + public string Phone { get; set; } = null!; + + public virtual ICollection Orders { get; } = new List(); + + public static Client Create(ClientBindingModel model) + { + return new Client() + { + Id = model.Id, + Name = model.Name, + Surname = model.Surname, + Patronymic = model.Patronymic, + Phone = model.Phone + }; + } + + public void Update(ClientBindingModel model) + { + Name = model.Name; + Surname = model.Surname; + Patronymic = model.Patronymic; + Phone = model.Phone; + } + + public ClientViewModel GetViewModel => new() + { + Id = Id, + Name = Name, + Surname = Surname, + Patronymic = Patronymic, + Phone = Phone + }; +} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Employee.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Employee.cs new file mode 100644 index 0000000..6ce0500 --- /dev/null +++ b/BeautySaloon/BeautySaloonDatabaseImplement/Employee.cs @@ -0,0 +1,88 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.ViewModels; +using BeautySaloonDataModels; + +namespace BeautySaloonDatabaseImplement; + +/// +/// Сущность сотрудники +/// +public partial class Employee : IEmployeeModel +{ + /// + /// Уникальный идентификатор + /// + public int Id { get; set; } + + /// + /// Имя + /// + public string Name { get; set; } = null!; + + /// + /// Фамилия + /// + public string Surname { get; set; } = null!; + + /// + /// Отчество + /// + public string? Patronymic { get; set; } + + /// + /// Номер телефона + /// + public string Phone { get; set; } = null!; + + /// + /// Идентификатор позиции + /// + public int PositionId { get; set; } + + public virtual ICollection Orders { get; } = new List(); + + public virtual Position Position { get; set; } = null!; + + public virtual ICollection ServiceOrders { get; } = new List(); + + public static Employee? Create(EmployeeBindingModel? model) + { + if (model == null) + { + return null; + } + return new Employee() + { + Id = model.Id, + Name = model.Name, + Surname = model.Surname, + Patronymic = model.Patronymic, + Phone = model.Phone, + PositionId = model.PositionId + }; + } + + public void Update(EmployeeBindingModel? model) + { + if (model == null) + { + return; + } + Name = model.Name; + Surname = model.Surname; + Patronymic = model.Patronymic; + Phone = model.Phone; + PositionId = model.PositionId; + } + + public EmployeeViewModel GetViewModel => new() + { + Id = Id, + Name = Name, + Surname = Surname, + Patronymic = Patronymic, + Phone = Phone, + PositionId = PositionId, + PositionName = Position.Name, + }; +} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Implements/ClientStorage.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Implements/ClientStorage.cs new file mode 100644 index 0000000..7a56379 --- /dev/null +++ b/BeautySaloon/BeautySaloonDatabaseImplement/Implements/ClientStorage.cs @@ -0,0 +1,86 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.StoragesContracts; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonDatabaseImplement.Implements +{ + public class ClientStorage : IClientStorage + { + public ClientViewModel? Delete(ClientBindingModel model) + { + using var context = new NewdbContext(); + var element = context.Clients + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Clients.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + + public ClientViewModel? GetElement(ClientSearchModel model) + { + using var context = new NewdbContext(); + if (model.Id.HasValue) + return context.Clients + .FirstOrDefault(x => x.Id == model.Id)? + .GetViewModel; + if (!string.IsNullOrEmpty(model.Phone)) + return context.Clients + .FirstOrDefault(x => x.Phone.Equals(model.Phone))? + .GetViewModel; + return null; + } + + public List GetFilteredList(ClientSearchModel model) + { + if (string.IsNullOrEmpty(model.Surname)) + { + return new(); + } + using var context = new NewdbContext(); + return context.Clients + .Where(x => x.Surname.Contains(model.Surname)) + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFullList() + { + using var context = new NewdbContext(); + return context.Clients + .Select(x => x.GetViewModel) + .ToList(); + } + + public ClientViewModel? Insert(ClientBindingModel model) + { + var newClient = Client.Create(model); + if (newClient == null) + { + return null; + } + using var context = new NewdbContext(); + context.Clients.Add(newClient); + context.SaveChanges(); + return newClient.GetViewModel; + } + + public ClientViewModel? Update(ClientBindingModel model) + { + using var context = new NewdbContext(); + var client = context.Clients + .FirstOrDefault(x => x.Id == model.Id); + if (client == null) + { + return null; + } + client.Update(model); + context.SaveChanges(); + return client.GetViewModel; + } + } +} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Implements/EmployeeStorage.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Implements/EmployeeStorage.cs new file mode 100644 index 0000000..c93f990 --- /dev/null +++ b/BeautySaloon/BeautySaloonDatabaseImplement/Implements/EmployeeStorage.cs @@ -0,0 +1,86 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.StoragesContracts; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonDatabaseImplement.Implements +{ + public class EmployeeStorage : IEmployeeStorage + { + public EmployeeViewModel? Delete(EmployeeBindingModel model) + { + using var context = new NewdbContext(); + var element = context.Employees + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Employees.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + + public EmployeeViewModel? GetElement(EmployeeSearchModel model) + { + using var context = new NewdbContext(); + if (model.Id.HasValue) + return context.Employees + .FirstOrDefault(x => x.Id == model.Id)? + .GetViewModel; + if (!string.IsNullOrEmpty(model.Phone)) + return context.Employees + .FirstOrDefault(x => x.Phone.Equals(model.Phone))? + .GetViewModel; + return null; + } + + public List GetFilteredList(EmployeeSearchModel model) + { + if (string.IsNullOrEmpty(model.Surname)) + { + return new(); + } + using var context = new NewdbContext(); + return context.Employees + .Where(x => x.Surname.Contains(model.Surname)) + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFullList() + { + using var context = new NewdbContext(); + return context.Employees + .Select(x => x.GetViewModel) + .ToList(); + } + + public EmployeeViewModel? Insert(EmployeeBindingModel model) + { + var newEmployee = Employee.Create(model); + if (newEmployee == null) + { + return null; + } + using var context = new NewdbContext(); + context.Employees.Add(newEmployee); + context.SaveChanges(); + return newEmployee.GetViewModel; + } + + public EmployeeViewModel? Update(EmployeeBindingModel model) + { + using var context = new NewdbContext(); + var client = context.Employees + .FirstOrDefault(x => x.Id == model.Id); + if (client == null) + { + return null; + } + client.Update(model); + context.SaveChanges(); + return client.GetViewModel; + } + } +} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Implements/OrderStorage.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Implements/OrderStorage.cs new file mode 100644 index 0000000..81c21f0 --- /dev/null +++ b/BeautySaloon/BeautySaloonDatabaseImplement/Implements/OrderStorage.cs @@ -0,0 +1,76 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.StoragesContracts; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonDatabaseImplement.Implements +{ + public class OrderStorage : IOrderStorage + { + public OrderViewModel? Delete(OrderBindingModel model) + { + using var context = new NewdbContext(); + var element = context.Orders + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Orders.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + + public OrderViewModel? GetElement(OrderSearchModel model) + { + using var context = new NewdbContext(); + if (model.Id.HasValue) + return context.Orders + .FirstOrDefault(x => x.Id == model.Id)? + .GetViewModel; + return null; + } + + public List GetFilteredList(OrderSearchModel model) + { + using var context = new NewdbContext(); + if (model.ClientId.HasValue) + return context.Orders + .Where(x => x.ClientId == model.ClientId) + .Select(x => x.GetViewModel) + .ToList(); + if (model.EmployeeId.HasValue) + return context.Orders + .Where(x => x.EmployeeId == model.EmployeeId) + .Select(x => x.GetViewModel) + .ToList(); + if (model.Date.HasValue) + return context.Orders + .Where(x => x.Date == model.Date) + .Select(x => x.GetViewModel) + .ToList(); + return new(); + } + + public List GetFullList() + { + using var context = new NewdbContext(); + return context.Orders + .Select(x => x.GetViewModel) + .ToList(); + } + + public OrderViewModel? Insert(OrderBindingModel model) + { + var newOrder = Order.Create(model); + if (newOrder == null) + { + return null; + } + using var context = new NewdbContext(); + context.Orders.Add(newOrder); + context.SaveChanges(); + return newOrder.GetViewModel; + } + } +} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Implements/PositionStorage.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Implements/PositionStorage.cs new file mode 100644 index 0000000..7826beb --- /dev/null +++ b/BeautySaloon/BeautySaloonDatabaseImplement/Implements/PositionStorage.cs @@ -0,0 +1,86 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.StoragesContracts; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonDatabaseImplement.Implements +{ + public class PositionStorage : IPositionStorage + { + public PositionViewModel? Delete(PositionBindingModel model) + { + using var context = new NewdbContext(); + var element = context.Positions + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Positions.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + + public PositionViewModel? GetElement(PositionSearchModel model) + { + using var context = new NewdbContext(); + if (model.Id.HasValue) + return context.Positions + .FirstOrDefault(x => x.Id == model.Id)? + .GetViewModel; + if (!string.IsNullOrEmpty(model.Name)) + return context.Positions + .FirstOrDefault(x => x.Name.Equals(model.Name))? + .GetViewModel; + return null; + } + + public List GetFilteredList(PositionSearchModel model) + { + if (string.IsNullOrEmpty(model.Name)) + { + return new(); + } + using var context = new NewdbContext(); + return context.Positions + .Where(x => x.Name.Contains(model.Name)) + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFullList() + { + using var context = new NewdbContext(); + return context.Positions + .Select(x => x.GetViewModel) + .ToList(); + } + + public PositionViewModel? Insert(PositionBindingModel model) + { + var newPosition = Position.Create(model); + if (newPosition == null) + { + return null; + } + using var context = new NewdbContext(); + context.Positions.Add(newPosition); + context.SaveChanges(); + return newPosition.GetViewModel; + } + + public PositionViewModel? Update(PositionBindingModel model) + { + using var context = new NewdbContext(); + var element = context.Positions + .FirstOrDefault(x => x.Id == model.Id); + if (element == null) + { + return null; + } + element.Update(model); + context.SaveChanges(); + return element.GetViewModel; + } + } +} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Implements/ServiceStorage.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Implements/ServiceStorage.cs new file mode 100644 index 0000000..728bb6a --- /dev/null +++ b/BeautySaloon/BeautySaloonDatabaseImplement/Implements/ServiceStorage.cs @@ -0,0 +1,86 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.SearchModels; +using BeautySaloonContracts.StoragesContracts; +using BeautySaloonContracts.ViewModels; + +namespace BeautySaloonDatabaseImplement.Implements +{ + public class ServiceStorage : IServiceStorage + { + public ServiceViewModel? Delete(ServiceBindingModel model) + { + using var context = new NewdbContext(); + var element = context.Services + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Services.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + + public ServiceViewModel? GetElement(ServiceSearchModel model) + { + using var context = new NewdbContext(); + if (model.Id.HasValue) + return context.Services + .FirstOrDefault(x => x.Id == model.Id)? + .GetViewModel; + if (!string.IsNullOrEmpty(model.Name)) + return context.Services + .FirstOrDefault(x => x.Name.Equals(model.Name))? + .GetViewModel; + return null; + } + + public List GetFilteredList(ServiceSearchModel model) + { + if (string.IsNullOrEmpty(model.Name)) + { + return new(); + } + using var context = new NewdbContext(); + return context.Services + .Where(x => x.Name.Contains(model.Name)) + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFullList() + { + using var context = new NewdbContext(); + return context.Services + .Select(x => x.GetViewModel) + .ToList(); + } + + public ServiceViewModel? Insert(ServiceBindingModel model) + { + var newService = Service.Create(model); + if (newService == null) + { + return null; + } + using var context = new NewdbContext(); + context.Services.Add(newService); + context.SaveChanges(); + return newService.GetViewModel; + } + + public ServiceViewModel? Update(ServiceBindingModel model) + { + using var context = new NewdbContext(); + var service = context.Services + .FirstOrDefault(x => x.Id == model.Id); + if (service == null) + { + return null; + } + service.Update(model); + context.SaveChanges(); + return service.GetViewModel; + } + } +} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Models/Client.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Models/Client.cs deleted file mode 100644 index 67047db..0000000 --- a/BeautySaloon/BeautySaloonDatabaseImplement/Models/Client.cs +++ /dev/null @@ -1,52 +0,0 @@ -using BeautySaloonContracts.BindingModels; -using BeautySaloonContracts.ViewModels; -using BeautySaloonDataModels; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Diagnostics; - -namespace BeautySaloonDatabaseImplement.Models -{ - public class Client : IClientModel - { - public int Id { get; set; } - [Required] - public string Name { get; set; } = string.Empty; - [Required] - public string Surname { get; set; } = string.Empty; - public string Patronymic { get; set; } = string.Empty; - [Required] - public string Phone { get; set; } = string.Empty; - [ForeignKey("ClientId")] - public virtual List Orders { get; set; } = new(); - - public static Client Create(ClientBindingModel model) - { - return new Client() - { - Id = model.Id, - Name = model.Name, - Surname = model.Surname, - Patronymic = model.Patronymic, - Phone = model.Phone - }; - } - - public void Update(ClientBindingModel model) - { - Name = model.Name; - Surname = model.Surname; - Patronymic = model.Patronymic; - Phone = model.Phone; - } - - public ClientViewModel GetViewModel => new() - { - Id = Id, - Name = Name, - Surname = Surname, - Patronymic = Patronymic, - Phone = Phone - }; - } -} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Models/Employee.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Models/Employee.cs deleted file mode 100644 index 68fc4d4..0000000 --- a/BeautySaloon/BeautySaloonDatabaseImplement/Models/Employee.cs +++ /dev/null @@ -1,70 +0,0 @@ -using BeautySaloonContracts.BindingModels; -using BeautySaloonContracts.ViewModels; -using BeautySaloonDataModels; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace BeautySaloonDatabaseImplement.Models -{ - public class Employee : IEmployeeModel - { - public int Id { get; set; } - [Required] - public string Name { get; set; } = string.Empty; - [Required] - public string Surname { get; set; } = string.Empty; - - public string Patronymic { get; set; } = string.Empty; - [Required] - public string Phone { get; set; } = string.Empty; - [Required] - public int PositionId { get; set; } - public Position Position { get; set; } - - [ForeignKey("EmployeeId")] - public virtual List Orders { get; set; } = new(); - [ForeignKey("EmployeeId")] - public virtual List OrderServices { get; set; } = new(); - - public static Employee? Create(EmployeeBindingModel? model) - { - if (model == null) - { - return null; - } - return new Employee() - { - Id = model.Id, - Name = model.Name, - Surname = model.Surname, - Patronymic = model.Patronymic, - Phone = model.Phone, - PositionId = model.PositionId - }; - } - - public void Update(EmployeeBindingModel? model) - { - if (model == null) - { - return; - } - Name = model.Name; - Surname = model.Surname; - Patronymic = model.Patronymic; - Phone = model.Phone; - PositionId = model.PositionId; - } - - public EmployeeViewModel GetViewModel => new() - { - Id = Id, - Name = Name, - Surname = Surname, - Patronymic = Patronymic, - Phone = Phone, - PositionId = PositionId, - PositionName = Position.Name, - }; - } -} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Models/Order.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Models/Order.cs deleted file mode 100644 index 978573e..0000000 --- a/BeautySaloon/BeautySaloonDatabaseImplement/Models/Order.cs +++ /dev/null @@ -1,38 +0,0 @@ -using BeautySaloonDataModels; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace BeautySaloonDatabaseImplement.Models -{ - public class Order : IOrderModel - { - public int Id { get; set; } - [Required] - public DateTime Date { get; set; } - [Required] - public double Sum { get; set; } - [Required] - public int ClientId { get; set; } - [Required] - public int EmployeeId { get; set; } - - private Dictionary? _orderServices = null; - [ForeignKey("OrderId")] - public virtual List Services { get; set; } = new(); - - [NotMapped] - public Dictionary OrderServices - { - get - { - /*if (_orderServices == null) - { - _orderServices = Services - .ToDictionary(recPC => recPC.ServiceId, - recPC => (recPC.Service as IServiceModel, recPC.Count)); - }*/ - return _orderServices; - } - } - } -} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Models/Position.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Models/Position.cs deleted file mode 100644 index ead7554..0000000 --- a/BeautySaloon/BeautySaloonDatabaseImplement/Models/Position.cs +++ /dev/null @@ -1,36 +0,0 @@ -using BeautySaloonContracts.BindingModels; -using BeautySaloonContracts.ViewModels; -using BeautySaloonDataModels; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace BeautySaloonDatabaseImplement.Models -{ - public class Position : IPositionModel - { - public int Id { get; set; } - [Required] - public string Name { get; set; } = string.Empty; - [ForeignKey("PositionId")] - public virtual List Employees { get; set; } = new(); - - public static Position Create(PositionBindingModel model) - { - return new Position() - { - Id = model.Id, - Name = model.Name - }; - } - public void Update(PositionBindingModel model) - { - Name = model.Name; - } - - public PositionViewModel GetViewModel => new() - { - Id = Id, - Name = Name - }; - } -} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Models/Service.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Models/Service.cs deleted file mode 100644 index 8b607d8..0000000 --- a/BeautySaloon/BeautySaloonDatabaseImplement/Models/Service.cs +++ /dev/null @@ -1,41 +0,0 @@ -using BeautySaloonContracts.BindingModels; -using BeautySaloonDataModels; -using System.ComponentModel.DataAnnotations.Schema; -using System.ComponentModel.DataAnnotations; -using BeautySaloonContracts.ViewModels; - -namespace BeautySaloonDatabaseImplement.Models -{ - public class Service : IServiceModel - { - public int Id { get; set; } - [Required] - public string Name { get; set; } = string.Empty; - [Required] - public double Price { get; set; } - [ForeignKey("ServiceId")] - public virtual List OrderServices { get; set; } = new(); - - public static Service Create(ServiceBindingModel model) - { - return new Service() - { - Id = model.Id, - Name = model.Name, - Price = model.Price - }; - } - public void Update(ServiceBindingModel model) - { - Name = model.Name; - Price = model.Price; - } - - public ServiceViewModel GetViewModel => new() - { - Id = Id, - Name = Name, - Price = Price - }; - } -} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Models/ServiceOrder.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Models/ServiceOrder.cs deleted file mode 100644 index 87ecdfd..0000000 --- a/BeautySaloon/BeautySaloonDatabaseImplement/Models/ServiceOrder.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace BeautySaloonDatabaseImplement.Models -{ - public class ServiceOrder - { - [Required] - public int ServiceId { get; set; } - - [Required] - public int OrderId { get; set; } - [Required] - public int EmployeeId { get; set; } - - [Required] - public DateTime Date { get; set; } - - public virtual Service Service { get; set; } = new(); - - public virtual Order Order { get; set; } = new(); - - public virtual Employee Employee { get; set; } = new(); - } -} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/NewdbContext.cs b/BeautySaloon/BeautySaloonDatabaseImplement/NewdbContext.cs new file mode 100644 index 0000000..c1e3ae8 --- /dev/null +++ b/BeautySaloon/BeautySaloonDatabaseImplement/NewdbContext.cs @@ -0,0 +1,215 @@ +using Microsoft.EntityFrameworkCore; + +namespace BeautySaloonDatabaseImplement; + +public partial class NewdbContext : DbContext +{ + public NewdbContext() + { + } + + public NewdbContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet Clients { get; set; } + + public virtual DbSet Employees { get; set; } + + public virtual DbSet Orders { get; set; } + + public virtual DbSet Positions { get; set; } + + public virtual DbSet Services { get; set; } + + public virtual DbSet ServiceOrders { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) +#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. + => optionsBuilder.UseNpgsql("Host=192.168.0.103;Port=5432;Database=newdb;Username=username123;Password=12345"); + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("client_pkey"); + + entity.ToTable("clients", tb => tb.HasComment("Сущность клиенты")); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasComment("Уникальный идентификатор") + .HasColumnName("id"); + entity.Property(e => e.Name) + .HasMaxLength(40) + .HasComment("Имя") + .HasColumnName("name"); + entity.Property(e => e.Patronymic) + .HasMaxLength(40) + .HasDefaultValueSql("'Отсутствует'::character varying") + .HasComment("Отчество") + .HasColumnName("patronymic"); + entity.Property(e => e.Phone) + .HasMaxLength(11) + .HasComment("Номер телефона") + .HasColumnName("phone"); + entity.Property(e => e.Surname) + .HasMaxLength(40) + .HasComment("Фамилия") + .HasColumnName("surname"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("employee_pkey"); + + entity.ToTable("employees", tb => tb.HasComment("Сущность сотрудники")); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasComment("Уникальный идентификатор") + .HasColumnName("id"); + entity.Property(e => e.Name) + .HasMaxLength(40) + .HasComment("Имя") + .HasColumnName("name"); + entity.Property(e => e.Patronymic) + .HasMaxLength(40) + .HasDefaultValueSql("'Отсутствует'::character varying") + .HasComment("Отчество") + .HasColumnName("patronymic"); + entity.Property(e => e.Phone) + .HasMaxLength(11) + .HasComment("Номер телефона") + .HasColumnName("phone"); + entity.Property(e => e.PositionId) + .HasComment("Идентификатор позиции") + .HasColumnName("position_id"); + entity.Property(e => e.Surname) + .HasMaxLength(40) + .HasComment("Фамилия") + .HasColumnName("surname"); + + entity.HasOne(d => d.Position).WithMany(p => p.Employees) + .HasForeignKey(d => d.PositionId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("position_fk"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("order_table_pkey"); + + entity.ToTable("orders", tb => tb.HasComment("Сущность заказы")); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasComment("Уникальный идентификатор") + .HasColumnName("id"); + entity.Property(e => e.ClientId) + .HasComment("Идентификатор клиента") + .HasColumnName("client_id"); + entity.Property(e => e.Date) + .HasComment("Дата") + .HasColumnName("date"); + entity.Property(e => e.EmployeeId) + .HasComment("Идентификатор сотрудника") + .HasColumnName("employee_id"); + entity.Property(e => e.Sum) + .HasPrecision(6, 2) + .HasComment("Сумма") + .HasColumnName("sum"); + + entity.HasOne(d => d.Client).WithMany(p => p.Orders) + .HasForeignKey(d => d.ClientId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("client_fk"); + + entity.HasOne(d => d.Employee).WithMany(p => p.Orders) + .HasForeignKey(d => d.EmployeeId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("employee_fk"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("position_pkey"); + + entity.ToTable("positions", tb => tb.HasComment("Сущность позиции")); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasComment("Идентификатор") + .HasColumnName("id"); + entity.Property(e => e.Name) + .HasMaxLength(40) + .HasComment("Название") + .HasColumnName("name"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("service_pkey"); + + entity.ToTable("services", tb => tb.HasComment("Сущность услуги")); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasComment("Уникальный идентификатор") + .HasColumnName("id"); + entity.Property(e => e.Name) + .HasMaxLength(40) + .HasComment("Название") + .HasColumnName("name"); + entity.Property(e => e.Price) + .HasPrecision(6, 2) + .HasComment("Цена") + .HasColumnName("price"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.ServiceId, e.OrderId }).HasName("service_order_pkey"); + + entity.ToTable("service_order", tb => tb.HasComment("Сущность-связь услуги с заказом")); + + entity.HasIndex(e => e.OrderId, "service_order_orderid_key").IsUnique(); + + entity.HasIndex(e => e.ServiceId, "service_order_serviceid_key").IsUnique(); + + entity.Property(e => e.ServiceId) + .HasComment("Составной первичный ключ: идентификатор услуги") + .HasColumnName("service_id"); + entity.Property(e => e.OrderId) + .HasComment("Составной первичный ключ: идентификатор заказа") + .HasColumnName("order_id"); + entity.Property(e => e.Date) + .HasPrecision(6) + .HasComment("Время") + .HasColumnName("date"); + entity.Property(e => e.EmployeeId) + .HasComment("Идентификатор сотрудника") + .HasColumnName("employee_id"); + + entity.HasOne(d => d.Employee).WithMany(p => p.ServiceOrders) + .HasForeignKey(d => d.EmployeeId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("employee_fk"); + + entity.HasOne(d => d.Order).WithOne(p => p.ServiceOrder) + .HasForeignKey(d => d.OrderId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("order_fk"); + + entity.HasOne(d => d.Service).WithOne(p => p.ServiceOrder) + .HasForeignKey(d => d.ServiceId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("service_fk"); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Order.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Order.cs new file mode 100644 index 0000000..d2e444e --- /dev/null +++ b/BeautySaloon/BeautySaloonDatabaseImplement/Order.cs @@ -0,0 +1,93 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.ViewModels; +using BeautySaloonDataModels; +using System; +using System.ComponentModel.DataAnnotations.Schema; +using System.Numerics; + +namespace BeautySaloonDatabaseImplement; + +/// +/// Сущность заказы +/// +public partial class Order : IOrderModel +{ + /// + /// Уникальный идентификатор + /// + public int Id { get; set; } + + /// + /// Дата + /// + public DateOnly Date { get; set; } + + /// + /// Сумма + /// + public decimal Sum { get; set; } + + /// + /// Идентификатор клиента + /// + public int ClientId { get; set; } + + /// + /// Идентификатор сотрудника + /// + public int EmployeeId { get; set; } + + public virtual Client Client { get; set; } = null!; + + public virtual Employee Employee { get; set; } = null!; + + public virtual ServiceOrder? ServiceOrder { get; set; } + + + public Dictionary _orderServices = null; + + public virtual List Services { get; set; } = new(); + + public Dictionary OrderServices + { + get + { + if (ServiceOrder != null) + { + _orderServices = Services + .ToDictionary(x => x.ServiceId, + x => (x.Date, x.Service as IServiceModel, x.Employee as IEmployeeModel)); + } + return _orderServices; + } + } + + public static Order? Create(OrderBindingModel? model) + { + if (model == null) + { + return null; + } + return new Order() + { + Id = model.Id, + Date = model.Date, + Sum = model.Sum, + ClientId = model.ClientId, + EmployeeId = model.EmployeeId + }; + } + + public OrderViewModel GetViewModel => new() + { + Id = Id, + Date = Date, + Sum = Sum, + ClientId = ClientId, + EmployeeId = EmployeeId, + ClientName = Client.Name, + EmployeeName = Employee.Name, + ClientPhone = Client.Phone, + EmployeePhone = Employee.Phone + }; +} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Position.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Position.cs new file mode 100644 index 0000000..4cbb4b8 --- /dev/null +++ b/BeautySaloon/BeautySaloonDatabaseImplement/Position.cs @@ -0,0 +1,42 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.ViewModels; +using BeautySaloonDataModels; + +namespace BeautySaloonDatabaseImplement; + +/// +/// Сущность позиции +/// +public partial class Position : IPositionModel +{ + /// + /// Идентификатор + /// + public int Id { get; set; } + + /// + /// Название + /// + public string Name { get; set; } = null!; + + public virtual ICollection Employees { get; } = new List(); + + public static Position Create(PositionBindingModel model) + { + return new Position() + { + Id = model.Id, + Name = model.Name + }; + } + public void Update(PositionBindingModel model) + { + Name = model.Name; + } + + public PositionViewModel GetViewModel => new() + { + Id = Id, + Name = Name + }; +} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/Service.cs b/BeautySaloon/BeautySaloonDatabaseImplement/Service.cs new file mode 100644 index 0000000..c8a8a7b --- /dev/null +++ b/BeautySaloon/BeautySaloonDatabaseImplement/Service.cs @@ -0,0 +1,52 @@ +using BeautySaloonContracts.BindingModels; +using BeautySaloonContracts.ViewModels; +using BeautySaloonDataModels; +using System; +using System.Collections.Generic; + +namespace BeautySaloonDatabaseImplement; + +/// +/// Сущность услуги +/// +public partial class Service : IServiceModel +{ + /// + /// Уникальный идентификатор + /// + public int Id { get; set; } + + /// + /// Название + /// + public string Name { get; set; } = null!; + + /// + /// Цена + /// + public decimal Price { get; set; } + + public virtual ServiceOrder? ServiceOrder { get; set; } + + public static Service Create(ServiceBindingModel model) + { + return new Service() + { + Id = model.Id, + Name = model.Name, + Price = model.Price + }; + } + public void Update(ServiceBindingModel model) + { + Name = model.Name; + Price = model.Price; + } + + public ServiceViewModel GetViewModel => new() + { + Id = Id, + Name = Name, + Price = Price + }; +} diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/ServiceOrder.cs b/BeautySaloon/BeautySaloonDatabaseImplement/ServiceOrder.cs new file mode 100644 index 0000000..abc469d --- /dev/null +++ b/BeautySaloon/BeautySaloonDatabaseImplement/ServiceOrder.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; + +namespace BeautySaloonDatabaseImplement; + +/// +/// Сущность-связь услуги с заказом +/// +public partial class ServiceOrder +{ + /// + /// Составной первичный ключ: идентификатор услуги + /// + public int ServiceId { get; set; } + + /// + /// Составной первичный ключ: идентификатор заказа + /// + public int OrderId { get; set; } + + /// + /// Время + /// + public TimeOnly Date { get; set; } + + /// + /// Идентификатор сотрудника + /// + public int EmployeeId { get; set; } + + public virtual Employee Employee { get; set; } = null!; + + public virtual Order Order { get; set; } = null!; + + public virtual Service Service { get; set; } = null!; +} diff --git a/BeautySaloon/BeautySaloonView/BeautySaloonView.csproj b/BeautySaloon/BeautySaloonView/BeautySaloonView.csproj index 9200065..2fdce82 100644 --- a/BeautySaloon/BeautySaloonView/BeautySaloonView.csproj +++ b/BeautySaloon/BeautySaloonView/BeautySaloonView.csproj @@ -9,12 +9,17 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/BeautySaloon/BeautySaloonView/FormMain.Designer.cs b/BeautySaloon/BeautySaloonView/FormMain.Designer.cs index b874383..3deb8e0 100644 --- a/BeautySaloon/BeautySaloonView/FormMain.Designer.cs +++ b/BeautySaloon/BeautySaloonView/FormMain.Designer.cs @@ -28,12 +28,126 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); + this.dataGridView = new System.Windows.Forms.DataGridView(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.должностиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.услугиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.сотрудникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.buttonUpdate = new System.Windows.Forms.Button(); + this.buttonCreateOrder = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.menuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // dataGridView + // + this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView.Dock = System.Windows.Forms.DockStyle.Left; + this.dataGridView.Location = new System.Drawing.Point(0, 24); + this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.dataGridView.Name = "dataGridView"; + this.dataGridView.RowHeadersWidth = 51; + this.dataGridView.RowTemplate.Height = 29; + this.dataGridView.Size = new System.Drawing.Size(854, 515); + this.dataGridView.TabIndex = 8; + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.справочникиToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(1037, 24); + this.menuStrip1.TabIndex = 9; + this.menuStrip1.Text = "menuStrip1"; + // + // справочникиToolStripMenuItem + // + this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.должностиToolStripMenuItem, + this.услугиToolStripMenuItem, + this.сотрудникиToolStripMenuItem, + this.клиентыToolStripMenuItem}); + this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; + this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(94, 20); + this.справочникиToolStripMenuItem.Text = "Справочники"; + // + // должностиToolStripMenuItem + // + this.должностиToolStripMenuItem.Name = "должностиToolStripMenuItem"; + this.должностиToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.должностиToolStripMenuItem.Text = "Должности"; + // + // услугиToolStripMenuItem + // + this.услугиToolStripMenuItem.Name = "услугиToolStripMenuItem"; + this.услугиToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.услугиToolStripMenuItem.Text = "Услуги"; + // + // сотрудникиToolStripMenuItem + // + this.сотрудникиToolStripMenuItem.Name = "сотрудникиToolStripMenuItem"; + this.сотрудникиToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.сотрудникиToolStripMenuItem.Text = "Сотрудники"; + // + // клиентыToolStripMenuItem + // + this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem"; + this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.клиентыToolStripMenuItem.Text = "Клиенты"; + // + // buttonUpdate + // + this.buttonUpdate.Location = new System.Drawing.Point(885, 270); + this.buttonUpdate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonUpdate.Name = "buttonUpdate"; + this.buttonUpdate.Size = new System.Drawing.Size(116, 58); + this.buttonUpdate.TabIndex = 17; + this.buttonUpdate.Text = "Обновить"; + this.buttonUpdate.UseVisualStyleBackColor = true; + // + // buttonCreateOrder + // + this.buttonCreateOrder.Location = new System.Drawing.Point(885, 208); + this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonCreateOrder.Name = "buttonCreateOrder"; + this.buttonCreateOrder.Size = new System.Drawing.Size(116, 58); + this.buttonCreateOrder.TabIndex = 13; + this.buttonCreateOrder.Text = "Создать заказ"; + this.buttonCreateOrder.UseVisualStyleBackColor = true; + // + // FormMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; + this.ClientSize = new System.Drawing.Size(1037, 539); + this.Controls.Add(this.buttonUpdate); + this.Controls.Add(this.buttonCreateOrder); + this.Controls.Add(this.dataGridView); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "FormMain"; + this.Text = "Салон красоты"; + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion + + private DataGridView dataGridView; + private MenuStrip menuStrip1; + private ToolStripMenuItem справочникиToolStripMenuItem; + private ToolStripMenuItem должностиToolStripMenuItem; + private ToolStripMenuItem услугиToolStripMenuItem; + private ToolStripMenuItem сотрудникиToolStripMenuItem; + private ToolStripMenuItem клиентыToolStripMenuItem; + private Button buttonUpdate; + private Button buttonCreateOrder; } } \ No newline at end of file diff --git a/BeautySaloon/BeautySaloonView/FormMain.resx b/BeautySaloon/BeautySaloonView/FormMain.resx index 1af7de1..938108a 100644 --- a/BeautySaloon/BeautySaloonView/FormMain.resx +++ b/BeautySaloon/BeautySaloonView/FormMain.resx @@ -1,64 +1,4 @@ - - - + @@ -117,4 +57,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file