Модели сущностей и контракты

This commit is contained in:
ityurner02@mail.ru 2023-04-09 17:25:21 +04:00
parent 32ff1e9dbe
commit fb117711dc
46 changed files with 544 additions and 13 deletions

View File

@ -0,0 +1,11 @@
using ElectronicJournalDataModels.Models;
namespace ElectronicJournalContracts.BindingModels
{
public class DisciplineBindingModel : IDiscipline
{
public string Title { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using ElectronicJournalDataModels.Models;
namespace ElectronicJournalContracts.BindingModels
{
public class GroupBindingModel : IGroup
{
public string Title { get; set; } = string.Empty;
public int Course { get; set; } = 1;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using ElectronicJournalDataModels.Models;
namespace ElectronicJournalContracts.BindingModels
{
public class ResultOfControlBindingModel : IResultOfControl
{
public string Form { get; set; } = string.Empty;
public DateTime Date { get; set; }
public string Mark { get; set; } = string.Empty;
public int StudentId { get; set; }
public int StatementId { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using ElectronicJournalDataModels.Models;
namespace ElectronicJournalContracts.BindingModels
{
public class StatementBindingModel : IStatement
{
public DateTime Date { get; set; }
public int DisciplineId { get; set; }
public int GroupId { get; set; }
public int TeacherId { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using ElectronicJournalDataModels.Models;
namespace ElectronicJournalContracts.BindingModels
{
public class StudentBindingModel : IStudent
{
public string Name { get; set; } = string.Empty;
public int GroupId { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using ElectronicJournalDataModels.Models;
namespace ElectronicJournalContracts.BindingModels
{
public class TeacherBindingModel : ITeacher
{
public string Name { get; set; } = string.Empty;
public string Academic_title { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using ElectronicJournalContracts.BindingModels;
using ElectronicJournalContracts.SearchModels;
using ElectronicJournalContracts.ViewModels;
namespace ElectronicJournalContracts.BusinessLogicContracts
{
public interface IDisciplineLogic
{
List<DisciplineViewModel>? ReadList(DisciplineSearchModel? model);
DisciplineViewModel? ReadElement(DisciplineSearchModel model);
bool Create(DisciplineBindingModel model);
bool Update(DisciplineBindingModel model);
bool Delete(DisciplineBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using ElectronicJournalContracts.BindingModels;
using ElectronicJournalContracts.SearchModels;
using ElectronicJournalContracts.ViewModels;
namespace ElectronicJournalContracts.BusinessLogicContracts
{
public interface IGroupLogic
{
List<GroupViewModel>? ReadList(GroupSearchModel? model);
GroupViewModel? ReadElement(GroupSearchModel model);
bool Create(GroupBindingModel model);
bool Update(GroupBindingModel model);
bool Delete(GroupBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using ElectronicJournalContracts.BindingModels;
using ElectronicJournalContracts.SearchModels;
using ElectronicJournalContracts.ViewModels;
namespace ElectronicJournalContracts.BusinessLogicContracts
{
public interface IResultOfControlLogic
{
List<ResultOfControlViewModel>? ReadList(ResultOfControlSearchModel? model);
ResultOfControlViewModel? ReadElement(ResultOfControlSearchModel model);
bool Create(ResultOfControlBindingModel model);
bool Update(ResultOfControlBindingModel model);
bool Delete(ResultOfControlBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using ElectronicJournalContracts.BindingModels;
using ElectronicJournalContracts.SearchModels;
using ElectronicJournalContracts.ViewModels;
namespace ElectronicJournalContracts.BusinessLogicContracts
{
public interface IStatementLogic
{
List<StatementViewModel>? ReadList(StatementSearchModel? model);
StatementViewModel? ReadElement(StatementSearchModel model);
bool Create(StatementBindingModel model);
bool Update(StatementBindingModel model);
bool Delete(StatementBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using ElectronicJournalContracts.BindingModels;
using ElectronicJournalContracts.SearchModels;
using ElectronicJournalContracts.ViewModels;
namespace ElectronicJournalContracts.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,15 @@
using ElectronicJournalContracts.BindingModels;
using ElectronicJournalContracts.SearchModels;
using ElectronicJournalContracts.ViewModels;
namespace ElectronicJournalContracts.BusinessLogicContracts
{
public interface ITeacherLogic
{
List<TeacherViewModel>? ReadList(TeacherSearchModel? model);
TeacherViewModel? ReadElement(TeacherSearchModel model);
bool Create(TeacherBindingModel model);
bool Update(TeacherBindingModel model);
bool Delete(TeacherBindingModel model);
}
}

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="..\ElectronicJournalDataModels\ElectronicJournalDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,8 @@
namespace ElectronicJournalContracts.SearchModels
{
public class DisciplineSearchModel
{
public int? Id { get; set; }
public string? Title { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace ElectronicJournalContracts.SearchModels
{
public class GroupSearchModel
{
public int? Id { get; set; }
public string? Title { get; set; }
public int? Course { get; set; }
}
}

View File

@ -0,0 +1,13 @@
namespace ElectronicJournalContracts.SearchModels
{
public class ResultOfControlSearchModel
{
public int? Id { get; set; }
public string? Form { get; set; }
public DateTime? Date { get; set; }
public string? Mark { get; set; }
public int? StudentId { get; set; }
public string? StudentName { get; set; }
public int? StatementId { get; set; }
}
}

View File

@ -0,0 +1,14 @@
namespace ElectronicJournalContracts.SearchModels
{
public class StatementSearchModel
{
public int? Id { get; set; }
public DateTime? Date { get; set; }
public int? DisciplineId { get; set; }
public string? DisciplineName { get; set; }
public int? GroupId { get; set; }
public string? GroupName { get; set; }
public int? TeacherId { get; set; }
public string? TeacherName { get; set; }
}
}

View File

@ -0,0 +1,10 @@
namespace ElectronicJournalContracts.SearchModels
{
public class StudentSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
public int? GroupId { get; set; }
public string? GroupName { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace ElectronicJournalContracts.SearchModels
{
public class TeacherSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
public string? Academic_title { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using ElectronicJournalContracts.BindingModels;
using ElectronicJournalContracts.SearchModels;
using ElectronicJournalContracts.ViewModels;
namespace ElectronicJournalContracts.StorageContracts
{
public interface IDisciplineStorage
{
List<DisciplineViewModel> GetFullList();
List<DisciplineViewModel> GetFilteredList(DisciplineSearchModel model);
DisciplineViewModel? GetElement(DisciplineSearchModel model);
DisciplineViewModel? Insert(DisciplineBindingModel model);
DisciplineViewModel? Update(DisciplineBindingModel model);
DisciplineViewModel? Delete(DisciplineBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using ElectronicJournalContracts.BindingModels;
using ElectronicJournalContracts.SearchModels;
using ElectronicJournalContracts.ViewModels;
namespace ElectronicJournalContracts.StorageContracts
{
public interface IGroupStorage
{
List<GroupViewModel> GetFullList();
List<GroupViewModel> GetFilteredList(GroupSearchModel model);
GroupViewModel? GetElement(GroupSearchModel model);
GroupViewModel? Insert(GroupBindingModel model);
GroupViewModel? Update(GroupBindingModel model);
GroupViewModel? Delete(GroupBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using ElectronicJournalContracts.BindingModels;
using ElectronicJournalContracts.SearchModels;
using ElectronicJournalContracts.ViewModels;
namespace ElectronicJournalContracts.StorageContracts
{
public interface IResultOfControlStorage
{
List<ResultOfControlViewModel> GetFullList();
List<ResultOfControlViewModel> GetFilteredList(ResultOfControlSearchModel model);
ResultOfControlViewModel? GetElement(ResultOfControlSearchModel model);
ResultOfControlViewModel? Insert(ResultOfControlBindingModel model);
ResultOfControlViewModel? Update(ResultOfControlBindingModel model);
ResultOfControlViewModel? Delete(ResultOfControlBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using ElectronicJournalContracts.BindingModels;
using ElectronicJournalContracts.SearchModels;
using ElectronicJournalContracts.ViewModels;
namespace ElectronicJournalContracts.StorageContracts
{
public interface IStatementStorage
{
List<StatementViewModel> GetFullList();
List<StatementViewModel> GetFilteredList(StatementSearchModel model);
StatementViewModel? GetElement(StatementSearchModel model);
StatementViewModel? Insert(StatementBindingModel model);
StatementViewModel? Update(StatementBindingModel model);
StatementViewModel? Delete(StatementBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using ElectronicJournalContracts.BindingModels;
using ElectronicJournalContracts.SearchModels;
using ElectronicJournalContracts.ViewModels;
namespace ElectronicJournalContracts.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,16 @@
using ElectronicJournalContracts.BindingModels;
using ElectronicJournalContracts.SearchModels;
using ElectronicJournalContracts.ViewModels;
namespace ElectronicJournalContracts.StorageContracts
{
public interface ITeacherStorage
{
List<TeacherViewModel> GetFullList();
List<TeacherViewModel> GetFilteredList(TeacherSearchModel model);
TeacherViewModel? GetElement(TeacherSearchModel model);
TeacherViewModel? Insert(TeacherBindingModel model);
TeacherViewModel? Update(TeacherBindingModel model);
TeacherViewModel? Delete(TeacherBindingModel model);
}
}

View File

@ -0,0 +1,13 @@
using ElectronicJournalDataModels.Models;
using System.ComponentModel;
namespace ElectronicJournalContracts.ViewModels
{
public class DisciplineViewModel : IDiscipline
{
[DisplayName("Номер")]
public int Id { get; set; }
[DisplayName("Название")]
public string Title { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,15 @@
using ElectronicJournalDataModels.Models;
using System.ComponentModel;
namespace ElectronicJournalContracts.ViewModels
{
public class GroupViewModel : IGroup
{
[DisplayName("Номер")]
public int Id { get; set; }
[DisplayName("Название")]
public string Title { get; set; } = string.Empty;
[DisplayName("Курс")]
public int Course { get; set; } = 1;
}
}

View File

@ -0,0 +1,22 @@
using ElectronicJournalDataModels.Models;
using System.ComponentModel;
namespace ElectronicJournalContracts.ViewModels
{
public class ResultOfControlViewModel : IResultOfControl
{
[DisplayName("Номер")]
public int Id { get; set; }
[DisplayName("Форма")]
public string Form { get; set; } = string.Empty;
[DisplayName("Дата")]
public DateTime Date { get; set; }
[DisplayName("Оценка")]
public string Mark { get; set; } = string.Empty;
public int StudentId { get; set; }
[DisplayName("Студент")]
public string StudentName { get; set; } = string.Empty;
[DisplayName("Номер ведомости")]
public int StatementId { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using ElectronicJournalDataModels.Models;
using System.ComponentModel;
namespace ElectronicJournalContracts.ViewModels
{
public class StatementViewModel : IStatement
{
[DisplayName("Номер")]
public int Id { get; set; }
[DisplayName("Дата")]
public DateTime Date { get; set; }
public int DisciplineId { get; set; }
[DisplayName("Дисциплина")]
public string DisciplineName { get; set; } = string.Empty;
public int GroupId { get; set; }
[DisplayName("Группа")]
public string GroupName { get; set; } = string.Empty;
public int TeacherId { get; set; }
[DisplayName("Преподаватель")]
public string TeacherName { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,16 @@
using ElectronicJournalDataModels.Models;
using System.ComponentModel;
namespace ElectronicJournalContracts.ViewModels
{
public class StudentViewModel : IStudent
{
[DisplayName("Номер")]
public int Id { get; set; }
[DisplayName("Имя")]
public string Name { get; set; } = string.Empty;
public int GroupId { get; set; }
[DisplayName("Группа")]
public string GroupName { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,15 @@
using ElectronicJournalDataModels.Models;
using System.ComponentModel;
namespace ElectronicJournalContracts.ViewModels
{
public class TeacherViewModel : ITeacher
{
[DisplayName("Номер")]
public int Id { get; set; }
[DisplayName("Имя")]
public string Name { get; set; } = string.Empty;
[DisplayName("Ученое звание")]
public string Academic_title { get; set; } = string.Empty;
}
}

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 ElectronicJournalDataModels
{
public interface IId
{
int Id { get; }
}
}

View File

@ -0,0 +1,7 @@
namespace ElectronicJournalDataModels.Models
{
public interface IDiscipline : IId
{
string Title { get; }
}
}

View File

@ -0,0 +1,8 @@
namespace ElectronicJournalDataModels.Models
{
public interface IGroup : IId
{
string Title { get; }
int Course { get; }
}
}

View File

@ -0,0 +1,11 @@
namespace ElectronicJournalDataModels.Models
{
public interface IResultOfControl : IId
{
string Form { get; }
DateTime Date { get; }
string Mark { get; }
int StudentId { get; }
int StatementId { get; }
}
}

View File

@ -0,0 +1,10 @@
namespace ElectronicJournalDataModels.Models
{
public interface IStatement : IId
{
DateTime Date { get; }
int DisciplineId { get; }
int GroupId { get; }
int TeacherId { get; }
}
}

View File

@ -0,0 +1,8 @@
namespace ElectronicJournalDataModels.Models
{
public interface IStudent : IId
{
string Name { get; }
int GroupId { get; }
}
}

View File

@ -0,0 +1,8 @@
namespace ElectronicJournalDataModels.Models
{
public interface ITeacher : IId
{
string Name { get; }
string Academic_title { get; }
}
}

View File

@ -3,7 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33414.496
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SUBD", "SUBD\SUBD.csproj", "{5007C09F-233B-47ED-99EC-9EA8943A3E72}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElectronicJournal", "SUBD\ElectronicJournal.csproj", "{5007C09F-233B-47ED-99EC-9EA8943A3E72}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElectronicJournalDataModels", "ElectronicJournalDataModels\ElectronicJournalDataModels.csproj", "{7B5D6323-F9AB-4F6C-A788-86D98748E202}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElectronicJournalContracts", "ElectronicJournalContracts\ElectronicJournalContracts.csproj", "{374D708E-00B2-4680-8F92-F88173620B09}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -15,6 +19,14 @@ Global
{5007C09F-233B-47ED-99EC-9EA8943A3E72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5007C09F-233B-47ED-99EC-9EA8943A3E72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5007C09F-233B-47ED-99EC-9EA8943A3E72}.Release|Any CPU.Build.0 = Release|Any CPU
{7B5D6323-F9AB-4F6C-A788-86D98748E202}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B5D6323-F9AB-4F6C-A788-86D98748E202}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B5D6323-F9AB-4F6C-A788-86D98748E202}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B5D6323-F9AB-4F6C-A788-86D98748E202}.Release|Any CPU.Build.0 = Release|Any CPU
{374D708E-00B2-4680-8F92-F88173620B09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{374D708E-00B2-4680-8F92-F88173620B09}.Debug|Any CPU.Build.0 = Debug|Any CPU
{374D708E-00B2-4680-8F92-F88173620B09}.Release|Any CPU.ActiveCfg = Release|Any CPU
{374D708E-00B2-4680-8F92-F88173620B09}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,10 +0,0 @@
namespace SUBD
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -1,6 +1,6 @@
namespace SUBD
{
partial class Form1
partial class FormElectronicJournal
{
/// <summary>
/// Required designer variable.

View File

@ -0,0 +1,10 @@
namespace SUBD
{
public partial class FormElectronicJournal : Form
{
public FormElectronicJournal()
{
InitializeComponent();
}
}
}

View File

@ -11,7 +11,7 @@ namespace SUBD
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(new FormElectronicJournal());
}
}
}