Частичное создание контрактов

This commit is contained in:
dasha 2023-03-28 16:13:50 +04:00
parent c53a1e3b6a
commit ba10c6695a
28 changed files with 331 additions and 16 deletions

View File

@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeautySaloonView", "BeautySaloonView\BeautySaloonView.csproj", "{4098AFA1-025D-4259-A4FD-4546A533DE60}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeautySaloonView", "BeautySaloonView\BeautySaloonView.csproj", "{4098AFA1-025D-4259-A4FD-4546A533DE60}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeautySaloonDataModels", "BeautySaloonDataModels\BeautySaloonDataModels.csproj", "{A83AC6FD-F6BD-4BD2-AC69-3BB5BA30FF7D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeautySaloonDataModels", "BeautySaloonDataModels\BeautySaloonDataModels.csproj", "{A83AC6FD-F6BD-4BD2-AC69-3BB5BA30FF7D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeautySaloonContracts", "BeautySaloonContracts\BeautySaloonContracts.csproj", "{7494D3AF-2581-4128-9183-BB87A9DC4B10}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -21,6 +23,10 @@ Global
{A83AC6FD-F6BD-4BD2-AC69-3BB5BA30FF7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A83AC6FD-F6BD-4BD2-AC69-3BB5BA30FF7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A83AC6FD-F6BD-4BD2-AC69-3BB5BA30FF7D}.Release|Any CPU.Build.0 = Release|Any CPU
{7494D3AF-2581-4128-9183-BB87A9DC4B10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7494D3AF-2581-4128-9183-BB87A9DC4B10}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7494D3AF-2581-4128-9183-BB87A9DC4B10}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7494D3AF-2581-4128-9183-BB87A9DC4B10}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="StoragesContracts\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BeautySaloonDataModels\BeautySaloonDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,13 @@
using BeautySaloonDataModels;
namespace BeautySaloonContracts.BindingModels
{
public class ClientBindingModel : IClientModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Surname { get; set; } = string.Empty;
public string Patronymic { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,14 @@
using BeautySaloonDataModels;
namespace BeautySaloonContracts.BindingModels
{
public class EmployeeBindingModel : IEmployeeModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Surname { get; set; } = string.Empty;
public string Patronymic { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
public int PositionId { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using BeautySaloonDataModels;
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 int ClientId { get; set; }
public int EmployeeId { get; set; }
public Dictionary<DateTime, (IServiceModel, IEmployeeModel)> OrderServices
{
get;
set;
} = new();
}
}

View File

@ -0,0 +1,11 @@

using BeautySaloonDataModels;
namespace BeautySaloonContracts.BindingModels
{
public class PositionBindingModel : IPositionModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,11 @@
using BeautySaloonDataModels;
namespace BeautySaloonContracts.BindingModels
{
public class ServiceBindingModel : IServiceModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public double Price { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using BeautySaloonContracts.BindingModels;
using BeautySaloonContracts.SearchModels;
using BeautySaloonContracts.ViewModels;
namespace BeautySaloonContracts.BusinessLogicsContracts
{
public interface IClientLogic
{
List<ClientViewModel>? ReadList(ClientSearchModel? model);
ClientViewModel? ReadElement(ClientSearchModel model);
bool Create(ClientBindingModel model);
bool Update(ClientBindingModel model);
bool Delete(ClientBindingModel model);
}
}

View File

@ -0,0 +1,19 @@
using BeautySaloonContracts.BindingModels;
using BeautySaloonContracts.SearchModels;
using BeautySaloonContracts.ViewModels;
namespace BeautySaloonContracts.BusinessLogicsContracts
{
public interface IEmployeeLogic
{
List<EmployeeViewModel>? ReadList(EmployeeSearchModel? model);
EmployeeViewModel? ReadElement(EmployeeSearchModel model);
bool Create(EmployeeBindingModel model);
bool Update(EmployeeBindingModel model);
bool Delete(EmployeeBindingModel model);
}
}

View File

@ -0,0 +1,13 @@
using BeautySaloonContracts.BindingModels;
using BeautySaloonContracts.SearchModels;
using BeautySaloonContracts.ViewModels;
namespace BeautySaloonContracts.BusinessLogicsContracts
{
public interface IOrderLogic
{
List<OrderViewModel>? ReadList(OrderSearchModel? model);
bool CreateOrder(OrderBindingModel model);
}
}

View File

@ -0,0 +1,19 @@
using BeautySaloonContracts.BindingModels;
using BeautySaloonContracts.SearchModels;
using BeautySaloonContracts.ViewModels;
namespace BeautySaloonContracts.BusinessLogicsContracts
{
public interface IPositionLogic
{
List<PositionViewModel>? ReadList(PositionSearchModel? model);
PositionViewModel? ReadElement(PositionSearchModel model);
bool Create(PositionBindingModel model);
bool Update(PositionBindingModel model);
bool Delete(PositionBindingModel model);
}
}

View File

@ -0,0 +1,19 @@
using BeautySaloonContracts.BindingModels;
using BeautySaloonContracts.SearchModels;
using BeautySaloonContracts.ViewModels;
namespace BeautySaloonContracts.BusinessLogicsContracts
{
public interface IServiceLogic
{
List<ServiceViewModel>? ReadList(ServiceSearchModel? model);
ServiceViewModel? ReadElement(ServiceSearchModel model);
bool Create(ServiceBindingModel model);
bool Update(ServiceBindingModel model);
bool Delete(ServiceBindingModel model);
}
}

View File

@ -0,0 +1,11 @@
namespace BeautySaloonContracts.SearchModels
{
public class ClientSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
public string? Surname { get; set; }
public string? Patronymic { get; set; }
public string? Phone { get; set; }
}
}

View File

@ -0,0 +1,12 @@
namespace BeautySaloonContracts.SearchModels
{
public class EmployeeSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
public string? Surname { get; set; }
public string? Patronymic { get; set; }
public string? Phone { get; set; }
public int? PositionId { get; set; }
}
}

View File

@ -0,0 +1,10 @@
namespace BeautySaloonContracts.SearchModels
{
public class OrderSearchModel
{
public int? Id { get; set; }
public DateTime? Date { get; set; }
public int? Client_Id { get; set; }
public int? Employee_Id { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace BeautySaloonContracts.SearchModels
{
public class PositionSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace BeautySaloonContracts.SearchModels
{
public class ServiceSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using BeautySaloonDataModels;
using System.ComponentModel;
namespace BeautySaloonContracts.ViewModels
{
public class ClientViewModel : IClientModel
{
public int Id { get; set; }
[DisplayName("Имя")]
public string Name { get; set; } = string.Empty;
[DisplayName("Фамилия")]
public string Surname { get; set; } = string.Empty;
[DisplayName("Отчество")]
public string Patronymic { get; set; } = string.Empty;
[DisplayName("Телефон")]
public string Phone { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,21 @@
using BeautySaloonDataModels;
using System.ComponentModel;
namespace BeautySaloonContracts.ViewModels
{
public class EmployeeViewModel : IEmployeeModel
{
public int Id { get; set; }
public int PositionId { get; set; }
[DisplayName("Должность")]
public string PositionName { get; set; } = string.Empty;
[DisplayName("Имя")]
public string Name { get; set; } = string.Empty;
[DisplayName("Фамилия")]
public string Surname { get; set; } = string.Empty;
[DisplayName("Отчество")]
public string Patronymic { get; set; } = string.Empty;
[DisplayName("Телефон")]
public string Phone { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,22 @@
using BeautySaloonDataModels;
using System.ComponentModel;
namespace BeautySaloonContracts.ViewModels
{
public class OrderViewModel : IOrderModel
{
[DisplayName("Номер")]
public int Id { get; set; }
[DisplayName("Дата заказа")]
public DateTime Date { get; set; } = DateTime.Now;
[DisplayName("Сумма")]
public double Sum { get; set; }
public int ClientId { get; set; }
[DisplayName("Клиент")]
public string ClientName { get; set; } = string.Empty;
public int EmployeeId { get; set; }
[DisplayName("Продавец")]
public string EmployeeName { get; set; } = string.Empty;
public Dictionary<DateTime, (IServiceModel, IEmployeeModel)> OrderServices { get; set; } = new();
}
}

View File

@ -0,0 +1,12 @@
using BeautySaloonDataModels;
using System.ComponentModel;
namespace BeautySaloonContracts.ViewModels
{
public class PositionViewModel : IPositionModel
{
public int Id { get; set; }
[DisplayName("Должность")]
public string Name { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,14 @@
using BeautySaloonDataModels;
using System.ComponentModel;
namespace BeautySaloonContracts.ViewModels
{
public class ServiceViewModel : IServiceModel
{
public int Id { get; set; }
[DisplayName("Услуга")]
public string Name { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
}
}

View File

@ -1,4 +1,4 @@
namespace BeautySaloonDataModels.Models
namespace BeautySaloonDataModels
{
public interface IClientModel
{
@ -7,6 +7,5 @@
string Surname { get; }
string Patronymic { get; }
string Phone { get; }
List<IOrderModel> Orders { get; }
}
}

View File

@ -1,4 +1,4 @@
namespace BeautySaloonDataModels.Models
namespace BeautySaloonDataModels
{
public interface IEmployeeModel
{

View File

@ -1,4 +1,4 @@
namespace BeautySaloonDataModels.Models
namespace BeautySaloonDataModels
{
public interface IOrderModel
{
@ -6,6 +6,7 @@
DateTime Date { get; }
double Sum { get; }
int ClientId { get; }
Dictionary<IServiceModel, (IEmployeeModel, DateTime)> OrderServices { get; }
int EmployeeId { get; }
Dictionary<DateTime, (IServiceModel, IEmployeeModel)> OrderServices { get; }
}
}

View File

@ -0,0 +1,8 @@
namespace BeautySaloonDataModels
{
public interface IPositionModel
{
int Id { get; }
string Name { get; }
}
}

View File

@ -1,4 +1,4 @@
namespace BeautySaloonDataModels.Models
namespace BeautySaloonDataModels
{
public interface IServiceModel
{

View File

@ -1,8 +0,0 @@
namespace BeautySaloonDataModels.Models
{
public interface IPositionModel
{
int Id { get; }
string Name { get; }
}
}