implement 3 of 5 projects (remain View and DatabaseImplement)

This commit is contained in:
DavidMakarov 2024-04-16 20:15:07 +04:00
parent 55beb4f1ed
commit 5f67d6dc8a
36 changed files with 901 additions and 0 deletions

View File

@ -0,0 +1,49 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33815.320
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentEnrollmentView", "StudentEnrollmentView\StudentEnrollmentView.csproj", "{9F2D2847-BC2D-43E8-95D3-65FF657A4BC9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentEnrollmentDatabaseImplement", "StudentEnrollmentDatabaseImplement\StudentEnrollmentDatabaseImplement.csproj", "{0E15CFEE-D946-455E-9E4E-90FA14674F7D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentEnrollmentDataModels", "StudentEnrollmentDataModels\StudentEnrollmentDataModels.csproj", "{1E2E27BF-4895-4191-9669-A5822D7FA989}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentEnrollmentBusinessLogic", "StudentEnrollmentBusinessLogic\StudentEnrollmentBusinessLogic.csproj", "{A53CE753-75B2-44CC-9BE8-AE478C1A5796}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentEnrollmentContracts", "StudentEnrollmentContracts\StudentEnrollmentContracts.csproj", "{2F21A9AA-6FA9-4113-88C0-9C7BCCFBB822}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9F2D2847-BC2D-43E8-95D3-65FF657A4BC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9F2D2847-BC2D-43E8-95D3-65FF657A4BC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F2D2847-BC2D-43E8-95D3-65FF657A4BC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F2D2847-BC2D-43E8-95D3-65FF657A4BC9}.Release|Any CPU.Build.0 = Release|Any CPU
{0E15CFEE-D946-455E-9E4E-90FA14674F7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E15CFEE-D946-455E-9E4E-90FA14674F7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E15CFEE-D946-455E-9E4E-90FA14674F7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E15CFEE-D946-455E-9E4E-90FA14674F7D}.Release|Any CPU.Build.0 = Release|Any CPU
{1E2E27BF-4895-4191-9669-A5822D7FA989}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E2E27BF-4895-4191-9669-A5822D7FA989}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E2E27BF-4895-4191-9669-A5822D7FA989}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E2E27BF-4895-4191-9669-A5822D7FA989}.Release|Any CPU.Build.0 = Release|Any CPU
{A53CE753-75B2-44CC-9BE8-AE478C1A5796}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A53CE753-75B2-44CC-9BE8-AE478C1A5796}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A53CE753-75B2-44CC-9BE8-AE478C1A5796}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A53CE753-75B2-44CC-9BE8-AE478C1A5796}.Release|Any CPU.Build.0 = Release|Any CPU
{2F21A9AA-6FA9-4113-88C0-9C7BCCFBB822}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F21A9AA-6FA9-4113-88C0-9C7BCCFBB822}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F21A9AA-6FA9-4113-88C0-9C7BCCFBB822}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F21A9AA-6FA9-4113-88C0-9C7BCCFBB822}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6F203950-511C-4D26-A9CF-129D159AE690}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,106 @@
using Microsoft.Extensions.Logging;
using StudentEnrollmentContracts.BindingModels;
using StudentEnrollmentContracts.BusinessLogicContracts;
using StudentEnrollmentContracts.SearchModels;
using StudentEnrollmentContracts.StorageContracts;
using StudentEnrollmentContracts.ViewModels;
namespace StudentEnrollmentBusinessLogic
{
public class CourseLogic : ICourseLogic
{
private readonly ILogger _logger;
private readonly ICourseStorage _courseStorage;
public CourseLogic(ILogger<CourseLogic> logger, ICourseStorage
courseStorage)
{
_logger = logger;
_courseStorage = courseStorage;
}
public List<CourseViewModel>? ReadList(CourseSearchModel? model)
{
_logger.LogInformation("ReadList. CourseName:{CourseName}.Id:{ Id}", model?.CourseName, model?.Id);
var list = model == null ? _courseStorage.GetFullList() :
_courseStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public CourseViewModel? ReadElement(CourseSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. CourseName:{CourseName}.Id:{ Id}", model.CourseName, model.Id);
var element = _courseStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(CourseBindingModel model)
{
CheckModel(model);
if (_courseStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(CourseBindingModel model)
{
CheckModel(model);
if (_courseStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(CourseBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_courseStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(CourseBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.CourseName))
{
throw new ArgumentNullException("Нет названия направления!",
nameof(model.CourseName));
}
_logger.LogInformation("Course. CourseName:{CourseName}. Id: { Id}", model.CourseName, model.Id);
var element = _courseStorage.GetElement(new CourseSearchModel
{
CourseName = model.CourseName
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Направление с таким названием уже есть");
}
}
}
}

View File

@ -0,0 +1,112 @@
using Microsoft.Extensions.Logging;
using StudentEnrollmentContracts.BindingModels;
using StudentEnrollmentContracts.BusinessLogicContracts;
using StudentEnrollmentContracts.SearchModels;
using StudentEnrollmentContracts.StorageContracts;
using StudentEnrollmentContracts.ViewModels;
namespace StudentEnrollmentBusinessLogic
{
public class ExamPointsLogic : IExamPointsLogic
{
private readonly ILogger _logger;
private readonly IExamPointsStorage _examPointsStorage;
public ExamPointsLogic(ILogger<ExamPointsLogic> logger, IExamPointsStorage
examPointsStorage)
{
_logger = logger;
_examPointsStorage = examPointsStorage;
}
public List<ExamPointsViewModel>? ReadList(ExamPointsSearchModel? model)
{
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
var list = model == null ? _examPointsStorage.GetFullList() :
_examPointsStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public ExamPointsViewModel? ReadElement(ExamPointsSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement .Id:{ Id}", model.Id);
var element = _examPointsStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(ExamPointsBindingModel model)
{
CheckModel(model);
if (_examPointsStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(ExamPointsBindingModel model)
{
CheckModel(model);
if (_examPointsStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(ExamPointsBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_examPointsStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(ExamPointsBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (model.FirstExamPoints == 0)
{
throw new ArgumentNullException("Нет баллов за первый экзамен",
nameof(model.FirstExamPoints));
}
if (model.SecondExamPoints == 0)
{
throw new ArgumentNullException("Нет баллов за второй экзамен",
nameof(model.SecondExamPoints));
}
if (model.ThirdExamPoints == 0)
{
throw new ArgumentNullException("Нет баллов за третий экзамен",
nameof(model.ThirdExamPoints));
}
_logger.LogInformation("ExamPoints. FirstExamPoints: {FirstExamPoints}. " +
"SecondExamPoints: {SecondExamPoints}. ThirdExamPoints: {ThirdExamPoints}. AddPoints: {AddPoints}. Summary: {Summary}" +
"Id: { Id}",
model.FirstExamPoints, model.SecondExamPoints, model.ThirdExamPoints,
model.AddPoints, model.Summary, model.Id);
}
}
}

View File

@ -0,0 +1,108 @@
using StudentEnrollmentContracts.BusinessLogicContracts;
using StudentEnrollmentContracts.StorageContracts;
using StudentEnrollmentContracts.ViewModels;
using StudentEnrollmentContracts.BindingModels;
using StudentEnrollmentContracts.SearchModels;
using Microsoft.Extensions.Logging;
namespace StudentEnrollmentBusinessLogic
{
public class FacultyLogic : IFacultyLogic
{
private readonly IFacultyStorage _facultyStorage;
private readonly ILogger _logger;
public FacultyLogic(IFacultyStorage facultyStorage, ILogger logger)
{
_facultyStorage = facultyStorage;
_logger = logger;
}
public List<FacultyViewModel>? ReadList(FacultySearchModel? model)
{
_logger.LogInformation("ReadList. FacultyName:{FacultyName}.Id:{ Id}", model?.FacultyName, model?.Id);
var list = model == null ? _facultyStorage.GetFullList() :
_facultyStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public FacultyViewModel? ReadElement(FacultySearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. FacultyName:{FacultyName}.Id:{ Id}", model.FacultyName, model.Id);
var element = _facultyStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(FacultyBindingModel model)
{
CheckModel(model);
if (_facultyStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(FacultyBindingModel model)
{
CheckModel(model);
if (_facultyStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(FacultyBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_facultyStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(FacultyBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.FacultyName))
{
throw new ArgumentNullException("Нет названия факультета!",
nameof(model.FacultyName));
}
_logger.LogInformation("Faculty. FacultyName:{FacultyName}. Id: { Id}", model.FacultyName, model.Id);
var element = _facultyStorage.GetElement(new FacultySearchModel
{
FacultyName = model.FacultyName,
}); ;
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Факультет с таким же названием уже есть");
}
}
}
}

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\StudentEnrollmentContracts\StudentEnrollmentContracts.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,119 @@
using Microsoft.Extensions.Logging;
using StudentEnrollmentContracts.BindingModels;
using StudentEnrollmentContracts.BusinessLogicContracts;
using StudentEnrollmentContracts.SearchModels;
using StudentEnrollmentContracts.StorageContracts;
using StudentEnrollmentContracts.ViewModels;
namespace StudentEnrollmentBusinessLogic
{
public class StudentLogic : IStudentLogic
{
private readonly ILogger _logger;
private readonly IStudentStorage _studentStorage;
public StudentLogic(ILogger<StudentLogic> logger, IStudentStorage studentStorage)
{
_logger = logger;
_studentStorage = studentStorage;
}
public List<StudentViewModel>? ReadList(StudentSearchModel? model)
{
_logger.LogInformation("ReadList. TIN: {TIN}. Id:{Id}", model?.TIN, model?.Id);
var list = model == null ? _studentStorage.GetFullList() : _studentStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public StudentViewModel? ReadElement(StudentSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadList. TIN: {TIN}. Id:{Id}", model?.TIN, model.Id);
var element = _studentStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool Create(StudentBindingModel model)
{
CheckModel(model);
if (_studentStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(StudentBindingModel model)
{
CheckModel(model);
if (_studentStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool Delete(StudentBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_studentStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
private void CheckModel(StudentBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.LastName))
{
throw new ArgumentNullException("Нет фамилии студента!", nameof(model.LastName));
}
if (string.IsNullOrEmpty(model.FirstName))
{
throw new ArgumentNullException("Нет имени студента!", nameof(model.FirstName));
}
if (string.IsNullOrEmpty(model.TIN))
{
throw new ArgumentNullException("Нет ИНН студента!", nameof(model.TIN));
}
if (string.IsNullOrEmpty(model.Email))
{
throw new ArgumentNullException("Нет почты студента!", nameof(model.Email));
}
if (model.StudentCourse.Count == 0)
{
throw new ArgumentNullException("У студента должны быть баллы за экзамены!", nameof(model.StudentCourse));
}
_logger.LogInformation("Student. LastName: {LastName}, FirstName: {FirstName}, MiddleName: {MiddleName}, TIN: {TIN}, Email: {Email}, Id: {Id}", model.LastName, model.FirstName, model.MiddleName, model.TIN, model.Email, model.Id);
var element = _studentStorage.GetElement(new StudentSearchModel
{
TIN = model.TIN
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Студент с таким ИНН уже есть");
}
}
}
}

View File

@ -0,0 +1,11 @@
using StudentEnrollmentDataModels.Models;
namespace StudentEnrollmentContracts.BindingModels
{
public class CourseBindingModel : ICourseModel
{
public long Id { get; set; }
public string CourseName { get; set; } = string.Empty;
public string FacultyName { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,14 @@
using StudentEnrollmentDataModels.Models;
namespace StudentEnrollmentContracts.BindingModels
{
public class ExamPointsBindingModel : IExamPointsModel
{
public long Id { get; set; }
public int FirstExamPoints { get; set; }
public int SecondExamPoints { get; set; }
public int ThirdExamPoints { get; set; }
public int AddPoints { get; set; } = 0;
public int Summary { get; set; }
}
}

View File

@ -0,0 +1,10 @@
using StudentEnrollmentDataModels.Models;
namespace StudentEnrollmentContracts.BindingModels
{
public class FacultyBindingModel : IFacultyModel
{
public long Id { get; set; }
public string FacultyName { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,20 @@
using StudentEnrollmentDataModels.Models;
namespace StudentEnrollmentContracts.BindingModels
{
public class StudentBindingModel : IStudentModel
{
public long Id { get; set; }
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
public string MiddleName { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string TIN { get; set; } = string.Empty;
public long ExamPointsId { get; set; }
public Dictionary<long, (ICourseModel, long)> StudentCourse
{
get;
set;
} = new();
}
}

View File

@ -0,0 +1,15 @@
using StudentEnrollmentContracts.BindingModels;
using StudentEnrollmentContracts.SearchModels;
using StudentEnrollmentContracts.ViewModels;
namespace StudentEnrollmentContracts.BusinessLogicContracts
{
public interface ICourseLogic
{
List<CourseViewModel>? ReadList(CourseSearchModel? model);
CourseViewModel? ReadElement(CourseSearchModel model);
bool Create(CourseBindingModel model);
bool Update(CourseBindingModel model);
bool Delete(CourseBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using StudentEnrollmentContracts.BindingModels;
using StudentEnrollmentContracts.SearchModels;
using StudentEnrollmentContracts.ViewModels;
namespace StudentEnrollmentContracts.BusinessLogicContracts
{
public interface IExamPointsLogic
{
List<ExamPointsViewModel>? ReadList(ExamPointsSearchModel? model);
ExamPointsViewModel? ReadElement(ExamPointsSearchModel model);
bool Create(ExamPointsBindingModel model);
bool Update(ExamPointsBindingModel model);
bool Delete(ExamPointsBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using StudentEnrollmentContracts.BindingModels;
using StudentEnrollmentContracts.SearchModels;
using StudentEnrollmentContracts.ViewModels;
namespace StudentEnrollmentContracts.BusinessLogicContracts
{
public interface IFacultyLogic
{
List<FacultyViewModel>? ReadList(FacultySearchModel? model);
FacultyViewModel? ReadElement(FacultySearchModel model);
bool Create(FacultyBindingModel model);
bool Update(FacultyBindingModel model);
bool Delete(FacultyBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using StudentEnrollmentContracts.BindingModels;
using StudentEnrollmentContracts.SearchModels;
using StudentEnrollmentContracts.ViewModels;
namespace StudentEnrollmentContracts.BusinessLogicContracts
{
public interface IStudentLogic
{
List<StudentViewModel>? ReadList(StudentSearchModel? model);
StudentViewModel? ReadElement(StudentSearchModel model);
bool Create(StudentBindingModel model);
bool Update(StudentBindingModel model);
bool Delete(StudentBindingModel model);
}
}

View File

@ -0,0 +1,8 @@
namespace StudentEnrollmentContracts.SearchModels
{
public class CourseSearchModel
{
public long? Id { get; set; }
public string? CourseName { get; set; }
}
}

View File

@ -0,0 +1,7 @@
namespace StudentEnrollmentContracts.SearchModels
{
public class ExamPointsSearchModel
{
public long? Id { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace StudentEnrollmentContracts.SearchModels
{
public class FacultySearchModel
{
public long? Id { get; set; }
public string? FacultyName { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace StudentEnrollmentContracts.SearchModels
{
public class StudentSearchModel
{
public long? Id { get; set; }
public string? TIN { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using StudentEnrollmentContracts.BindingModels;
using StudentEnrollmentContracts.SearchModels;
using StudentEnrollmentContracts.ViewModels;
namespace StudentEnrollmentContracts.StorageContracts
{
public interface ICourseStorage
{
List<CourseViewModel> GetFullList();
List<CourseViewModel> GetFilteredList(CourseSearchModel model);
CourseViewModel? GetElement(CourseSearchModel model);
CourseViewModel? Insert(CourseBindingModel model);
CourseViewModel? Update(CourseBindingModel model);
CourseViewModel? Delete(CourseBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using StudentEnrollmentContracts.BindingModels;
using StudentEnrollmentContracts.SearchModels;
using StudentEnrollmentContracts.ViewModels;
namespace StudentEnrollmentContracts.StorageContracts
{
public interface IExamPointsStorage
{
List<ExamPointsViewModel> GetFullList();
List<ExamPointsViewModel> GetFilteredList(ExamPointsSearchModel model);
ExamPointsViewModel? GetElement(ExamPointsSearchModel model);
ExamPointsViewModel? Insert(ExamPointsBindingModel model);
ExamPointsViewModel? Update(ExamPointsBindingModel model);
ExamPointsViewModel? Delete(ExamPointsBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using StudentEnrollmentContracts.BindingModels;
using StudentEnrollmentContracts.SearchModels;
using StudentEnrollmentContracts.ViewModels;
namespace StudentEnrollmentContracts.StorageContracts
{
public interface IFacultyStorage
{
List<FacultyViewModel> GetFullList();
List<FacultyViewModel> GetFilteredList(FacultySearchModel model);
FacultyViewModel? GetElement(FacultySearchModel model);
FacultyViewModel? Insert(FacultyBindingModel model);
FacultyViewModel? Update(FacultyBindingModel model);
FacultyViewModel? Delete(FacultyBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using StudentEnrollmentContracts.BindingModels;
using StudentEnrollmentContracts.SearchModels;
using StudentEnrollmentContracts.ViewModels;
namespace StudentEnrollmentContracts.StorageContracts
{
public interface IStudentStorage
{
List<StudentViewModel> GetFullList();
List<StudentViewModel> GetFilteredList(StudentSearchModel model);
StudentViewModel? GetElement(StudentSearchModel model);
StudentViewModel? Insert(StudentBindingModel model);
StudentViewModel? Update(StudentBindingModel model);
StudentViewModel? Delete(StudentBindingModel model);
}
}

View File

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

View File

@ -0,0 +1,14 @@
using StudentEnrollmentDataModels.Models;
using System.ComponentModel;
namespace StudentEnrollmentContracts.ViewModels
{
public class CourseViewModel : ICourseModel
{
public long Id { get; set; }
[DisplayName("Название направления")]
public string CourseName { get; set; } = string.Empty;
[DisplayName("Название факультета")]
public string FacultyName { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,20 @@
using StudentEnrollmentDataModels.Models;
using System.ComponentModel;
namespace StudentEnrollmentContracts.ViewModels
{
public class ExamPointsViewModel : IExamPointsModel
{
public long Id { get; set; }
[DisplayName("Баллы за первый экзамен")]
public int FirstExamPoints { get; set; }
[DisplayName("Баллы за второй экзамен")]
public int SecondExamPoints { get; set; }
[DisplayName("Баллы за третий экзамен")]
public int ThirdExamPoints { get; set; }
[DisplayName("Дополнительные баллы")]
public int AddPoints { get; set; } = 0;
[DisplayName("Сумма баллов")]
public int Summary { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using StudentEnrollmentDataModels.Models;
using System.ComponentModel;
namespace StudentEnrollmentContracts.ViewModels
{
public class FacultyViewModel : IFacultyModel
{
public long Id { get; set; }
[DisplayName("Название факультета")]
public string FacultyName { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,28 @@
using StudentEnrollmentDataModels.Models;
using System.ComponentModel;
namespace StudentEnrollmentContracts.ViewModels
{
public class StudentViewModel : IStudentModel
{
public long Id { get; set; }
[DisplayName("Имя")]
public string FirstName { get; set; } = string.Empty;
[DisplayName("Фамилия")]
public string LastName { get; set; } = string.Empty;
[DisplayName("Отчество")]
public string MiddleName { get; set; } = string.Empty;
[DisplayName("Почта")]
public string Email { get; set; } = string.Empty;
[DisplayName("ИНН")]
public string TIN { get; set; } = string.Empty;
public long ExamPointsId { get; set; }
[DisplayName("Суммарное количество баллов")]
public int ExamPoints { get; set; }
public Dictionary<long, (ICourseModel, long)> StudentCourse
{
get;
set;
} = new();
}
}

View File

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

View File

@ -0,0 +1,8 @@
namespace StudentEnrollmentDataModels.Models
{
public interface ICourseModel : IId
{
string CourseName { get; }
string FacultyName { get; }
}
}

View File

@ -0,0 +1,10 @@
namespace StudentEnrollmentDataModels.Models
{
public interface IExamPointsModel : IId
{
int FirstExamPoints { get; }
int SecondExamPoints { get; }
int AddPoints { get; }
int Summary { get; }
}
}

View File

@ -0,0 +1,7 @@
namespace StudentEnrollmentDataModels.Models
{
public interface IFacultyModel : IId
{
string FacultyName { get; }
}
}

View File

@ -0,0 +1,13 @@
namespace StudentEnrollmentDataModels.Models
{
public interface IStudentModel : IId
{
string LastName { get; }
string FirstName { get; }
string MiddleName { get; }
string Email { get; }
string TIN { get; }
long ExamPointsId { get; }
Dictionary<long, (ICourseModel, long)> StudentCourse { get; }
}
}

View File

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

View File

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

View File

@ -0,0 +1,19 @@
namespace StudentEnrollmentView
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
}
}

View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>