Сейчас будет...
This commit is contained in:
parent
b43ee50092
commit
49aea2f442
@ -142,6 +142,7 @@ namespace LawCompanyBusinessLogic.BusinessLogics
|
|||||||
FIO = model.FIO,
|
FIO = model.FIO,
|
||||||
Phone = model.Phone,
|
Phone = model.Phone,
|
||||||
Email = model.Email,
|
Email = model.Email,
|
||||||
|
ExecutorId = model.ExecutorId,
|
||||||
});
|
});
|
||||||
if (element != null && element.Id != model.Id)
|
if (element != null && element.Id != model.Id)
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ namespace LawCompanyBusinessLogic.BusinessLogics
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IExecutorStorage _executorStorage;
|
private readonly IExecutorStorage _executorStorage;
|
||||||
|
|
||||||
public ExecutorLogic(ILogger<ExecutorLogic> logger, IExecutorStorage executorStorage)
|
public ExecutorLogic(ILogger logger, IExecutorStorage executorStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_executorStorage = executorStorage;
|
_executorStorage = executorStorage;
|
||||||
|
@ -12,7 +12,7 @@ namespace LawCompanyBusinessLogic.BusinessLogics
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IGuarantorStorage _guarantorStorage;
|
private readonly IGuarantorStorage _guarantorStorage;
|
||||||
|
|
||||||
public GuarantorLogic(ILogger<GuarantorLogic> logger, IGuarantorStorage guarantorStorage)
|
public GuarantorLogic(ILogger logger, IGuarantorStorage guarantorStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_guarantorStorage = guarantorStorage;
|
_guarantorStorage = guarantorStorage;
|
||||||
|
@ -95,10 +95,6 @@ namespace LawCompanyBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (element.HearingLawyers.ContainsKey(lawyer.Id))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
element.HearingLawyers[lawyer.Id] = lawyer;
|
element.HearingLawyers[lawyer.Id] = lawyer;
|
||||||
|
|
||||||
_hearingStorage.Update(new()
|
_hearingStorage.Update(new()
|
||||||
@ -122,11 +118,6 @@ namespace LawCompanyBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(model.Judge))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Не указан суд",
|
|
||||||
nameof(model.Judge));
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty((model.HearingDate).ToString()))
|
if (string.IsNullOrEmpty((model.HearingDate).ToString()))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Не поставлено время", nameof(model.HearingDate));
|
throw new ArgumentNullException("Не поставлено время", nameof(model.HearingDate));
|
||||||
@ -137,6 +128,7 @@ namespace LawCompanyBusinessLogic.BusinessLogics
|
|||||||
HearingDate = model.HearingDate
|
HearingDate = model.HearingDate
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (element != null && element.Id != model.Id)
|
if (element != null && element.Id != model.Id)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("На данное время уже назначено слушание");
|
throw new InvalidOperationException("На данное время уже назначено слушание");
|
||||||
|
@ -142,6 +142,7 @@ namespace LawCompanyBusinessLogic.BusinessLogics
|
|||||||
FIO = model.FIO,
|
FIO = model.FIO,
|
||||||
Phone = model.Phone,
|
Phone = model.Phone,
|
||||||
Email = model.Email,
|
Email = model.Email,
|
||||||
|
GuarantorId = model.GuarantorId,
|
||||||
|
|
||||||
});
|
});
|
||||||
if (element != null && element.Id != model.Id)
|
if (element != null && element.Id != model.Id)
|
||||||
|
@ -8,6 +8,6 @@ namespace LawCompanyContracts.BindingModels
|
|||||||
public string FIO { get; set; } = string.Empty;
|
public string FIO { get; set; } = string.Empty;
|
||||||
public string Phone { get; set; } = string.Empty;
|
public string Phone { get; set; } = string.Empty;
|
||||||
public string Email { get; set; } = string.Empty;
|
public string Email { get; set; } = string.Empty;
|
||||||
public int? GuarantorId { get; set; }
|
public int GuarantorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public double? Cost { get; set; }
|
public double? Cost { get; set; }
|
||||||
public DateTime? ConsultationDate { get; set; }
|
public DateTime? ConsultationDate { get; set; }
|
||||||
public DateTime? DateFrom { get; set; }
|
|
||||||
public DateTime? DateTo { get; set; }
|
|
||||||
public int? CaseId { get; set; }
|
public int? CaseId { get; set; }
|
||||||
public int? GuarantorId { get; set; }
|
public int? GuarantorId { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public DateTime? HearingDate { get; set; }
|
public DateTime? HearingDate { get; set; }
|
||||||
public DateTime? DateFrom { get; set; }
|
|
||||||
public DateTime? DateTo { get; set; }
|
|
||||||
public int? GuarantorId { get; set; }
|
public int? GuarantorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@ namespace LawCompanyContracts.ViewModels
|
|||||||
[DisplayName("Дело")]
|
[DisplayName("Дело")]
|
||||||
public string CaseName { get; set; } = string.Empty;
|
public string CaseName { get; set; } = string.Empty;
|
||||||
public int CaseId { get; set; }
|
public int CaseId { get; set; }
|
||||||
|
[DisplayName("Имя поручителя")]
|
||||||
|
public string GuarantorName { get; set; } = string.Empty;
|
||||||
public int GuarantorId { get; set; }
|
public int GuarantorId { get; set; }
|
||||||
public Dictionary<int, ILawyerModel> ConsultationLawyers { get; set; } = new();
|
public Dictionary<int, ILawyerModel> ConsultationLawyers { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@ namespace LawCompanyContracts.ViewModels
|
|||||||
public DateTime HearingDate { get; set; }
|
public DateTime HearingDate { get; set; }
|
||||||
[DisplayName("Суд")]
|
[DisplayName("Суд")]
|
||||||
public string Judge { get; set; } = string.Empty;
|
public string Judge { get; set; } = string.Empty;
|
||||||
|
[DisplayName("Имя поручителя")]
|
||||||
|
public string GuarantorName { get; set; } = string.Empty;
|
||||||
public int GuarantorId { get; set; }
|
public int GuarantorId { get; set; }
|
||||||
public Dictionary<int, ILawyerModel> HearingLawyers { get; set; } = new();
|
public Dictionary<int, ILawyerModel> HearingLawyers { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,6 @@ namespace LawCompanyContracts.ViewModels
|
|||||||
public string Phone { get; set; } = string.Empty;
|
public string Phone { get; set; } = string.Empty;
|
||||||
[DisplayName("E-mail юриста")]
|
[DisplayName("E-mail юриста")]
|
||||||
public string Email { get; set; } = string.Empty;
|
public string Email { get; set; } = string.Empty;
|
||||||
public int? GuarantorId { get; set; }
|
public int GuarantorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using LawCompanyDataModels;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace LawCompanyDataModels.Models
|
namespace LawCompanyDataModels.Models
|
||||||
{
|
{
|
||||||
@ -11,6 +7,6 @@ namespace LawCompanyDataModels.Models
|
|||||||
string FIO { get; }
|
string FIO { get; }
|
||||||
string Phone { get; }
|
string Phone { get; }
|
||||||
string Email { get; }
|
string Email { get; }
|
||||||
public int? GuarantorId { get; }
|
public int GuarantorId { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.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)
|
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.FIO)
|
||||||
&& string.IsNullOrEmpty(model.Phone) && !model.ExecutorId.HasValue)
|
&& string.IsNullOrEmpty(model.Phone) && !model.ExecutorId.HasValue)
|
||||||
|
@ -59,7 +59,7 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
public GuarantorViewModel? Insert(GuarantorBindingModel model)
|
public GuarantorViewModel? Insert(GuarantorBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
var newGuarantor = Guarantor.Create(context, model);
|
var newGuarantor = Guarantor.Create(model);
|
||||||
if (newGuarantor == null)
|
if (newGuarantor == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -61,7 +61,7 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
public LawyerViewModel? Insert(LawyerBindingModel model)
|
public LawyerViewModel? Insert(LawyerBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
var newLawyer = Lawyer.Create(context, model);
|
var newLawyer = Lawyer.Create(model);
|
||||||
if (newLawyer == null)
|
if (newLawyer == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -74,7 +74,7 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
return context.Visits
|
return context.Visits
|
||||||
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||||
.Where(x => x.Id == model.Id)
|
.Where(x => x.Id == model.Id)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -91,8 +91,8 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
public VisitViewModel? GetElement(VisitSearchModel model)
|
public VisitViewModel? GetElement(VisitSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue && !model.VisitDate.HasValue
|
if (!model.Id.HasValue && !model.ExecutorId.HasValue
|
||||||
&& !model.HearingId.HasValue)
|
&& !model.VisitDate.HasValue && !model.HearingId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using LawCompanyDatabaseImplement.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace LawCompanyDatabaseImplement.Models
|
namespace LawCompanyDatabaseImplement.Models
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using LawCompanyDatabaseImplement.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace LawCompanyDatabaseImplement.Models
|
namespace LawCompanyDatabaseImplement.Models
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@ namespace LawCompanyDatabaseImplement.Models
|
|||||||
[ForeignKey("GuarantorId")]
|
[ForeignKey("GuarantorId")]
|
||||||
public virtual List<Consultation> Consultations { get; set; } = new();
|
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)
|
if (model == null)
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
using LawCompanyDataModels.Models;
|
using LawCompanyContracts.BindingModels;
|
||||||
|
using LawCompanyContracts.ViewModels;
|
||||||
|
using LawCompanyDataModels.Models;
|
||||||
|
using LawCompanyDataModels.Models;
|
||||||
using LawCompanyContracts.BindingModels;
|
using LawCompanyContracts.BindingModels;
|
||||||
using LawCompanyContracts.ViewModels;
|
using LawCompanyContracts.ViewModels;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.ComponentModel.Design;
|
|
||||||
|
|
||||||
|
|
||||||
namespace LawCompanyDatabaseImplement.Models
|
namespace LawCompanyDatabaseImplement.Models
|
||||||
@ -21,9 +23,9 @@ namespace LawCompanyDatabaseImplement.Models
|
|||||||
public virtual List<HearingLawyer> HearingLawyers { get; set; } = new();
|
public virtual List<HearingLawyer> HearingLawyers { get; set; } = new();
|
||||||
[ForeignKey("LawyerId")]
|
[ForeignKey("LawyerId")]
|
||||||
public virtual List<ConsultationLawyer> ConsultationLawyers { get; set; } = new();
|
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)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -58,7 +60,6 @@ namespace LawCompanyDatabaseImplement.Models
|
|||||||
FIO = model.FIO;
|
FIO = model.FIO;
|
||||||
Email = model.Email;
|
Email = model.Email;
|
||||||
Phone = model.Phone;
|
Phone = model.Phone;
|
||||||
if (!model.GuarantorId.HasValue) GuarantorId = model.GuarantorId;
|
|
||||||
}
|
}
|
||||||
public LawyerViewModel GetViewModel => new()
|
public LawyerViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user