добавлены контракты

This commit is contained in:
Татьяна Артамонова 2023-05-13 13:37:59 +04:00
parent 8705e36039
commit 768f3b6b36
28 changed files with 335 additions and 0 deletions

View File

@ -5,6 +5,10 @@ VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeautySalon", "BeautySalon.csproj", "{1D636E61-E3F0-4B64-998C-730FC76731F1}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeautySalon", "BeautySalon.csproj", "{1D636E61-E3F0-4B64-998C-730FC76731F1}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeautySalonDataModels", "..\BeautySalonDataModels\BeautySalonDataModels.csproj", "{3BE3FEC4-6794-4EA7-83BE-D382996DB168}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeautySalonContracts", "..\BeauySalonContracts\BeautySalonContracts.csproj", "{8CBBB8D6-5615-417B-82C5-B069EA84AB3C}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -15,6 +19,14 @@ Global
{1D636E61-E3F0-4B64-998C-730FC76731F1}.Debug|Any CPU.Build.0 = Debug|Any CPU {1D636E61-E3F0-4B64-998C-730FC76731F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D636E61-E3F0-4B64-998C-730FC76731F1}.Release|Any CPU.ActiveCfg = Release|Any CPU {1D636E61-E3F0-4B64-998C-730FC76731F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D636E61-E3F0-4B64-998C-730FC76731F1}.Release|Any CPU.Build.0 = Release|Any CPU {1D636E61-E3F0-4B64-998C-730FC76731F1}.Release|Any CPU.Build.0 = Release|Any CPU
{3BE3FEC4-6794-4EA7-83BE-D382996DB168}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3BE3FEC4-6794-4EA7-83BE-D382996DB168}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3BE3FEC4-6794-4EA7-83BE-D382996DB168}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3BE3FEC4-6794-4EA7-83BE-D382996DB168}.Release|Any CPU.Build.0 = Release|Any CPU
{8CBBB8D6-5615-417B-82C5-B069EA84AB3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8CBBB8D6-5615-417B-82C5-B069EA84AB3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8CBBB8D6-5615-417B-82C5-B069EA84AB3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8CBBB8D6-5615-417B-82C5-B069EA84AB3C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,7 @@
namespace BeautySalonDataModels
{
public interface IId
{
int Id { get; }
}
}

View File

@ -0,0 +1,8 @@
namespace BeautySalonDataModels.Models
{
public interface IClientModel : IId
{
string ClientFIO { get; }
string PhoneNumber { get; }
}
}

View File

@ -0,0 +1,9 @@
namespace BeautySalonDataModels.Models
{
public interface IMasterModel : IId
{
string MasterFIO { get; }
string Specialization { get; }
public Dictionary<int, (IServiceModel, int)> MasterServices { get; }
}
}

View File

@ -0,0 +1,8 @@
namespace BeautySalonDataModels.Models
{
public interface IServiceModel : IId
{
string ServiceName { get; }
double Cost { get; }
}
}

View File

@ -0,0 +1,10 @@
namespace BeautySalonDataModels.Models
{
public interface IVisitModel : IId
{
DateTime DateOfVisit { get; }
int ClientId { get; }
int MasterId { get; }
int ServiceId { get; }
}
}

View File

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

View File

@ -0,0 +1,11 @@
using BeautySalonDataModels.Models;
namespace BeautySalonContracts.BindingModels
{
public class ClientBindingModel : IClientModel
{
public int Id { get; set; }
public string ClientFIO { get; set; } = string.Empty;
public string PhoneNumber { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,11 @@
using BeautySalonDataModels.Models;
namespace BeautySalonContracts.BindingModels
{
public class MasterBindingModel : IMasterModel
{
public int Id { get; set; }
public string MasterFIO { get; set; } = string.Empty;
public string Specialization { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,11 @@
using BeautySalonDataModels.Models;
namespace BeautySalonContracts.BindingModels
{
public class ServiceBindingModel : IServiceModel
{
public int Id { get; set; }
public string ServiceName { get; set; } = string.Empty;
public double Cost { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using BeautySalonDataModels.Models;
namespace BeautySalonContracts.BindingModels
{
public class VisitBindingModel : IVisitModel
{
public int Id { get; set; }
public DateTime DateOfVisit { get; set; }
public int ClientId { get; set; }
public int MasterId { get; set; }
public int ServiceId { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.SearchModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.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,15 @@
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.SearchModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.BusinessLogicsContracts
{
public interface IMasterLogic
{
List<MasterViewModel>? ReadList(MasterSearchModel? model);
MasterViewModel? ReadElement(MasterSearchModel model);
bool Create(MasterBindingModel model);
bool Update(MasterBindingModel model);
bool Delete(MasterBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.SearchModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.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,15 @@
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.SearchModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.BusinessLogicsContracts
{
public interface IVisitLogic
{
List<VisitViewModel>? ReadList(VisitSearchModel? model);
VisitViewModel? ReadElement(VisitSearchModel model);
bool Create(VisitBindingModel model);
bool Update(VisitBindingModel model);
bool Delete(VisitBindingModel model);
}
}

View File

@ -0,0 +1,9 @@
namespace BeautySalonContracts.SearchModels
{
public class ClientSearchModel
{
public int? Id { get; set; }
public string? ClientFIO { get; set; }
public string? PhoneNumber { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace BeautySalonContracts.SearchModels
{
public class MasterSearchModel
{
public int? Id { get; set; }
public string? MasterFIO { get; set; }
public string? Specilization { get; set; }
}
}

View File

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

View File

@ -0,0 +1,7 @@
namespace BeautySalonContracts.SearchModels
{
public class VisitSearchModel
{
public int? Id { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.SearchModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.StoragesContracts
{
public interface IClientStorage
{
List<ClientViewModel> GetFullList();
List<ClientViewModel> GetFilteredList(ClientSearchModel model);
ClientViewModel? GetElement(ClientSearchModel model);
ClientViewModel? Insert(ClientBindingModel model);
ClientViewModel? Update(ClientBindingModel model);
ClientViewModel? Delete(ClientBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.SearchModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.StoragesContracts
{
public interface IMasterStorage
{
List<MasterViewModel> GetFullList();
List<MasterViewModel> GetFilteredList(MasterSearchModel model);
MasterViewModel? GetElement(MasterSearchModel model);
MasterViewModel? Insert(MasterBindingModel model);
MasterViewModel? Update(MasterBindingModel model);
MasterViewModel? Delete(MasterBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.SearchModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.StoragesContracts
{
public interface IServiceStorage
{
List<ServiceViewModel> GetFullList();
List<ServiceViewModel> GetFilteredList(ServiceSearchModel model);
ServiceViewModel? GetElement(ServiceSearchModel model);
ServiceViewModel? Insert(ServiceBindingModel model);
ServiceViewModel? Update(ServiceBindingModel model);
ServiceViewModel? Delete(ServiceBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.SearchModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.StoragesContracts
{
public interface IVisitStorage
{
List<VisitViewModel> GetFullList();
List<VisitViewModel> GetFilteredList(VisitSearchModel model);
VisitViewModel? GetElement(VisitSearchModel model);
VisitViewModel? Insert(VisitBindingModel model);
VisitViewModel? Update(VisitBindingModel model);
VisitViewModel? Delete(VisitBindingModel model);
}
}

View File

@ -0,0 +1,14 @@
using BeautySalonDataModels.Models;
using System.ComponentModel;
namespace BeautySalonContracts.ViewModels
{
public class ClientViewModel : IClientModel
{
public int Id { get; set; }
[DisplayName("ФИО клиента")]
public string ClientFIO { get; set; } = string.Empty;
[DisplayName("Номер телефона")]
public string PhoneNumber { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,15 @@
using BeautySalonDataModels.Models;
using System.ComponentModel;
namespace BeautySalonContracts.ViewModels
{
public class MasterViewModel : IMasterModel
{
public int Id { get; set; }
[DisplayName("ФИО мастера")]
public string MasterFIO { get; set; } = string.Empty;
[DisplayName("Специализация")]
public string Specialization { get; set; } = string.Empty;
public Dictionary<int, (IServiceModel, int)> MasterServices { get; set; } = new();
}
}

View File

@ -0,0 +1,14 @@
using BeautySalonDataModels.Models;
using System.ComponentModel;
namespace BeautySalonContracts.ViewModels
{
public class ServiceViewModel : IServiceModel
{
public int Id { get; set; }
[DisplayName("Название услуги")]
public string ServiceName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Cost { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using BeautySalonDataModels.Models;
namespace BeautySalonContracts.ViewModels
{
public class VisitViewModel : IVisitModel
{
public int Id { get; set; }
public DateTime DateOfVisit { get; set; }
public int ClientId { get; set; }
public int MasterId { get; set; }
public int ServiceId { get; set; }
}
}