diff --git a/LawFim/LawFirmContracts/SearchModels/ConsultationSearchModel.cs b/LawFim/LawFirmContracts/SearchModels/ConsultationSearchModel.cs index 6572ee9..aad5b40 100644 --- a/LawFim/LawFirmContracts/SearchModels/ConsultationSearchModel.cs +++ b/LawFim/LawFirmContracts/SearchModels/ConsultationSearchModel.cs @@ -5,7 +5,9 @@ public int? Id { get; set; } public double? Cost { get; set; } public DateTime? ConsultationDate { get; set; } - public int? CaseId { get; set; } + public DateTime? DateFrom { get; set; } + public DateTime? DateTo { get; set; } + public int? CaseId { get; set; } public int? GuarantorId { get; set; } } } diff --git a/LawFim/LawFirmContracts/SearchModels/HearingSearchModel.cs b/LawFim/LawFirmContracts/SearchModels/HearingSearchModel.cs index d55b3ec..c687727 100644 --- a/LawFim/LawFirmContracts/SearchModels/HearingSearchModel.cs +++ b/LawFim/LawFirmContracts/SearchModels/HearingSearchModel.cs @@ -4,6 +4,8 @@ { public int? Id { get; set; } public DateTime? HearingDate { get; set; } - public int? GuarantorId { get; set; } + public DateTime? DateFrom { get; set; } + public DateTime? DateTo { get; set; } + public int? GuarantorId { get; set; } } } diff --git a/LawFim/LawFirmContracts/ViewModels/ConsultationViewModel.cs b/LawFim/LawFirmContracts/ViewModels/ConsultationViewModel.cs index 85d3a90..c7a3bbb 100644 --- a/LawFim/LawFirmContracts/ViewModels/ConsultationViewModel.cs +++ b/LawFim/LawFirmContracts/ViewModels/ConsultationViewModel.cs @@ -14,8 +14,6 @@ namespace LawFirmContracts.ViewModels [DisplayName("Дело")] public string CaseName { get; set; } = string.Empty; public int CaseId { get; set; } - [DisplayName("Имя поручителя")] - public string GuarantorName { get; set; } = string.Empty; public int GuarantorId { get; set; } public Dictionary ConsultationLawyers { get; set; } = new(); } diff --git a/LawFim/LawFirmContracts/ViewModels/IGuarantorViewModel.cs b/LawFim/LawFirmContracts/ViewModels/GuarantorViewModel.cs similarity index 100% rename from LawFim/LawFirmContracts/ViewModels/IGuarantorViewModel.cs rename to LawFim/LawFirmContracts/ViewModels/GuarantorViewModel.cs diff --git a/LawFim/LawFirmContracts/ViewModels/IHearingViewModel.cs b/LawFim/LawFirmContracts/ViewModels/HearingViewModel.cs similarity index 82% rename from LawFim/LawFirmContracts/ViewModels/IHearingViewModel.cs rename to LawFim/LawFirmContracts/ViewModels/HearingViewModel.cs index a99ed1e..6dd637b 100644 --- a/LawFim/LawFirmContracts/ViewModels/IHearingViewModel.cs +++ b/LawFim/LawFirmContracts/ViewModels/HearingViewModel.cs @@ -11,8 +11,6 @@ namespace LawFirmContracts.ViewModels public DateTime HearingDate { get; set; } [DisplayName("Суд")] public string Judge { get; set; } = string.Empty; - [DisplayName("Имя поручителя")] - public string GuarantorName { get; set; } = string.Empty; public int GuarantorId { get; set; } public Dictionary HearingLawyers { get; set; } = new(); } diff --git a/LawFim/LawFirmContracts/ViewModels/ILawyerViewModel.cs b/LawFim/LawFirmContracts/ViewModels/LawyerViewModel.cs similarity index 100% rename from LawFim/LawFirmContracts/ViewModels/ILawyerViewModel.cs rename to LawFim/LawFirmContracts/ViewModels/LawyerViewModel.cs diff --git a/LawFim/LawFirmDatabaseImplement/Implements/ConsultationStorage.cs b/LawFim/LawFirmDatabaseImplement/Implements/ConsultationStorage.cs index 5903d9f..38c3667 100644 --- a/LawFim/LawFirmDatabaseImplement/Implements/ConsultationStorage.cs +++ b/LawFim/LawFirmDatabaseImplement/Implements/ConsultationStorage.cs @@ -21,10 +21,23 @@ namespace LawFirmDatabaseImplement.Implements } public List GetFilteredList(ConsultationSearchModel model) { - if (!model.Id.HasValue && !model.GuarantorId.HasValue) + if (!model.Id.HasValue && !model.GuarantorId.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue + && !model.ConsultationDate.HasValue) { return new(); } + if (!model.GuarantorId.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue) + { + using var context = new LawFirmDatabase(); + return context.Consultations + .Include(x => x.Lawyers) + .ThenInclude(x => x.Lawyer) + .Where(x => x.GuarantorId == model.GuarantorId && x.ConsultationDate >= model.DateFrom + && x.ConsultationDate<= model.DateTo) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } if (!model.GuarantorId.HasValue) { using var context = new LawFirmDatabase(); @@ -32,23 +45,36 @@ namespace LawFirmDatabaseImplement.Implements .Include(x => x.Lawyers) .ThenInclude(x => x.Lawyer) .Where(x => x.GuarantorId == model.GuarantorId) + .ToList() .Select(x => x.GetViewModel) .ToList(); } + else if (!model.DateFrom.HasValue || !model.DateTo.HasValue) + { + using var context = new LawFirmDatabase(); + return context.Consultations + .Include(x => x.Lawyers) + .ThenInclude(x => x.Lawyer) + .Where(x => x.Id == model.Id) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } else { using var context = new LawFirmDatabase(); return context.Consultations .Include(x => x.Lawyers) .ThenInclude(x => x.Lawyer) - .Where(x => x.Id == model.Id) + .Where(x => x.ConsultationDate>= model.DateFrom && x.ConsultationDate<= model.DateTo) + .ToList() .Select(x => x.GetViewModel) .ToList(); } } public ConsultationViewModel? GetElement(ConsultationSearchModel model) { - if (!model.Id.HasValue && !model.GuarantorId.HasValue) + if (!model.Id.HasValue && !model.GuarantorId.HasValue && !model.ConsultationDate.HasValue) { return null; } diff --git a/LawFim/LawFirmDatabaseImplement/Implements/HearingStorage.cs b/LawFim/LawFirmDatabaseImplement/Implements/HearingStorage.cs index 4865c15..43d3bf6 100644 --- a/LawFim/LawFirmDatabaseImplement/Implements/HearingStorage.cs +++ b/LawFim/LawFirmDatabaseImplement/Implements/HearingStorage.cs @@ -21,11 +21,22 @@ namespace LawFirmDatabaseImplement.Implements } public List GetFilteredList(HearingSearchModel model) { - if (!model.Id.HasValue && !model.GuarantorId.HasValue) + if (!model.Id.HasValue && !model.GuarantorId.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue + && !model.HearingDate.HasValue) { return new(); } - + if (!model.GuarantorId.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue) + { + using var context = new LawFirmDatabase(); + return context.Hearings + .Include(x => x.Lawyers) + .ThenInclude(x => x.Lawyer) + .Where(x => x.GuarantorId == model.GuarantorId && x.HearingDate >= model.DateFrom + && x.HearingDate <= model.DateTo) + .Select(x => x.GetViewModel) + .ToList(); + } if (!model.GuarantorId.HasValue) { using var context = new LawFirmDatabase(); @@ -36,20 +47,30 @@ namespace LawFirmDatabaseImplement.Implements .Select(x => x.GetViewModel) .ToList(); } + else if (!model.DateFrom.HasValue || !model.DateTo.HasValue) + { + using var context = new LawFirmDatabase(); + return context.Hearings + .Include(x => x.Lawyers) + .ThenInclude(x => x.Lawyer) + .Where(x => x.Id == model.Id) + .Select(x => x.GetViewModel) + .ToList(); + } else { using var context = new LawFirmDatabase(); return context.Hearings .Include(x => x.Lawyers) .ThenInclude(x => x.Lawyer) - .Where(x => x.Id == model.Id) + .Where(x => x.HearingDate >= model.DateFrom && x.HearingDate <= model.DateTo) .Select(x => x.GetViewModel) .ToList(); } } public HearingViewModel? GetElement(HearingSearchModel model) { - if (!model.Id.HasValue && !model.GuarantorId.HasValue) + if (!model.Id.HasValue && !model.GuarantorId.HasValue && !model.HearingDate.HasValue) { return null; } @@ -57,9 +78,9 @@ namespace LawFirmDatabaseImplement.Implements return context.Hearings .Include(x => x.Lawyers) .ThenInclude(x => x.Lawyer) - .FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id || (model.GuarantorId.HasValue - && x.GuarantorId == model.GuarantorId)) - ?.GetViewModel; + .FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id || (model.GuarantorId.HasValue + && x.GuarantorId == model.GuarantorId)) + ?.GetViewModel; } public HearingViewModel? Insert(HearingBindingModel model) diff --git a/LawFim/LawFirmDatabaseImplement/LawFirmDatabase.cs b/LawFim/LawFirmDatabaseImplement/LawFirmDatabase.cs index 4d12370..022c99d 100644 --- a/LawFim/LawFirmDatabaseImplement/LawFirmDatabase.cs +++ b/LawFim/LawFirmDatabaseImplement/LawFirmDatabase.cs @@ -11,9 +11,9 @@ namespace LawFirmDatabaseImplement { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=ZIRAEL\SQLEXPRESS;Initial Catalog=LawFirmDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + //optionsBuilder.UseSqlServer(@"Data Source=ZIRAEL\SQLEXPRESS;Initial Catalog=LawFirmDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); - //optionsBuilder.UseSqlServer(@"Data Source=PC-Anna\SQLEXPRESS;Initial Catalog=LawFirmDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=PC-Anna\SQLEXPRESS;Initial Catalog=LawFirmDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } diff --git a/LawFim/LawFirmGuarantorApp/Program.cs b/LawFim/LawFirmGuarantorApp/Program.cs index 0727468..d1632a1 100644 --- a/LawFim/LawFirmGuarantorApp/Program.cs +++ b/LawFim/LawFirmGuarantorApp/Program.cs @@ -4,6 +4,7 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllersWithViews(); var app = builder.Build(); +APIClient.Connect(builder.Configuration); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) @@ -22,6 +23,6 @@ app.UseAuthorization(); app.MapControllerRoute( name: "default", - pattern: "{controller=Home}/{action=Index}/{id?}"); + pattern: "{controller=Home}/{action=EnterGuarantor}/{id?}"); app.Run(); diff --git a/LawFim/LawFirmGuarantorApp/Views/Home/Consultation.cshtml b/LawFim/LawFirmGuarantorApp/Views/Home/Consultation.cshtml new file mode 100644 index 0000000..32f38e1 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Home/Consultation.cshtml @@ -0,0 +1,61 @@ +@{ + ViewData["Title"] = "Create Consultation"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} +
+

Список консультаций

+
+
+ @{ +

+ Назначить консультацию + Добавить юристов к консультациям +

+ + + + + + + + + + + @foreach (var item in Model) + { + + + + + + + + + } + +
+ Номер + + Стоимость консультации + + Дата консультации + + Наименование дела +
+ @Html.DisplayFor(modelItem => + item.Id) + + @Html.DisplayFor(modelItem => + item.Cost) + + @Html.DisplayFor(modelItem => + item.CaseName) + + + + + + +
+ } +
\ No newline at end of file diff --git a/LawFim/LawFirmGuarantorApp/Views/Home/EnterGuarantor.cshtml b/LawFim/LawFirmGuarantorApp/Views/Home/EnterGuarantor.cshtml new file mode 100644 index 0000000..4ea0253 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Home/EnterGuarantor.cshtml @@ -0,0 +1,21 @@ +@{ + ViewData["Title"] = "Enter"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} +
+

Вход в приложение

+
+
+
+
Электронная почта:
+
+
+
+
Пароль:
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/LawFim/LawFirmGuarantorApp/Views/Home/Hearings.cshtml b/LawFim/LawFirmGuarantorApp/Views/Home/Hearings.cshtml new file mode 100644 index 0000000..d138978 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Home/Hearings.cshtml @@ -0,0 +1,58 @@ +@{ + ViewData["Title"] = "Create Hearing"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} +
+

Список слушаний

+
+
+ @{ +

+ Назначить слушание + Добавить юристов к слушаниям +

+ + + + + + + + + + @foreach (var item in Model) + { + + + + + + + + + } + +
+ Номер + + Дата слушания + + Наименование суда +
+ @Html.DisplayFor(modelItem => + item.Id) + + @Html.DisplayFor(modelItem => + item.HearingDate) + + @Html.DisplayFor(modelItem => + item.Judge) + + + + + + +
+ } +
\ No newline at end of file diff --git a/LawFim/LawFirmGuarantorApp/Views/Home/Index.cshtml b/LawFim/LawFirmGuarantorApp/Views/Home/Index.cshtml deleted file mode 100644 index d2d19bd..0000000 --- a/LawFim/LawFirmGuarantorApp/Views/Home/Index.cshtml +++ /dev/null @@ -1,8 +0,0 @@ -@{ - ViewData["Title"] = "Home Page"; -} - -
-

Welcome

-

Learn about building Web apps with ASP.NET Core.

-
diff --git a/LawFim/LawFirmGuarantorApp/Views/Home/Lawyers.cshtml b/LawFim/LawFirmGuarantorApp/Views/Home/Lawyers.cshtml new file mode 100644 index 0000000..cb0c600 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Home/Lawyers.cshtml @@ -0,0 +1,67 @@ +@{ + ViewData["Title"] = "Юристы"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} +
+

Список юристов

+
+
+ @{ + if (Model == null) + { +

Авторизируйтесь

+ return; + } +

+ Добавить юриста +

+ + + + + + + + + + + @foreach (var item in Model) + { + + + + + + + + + + } + +
+ Номер сотрудника + + ФИО + + Телефон + + Email +
+ @Html.DisplayFor(modelItem => + item.Id) + + @Html.DisplayFor(modelItem => + item.FIO) + + @Html.DisplayFor(modelItem => + item.Phone) + + @Html.DisplayFor(modelItem => + item.Email) + + + + +
+ } +
\ No newline at end of file diff --git a/LawFim/LawFirmGuarantorApp/Views/Home/Privacy.cshtml b/LawFim/LawFirmGuarantorApp/Views/Home/Privacy.cshtml deleted file mode 100644 index af4fb19..0000000 --- a/LawFim/LawFirmGuarantorApp/Views/Home/Privacy.cshtml +++ /dev/null @@ -1,6 +0,0 @@ -@{ - ViewData["Title"] = "Privacy Policy"; -} -

@ViewData["Title"]

- -

Use this page to detail your site's privacy policy.

diff --git a/LawFim/LawFirmGuarantorApp/Views/Home/PrivacyGuarantor.cshtml b/LawFim/LawFirmGuarantorApp/Views/Home/PrivacyGuarantor.cshtml new file mode 100644 index 0000000..b6d3342 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Home/PrivacyGuarantor.cshtml @@ -0,0 +1,36 @@ +@{ + ViewData["Title"] = "Privacy Policy"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} +
+

Личные данные

+
+
+
+
Электронная почта:
+
+ +
+
+
+
Пароль:
+
+ +
+
+
+
ФИО:
+
+ +
+
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/LawFim/LawFirmGuarantorApp/Views/Home/RegisterGuarantor.cshtml b/LawFim/LawFirmGuarantorApp/Views/Home/RegisterGuarantor.cshtml new file mode 100644 index 0000000..d6cc5c2 --- /dev/null +++ b/LawFim/LawFirmGuarantorApp/Views/Home/RegisterGuarantor.cshtml @@ -0,0 +1,28 @@ +@{ + ViewData["Title"] = "Register"; + Layout = "~/Views/Shared/_LayoutGuarantor.cshtml"; +} +
+

Регистрация поручителя

+
+
+
+
Электронная почта:
+
+
+
+
Пароль:
+
+
+
+
ФИО:
+
+
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/LawFim/LawFirmGuarantorApp/Views/Shared/_Layout.cshtml b/LawFim/LawFirmGuarantorApp/Views/Shared/_LayoutGuarantor.cshtml similarity index 61% rename from LawFim/LawFirmGuarantorApp/Views/Shared/_Layout.cshtml rename to LawFim/LawFirmGuarantorApp/Views/Shared/_LayoutGuarantor.cshtml index a687724..e2c51b5 100644 --- a/LawFim/LawFirmGuarantorApp/Views/Shared/_Layout.cshtml +++ b/LawFim/LawFirmGuarantorApp/Views/Shared/_LayoutGuarantor.cshtml @@ -12,7 +12,7 @@