From e3a8abde5a62d5ff9047f08f3ac9d77b1a6e22cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D1=8C=D1=84=D0=B8=D1=8F=20=D0=A2=D1=83=D0=BA?= =?UTF-8?q?=D0=B0=D0=B5=D0=B2=D0=B0?= Date: Mon, 3 Apr 2023 17:46:26 +0300 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20DataModels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- School/School.sln | 8 +++++++- .../BindingModels/CircleBindingModel.cs | 5 +++-- .../BindingModels/ClientBindingModel.cs | 5 +++-- .../BindingModels/EmployeeBindingModel.cs | 5 +++-- .../BindingModels/LessonBindingModel.cs | 7 ++++--- .../BindingModels/PaymentBindingModel.cs | 7 ++++--- School/SchoolContracts/SchoolContracts.csproj | 4 ++++ .../StoragesContracts/ICircleStorage.cs | 5 +++-- .../StoragesContracts/IClientStorage.cs | 5 +++-- .../StoragesContracts/IEmployeeStorage.cs | 5 +++-- .../StoragesContracts/ILessonStorage.cs | 5 +++-- .../StoragesContracts/IPaymentStorage.cs | 5 +++-- .../ViewModels/CircleViewModel.cs | 5 +++-- .../ViewModels/ClientViewModel.cs | 5 +++-- .../ViewModels/EmployeeViewModel.cs | 5 +++-- .../ViewModels/LessonViewModel.cs | 5 +++-- .../ViewModels/PaymentViewModel.cs | 5 +++-- School/SchoolDataModels/IId.cs | 13 +++++++++++++ School/SchoolDataModels/Models/ICircleModel.cs | 16 ++++++++++++++++ School/SchoolDataModels/Models/IClientModel.cs | 16 ++++++++++++++++ School/SchoolDataModels/Models/IEmployeeModel.cs | 16 ++++++++++++++++ School/SchoolDataModels/Models/ILessonModel.cs | 9 +++++++++ School/SchoolDataModels/Models/IPaymentModel.cs | 16 ++++++++++++++++ School/SchoolDataModels/SchoolDataModels.csproj | 9 +++++++++ 24 files changed, 153 insertions(+), 33 deletions(-) create mode 100644 School/SchoolDataModels/IId.cs create mode 100644 School/SchoolDataModels/Models/ICircleModel.cs create mode 100644 School/SchoolDataModels/Models/IClientModel.cs create mode 100644 School/SchoolDataModels/Models/IEmployeeModel.cs create mode 100644 School/SchoolDataModels/Models/ILessonModel.cs create mode 100644 School/SchoolDataModels/Models/IPaymentModel.cs create mode 100644 School/SchoolDataModels/SchoolDataModels.csproj diff --git a/School/School.sln b/School/School.sln index b6cb592..1aa0d3a 100644 --- a/School/School.sln +++ b/School/School.sln @@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.4.33205.214 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchoolContracts", "SchoolContracts\SchoolContracts.csproj", "{CE6AA228-4B99-4071-9791-D6117703F66A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchoolContracts", "SchoolContracts\SchoolContracts.csproj", "{CE6AA228-4B99-4071-9791-D6117703F66A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchoolDataModels", "SchoolDataModels\SchoolDataModels.csproj", "{8F1FD758-DD7C-4CA5-8371-6D242FB03278}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +17,10 @@ Global {CE6AA228-4B99-4071-9791-D6117703F66A}.Debug|Any CPU.Build.0 = Debug|Any CPU {CE6AA228-4B99-4071-9791-D6117703F66A}.Release|Any CPU.ActiveCfg = Release|Any CPU {CE6AA228-4B99-4071-9791-D6117703F66A}.Release|Any CPU.Build.0 = Release|Any CPU + {8F1FD758-DD7C-4CA5-8371-6D242FB03278}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8F1FD758-DD7C-4CA5-8371-6D242FB03278}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8F1FD758-DD7C-4CA5-8371-6D242FB03278}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8F1FD758-DD7C-4CA5-8371-6D242FB03278}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/School/SchoolContracts/BindingModels/CircleBindingModel.cs b/School/SchoolContracts/BindingModels/CircleBindingModel.cs index b647522..8f46e32 100644 --- a/School/SchoolContracts/BindingModels/CircleBindingModel.cs +++ b/School/SchoolContracts/BindingModels/CircleBindingModel.cs @@ -1,4 +1,5 @@ -using System; +using SchoolDataModels.Models; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +7,7 @@ using System.Threading.Tasks; namespace SchoolContracts.BindingModel { - public class CircleBindingModel + public class CircleBindingModel : ICircleModel { public int Id { get; set; } public DateTime StartDate { get; set; } = DateTime.Now; diff --git a/School/SchoolContracts/BindingModels/ClientBindingModel.cs b/School/SchoolContracts/BindingModels/ClientBindingModel.cs index 4f138c6..bfe67c4 100644 --- a/School/SchoolContracts/BindingModels/ClientBindingModel.cs +++ b/School/SchoolContracts/BindingModels/ClientBindingModel.cs @@ -1,4 +1,5 @@ -using System; +using SchoolDataModels.Models; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +7,7 @@ using System.Threading.Tasks; namespace SchoolContracts.BindingModel { - public class ClientBindingModel + public class ClientBindingModel :IClientModel { public int Id { get; set; } public string ClientName { get; set; } = string.Empty; diff --git a/School/SchoolContracts/BindingModels/EmployeeBindingModel.cs b/School/SchoolContracts/BindingModels/EmployeeBindingModel.cs index 3bd9d79..084d318 100644 --- a/School/SchoolContracts/BindingModels/EmployeeBindingModel.cs +++ b/School/SchoolContracts/BindingModels/EmployeeBindingModel.cs @@ -1,4 +1,5 @@ -using System; +using SchoolDataModels.Models; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +7,7 @@ using System.Threading.Tasks; namespace SchoolContracts.BindingModel { - public class EmployeeBindingModel + public class EmployeeBindingModel : IEmployeeModel { public int Id { get; set; } public string EmployeeName { get; set; } = string.Empty; diff --git a/School/SchoolContracts/BindingModels/LessonBindingModel.cs b/School/SchoolContracts/BindingModels/LessonBindingModel.cs index 90594c9..9211bb1 100644 --- a/School/SchoolContracts/BindingModels/LessonBindingModel.cs +++ b/School/SchoolContracts/BindingModels/LessonBindingModel.cs @@ -1,4 +1,5 @@ -using System; +using SchoolDataModels.Models; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,11 +7,11 @@ using System.Threading.Tasks; namespace SchoolContracts.BindingModel { - public class LessonBindingModel + public class LessonBindingModel : ILessonModel { public int Id { get; set; } public string LessonName { get; set; } = string.Empty; public decimal LessonCost { get; set; } - public int EmployeeId { get; set; } + public int? EmployeeId { get; set; } } } diff --git a/School/SchoolContracts/BindingModels/PaymentBindingModel.cs b/School/SchoolContracts/BindingModels/PaymentBindingModel.cs index d94e296..06fe5e5 100644 --- a/School/SchoolContracts/BindingModels/PaymentBindingModel.cs +++ b/School/SchoolContracts/BindingModels/PaymentBindingModel.cs @@ -1,4 +1,5 @@ -using System; +using SchoolDataModels.Models; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,12 +7,12 @@ using System.Threading.Tasks; namespace SchoolContracts.BindingModel { - public class PaymentBindingModel + public class PaymentBindingModel : IPaymentModel { public int Id { get; set; } public decimal Sum { get; set; } public decimal Remains { get; set; } - public DateTime DateOfPayment { get; set; } + public DateTime? DateOfPayment { get; set; } public int LessonId { get; set; } } diff --git a/School/SchoolContracts/SchoolContracts.csproj b/School/SchoolContracts/SchoolContracts.csproj index 132c02c..d91be07 100644 --- a/School/SchoolContracts/SchoolContracts.csproj +++ b/School/SchoolContracts/SchoolContracts.csproj @@ -6,4 +6,8 @@ enable + + + + diff --git a/School/SchoolContracts/StoragesContracts/ICircleStorage.cs b/School/SchoolContracts/StoragesContracts/ICircleStorage.cs index 989f8b1..7f0e981 100644 --- a/School/SchoolContracts/StoragesContracts/ICircleStorage.cs +++ b/School/SchoolContracts/StoragesContracts/ICircleStorage.cs @@ -1,4 +1,5 @@ using SchoolContracts.BindingModel; +using SchoolContracts.SearchModel; using SchoolContracts.ViewModels; using System; using System.Collections.Generic; @@ -11,8 +12,8 @@ namespace SchoolContracts.StoragesContracts public interface ICircleStorage { List GetFullList(); - List GetFilteredList(CircleBindingModel model); - CircleViewModel GetElement(CircleBindingModel model); + List GetFilteredList(CircleSearchModel model); + CircleViewModel GetElement(CircleSearchModel model); CircleViewModel? Insert(CircleBindingModel model); CircleViewModel? Update(CircleBindingModel model); CircleViewModel? Delete(CircleBindingModel model); diff --git a/School/SchoolContracts/StoragesContracts/IClientStorage.cs b/School/SchoolContracts/StoragesContracts/IClientStorage.cs index 18e27c4..7a5f78e 100644 --- a/School/SchoolContracts/StoragesContracts/IClientStorage.cs +++ b/School/SchoolContracts/StoragesContracts/IClientStorage.cs @@ -1,4 +1,5 @@ using SchoolContracts.BindingModel; +using SchoolContracts.SearchModel; using SchoolContracts.ViewModels; using System; using System.Collections.Generic; @@ -11,8 +12,8 @@ namespace SchoolContracts.StoragesContracts public interface IClientStorage { List GetFullList(); - List GetFilteredList(ClientBindingModel model); - ClientViewModel GetElement(ClientBindingModel model); + List GetFilteredList(ClientSearchModel model); + ClientViewModel GetElement(ClientSearchModel model); ClientViewModel? Insert(ClientBindingModel model); ClientViewModel? Update(ClientBindingModel model); ClientViewModel? Delete(ClientBindingModel model); diff --git a/School/SchoolContracts/StoragesContracts/IEmployeeStorage.cs b/School/SchoolContracts/StoragesContracts/IEmployeeStorage.cs index 0cb0857..89ce7f1 100644 --- a/School/SchoolContracts/StoragesContracts/IEmployeeStorage.cs +++ b/School/SchoolContracts/StoragesContracts/IEmployeeStorage.cs @@ -1,4 +1,5 @@ using SchoolContracts.BindingModel; +using SchoolContracts.SearchModel; using SchoolContracts.ViewModels; using System; using System.Collections.Generic; @@ -11,8 +12,8 @@ namespace SchoolContracts.StoragesContracts public interface IEmployeeStorage { List GetFullList(); - List GetFilteredList(EmployeeBindingModel model); - EmployeeViewModel GetElement(EmployeeBindingModel model); + List GetFilteredList(EmployeeSearchModel model); + EmployeeViewModel GetElement(EmployeeSearchModel model); EmployeeViewModel? Insert(EmployeeBindingModel model); EmployeeViewModel? Update(EmployeeBindingModel model); EmployeeViewModel? Delete(EmployeeBindingModel model); diff --git a/School/SchoolContracts/StoragesContracts/ILessonStorage.cs b/School/SchoolContracts/StoragesContracts/ILessonStorage.cs index 35ca7bc..10dc294 100644 --- a/School/SchoolContracts/StoragesContracts/ILessonStorage.cs +++ b/School/SchoolContracts/StoragesContracts/ILessonStorage.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using SchoolContracts.BindingModel; +using SchoolContracts.SearchModel; using SchoolContracts.ViewModels; namespace SchoolContracts.StoragesContracts @@ -11,8 +12,8 @@ namespace SchoolContracts.StoragesContracts public interface ILessonStorage { List GetFullList(); - List GetFilteredList(LessonBindingModel model); - LessonViewModel GetElement(LessonBindingModel model); + List GetFilteredList(LessonSearchModel model); + LessonViewModel GetElement(LessonSearchModel model); LessonViewModel? Insert(LessonBindingModel model); LessonViewModel? Update(LessonBindingModel model); LessonViewModel? Delete(LessonBindingModel model); diff --git a/School/SchoolContracts/StoragesContracts/IPaymentStorage.cs b/School/SchoolContracts/StoragesContracts/IPaymentStorage.cs index bbfe3e3..1317875 100644 --- a/School/SchoolContracts/StoragesContracts/IPaymentStorage.cs +++ b/School/SchoolContracts/StoragesContracts/IPaymentStorage.cs @@ -1,5 +1,6 @@ using SchoolContracts.BindingModel; using SchoolContracts.BindingModels; +using SchoolContracts.SearchModel; using SchoolContracts.ViewModels; using System; using System.Collections.Generic; @@ -12,8 +13,8 @@ namespace SchoolContracts.StoragesContracts public interface IPaymentStorage { List GetFullList(); - List GetFilteredList(PaymentBindingModel model); - PaymentViewModel GetElement(PaymentBindingModel model); + List GetFilteredList(PaymentSearchModel model); + PaymentViewModel GetElement(PaymentSearchModel model); PaymentViewModel? Insert(PaymentBindingModel model); PaymentViewModel? Update(PaymentBindingModel model); PaymentViewModel GetElementFirstLast(PaymentDateBindingModel model); diff --git a/School/SchoolContracts/ViewModels/CircleViewModel.cs b/School/SchoolContracts/ViewModels/CircleViewModel.cs index ffee3eb..078723c 100644 --- a/School/SchoolContracts/ViewModels/CircleViewModel.cs +++ b/School/SchoolContracts/ViewModels/CircleViewModel.cs @@ -1,4 +1,5 @@ -using System; +using SchoolDataModels.Models; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; @@ -7,7 +8,7 @@ using System.Threading.Tasks; namespace SchoolContracts.ViewModels { - public class CircleViewModel + public class CircleViewModel : ICircleModel { public int Id { get; set; } [DisplayName("Дата начала кружка")] diff --git a/School/SchoolContracts/ViewModels/ClientViewModel.cs b/School/SchoolContracts/ViewModels/ClientViewModel.cs index 0218dd9..4af6ecd 100644 --- a/School/SchoolContracts/ViewModels/ClientViewModel.cs +++ b/School/SchoolContracts/ViewModels/ClientViewModel.cs @@ -1,4 +1,5 @@ -using System; +using SchoolDataModels.Models; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +7,7 @@ using System.Threading.Tasks; namespace SchoolContracts.ViewModels { - public class ClientViewModel + public class ClientViewModel : IClientModel { public int Id { get; set; } public string ClientName { get; set; } diff --git a/School/SchoolContracts/ViewModels/EmployeeViewModel.cs b/School/SchoolContracts/ViewModels/EmployeeViewModel.cs index e361761..fb7be67 100644 --- a/School/SchoolContracts/ViewModels/EmployeeViewModel.cs +++ b/School/SchoolContracts/ViewModels/EmployeeViewModel.cs @@ -1,4 +1,5 @@ -using System; +using SchoolDataModels.Models; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +7,7 @@ using System.Threading.Tasks; namespace SchoolContracts.ViewModels { - public class EmployeeViewModel + public class EmployeeViewModel : IEmployeeModel { public int Id { get; set; } public string EmployeeName { get; set; } diff --git a/School/SchoolContracts/ViewModels/LessonViewModel.cs b/School/SchoolContracts/ViewModels/LessonViewModel.cs index f25bac7..aed355a 100644 --- a/School/SchoolContracts/ViewModels/LessonViewModel.cs +++ b/School/SchoolContracts/ViewModels/LessonViewModel.cs @@ -1,4 +1,5 @@ -using System; +using SchoolDataModels.Models; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; @@ -7,7 +8,7 @@ using System.Threading.Tasks; namespace SchoolContracts.ViewModels { - public class LessonViewModel + public class LessonViewModel : ILessonModel { public int Id { get; set; } [DisplayName("Название занятия")] diff --git a/School/SchoolContracts/ViewModels/PaymentViewModel.cs b/School/SchoolContracts/ViewModels/PaymentViewModel.cs index 4471296..1878f6c 100644 --- a/School/SchoolContracts/ViewModels/PaymentViewModel.cs +++ b/School/SchoolContracts/ViewModels/PaymentViewModel.cs @@ -1,4 +1,5 @@ -using System; +using SchoolDataModels.Models; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +7,7 @@ using System.Threading.Tasks; namespace SchoolContracts.ViewModels { - public class PaymentViewModel + public class PaymentViewModel : IPaymentModel { public int Id { get; set; } public decimal Sum { get; set; } diff --git a/School/SchoolDataModels/IId.cs b/School/SchoolDataModels/IId.cs new file mode 100644 index 0000000..c8e514a --- /dev/null +++ b/School/SchoolDataModels/IId.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchoolDataModels +{ + public interface IId + { + int Id { get; } + } +} diff --git a/School/SchoolDataModels/Models/ICircleModel.cs b/School/SchoolDataModels/Models/ICircleModel.cs new file mode 100644 index 0000000..b5dd24b --- /dev/null +++ b/School/SchoolDataModels/Models/ICircleModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchoolDataModels.Models +{ + public interface ICircleModel : IId + { + public DateTime StartDate { get; set; } + public int ClientId { get; set; } + public int LessonId { get; set; } + public Dictionary CircleLessons { get; set; } + } +} diff --git a/School/SchoolDataModels/Models/IClientModel.cs b/School/SchoolDataModels/Models/IClientModel.cs new file mode 100644 index 0000000..ccce435 --- /dev/null +++ b/School/SchoolDataModels/Models/IClientModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchoolDataModels.Models +{ + public interface IClientModel : IId + { + public string ClientName { get; set; } + public string ClientEmail { get; set; } + public string ClientPhone { get; set; } + public string ClientPassword { get; set; } + } +} diff --git a/School/SchoolDataModels/Models/IEmployeeModel.cs b/School/SchoolDataModels/Models/IEmployeeModel.cs new file mode 100644 index 0000000..2bc46da --- /dev/null +++ b/School/SchoolDataModels/Models/IEmployeeModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchoolDataModels.Models +{ + public interface IEmployeeModel : IId + { + public string EmployeeName { get; set; } + public string EmployeePassword { get; set; } + public string EmployeeEmail { get; set; } + public string EmployeePhone { get; set; } + } +} diff --git a/School/SchoolDataModels/Models/ILessonModel.cs b/School/SchoolDataModels/Models/ILessonModel.cs new file mode 100644 index 0000000..1d5cee6 --- /dev/null +++ b/School/SchoolDataModels/Models/ILessonModel.cs @@ -0,0 +1,9 @@ +namespace SchoolDataModels.Models +{ + public interface ILessonModel : IId + { + public string LessonName { get; set; } + public decimal LessonCost { get; set; } + public int? EmployeeId { get; set; } + } +} \ No newline at end of file diff --git a/School/SchoolDataModels/Models/IPaymentModel.cs b/School/SchoolDataModels/Models/IPaymentModel.cs new file mode 100644 index 0000000..f0a0086 --- /dev/null +++ b/School/SchoolDataModels/Models/IPaymentModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchoolDataModels.Models +{ + public interface IPaymentModel : IId + { + public decimal Sum { get; set; } + public decimal Remains { get; set; } + public DateTime? DateOfPayment { get; set; } + public int LessonId { get; set; } + } +} diff --git a/School/SchoolDataModels/SchoolDataModels.csproj b/School/SchoolDataModels/SchoolDataModels.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/School/SchoolDataModels/SchoolDataModels.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + +