Сейчас будет...

This commit is contained in:
Софья Якобчук 2024-05-02 14:23:30 +04:00
parent b43ee50092
commit 49aea2f442
20 changed files with 33 additions and 39 deletions

View File

@ -142,6 +142,7 @@ namespace LawCompanyBusinessLogic.BusinessLogics
FIO = model.FIO,
Phone = model.Phone,
Email = model.Email,
ExecutorId = model.ExecutorId,
});
if (element != null && element.Id != model.Id)
{

View File

@ -17,7 +17,7 @@ namespace LawCompanyBusinessLogic.BusinessLogics
private readonly ILogger _logger;
private readonly IExecutorStorage _executorStorage;
public ExecutorLogic(ILogger<ExecutorLogic> logger, IExecutorStorage executorStorage)
public ExecutorLogic(ILogger logger, IExecutorStorage executorStorage)
{
_logger = logger;
_executorStorage = executorStorage;

View File

@ -12,7 +12,7 @@ namespace LawCompanyBusinessLogic.BusinessLogics
private readonly ILogger _logger;
private readonly IGuarantorStorage _guarantorStorage;
public GuarantorLogic(ILogger<GuarantorLogic> logger, IGuarantorStorage guarantorStorage)
public GuarantorLogic(ILogger logger, IGuarantorStorage guarantorStorage)
{
_logger = logger;
_guarantorStorage = guarantorStorage;

View File

@ -95,10 +95,6 @@ namespace LawCompanyBusinessLogic.BusinessLogics
{
return false;
}
if (element.HearingLawyers.ContainsKey(lawyer.Id))
{
return false;
}
element.HearingLawyers[lawyer.Id] = lawyer;
_hearingStorage.Update(new()
@ -122,11 +118,6 @@ namespace LawCompanyBusinessLogic.BusinessLogics
{
return;
}
if (string.IsNullOrEmpty(model.Judge))
{
throw new ArgumentNullException("Не указан суд",
nameof(model.Judge));
}
if (string.IsNullOrEmpty((model.HearingDate).ToString()))
{
throw new ArgumentNullException("Не поставлено время", nameof(model.HearingDate));
@ -137,6 +128,7 @@ namespace LawCompanyBusinessLogic.BusinessLogics
HearingDate = model.HearingDate
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("На данное время уже назначено слушание");

View File

@ -142,6 +142,7 @@ namespace LawCompanyBusinessLogic.BusinessLogics
FIO = model.FIO,
Phone = model.Phone,
Email = model.Email,
GuarantorId = model.GuarantorId,
});
if (element != null && element.Id != model.Id)

View File

@ -8,6 +8,6 @@ namespace LawCompanyContracts.BindingModels
public string FIO { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public int? GuarantorId { get; set; }
public int GuarantorId { get; set; }
}
}

View File

@ -5,8 +5,6 @@
public int? Id { get; set; }
public double? Cost { get; set; }
public DateTime? ConsultationDate { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
public int? CaseId { get; set; }
public int? GuarantorId { get; set; }
}

View File

@ -4,8 +4,6 @@
{
public int? Id { get; set; }
public DateTime? HearingDate { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
public int? GuarantorId { get; set; }
}
}

View File

@ -14,6 +14,8 @@ namespace LawCompanyContracts.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<int, ILawyerModel> ConsultationLawyers { get; set; } = new();
}

View File

@ -11,6 +11,8 @@ namespace LawCompanyContracts.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<int, ILawyerModel> HearingLawyers { get; set; } = new();
}

View File

@ -13,6 +13,6 @@ namespace LawCompanyContracts.ViewModels
public string Phone { get; set; } = string.Empty;
[DisplayName("E-mail юриста")]
public string Email { get; set; } = string.Empty;
public int? GuarantorId { get; set; }
public int GuarantorId { get; set; }
}
}

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LawCompanyDataModels;
namespace LawCompanyDataModels.Models
{
@ -11,6 +7,6 @@ namespace LawCompanyDataModels.Models
string FIO { get; }
string Phone { get; }
string Email { get; }
public int? GuarantorId { get; }
public int GuarantorId { get; }
}
}

View File

@ -15,7 +15,8 @@ namespace LawCompanyDatabaseImplement.Implements
.Select(x => x.GetViewModel)
.ToList();
}
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
public List<ClientViewModel> GetFilteredList(ClientSearchModel
model)
{
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.FIO)
&& string.IsNullOrEmpty(model.Phone) && !model.ExecutorId.HasValue)

View File

@ -59,7 +59,7 @@ namespace LawCompanyDatabaseImplement.Implements
public GuarantorViewModel? Insert(GuarantorBindingModel model)
{
using var context = new LawCompanyDatabase();
var newGuarantor = Guarantor.Create(context, model);
var newGuarantor = Guarantor.Create(model);
if (newGuarantor == null)
{
return null;

View File

@ -61,7 +61,7 @@ namespace LawCompanyDatabaseImplement.Implements
public LawyerViewModel? Insert(LawyerBindingModel model)
{
using var context = new LawCompanyDatabase();
var newLawyer = Lawyer.Create(context, model);
var newLawyer = Lawyer.Create(model);
if (newLawyer == null)
{
return null;

View File

@ -91,8 +91,8 @@ namespace LawCompanyDatabaseImplement.Implements
}
public VisitViewModel? GetElement(VisitSearchModel model)
{
if (!model.Id.HasValue && !model.VisitDate.HasValue
&& !model.HearingId.HasValue)
if (!model.Id.HasValue && !model.ExecutorId.HasValue
&& !model.VisitDate.HasValue && !model.HearingId.HasValue)
{
return new();
}

View File

@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using LawCompanyDatabaseImplement.Models;
using System.ComponentModel.DataAnnotations;
namespace LawCompanyDatabaseImplement.Models
{

View File

@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using LawCompanyDatabaseImplement.Models;
using System.ComponentModel.DataAnnotations;
namespace LawCompanyDatabaseImplement.Models
{

View File

@ -23,7 +23,7 @@ namespace LawCompanyDatabaseImplement.Models
[ForeignKey("GuarantorId")]
public virtual List<Consultation> Consultations { get; set; } = new();
public static Guarantor? Create(LawCompanyDatabase context, GuarantorBindingModel? model)
public static Guarantor? Create(GuarantorBindingModel? model)
{
if (model == null)
{

View File

@ -1,9 +1,11 @@
using LawCompanyDataModels.Models;
using LawCompanyContracts.BindingModels;
using LawCompanyContracts.ViewModels;
using LawCompanyDataModels.Models;
using LawCompanyDataModels.Models;
using LawCompanyContracts.BindingModels;
using LawCompanyContracts.ViewModels;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.Design;
namespace LawCompanyDatabaseImplement.Models
@ -21,9 +23,9 @@ namespace LawCompanyDatabaseImplement.Models
public virtual List<HearingLawyer> HearingLawyers { get; set; } = new();
[ForeignKey("LawyerId")]
public virtual List<ConsultationLawyer> ConsultationLawyers { get; set; } = new();
public int? GuarantorId { get; set; }
public int GuarantorId { get; set; }
public static Lawyer? Create(LawCompanyDatabase context, LawyerBindingModel? model)
public static Lawyer? Create(LawyerBindingModel? model)
{
if (model == null)
{
@ -58,7 +60,6 @@ namespace LawCompanyDatabaseImplement.Models
FIO = model.FIO;
Email = model.Email;
Phone = model.Phone;
if (!model.GuarantorId.HasValue) GuarantorId = model.GuarantorId;
}
public LawyerViewModel GetViewModel => new()
{