Поручитель: слой контрактов

This commit is contained in:
ityurner02@mail.ru 2023-04-03 20:01:18 +04:00
parent 9e21c5bbf0
commit 3594acfa15
26 changed files with 524 additions and 0 deletions

View File

@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchoolAgainStudy", "SchoolA
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchoolAgainStudyDataModels", "SchoolAgainStudyDataModels\SchoolAgainStudyDataModels.csproj", "{F4F2EDE5-975A-4A60-8C1F-9AEF303AC0B3}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchoolAgainStudyDataModels", "SchoolAgainStudyDataModels\SchoolAgainStudyDataModels.csproj", "{F4F2EDE5-975A-4A60-8C1F-9AEF303AC0B3}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchoolAgainStudyContracts", "SchoolAgainStudyContracts\SchoolAgainStudyContracts.csproj", "{5D678B52-4EDB-439A-BF15-E18280D39585}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -21,6 +23,10 @@ Global
{F4F2EDE5-975A-4A60-8C1F-9AEF303AC0B3}.Debug|Any CPU.Build.0 = Debug|Any CPU {F4F2EDE5-975A-4A60-8C1F-9AEF303AC0B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4F2EDE5-975A-4A60-8C1F-9AEF303AC0B3}.Release|Any CPU.ActiveCfg = Release|Any CPU {F4F2EDE5-975A-4A60-8C1F-9AEF303AC0B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4F2EDE5-975A-4A60-8C1F-9AEF303AC0B3}.Release|Any CPU.Build.0 = Release|Any CPU {F4F2EDE5-975A-4A60-8C1F-9AEF303AC0B3}.Release|Any CPU.Build.0 = Release|Any CPU
{5D678B52-4EDB-439A-BF15-E18280D39585}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5D678B52-4EDB-439A-BF15-E18280D39585}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D678B52-4EDB-439A-BF15-E18280D39585}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D678B52-4EDB-439A-BF15-E18280D39585}.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,25 @@
using SchoolAgainStudyDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.BindingModel
{
public class LessonBindingModel : ILesson
{
public string Title { get; set; } = string.Empty;
public DateTime DateEvent { get; set; }
public int ProductId { get; set; }
public string ProductName { get; set; } = string.Empty;
public int TeacherId { get; set; }
public Dictionary<int, IMaterial> LessonMaterials { get; set; } = new();
public int Id { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using SchoolAgainStudyDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.BindingModel
{
public class MaterialBindingModel : IMaterial
{
public string Title { get; set; } = string.Empty;
public string SphereUse { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.BindingModel
{
public class ReportBindingModel
{
public string FileName { get; set; } = string.Empty;
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using SchoolAgainStudyDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.BindingModel
{
public class TaskBindingModel : ITask
{
public string Title { get; set; } = string.Empty;
public DateTime DateIssue { get; set; }
public DateTime DateDelivery { get; set; }
public int TeacherId { get; set; }
public Dictionary<int, IMaterial> TaskMaterials { get; set; } = new();
public int Id { get; set; }
}
}

View File

@ -0,0 +1,26 @@
using SchoolAgainStudyDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.BindingModel
{
public class TeacherBindingModel : ITeacher
{
public string Name { get; set; } = string.Empty;
public string Post { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
public string Login { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public Dictionary<int, IMaterial> TeacherMaterials { get; set; } = new();
public int Id { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using SchoolAgainStudyContracts.BindingModel;
using SchoolAgainStudyContracts.SearchModel;
using SchoolAgainStudyContracts.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.BusinessLogicContracts
{
public interface ILessonLogic
{
List<LessonViewModel>? ReadList(LessonSearchModel? model);
LessonViewModel? ReadElement(LessonSearchModel model);
bool Create(LessonBindingModel model);
bool Update(LessonBindingModel model);
bool Delete(LessonBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using SchoolAgainStudyContracts.BindingModel;
using SchoolAgainStudyContracts.SearchModel;
using SchoolAgainStudyContracts.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.BusinessLogicContracts
{
public interface IMaterialLogic
{
List<MaterialViewModel>? ReadList(MaterialSearchModel? model);
MaterialViewModel? ReadElement(MaterialSearchModel model);
bool Create(MaterialBindingModel model);
bool Update(MaterialBindingModel model);
bool Delete(MaterialBindingModel model);
}
}

View File

@ -0,0 +1,39 @@
using SchoolAgainStudyContracts.BindingModel;
using SchoolAgainStudyContracts.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.BusinessLogicContracts
{
public interface IReportLogic
{
List<ReportInterestLessonViewModel> GetInterestLesson();
List<ReportInterestViewModel> GetOrders(ReportBindingModel model);
List<ReportDiyMaterialViewModel> GetDiyMaterial();
List<ReportLessonTaskViewModel> GetLessonTask(ReportBindingModel model);
void SaveInterestLessonToWordFile(ReportBindingModel model);
void SaveInterestLessonToExcelFile(ReportBindingModel model);
void SaveInterestsToPdfFile(ReportBindingModel model);
void SaveDiyMaterialToWordFile(ReportBindingModel model);
void SaveDiyMaterialToExcelFile(ReportBindingModel model);
void SaveLessonTaskToPdfFile(ReportBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using SchoolAgainStudyContracts.BindingModel;
using SchoolAgainStudyContracts.SearchModel;
using SchoolAgainStudyContracts.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.BusinessLogicContracts
{
public interface ITaskLogic
{
List<TaskViewModel>? ReadList(TaskSearchModel? model);
TaskViewModel? ReadElement(TaskSearchModel model);
bool Create(TaskBindingModel model);
bool Update(TaskBindingModel model);
bool Delete(TaskBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using SchoolAgainStudyContracts.BindingModel;
using SchoolAgainStudyContracts.SearchModel;
using SchoolAgainStudyContracts.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.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,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.SearchModel
{
public class LessonSearchModel
{
public int? Id { get; set; }
public string? Title { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.SearchModel
{
public class MaterialSearchModel
{
public int? Id { get; set; }
public string? Title { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.SearchModel
{
public class TaskSearchModel
{
public int? Id { get; set; }
public string? Title { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.SearchModel
{
public class TeacherSearchModel
{
public int? Id { get; set; }
public string? Login { get; set; }
public string? Name { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using SchoolAgainStudyContracts.BindingModel;
using SchoolAgainStudyContracts.SearchModel;
using SchoolAgainStudyContracts.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.StorageContracts
{
public interface ILessonStorage
{
List<LessonViewModel> GetFullList();
List<LessonViewModel> GetFilteredList(LessonSearchModel model);
LessonViewModel? GetElement(LessonSearchModel model);
LessonViewModel? Insert(LessonBindingModel model);
LessonViewModel? Update(LessonBindingModel model);
LessonViewModel? Delete(LessonBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using SchoolAgainStudyContracts.BindingModel;
using SchoolAgainStudyContracts.SearchModel;
using SchoolAgainStudyContracts.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.StorageContracts
{
public interface IMaterialStorage
{
List<MaterialViewModel> GetFullList();
List<MaterialViewModel> GetFilteredList(MaterialSearchModel model);
MaterialViewModel? GetElement(MaterialSearchModel model);
MaterialViewModel? Insert(MaterialBindingModel model);
MaterialViewModel? Update(MaterialBindingModel model);
MaterialViewModel? Delete(MaterialBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using SchoolAgainStudyContracts.BindingModel;
using SchoolAgainStudyContracts.SearchModel;
using SchoolAgainStudyContracts.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.StorageContracts
{
public interface ITaskStorage
{
List<TaskViewModel> GetFullList();
List<TaskViewModel> GetFilteredList(TaskSearchModel model);
TaskViewModel? GetElement(TaskSearchModel model);
TaskViewModel? Insert(TaskBindingModel model);
TaskViewModel? Update(TaskBindingModel model);
TaskViewModel? Delete(TaskBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using SchoolAgainStudyContracts.BindingModel;
using SchoolAgainStudyContracts.SearchModel;
using SchoolAgainStudyContracts.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.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,28 @@
using SchoolAgainStudyDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.ViewModel
{
public class LessonViewModel : ILesson
{
[DisplayName("Название")]
public string Title { get; set; } = string.Empty;
[DisplayName("Дата проведения")]
public DateTime DateEvent { get; set; }
public int ProductId { get; set; }
[DisplayName("Изделие")]
public string ProductName { get; set; } = string.Empty;
public int TeacherId { get; set; }
public Dictionary<int, IMaterial> LessonMaterials { get; set; } = new();
[DisplayName("Номер")]
public int Id { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using SchoolAgainStudyDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.ViewModel
{
public class MaterialViewModel : IMaterial
{
[DisplayName("Название")]
public string Title { get; set; } = string.Empty;
[DisplayName("Сфера использования")]
public string SphereUse { get; set; } = string.Empty;
[DisplayName("Номер")]
public int Id { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.ViewModel
{
public class ReportDiyMaterialViewModel
{
public string Title { get; set; } = string.Empty;
public List<string> Diys { get; set; } = new();
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.ViewModel
{
public class ReportLessonTaskViewModel
{
public int Id { get; set; }
public string TitleLesson { get; set; } = string.Empty;
public string TitleTask { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,26 @@
using SchoolAgainStudyDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.ViewModel
{
public class TaskViewModel : ITask
{
[DisplayName("Название")]
public string Title { get; set; } = string.Empty;
[DisplayName("Дата выдачи")]
public DateTime DateIssue { get; set; }
[DisplayName("Дата сдачи")]
public DateTime DateDelivery { get; set; }
public int TeacherId { get; set; }
public Dictionary<int, IMaterial> TaskMaterials { get; set; } = new();
[DisplayName("Номер")]
public int Id { get; set; }
}
}

View File

@ -0,0 +1,28 @@
using SchoolAgainStudyDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolAgainStudyContracts.ViewModel
{
public class TeacherViewModel : ITeacher
{
[DisplayName("ФИО")]
public string Name { get; set; } = string.Empty;
[DisplayName("Должность")]
public string Post { get; set; } = string.Empty;
[DisplayName("Телефон")]
public string Phone { get; set; } = string.Empty;
[DisplayName("Логин")]
public string Login { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
public Dictionary<int, IMaterial> TeacherMaterials { get; set; } = new();
[DisplayName("Номер")]
public int Id { get; set; }
}
}