синдром туррета у меня скоро начнется
This commit is contained in:
parent
f78bfe096d
commit
c7d1606a5b
@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34701.34
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "University", "University\University.csproj", "{AB3D7409-2E5B-4ABC-8849-935C708658E1}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "University", "University\University.csproj", "{AB3D7409-2E5B-4ABC-8849-935C708658E1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversityDataModels", "UniversityDataModels\UniversityDataModels.csproj", "{213B879D-95E6-4554-8C05-DF591E9006FF}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityDataModels", "UniversityDataModels\UniversityDataModels.csproj", "{213B879D-95E6-4554-8C05-DF591E9006FF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversityContracts", "UniversityContracts\UniversityContracts.csproj", "{AC1D090C-E5C5-412C-88F7-139A64F6C58C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -21,6 +23,10 @@ Global
|
||||
{213B879D-95E6-4554-8C05-DF591E9006FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{213B879D-95E6-4554-8C05-DF591E9006FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{213B879D-95E6-4554-8C05-DF591E9006FF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AC1D090C-E5C5-412C-88F7-139A64F6C58C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AC1D090C-E5C5-412C-88F7-139A64F6C58C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AC1D090C-E5C5-412C-88F7-139A64F6C58C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AC1D090C-E5C5-412C-88F7-139A64F6C58C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -0,0 +1,17 @@
|
||||
using UniversityDataModels;
|
||||
|
||||
namespace UniversityContracts.BindingModels
|
||||
{
|
||||
public class ClientBindingModel : IClientModel
|
||||
{
|
||||
public int DirectorId { get; set; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public double Price { get; set; }
|
||||
|
||||
public int Course { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using UniversityDataModels;
|
||||
|
||||
namespace UniversityContracts.BindingModels
|
||||
{
|
||||
public class DirectorBindingModel : IDirectorModel
|
||||
{
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
|
||||
public string Login { get; set; } = string.Empty;
|
||||
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string PhoneNumber { get; set; } = string.Empty;
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using System.ComponentModel;
|
||||
using UniversityDataModels;
|
||||
using UniversityDataModels.ProxyModels;
|
||||
|
||||
namespace UniversityContracts.BindingModels
|
||||
{
|
||||
public class DisciplineBindingModel : IDisciplineModel
|
||||
{
|
||||
public int ImplementerId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public double Price { get; set; }
|
||||
|
||||
public DateOnly DateOfReceipt { get; set; } = DateOnly.FromDateTime(DateTime.Now);
|
||||
public DateOnly DateOfPassage { get; set; } = DateOnly.FromDateTime(DateTime.Now);
|
||||
|
||||
public Dictionary<int, ClientByDisciplineModel> ClientsModel { get; set; } = new();
|
||||
public List<RequirementByDisciplineModel> RequirementsModel { get; set; } = new();
|
||||
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using UniversityDataModels;
|
||||
using UniversityDataModels.ProxyModels;
|
||||
|
||||
namespace UniversityContracts.BindingModels
|
||||
{
|
||||
public class RequirementBindingModel : IRequirementModel
|
||||
{
|
||||
public int DirectorId { get; set; }
|
||||
|
||||
public string NameOfRequirement { get; set; } = string.Empty;
|
||||
|
||||
public double Price { get; set; }
|
||||
public Dictionary<int, RequirementByDisciplineModel> DisciplinesModels { get; set; } = new();
|
||||
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IClientLogic
|
||||
{
|
||||
List<ClientViewModel> ReadList(ClientSearchModel? model = null);
|
||||
ClientViewModel ReadElement(ClientSearchModel model);
|
||||
bool Create(ClientBindingModel model);
|
||||
bool Update(ClientBindingModel model);
|
||||
bool Delete(ClientBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IDirectorLogic
|
||||
{
|
||||
DirectorViewModel ReadElement(DirectorSearchModel model);
|
||||
bool Create(DirectorBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IRequirementLogic
|
||||
{
|
||||
List<RequirementViewModel> ReadList(RequirementSearchModel? model = null);
|
||||
RequirementViewModel ReadElement(RequirementSearchModel model);
|
||||
bool Create(RequirementBindingModel model);
|
||||
bool Update(RequirementBindingModel model);
|
||||
bool Delete(RequirementBindingModel model);
|
||||
}
|
||||
}
|
29
University/UniversityContracts/Extensions/ExtensionCast.cs
Normal file
29
University/UniversityContracts/Extensions/ExtensionCast.cs
Normal file
@ -0,0 +1,29 @@
|
||||
namespace UniversityContracts.Extensions
|
||||
{
|
||||
public static class ExtensionCast
|
||||
{
|
||||
/// <summary>
|
||||
/// Создает из исходного объекта, объект класса TO копируя в него все общие свойства
|
||||
/// </summary>
|
||||
/// <typeparam name="TO">The type of the to.</typeparam>
|
||||
/// <typeparam name="TFrom">The type of from.</typeparam>
|
||||
/// <returns></returns>
|
||||
public static TO CastWithCommonProperties<TO, TFrom>(this TFrom fromObject)
|
||||
where TO : class, new()
|
||||
where TFrom : class, new()
|
||||
{
|
||||
TO result = new();
|
||||
foreach (var propFrom in typeof(TFrom).GetProperties())
|
||||
{
|
||||
foreach (var propTo in typeof(TO).GetProperties())
|
||||
{
|
||||
if (propFrom.Name == propTo.Name && propFrom.PropertyType == propTo.PropertyType && propTo.CanWrite)
|
||||
{
|
||||
propTo.SetValue(result, propFrom.GetValue(fromObject));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
namespace UniversityContracts.SearchModels
|
||||
{
|
||||
public class ClientSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public int? DirectorId { get; set; }
|
||||
|
||||
public List<int>? DisciplinesIds { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace UniversityContracts.SearchModels
|
||||
{
|
||||
public class DirectorSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Login { get; set; }
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace UniversityContracts.SearchModels
|
||||
{
|
||||
public class RequirementSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public int? DirectorId { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.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);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.StoragesContracts
|
||||
{
|
||||
public interface IDirectorStorage
|
||||
{
|
||||
DirectorViewModel? GetElement(DirectorSearchModel model);
|
||||
DirectorViewModel? Insert(DirectorBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.StoragesContracts
|
||||
{
|
||||
public interface IRequirementStorage
|
||||
{
|
||||
List<RequirementViewModel> GetFullList();
|
||||
List<RequirementViewModel> GetFilteredList(RequirementSearchModel model);
|
||||
RequirementViewModel? GetElement(RequirementSearchModel model);
|
||||
RequirementViewModel? Insert(RequirementBindingModel model);
|
||||
RequirementViewModel? Update(RequirementBindingModel model);
|
||||
RequirementViewModel? Delete(RequirementBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
29
University/UniversityContracts/ViewModels/ClientViewModel.cs
Normal file
29
University/UniversityContracts/ViewModels/ClientViewModel.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using UniversityDataModels;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace UniversityContracts.ViewModels
|
||||
{
|
||||
public class ClientViewModel : IClientModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int DirectorId { get; set; }
|
||||
public string DirectorLogin { get; set; } = string.Empty;
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public int Course { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<DisciplineViewModel> Disciplines { get; set; } = new();
|
||||
public override string ToString()
|
||||
{
|
||||
var result = new StringBuilder();
|
||||
foreach (var discipline in Disciplines)
|
||||
{
|
||||
result.Append($"Студент {Name} {Course} курса, записанный {discipline.ClientsModel[Id].DateOfClient.ToShortDateString()}, " +
|
||||
$"на дисциплину {discipline.Name}.\n");
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
using UniversityDataModels;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace UniversityContracts.ViewModels
|
||||
{
|
||||
public class DirectorViewModel : IDirectorModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Фамилия")]
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
[DisplayName("Имя")]
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
public string Login { get; set; } = string.Empty;
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
public string PhoneNumber { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using UniversityDataModels;
|
||||
using System.ComponentModel;
|
||||
using UniversityDataModels.ProxyModels;
|
||||
|
||||
namespace UniversityContracts.ViewModels
|
||||
{
|
||||
public class RequirementViewModel : IRequirementModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int DirectorId { get; set; }
|
||||
[DisplayName("Логин сотрудника")]
|
||||
public string DirectorLogin { get; set; } = string.Empty;
|
||||
[DisplayName("Наименование")]
|
||||
public string NameOfRequirement { get; set; } = string.Empty;
|
||||
[DisplayName("Стоимость")]
|
||||
public double Price { get; set; }
|
||||
|
||||
// Дата счета дисциплины для отчета
|
||||
public Dictionary<int, RequirementByDisciplineModel> DisciplinesModels { get; set; } = new();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user