...
This commit is contained in:
parent
8484941fa6
commit
2e39657b08
@ -72,6 +72,7 @@ namespace LawCompanyBusinessLogic.BusinessLogics
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool Update(ConsultationBindingModel model)
|
public bool Update(ConsultationBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model);
|
CheckModel(model);
|
||||||
@ -124,8 +125,7 @@ namespace LawCompanyBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
throw new ArgumentNullException("Не поставлено время", nameof(model.ConsultationDate));
|
throw new ArgumentNullException("Не поставлено время", nameof(model.ConsultationDate));
|
||||||
}
|
}
|
||||||
|
_logger.LogInformation("Consultation.ConsultationDate: { ConsultationDate}. Id: {Id} ", model.ConsultationDate, model.Id);
|
||||||
_logger.LogInformation("Consultation. ConsultationDate:{ConsultationDate}. Id: {Id} ", model.ConsultationDate, model.Id);
|
|
||||||
var element = _consultationStorage.GetElement(new ConsultationSearchModel
|
var element = _consultationStorage.GetElement(new ConsultationSearchModel
|
||||||
{
|
{
|
||||||
ConsultationDate = model.ConsultationDate
|
ConsultationDate = model.ConsultationDate
|
||||||
|
@ -7,13 +7,12 @@ using LawCompanyContracts.StoragesContracts;
|
|||||||
using LawCompanyContracts.ViewModels;
|
using LawCompanyContracts.ViewModels;
|
||||||
using LawCompanyDatabaseImplement.Models;
|
using LawCompanyDatabaseImplement.Models;
|
||||||
using LawCompanyDatabaseImplement.Implements;
|
using LawCompanyDatabaseImplement.Implements;
|
||||||
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||||
|
|
||||||
namespace HotelBusinessLogic.BusinessLogics
|
namespace HotelBusinessLogic.BusinessLogics
|
||||||
{
|
{
|
||||||
public class ReportLogicExecutor : IReportExecutorLogic
|
public class ReportLogicExecutor : IReportExecutorLogic
|
||||||
{
|
{
|
||||||
private readonly IHearingStorage _hearingStorage;
|
|
||||||
private readonly ILawyerStorage _lawyerStorage;
|
|
||||||
private readonly IVisitStorage _visitStorage;
|
private readonly IVisitStorage _visitStorage;
|
||||||
private readonly IConsultationStorage _consultationStorage;
|
private readonly IConsultationStorage _consultationStorage;
|
||||||
private readonly ICaseStorage _caseStorage;
|
private readonly ICaseStorage _caseStorage;
|
||||||
@ -22,12 +21,10 @@ namespace HotelBusinessLogic.BusinessLogics
|
|||||||
private readonly AbstractSaveToWordExecutor _saveToWord;
|
private readonly AbstractSaveToWordExecutor _saveToWord;
|
||||||
private readonly AbstractSaveToPdfExecutor _saveToPdf;
|
private readonly AbstractSaveToPdfExecutor _saveToPdf;
|
||||||
|
|
||||||
public ReportLogicExecutor(IHearingStorage hearingStorage, ILawyerStorage lawyerStorage,
|
public ReportLogicExecutor(
|
||||||
IVisitStorage visitStorage, IConsultationStorage consultationStorage, ICaseStorage caseStorage, IClientStorage clientStorage,
|
IVisitStorage visitStorage, IConsultationStorage consultationStorage, ICaseStorage caseStorage, IClientStorage clientStorage,
|
||||||
AbstractSaveToExcelExecutor saveToExcel, AbstractSaveToWordExecutor saveToWord, AbstractSaveToPdfExecutor saveToPdf)
|
AbstractSaveToExcelExecutor saveToExcel, AbstractSaveToWordExecutor saveToWord, AbstractSaveToPdfExecutor saveToPdf)
|
||||||
{
|
{
|
||||||
_hearingStorage = hearingStorage;
|
|
||||||
_lawyerStorage = lawyerStorage;
|
|
||||||
_visitStorage = visitStorage;
|
_visitStorage = visitStorage;
|
||||||
_consultationStorage = consultationStorage;
|
_consultationStorage = consultationStorage;
|
||||||
_clientStorage = clientStorage;
|
_clientStorage = clientStorage;
|
||||||
@ -37,138 +34,134 @@ namespace HotelBusinessLogic.BusinessLogics
|
|||||||
_saveToPdf = saveToPdf;
|
_saveToPdf = saveToPdf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ReportClientHearingViewModel> GetClientHearing(List<int> Ids)
|
public List<ReportClientHearingViewModel> GetClientHearing(List<int> ids)
|
||||||
{
|
{
|
||||||
if (Ids == null || !Ids.Any())
|
var cases = _caseStorage.GetFullList();
|
||||||
{
|
var consultations = _consultationStorage.GetFullList();
|
||||||
return new List<ReportClientHearingViewModel>();
|
|
||||||
}
|
|
||||||
|
|
||||||
var clients = _clientStorage.GetFullList();
|
var list = new List<ReportClientHearingViewModel>();
|
||||||
var hearings = _hearingStorage.GetFullList();
|
|
||||||
var visits = _visitStorage.GetFullList();
|
|
||||||
|
|
||||||
var filteredClients = clients.Where(c => Ids.Contains(c.Id)).ToList();
|
foreach (var id in ids)
|
||||||
var result = new List<ReportClientHearingViewModel>();
|
|
||||||
|
|
||||||
foreach (var client in filteredClients)
|
|
||||||
{
|
|
||||||
var record = new ReportClientHearingViewModel
|
|
||||||
{
|
|
||||||
FIO = client.FIO,
|
|
||||||
Hearing = new List<Tuple<string, DateTime>>()
|
|
||||||
};
|
|
||||||
|
|
||||||
var clientVisits = visits.Where(v => v.VisitClients.ContainsKey(client.Id)).ToList();
|
|
||||||
foreach (var visit in clientVisits)
|
|
||||||
{
|
|
||||||
if (visit.HearingId.HasValue)
|
|
||||||
{
|
|
||||||
var hearing = hearings.FirstOrDefault(h => h.Id == visit.HearingId.Value);
|
|
||||||
if (hearing != null)
|
|
||||||
{
|
|
||||||
record.Hearing.Add(new Tuple<string, DateTime>(hearing.Judge, hearing.HearingDate));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result.Add(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ReportClientsViewModel> GetClients(ReportExecutorBindingModel model)
|
|
||||||
{
|
|
||||||
var listAll = new List<ReportClientsViewModel>();
|
|
||||||
|
|
||||||
// Получаем список всех дел для указанного исполнителя и за указанный период
|
|
||||||
var cases = _caseStorage.GetFilteredList(new CaseSearchModel
|
|
||||||
{
|
{
|
||||||
ExecutorId = model.ExecutorId,
|
var clients = _clientStorage.GetFilteredList(new ClientSearchModel { Id = id });
|
||||||
DateFrom = model.DateFrom,
|
|
||||||
DateTo = model.DateTo
|
|
||||||
});
|
|
||||||
|
|
||||||
// Добавляем информацию о клиентах из дел
|
if (clients.Count == 0)
|
||||||
foreach (var _case in cases)
|
continue;
|
||||||
{
|
|
||||||
foreach (var cc in _case.CaseClients.Values)
|
var client = clients.First();
|
||||||
|
var record = new ReportClientHearingViewModel
|
||||||
{
|
{
|
||||||
listAll.Add(new ReportClientsViewModel
|
FIO = client.FIO,
|
||||||
|
Hearing = new List<Tuple<string, DateTime>>()
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var cas in cases)
|
||||||
|
{
|
||||||
|
if (!cas.CaseClients.ContainsKey(client.Id))
|
||||||
{
|
{
|
||||||
FIO = cc.FIO,
|
foreach (var cons in consultations)
|
||||||
Name = _case.Name,
|
{
|
||||||
Status = _case.Status
|
if (cons.CaseId.Equals(cas.Id))
|
||||||
});
|
{
|
||||||
|
record.Hearing.Add(new Tuple<string, DateTime>(cas.Name, cons.ConsultationDate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.Add(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Получаем список всех консультаций для указанного исполнителя и за указанный период
|
return list;
|
||||||
var consultations = _consultationStorage.GetFilteredList(new ConsultationSearchModel
|
|
||||||
{
|
|
||||||
GuarantorId = model.ExecutorId,
|
|
||||||
DateFrom = model.DateFrom,
|
|
||||||
DateTo = model.DateTo
|
|
||||||
});
|
|
||||||
|
|
||||||
// Добавляем информацию о клиентах из консультаций
|
|
||||||
foreach (var consultation in consultations)
|
|
||||||
{
|
|
||||||
foreach (var cc in consultation.Case.CaseClients.Values)
|
|
||||||
{
|
|
||||||
listAll.Add(new ReportClientsViewModel
|
|
||||||
{
|
|
||||||
FIO = cc.FIO,
|
|
||||||
ConsultationDate = consultation.ConsultationDate,
|
|
||||||
Cost = consultation.Cost
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return listAll;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveClientHearingToExcelFile(ReportExecutorBindingModel model)
|
public List<ReportClientsViewModel> GetClients(ReportExecutorBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToExcel.CreateReport(new ExcelInfoExecutor
|
var list = new List<ReportClientsViewModel>();
|
||||||
{
|
var clients = _clientStorage.GetFilteredList(new ClientSearchModel
|
||||||
FileName = model.FileName,
|
{
|
||||||
Title = "Список слушаний",
|
ExecutorId = model.ExecutorId
|
||||||
ClientHearings = GetClientHearing(model.Ids)
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveClientHearingToWordFile(ReportExecutorBindingModel model)
|
var visits = _visitStorage.GetFilteredList(new VisitSearchModel
|
||||||
{
|
{
|
||||||
_saveToWord.CreateDoc(new WordInfoExecutor
|
DateFrom = model.DateFrom,
|
||||||
{
|
DateTo = model.DateTo
|
||||||
FileName = model.FileName,
|
});
|
||||||
Title = "Список слушаний",
|
|
||||||
ClientHearings = GetClientHearing(model.Ids)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveClientsToPdfFile(ReportExecutorBindingModel model)
|
var cases = _caseStorage.GetFilteredList(new CaseSearchModel
|
||||||
{
|
{
|
||||||
if (model.DateFrom == null)
|
DateFrom = model.DateFrom,
|
||||||
{
|
DateTo = model.DateTo
|
||||||
throw new ArgumentException("Дата начала не задана");
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if (model.DateTo == null)
|
foreach (var client in clients)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Дата окончания не задана");
|
var record = new ReportClientsViewModel
|
||||||
}
|
{
|
||||||
_saveToPdf.CreateDoc(new PdfInfoExecutor
|
FIO = client.FIO,
|
||||||
{
|
CaseName = new List<string>(),
|
||||||
FileName = model.FileName,
|
VisitDate = new List<DateTime>()
|
||||||
Title = "Список клиентов",
|
};
|
||||||
DateFrom = model.DateFrom!.Value,
|
|
||||||
DateTo = model.DateTo!.Value,
|
foreach (var cas in cases)
|
||||||
Clients = GetClients(model)
|
{
|
||||||
});
|
if (!cas.CaseClients.ContainsKey(client.Id))
|
||||||
}
|
{
|
||||||
}
|
record.CaseName.Add(cas.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (var vis in visits)
|
||||||
|
{
|
||||||
|
if (!vis.VisitClients.ContainsKey(client.Id))
|
||||||
|
{
|
||||||
|
record.VisitDate.Add(vis.VisitDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.Add(record);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveClientHearingToExcelFile(ReportExecutorBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToExcel.CreateReport(new ExcelInfoExecutor
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список дел",
|
||||||
|
ClientHearings = GetClientHearing(model.Ids)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveClientHearingToWordFile(ReportExecutorBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToWord.CreateDoc(new WordInfoExecutor
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список дел",
|
||||||
|
ClientHearings = GetClientHearing(model.Ids)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveClientsToPdfFile(ReportExecutorBindingModel model)
|
||||||
|
{
|
||||||
|
if (model.DateFrom == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Дата начала не задана");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.DateTo == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Дата окончания не задана");
|
||||||
|
}
|
||||||
|
_saveToPdf.CreateDoc(new PdfInfoExecutor
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список клиентов",
|
||||||
|
DateFrom = model.DateFrom!.Value,
|
||||||
|
DateTo = model.DateTo!.Value,
|
||||||
|
Clients = GetClients(model)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,56 +6,182 @@ using LawCompanyContracts.SearchModels;
|
|||||||
using LawCompanyContracts.StoragesContracts;
|
using LawCompanyContracts.StoragesContracts;
|
||||||
using LawCompanyContracts.ViewModels;
|
using LawCompanyContracts.ViewModels;
|
||||||
using LawCompanyDatabaseImplement.Models;
|
using LawCompanyDatabaseImplement.Models;
|
||||||
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||||
|
using LawCompanyDatabaseImplement;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LawCompanyBusinessLogic.BusinessLogics
|
namespace LawCompanyBusinessLogic.BusinessLogics
|
||||||
{
|
{
|
||||||
public class ReportLogicGuarantor : IReportGuarantorLogic
|
public class ReportLogicGuarantor : IReportGuarantorLogic
|
||||||
{
|
{
|
||||||
/*private readonly IVisitStorage _visitStorage;
|
private readonly IVisitStorage _visitStorage;
|
||||||
private readonly IClientStorage _clientStorage;
|
private readonly ICaseStorage _caseStorage;
|
||||||
private readonly ICaseStorage _caseStorage;
|
private readonly IConsultationStorage _consultationStorage;
|
||||||
private readonly IConsultationStorage _consultationStorage;
|
private readonly IHearingStorage _hearingStorage;
|
||||||
private readonly IHearingStorage _hearingStorage;
|
private readonly ILawyerStorage _lawyerStorage;
|
||||||
private readonly AbstractSaveToExcelGuarantor _saveToExcel;
|
private readonly AbstractSaveToExcelGuarantor _saveToExcel;
|
||||||
private readonly AbstractSaveToWordGuarantor _saveToWord;
|
private readonly AbstractSaveToWordGuarantor _saveToWord;
|
||||||
private readonly AbstractSaveToPdfGuarantor _saveToPdf;
|
private readonly AbstractSaveToPdfGuarantor _saveToPdf;
|
||||||
|
|
||||||
public ReportLogicGuarantor(IVisitStorage visitStorage, IClientStorage clientStorage, ICaseStorage caseStorage,
|
public ReportLogicGuarantor(IVisitStorage visitStorage, ICaseStorage caseStorage,
|
||||||
IConsultationStorage consultationStorage, IHearingStorage hearingStorage,
|
IConsultationStorage consultationStorage, IHearingStorage hearingStorage, ILawyerStorage lawyerStorage,
|
||||||
AbstractSaveToExcelGuarantor saveToExcel, AbstractSaveToWordGuarantor saveToWord, AbstractSaveToPdfGuarantor saveToPdf)
|
AbstractSaveToExcelGuarantor saveToExcel, AbstractSaveToWordGuarantor saveToWord, AbstractSaveToPdfGuarantor saveToPdf)
|
||||||
{
|
|
||||||
_visitStorage = visitStorage;
|
|
||||||
_clientStorage = clientStorage;
|
|
||||||
_caseStorage = caseStorage;
|
|
||||||
_consultationStorage = consultationStorage;
|
|
||||||
_hearingStorage = hearingStorage;
|
|
||||||
_saveToExcel = saveToExcel;
|
|
||||||
_saveToWord = saveToWord;
|
|
||||||
_saveToPdf = saveToPdf;
|
|
||||||
}*/
|
|
||||||
public List<ReportLawyerHearingViewModel> GetLawyerHearing(List<int> Ids)
|
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
_visitStorage = visitStorage;
|
||||||
|
_caseStorage = caseStorage;
|
||||||
|
_consultationStorage = consultationStorage;
|
||||||
|
_hearingStorage = hearingStorage;
|
||||||
|
_lawyerStorage = lawyerStorage;
|
||||||
|
_saveToExcel = saveToExcel;
|
||||||
|
_saveToWord = saveToWord;
|
||||||
|
_saveToPdf = saveToPdf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReportLawyerHearingViewModel> GetLawyerHearing(List<int> Ids)
|
||||||
|
{
|
||||||
|
if (Ids == null || !Ids.Any())
|
||||||
|
{
|
||||||
|
return new List<ReportLawyerHearingViewModel>();
|
||||||
|
}
|
||||||
|
|
||||||
|
using var context = new LawCompanyDatabase();
|
||||||
|
|
||||||
|
var hearings = context.Hearings
|
||||||
|
.Include(h => h.Lawyers)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var visits = context.Visits
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var hearingLawyers = context.HearingLawyers
|
||||||
|
.Include(hl => hl.Lawyer)
|
||||||
|
.Where(hl => Ids.Contains(hl.LawyerId))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var lawyerHearingsDict = hearingLawyers
|
||||||
|
.GroupBy(hl => hl.HearingId)
|
||||||
|
.ToDictionary(g => g.Key, g => g.Select(hl => hl.LawyerId).ToList());
|
||||||
|
|
||||||
|
var list = new List<ReportLawyerHearingViewModel>();
|
||||||
|
|
||||||
|
foreach (var id in Ids)
|
||||||
|
{
|
||||||
|
var lawyer = context.Lawyers
|
||||||
|
.FirstOrDefault(l => l.Id == id);
|
||||||
|
|
||||||
|
if (lawyer == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var record = new ReportLawyerHearingViewModel
|
||||||
|
{
|
||||||
|
FIO = lawyer.FIO,
|
||||||
|
Visits = new List<Tuple<string, DateTime>>()
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var hearing in hearings)
|
||||||
|
{
|
||||||
|
if (lawyerHearingsDict.TryGetValue(hearing.Id, out var lawyerIds) && lawyerIds.Contains(id))
|
||||||
|
{
|
||||||
|
foreach (var visit in visits)
|
||||||
|
{
|
||||||
|
record.Visits.Add(new Tuple<string, DateTime>(hearing.Judge, visit.VisitDate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
list.Add(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ReportLawyersViewModel> GetLawyers(ReportGuarantorBindingModel model)
|
public List<ReportLawyersViewModel> GetLawyers(ReportGuarantorBindingModel model)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var list = new List<ReportLawyersViewModel>();
|
||||||
|
|
||||||
|
var consultations = _consultationStorage.GetFilteredList(new ConsultationSearchModel
|
||||||
|
{
|
||||||
|
GuarantorId = model.GuarantorId,
|
||||||
|
DateFrom = model.DateFrom,
|
||||||
|
DateTo = model.DateTo
|
||||||
|
});
|
||||||
|
|
||||||
|
var lawyers = _lawyerStorage.GetFilteredList(new LawyerSearchModel { GuarantorId = model.GuarantorId });
|
||||||
|
|
||||||
|
var hearings = _hearingStorage.GetFilteredList(new HearingSearchModel
|
||||||
|
{
|
||||||
|
GuarantorId = model.GuarantorId,
|
||||||
|
DateFrom = model.DateFrom,
|
||||||
|
DateTo = model.DateTo
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (LawyerViewModel lawyer in lawyers)
|
||||||
|
{
|
||||||
|
var record = new ReportLawyersViewModel
|
||||||
|
{
|
||||||
|
FIO = lawyer.FIO,
|
||||||
|
Consultation = new List<(DateTime ConsultationDate, double Price)>(),
|
||||||
|
Hearing = new List<(DateTime HearingDate, string Judge)>()
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var consultation in consultations)
|
||||||
|
{
|
||||||
|
if (!consultation.ConsultationLawyers.ContainsKey(lawyer.Id))
|
||||||
|
{
|
||||||
|
record.Consultation.Add(new(consultation.ConsultationDate, consultation.Cost));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (var hearing in hearings)
|
||||||
|
{
|
||||||
|
if (!hearing.HearingLawyers.ContainsKey(lawyer.Id))
|
||||||
|
{
|
||||||
|
record.Hearing.Add(new(hearing.HearingDate, hearing.Judge));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.Add(record);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveLawyerHearingToExcelFile(ReportGuarantorBindingModel model)
|
public void SaveLawyerHearingToExcelFile(ReportGuarantorBindingModel model)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
_saveToExcel.CreateReport(new ExcelInfoGuarantor
|
||||||
}
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список слушаний",
|
||||||
|
LawyerHearings = GetLawyerHearing(model.Ids)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void SaveLawyerHearingToWordFile(ReportGuarantorBindingModel model)
|
public void SaveLawyerHearingToWordFile(ReportGuarantorBindingModel model)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
_saveToWord.CreateDoc(new WordInfoGuarantor
|
||||||
}
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список слушаний",
|
||||||
|
LawyerHearings = GetLawyerHearing(model.Ids)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void SaveLawyersToPdfFile(ReportGuarantorBindingModel model)
|
public void SaveLawyersToPdfFile(ReportGuarantorBindingModel model)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (model.DateFrom == null)
|
||||||
}
|
{
|
||||||
}
|
throw new ArgumentException("Дата начала не задана");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.DateTo == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Дата окончания не задана");
|
||||||
|
}
|
||||||
|
_saveToPdf.CreateDoc(new PdfInfoGuarantor
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список клиентов",
|
||||||
|
DateFrom = model.DateFrom!.Value,
|
||||||
|
DateTo = model.DateTo!.Value,
|
||||||
|
Lawyers = GetLawyers(model)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using System;
|
using LawCompanyBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using LawCompanyBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -6,7 +8,73 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace LawCompanyBusinessLogic.OfficePackage
|
namespace LawCompanyBusinessLogic.OfficePackage
|
||||||
{
|
{
|
||||||
internal class AbstractSaveToExcelGuarantor
|
public abstract class AbstractSaveToExcelGuarantor
|
||||||
{
|
{
|
||||||
|
public void CreateReport(ExcelInfoGuarantor info)
|
||||||
|
{
|
||||||
|
CreateExcel(info);
|
||||||
|
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = 1,
|
||||||
|
Text = info.Title,
|
||||||
|
StyleInfo = ExcelStyleInfoType.Title
|
||||||
|
});
|
||||||
|
|
||||||
|
MergeCells(new ExcelMergeParameters
|
||||||
|
{
|
||||||
|
CellFromName = "A1",
|
||||||
|
CellToName = "C1"
|
||||||
|
});
|
||||||
|
|
||||||
|
uint rowIndex = 2;
|
||||||
|
|
||||||
|
foreach (var mc in info.LawyerHearings)
|
||||||
|
{
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = mc.FIO,
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
|
||||||
|
rowIndex++;
|
||||||
|
|
||||||
|
foreach (var conference in mc.Visits)
|
||||||
|
{
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "B",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = conference.Item1,
|
||||||
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||||
|
});
|
||||||
|
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "C",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = conference.Item2.ToString("d"),
|
||||||
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||||
|
});
|
||||||
|
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveExcel(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void CreateExcel(ExcelInfoGuarantor info);
|
||||||
|
|
||||||
|
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||||
|
|
||||||
|
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
||||||
|
|
||||||
|
protected abstract void SaveExcel(ExcelInfoGuarantor info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,85 +1,67 @@
|
|||||||
using LawCompanyBusinessLogic.OfficePackage.HelperEnums;
|
using LawCompanyBusinessLogic.OfficePackage.HelperEnums;
|
||||||
using LawCompanyBusinessLogic.OfficePackage.HelperModels;
|
using LawCompanyBusinessLogic.OfficePackage.HelperModels;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace LawCompanyBusinessLogic.OfficePackage
|
namespace LawCompanyBusinessLogic.OfficePackage
|
||||||
{
|
{
|
||||||
public abstract class AbstractSaveToPdfExecutor
|
public abstract class AbstractSaveToPdfExecutor
|
||||||
{
|
{
|
||||||
public void CreateDoc(PdfInfoExecutor info)
|
public void CreateDoc(PdfInfoExecutor info)
|
||||||
{
|
{
|
||||||
CreatePdf(info);
|
CreatePdf(info);
|
||||||
|
CreateParagraph(new PdfParagraph
|
||||||
|
{
|
||||||
|
Text = info.Title,
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
CreateParagraph(new PdfParagraph
|
||||||
|
{
|
||||||
|
Text = $"с{info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm" });
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> {"Имя клиента", "Дело", "Дата консультации" },
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
foreach (var client in info.Clients)
|
||||||
|
{
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { client.FIO, " ", " " },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
foreach (var cas in client.CaseName)
|
||||||
|
{
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { " ", cas, " " },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
}
|
||||||
|
foreach (var vis in client.VisitDate)
|
||||||
|
{
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { " ", " ", vis.ToShortDateString() },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CreateParagraph(new PdfParagraph
|
SavePdf(info);
|
||||||
{
|
}
|
||||||
Text = info.Title,
|
|
||||||
Style = "NormalTitle",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
|
|
||||||
CreateParagraph(new PdfParagraph
|
protected abstract void CreatePdf(PdfInfoExecutor info);
|
||||||
{
|
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
||||||
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
protected abstract void CreateTable(List<string> columns);
|
||||||
Style = "Normal",
|
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
protected abstract void SavePdf(PdfInfoExecutor info);
|
||||||
});
|
}
|
||||||
|
|
||||||
CreateTable(new List<string> { "4cm", "5cm", "3cm", "4cm", "2cm" });
|
|
||||||
|
|
||||||
CreateRow(new PdfRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string> { "ФИО клиента", "Дата консультации", "Стоимость консультации", "Название дела", "Статус дела" },
|
|
||||||
Style = "NormalTitle",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach (var member in info.Clients)
|
|
||||||
{
|
|
||||||
bool IsDate = true;
|
|
||||||
if (member.ConsultationDate.ToShortDateString() == "01.01.0001")
|
|
||||||
{
|
|
||||||
IsDate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsCost = true;
|
|
||||||
if (member.Cost.ToString() == "0")
|
|
||||||
{
|
|
||||||
IsCost = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateRow(new PdfRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string>
|
|
||||||
{
|
|
||||||
member.FIO,
|
|
||||||
IsDate is true ? member.ConsultationDate.ToShortDateString() : string.Empty,
|
|
||||||
IsCost is true ? member.Cost.ToString() : string.Empty,
|
|
||||||
member.Name,
|
|
||||||
member.Status.ToString(),
|
|
||||||
},
|
|
||||||
Style = "Normal",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateParagraph(new PdfParagraph
|
|
||||||
{
|
|
||||||
Text = $"Итого: {info.Clients.Sum(x => x.Cost)}\t",
|
|
||||||
Style = "Normal",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Rigth
|
|
||||||
});
|
|
||||||
|
|
||||||
SavePdf(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void CreatePdf(PdfInfoExecutor info);
|
|
||||||
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
|
||||||
protected abstract void CreateTable(List<string> columns);
|
|
||||||
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
|
||||||
protected abstract void SavePdf(PdfInfoExecutor info);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using System;
|
using LawCompanyBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using LawCompanyBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -6,7 +8,93 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace LawCompanyBusinessLogic.OfficePackage
|
namespace LawCompanyBusinessLogic.OfficePackage
|
||||||
{
|
{
|
||||||
internal class AbstractSaveToPdfGuarantor
|
public abstract class AbstractSaveToPdfGuarantor
|
||||||
{
|
{
|
||||||
|
public void CreateDoc(PdfInfoGuarantor info)
|
||||||
|
{
|
||||||
|
CreatePdf(info);
|
||||||
|
|
||||||
|
CreateParagraph(new PdfParagraph
|
||||||
|
{
|
||||||
|
Text = info.Title,
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
CreateParagraph(new PdfParagraph
|
||||||
|
{
|
||||||
|
Text = $"с{info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
CreateTable(new List<string> { "3cm", "5cm", "5cm" });
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { "Юрист", "Цена консультации", "Дата консультации" },
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var ch in info.Lawyers)
|
||||||
|
{
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { ch.FIO, " ", " " },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
|
||||||
|
});
|
||||||
|
foreach (var cons in ch.Consultation)
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { " ", cons.Price.ToString() + " рублей", cons.ConsultationDate.ToShortDateString() },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { " ", " ", "Итого: " + ch.Consultation.Count.ToString() },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Rigth
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateTable(new List<string> { "3cm", "5cm", "5cm" });
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { "Юрист", "Суд", "Дата слушания" },
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
foreach (var ch in info.Lawyers)
|
||||||
|
{
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { ch.FIO, " ", " " },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
|
||||||
|
});
|
||||||
|
foreach (var hear in ch.Hearing)
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { " ", hear.Judge, hear.HearingDate.ToShortDateString() },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
|
});
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { " ", " ", "Итого: " + ch.Hearing.Count.ToString() },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Rigth
|
||||||
|
});
|
||||||
|
}
|
||||||
|
SavePdf(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void CreatePdf(PdfInfoGuarantor info);
|
||||||
|
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
||||||
|
protected abstract void CreateTable(List<string> columns);
|
||||||
|
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
||||||
|
protected abstract void SavePdf(PdfInfoGuarantor info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,73 +8,55 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace LawCompanyBusinessLogic.OfficePackage
|
namespace LawCompanyBusinessLogic.OfficePackage
|
||||||
{
|
{
|
||||||
public class AbstractSaveToWordGuarantor
|
public abstract class AbstractSaveToWordGuarantor
|
||||||
{
|
{
|
||||||
/*public void CreateReport(ExcelInfoGuarantor info)
|
public void CreateDoc(WordInfoGuarantor info)
|
||||||
{
|
{
|
||||||
CreateExcel(info);
|
CreateWord(info);
|
||||||
z
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "A",
|
|
||||||
RowIndex = 1,
|
|
||||||
Text = info.Title,
|
|
||||||
StyleInfo = ExcelStyleInfoType.Title
|
|
||||||
});
|
|
||||||
|
|
||||||
MergeCells(new ExcelMergeParameters
|
CreateParagraph(new WordParagraph
|
||||||
{
|
{
|
||||||
CellFromName = "A1",
|
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||||
CellToName = "C1"
|
TextProperties = new WordTextProperties
|
||||||
});
|
|
||||||
|
|
||||||
uint rowIndex = 2;
|
|
||||||
|
|
||||||
foreach (var mc in info.MemberConferences)
|
|
||||||
{
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
{
|
||||||
ColumnName = "A",
|
Size = "24",
|
||||||
RowIndex = rowIndex,
|
JustificationType = WordJustificationType.Center
|
||||||
Text = $"{mc.MemberSurname} {mc.MemberName} {mc.MemberPatronymic}",
|
}
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
});
|
||||||
|
|
||||||
|
foreach (var mc in info.LawyerHearings)
|
||||||
|
{
|
||||||
|
CreateParagraph(new WordParagraph
|
||||||
|
{
|
||||||
|
Texts = new List<(string, WordTextProperties)>
|
||||||
|
{ ( mc.FIO, new WordTextProperties { Size = "20", Bold=true})},
|
||||||
|
TextProperties = new WordTextProperties
|
||||||
|
{
|
||||||
|
Size = "24",
|
||||||
|
JustificationType = WordJustificationType.Both
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
rowIndex++;
|
foreach (var conference in mc.Visits)
|
||||||
|
|
||||||
foreach (var conference in mc.ConferenceBookings)
|
|
||||||
{
|
{
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
CreateParagraph(new WordParagraph
|
||||||
{
|
{
|
||||||
ColumnName = "B",
|
Texts = new List<(string, WordTextProperties)>
|
||||||
RowIndex = rowIndex,
|
{ (conference.Item1 + " - ", new WordTextProperties { Size = "16", Bold=false}),
|
||||||
Text = conference.Item1,
|
(conference.Item2.ToShortDateString(), new WordTextProperties { Size = "16", Bold=false})},
|
||||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
TextProperties = new WordTextProperties
|
||||||
|
{
|
||||||
|
Size = "24",
|
||||||
|
JustificationType = WordJustificationType.Both
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "C",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = conference.Item2.ToString("d"),
|
|
||||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
|
||||||
|
|
||||||
rowIndex++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rowIndex++;
|
|
||||||
}
|
}
|
||||||
|
SaveWord(info);
|
||||||
SaveExcel(info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void CreateExcel(ExcelInfoOrganiser info);
|
protected abstract void CreateWord(WordInfoGuarantor info);
|
||||||
|
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
protected abstract void SaveWord(WordInfoGuarantor info);
|
||||||
|
|
||||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
|
||||||
|
|
||||||
protected abstract void SaveExcel(ExcelInfoOrganiser info);*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ namespace LawCompanyBusinessLogic.OfficePackage.HelperModels
|
|||||||
{
|
{
|
||||||
public class ExcelInfoExecutor
|
public class ExcelInfoExecutor
|
||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public List<ReportClientHearingViewModel> ClientHearings { get; set; } = new();
|
public List<ReportClientHearingViewModel> ClientHearings { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using LawCompanyContracts.ViewModels;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -10,6 +11,6 @@ namespace LawCompanyBusinessLogic.OfficePackage.HelperModels
|
|||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
//public List<ReportLawyerHearingsViewModel> LawyerHearings { get; set; } = new();
|
public List<ReportLawyerHearingViewModel> LawyerHearings { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,6 @@ namespace LawCompanyBusinessLogic.OfficePackage.HelperModels
|
|||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public DateTime DateFrom { get; set; }
|
public DateTime DateFrom { get; set; }
|
||||||
public DateTime DateTo { get; set; }
|
public DateTime DateTo { get; set; }
|
||||||
public List<ReportClientsViewModel> Clients { get; set; } = new();
|
public List<ReportClientsViewModel> Clients { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using LawCompanyContracts.ViewModels;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -6,7 +7,12 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace LawCompanyBusinessLogic.OfficePackage.HelperModels
|
namespace LawCompanyBusinessLogic.OfficePackage.HelperModels
|
||||||
{
|
{
|
||||||
internal class PdfInfoGuarantor
|
public class PdfInfoGuarantor
|
||||||
{
|
{
|
||||||
|
public string FileName { get; set; } = "C:\\Reports\\pdffile.pdf";
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public DateTime DateFrom { get; set; }
|
||||||
|
public DateTime DateTo { get; set; }
|
||||||
|
public List<ReportLawyersViewModel> Lawyers { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using LawCompanyContracts.ViewModels;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -6,7 +7,10 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace LawCompanyBusinessLogic.OfficePackage.HelperModels
|
namespace LawCompanyBusinessLogic.OfficePackage.HelperModels
|
||||||
{
|
{
|
||||||
internal class WordInfoGuarantor
|
public class WordInfoGuarantor
|
||||||
{
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public List<ReportLawyerHearingViewModel> LawyerHearings { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ using DocumentFormat.OpenXml;
|
|||||||
|
|
||||||
namespace LawCompanyBusinessLogic.OfficePackage.Implements
|
namespace LawCompanyBusinessLogic.OfficePackage.Implements
|
||||||
{
|
{
|
||||||
/*public class SaveToExcelGuarantor : AbstractSaveToExcelGuarantor
|
public class SaveToExcelGuarantor : AbstractSaveToExcelGuarantor
|
||||||
{
|
{
|
||||||
private SpreadsheetDocument? _spreadsheetDocument;
|
private SpreadsheetDocument? _spreadsheetDocument;
|
||||||
private SharedStringTablePart? _shareStringPart;
|
private SharedStringTablePart? _shareStringPart;
|
||||||
@ -324,5 +324,5 @@ namespace LawCompanyBusinessLogic.OfficePackage.Implements
|
|||||||
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
||||||
_spreadsheetDocument.Close();
|
_spreadsheetDocument.Close();
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,103 @@
|
|||||||
using System;
|
using LawCompanyBusinessLogic.OfficePackage.HelperEnums;
|
||||||
using System.Collections.Generic;
|
using LawCompanyBusinessLogic.OfficePackage.HelperModels;
|
||||||
using System.Linq;
|
using MigraDoc.DocumentObjectModel;
|
||||||
using System.Text;
|
using MigraDoc.Rendering;
|
||||||
using System.Threading.Tasks;
|
using MigraDoc.DocumentObjectModel.Tables;
|
||||||
|
|
||||||
|
|
||||||
namespace LawCompanyBusinessLogic.OfficePackage.Implements
|
namespace LawCompanyBusinessLogic.OfficePackage.Implements
|
||||||
{
|
{
|
||||||
internal class SaveToPdfGuarantor
|
public class SaveToPdfGuarantor : AbstractSaveToPdfGuarantor
|
||||||
{
|
{
|
||||||
|
private Document? _document;
|
||||||
|
private Section? _section;
|
||||||
|
private Table? _table;
|
||||||
|
|
||||||
|
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
|
||||||
|
{
|
||||||
|
return type switch
|
||||||
|
{
|
||||||
|
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
|
||||||
|
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
|
||||||
|
PdfParagraphAlignmentType.Rigth => ParagraphAlignment.Right,
|
||||||
|
_ => ParagraphAlignment.Justify,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void DefineStyles(Document document)
|
||||||
|
{
|
||||||
|
var style = document.Styles["Normal"];
|
||||||
|
style.Font.Name = "Times New Roman";
|
||||||
|
style.Font.Size = 14;
|
||||||
|
style = document.Styles.AddStyle("NormalTitle", "Normal");
|
||||||
|
style.Font.Bold = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateParagraph(PdfParagraph pdfParagraph)
|
||||||
|
{
|
||||||
|
if (_section == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var paragraph = _section.AddParagraph(pdfParagraph.Text);
|
||||||
|
paragraph.Format.SpaceAfter = "1cm";
|
||||||
|
paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
|
||||||
|
paragraph.Style = pdfParagraph.Style;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreatePdf(PdfInfoGuarantor info)
|
||||||
|
{
|
||||||
|
_document = new Document();
|
||||||
|
DefineStyles(_document);
|
||||||
|
_section = _document.AddSection();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateRow(PdfRowParameters rowParameters)
|
||||||
|
{
|
||||||
|
if (_table == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var row = _table.AddRow();
|
||||||
|
for (int i = 0; i < rowParameters.Texts.Count; ++i)
|
||||||
|
{
|
||||||
|
row.Cells[i].AddParagraph(rowParameters.Texts[i]);
|
||||||
|
if (!string.IsNullOrEmpty(rowParameters.Style))
|
||||||
|
{
|
||||||
|
row.Cells[i].Style = rowParameters.Style;
|
||||||
|
}
|
||||||
|
Unit borderWidth = 0.5;
|
||||||
|
row.Cells[i].Borders.Left.Width = borderWidth;
|
||||||
|
row.Cells[i].Borders.Right.Width = borderWidth;
|
||||||
|
row.Cells[i].Borders.Top.Width = borderWidth;
|
||||||
|
row.Cells[i].Borders.Bottom.Width = borderWidth;
|
||||||
|
row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment);
|
||||||
|
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateTable(List<string> columns)
|
||||||
|
{
|
||||||
|
if (_document == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_table = _document.LastSection.AddTable();
|
||||||
|
foreach (var elem in columns)
|
||||||
|
{
|
||||||
|
_table.AddColumn(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void SavePdf(PdfInfoGuarantor info)
|
||||||
|
{
|
||||||
|
var renderer = new PdfDocumentRenderer(true)
|
||||||
|
{
|
||||||
|
Document = _document
|
||||||
|
};
|
||||||
|
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
||||||
|
renderer.RenderDocument();
|
||||||
|
renderer.PdfDocument.Save(info.FileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
using System;
|
using DocumentFormat.OpenXml.Packaging;
|
||||||
|
using DocumentFormat.OpenXml.Wordprocessing;
|
||||||
|
using DocumentFormat.OpenXml;
|
||||||
|
using LawCompanyBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using LawCompanyBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -6,7 +11,120 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace LawCompanyBusinessLogic.OfficePackage.Implements
|
namespace LawCompanyBusinessLogic.OfficePackage.Implements
|
||||||
{
|
{
|
||||||
internal class SaveToWordGuarantor
|
public class SaveToWordGuarantor : AbstractSaveToWordGuarantor
|
||||||
{
|
{
|
||||||
|
private WordprocessingDocument? _wordDocument;
|
||||||
|
private Body? _docBody;
|
||||||
|
|
||||||
|
private static JustificationValues GetJustificationValues(WordJustificationType type)
|
||||||
|
{
|
||||||
|
return type switch
|
||||||
|
{
|
||||||
|
WordJustificationType.Both => JustificationValues.Both,
|
||||||
|
WordJustificationType.Center => JustificationValues.Center,
|
||||||
|
_ => JustificationValues.Left,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SectionProperties CreateSectionProperties()
|
||||||
|
{
|
||||||
|
var properties = new SectionProperties();
|
||||||
|
var pageSize = new PageSize
|
||||||
|
{
|
||||||
|
Orient = PageOrientationValues.Portrait
|
||||||
|
};
|
||||||
|
properties.AppendChild(pageSize);
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
||||||
|
{
|
||||||
|
if (paragraphProperties == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var properties = new ParagraphProperties();
|
||||||
|
|
||||||
|
properties.AppendChild(new Justification()
|
||||||
|
{
|
||||||
|
Val = GetJustificationValues(paragraphProperties.JustificationType)
|
||||||
|
});
|
||||||
|
|
||||||
|
properties.AppendChild(new SpacingBetweenLines
|
||||||
|
{
|
||||||
|
LineRule = LineSpacingRuleValues.Auto
|
||||||
|
});
|
||||||
|
|
||||||
|
properties.AppendChild(new Indentation());
|
||||||
|
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
||||||
|
{
|
||||||
|
paragraphMarkRunProperties.AppendChild(new FontSize
|
||||||
|
{
|
||||||
|
Val = paragraphProperties.Size
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
properties.AppendChild(paragraphMarkRunProperties);
|
||||||
|
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateParagraph(WordParagraph paragraph)
|
||||||
|
{
|
||||||
|
if (_docBody == null || paragraph == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var docParagraph = new Paragraph();
|
||||||
|
|
||||||
|
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
||||||
|
|
||||||
|
foreach (var run in paragraph.Texts)
|
||||||
|
{
|
||||||
|
var docRun = new Run();
|
||||||
|
var properties = new RunProperties();
|
||||||
|
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
||||||
|
|
||||||
|
if (run.Item2.Bold)
|
||||||
|
{
|
||||||
|
properties.AppendChild(new Bold());
|
||||||
|
}
|
||||||
|
|
||||||
|
docRun.AppendChild(properties);
|
||||||
|
|
||||||
|
docRun.AppendChild(new Text
|
||||||
|
{
|
||||||
|
Text = run.Item1,
|
||||||
|
Space = SpaceProcessingModeValues.Preserve
|
||||||
|
});
|
||||||
|
|
||||||
|
docParagraph.AppendChild(docRun);
|
||||||
|
}
|
||||||
|
_docBody.AppendChild(docParagraph);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateWord(WordInfoGuarantor info)
|
||||||
|
{
|
||||||
|
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
|
||||||
|
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
||||||
|
mainPart.Document = new Document();
|
||||||
|
_docBody = mainPart.Document.AppendChild(new Body());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void SaveWord(WordInfoGuarantor info)
|
||||||
|
{
|
||||||
|
if (_docBody == null || _wordDocument == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_docBody.AppendChild(CreateSectionProperties());
|
||||||
|
_wordDocument.MainDocumentPart!.Document.Save();
|
||||||
|
_wordDocument.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ namespace LawCompanyContracts.BindingModels
|
|||||||
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 int CaseId { get; set; }
|
public int? CaseId { get; set; }
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
@ -13,5 +13,5 @@ namespace LawCompanyContracts.BindingModels
|
|||||||
public DateTime? DateTo { get; set; }
|
public DateTime? DateTo { get; set; }
|
||||||
public List<int>? Ids { get; set; }
|
public List<int>? Ids { get; set; }
|
||||||
public int ExecutorId { get; set; }
|
public int ExecutorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ namespace LawCompanyContracts.BindingModels
|
|||||||
public class ReportGuarantorBindingModel
|
public class ReportGuarantorBindingModel
|
||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string HearingName { get; set; } = string.Empty;
|
|
||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
public DateTime? DateTo { get; set; }
|
public DateTime? DateTo { get; set; }
|
||||||
public List<int>? Ids { get; set; }
|
public List<int>? Ids { get; set; }
|
||||||
|
@ -11,7 +11,7 @@ namespace LawCompanyContracts.BusinessLogicContracts
|
|||||||
public interface IReportExecutorLogic
|
public interface IReportExecutorLogic
|
||||||
{
|
{
|
||||||
List<ReportClientHearingViewModel> GetClientHearing(List<int> Ids);
|
List<ReportClientHearingViewModel> GetClientHearing(List<int> Ids);
|
||||||
List<ReportClientsViewModel> GetClients(ReportExecutorBindingModel model);
|
List<ReportClientsViewModel> GetClients(ReportExecutorBindingModel model);
|
||||||
void SaveClientHearingToWordFile(ReportExecutorBindingModel model);
|
void SaveClientHearingToWordFile(ReportExecutorBindingModel model);
|
||||||
void SaveClientHearingToExcelFile(ReportExecutorBindingModel model);
|
void SaveClientHearingToExcelFile(ReportExecutorBindingModel model);
|
||||||
void SaveClientsToPdfFile(ReportExecutorBindingModel model);
|
void SaveClientsToPdfFile(ReportExecutorBindingModel model);
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
namespace LawCompanyContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ClientVisitCountViewModel
|
||||||
|
{
|
||||||
|
public string FIO { get; set; } = string.Empty;
|
||||||
|
public int VisitCount { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
using LawCompanyDataModels.Models;
|
using LawCompanyDataModels.Models;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace LawCompanyContracts.ViewModels
|
namespace LawCompanyContracts.ViewModels
|
||||||
{
|
{
|
||||||
@ -11,11 +12,17 @@ namespace LawCompanyContracts.ViewModels
|
|||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
[DisplayName("Дата консультации")]
|
[DisplayName("Дата консультации")]
|
||||||
public DateTime ConsultationDate { get; set; }
|
public DateTime ConsultationDate { get; set; }
|
||||||
[DisplayName("Дело")]
|
public int? CaseId { get; set; }
|
||||||
public string CaseName { get; set; } = string.Empty;
|
|
||||||
public int CaseId { get; set; }
|
|
||||||
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();
|
||||||
public CaseViewModel Case { get; set; }
|
public CaseViewModel Case { get; set; }
|
||||||
}
|
|
||||||
|
public ConsultationViewModel() { }
|
||||||
|
|
||||||
|
[JsonConstructor]
|
||||||
|
public ConsultationViewModel(Dictionary<int, LawyerViewModel> ConsultationLawyers)
|
||||||
|
{
|
||||||
|
this.ConsultationLawyers = ConsultationLawyers.ToDictionary(x => x.Key, x => x.Value as ILawyerModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
namespace LawCompanyContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class LawyerHearingCountViewModel
|
||||||
|
{
|
||||||
|
public string FIO { get; set; } = string.Empty;
|
||||||
|
public int HearingCount { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace LawCompanyContracts.ViewModels
|
|
||||||
{
|
|
||||||
internal class ReportClientCaseViewModel
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,15 +7,10 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace LawCompanyContracts.ViewModels
|
namespace LawCompanyContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class ReportClientsViewModel
|
public class ReportClientsViewModel
|
||||||
{
|
{
|
||||||
// клиент
|
public string FIO { get; set; } = string.Empty;
|
||||||
public string FIO { get; set; } = string.Empty;
|
public List<string> CaseName { get; set; } = new List<string>();
|
||||||
// дело
|
public List<DateTime> VisitDate { get; set; } = new List<DateTime>();
|
||||||
public string Name { get; set; } = string.Empty;
|
}
|
||||||
public CaseStatus Status { get; set; } = CaseStatus.Неизвестен;
|
|
||||||
// консультация
|
|
||||||
public DateTime ConsultationDate { get; set; }
|
|
||||||
public double Cost { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,12 +1,8 @@
|
|||||||
using System;
|
namespace LawCompanyContracts.ViewModels
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace LawCompanyContracts.ViewModels
|
|
||||||
{
|
{
|
||||||
public class ReportLawyerHearingViewModel
|
public class ReportLawyerHearingViewModel
|
||||||
{
|
{
|
||||||
|
public string FIO { get; set; } = string.Empty;
|
||||||
|
public List<Tuple<string, DateTime>> Visits { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using LawCompanyDataModels.Enums;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -8,5 +9,8 @@ namespace LawCompanyContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class ReportLawyersViewModel
|
public class ReportLawyersViewModel
|
||||||
{
|
{
|
||||||
}
|
public string FIO { get; set; } = string.Empty;
|
||||||
|
public List<(DateTime ConsultationDate, double Price)> Consultation { get; set; } = new();
|
||||||
|
public List<(DateTime HearingDate, string Judge)> Hearing { get; set; } = new();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ namespace LawCompanyDataModels.Models
|
|||||||
Dictionary<int, ILawyerModel> ConsultationLawyers { get; }
|
Dictionary<int, ILawyerModel> ConsultationLawyers { get; }
|
||||||
double Cost { get; }
|
double Cost { get; }
|
||||||
DateTime ConsultationDate { get; }
|
DateTime ConsultationDate { get; }
|
||||||
public int CaseId { get; }
|
public int? CaseId { get; }
|
||||||
public int GuarantorId { get; }
|
public int GuarantorId { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,16 +9,17 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
public class CaseStorage : ICaseStorage
|
public class CaseStorage : ICaseStorage
|
||||||
{
|
{
|
||||||
public List<CaseViewModel> GetFullList()
|
public List<CaseViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
return context.Cases.Include(x => x.CaseClients)
|
return context.Cases
|
||||||
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
public List<CaseViewModel> GetFilteredList(CaseSearchModel model)
|
|
||||||
|
public List<CaseViewModel> GetFilteredList(CaseSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue
|
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue
|
||||||
&& !model.ExecutorId.HasValue)
|
&& !model.ExecutorId.HasValue)
|
||||||
|
@ -9,9 +9,9 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
public class ConsultationStorage : IConsultationStorage
|
public class ConsultationStorage : IConsultationStorage
|
||||||
{
|
{
|
||||||
public List<ConsultationViewModel> GetFullList()
|
public List<ConsultationViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
return context.Consultations
|
return context.Consultations
|
||||||
.Include(x => x.Lawyers)
|
.Include(x => x.Lawyers)
|
||||||
.ThenInclude(x => x.Lawyer)
|
.ThenInclude(x => x.Lawyer)
|
||||||
@ -19,26 +19,13 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
public List<ConsultationViewModel> GetFilteredList(ConsultationSearchModel model)
|
public List<ConsultationViewModel> GetFilteredList(ConsultationSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue
|
if (!model.Id.HasValue && !model.GuarantorId.HasValue)
|
||||||
&& !model.ConsultationDate.HasValue && !model.CaseId.HasValue)
|
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
if (model.GuarantorId.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
if (model.GuarantorId.HasValue)
|
||||||
{
|
|
||||||
using var context = new LawCompanyDatabase();
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
else if (model.GuarantorId.HasValue)
|
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
return context.Consultations
|
return context.Consultations
|
||||||
@ -48,91 +35,76 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
else if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
|
||||||
{
|
|
||||||
using var context = new LawCompanyDatabase();
|
|
||||||
return context.Consultations
|
|
||||||
.Include(x => x.Lawyers)
|
|
||||||
.ThenInclude(x => x.Lawyer)
|
|
||||||
.Where(x => x.Id == model.Id)
|
|
||||||
.ToList()
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
return context.Consultations
|
return context.Consultations
|
||||||
.Include(x => x.Lawyers)
|
.Include(x => x.Lawyers)
|
||||||
.ThenInclude(x => x.Lawyer)
|
.ThenInclude(x => x.Lawyer)
|
||||||
.Where(x => x.ConsultationDate >= model.DateFrom && x.ConsultationDate <= model.DateTo)
|
.Where(x => x.Id == model.Id)
|
||||||
.ToList()
|
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public ConsultationViewModel? GetElement(ConsultationSearchModel model)
|
public ConsultationViewModel? GetElement(ConsultationSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue && !model.ConsultationDate.HasValue)
|
if (!model.Id.HasValue)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
return context.Consultations.
|
return context.Consultations
|
||||||
Include(x => x.Lawyers).
|
.Include(x => x.Lawyers)
|
||||||
ThenInclude(x => x.Lawyer)
|
.ThenInclude(x => x.Lawyer)
|
||||||
.FirstOrDefault(x => (model.GuarantorId.HasValue && x.GuarantorId == model.GuarantorId)
|
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?
|
||||||
|| (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
.GetViewModel;
|
||||||
}
|
}
|
||||||
public ConsultationViewModel? Insert(ConsultationBindingModel model)
|
public ConsultationViewModel? Insert(ConsultationBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
var newConsultation = Consultation.Create(context, model);
|
var newConsult = Consultation.Create(context, model);
|
||||||
if (newConsultation == null)
|
if (newConsult == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
context.Consultations.Add(newConsultation);
|
context.Consultations.Add(newConsult);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return newConsultation.GetViewModel;
|
return newConsult.GetViewModel;
|
||||||
}
|
}
|
||||||
public ConsultationViewModel? Update(ConsultationBindingModel model)
|
public ConsultationViewModel? Update(ConsultationBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
using var transaction = context.Database.BeginTransaction();
|
using var transaction = context.Database.BeginTransaction();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var consultation = context.Consultations.FirstOrDefault(rec =>
|
var consult = context.Consultations.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
rec.Id == model.Id);
|
if (consult == null)
|
||||||
if (consultation == null)
|
{
|
||||||
{
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
consult.Update(model);
|
||||||
consultation.Update(model);
|
context.SaveChanges();
|
||||||
context.SaveChanges();
|
consult.UpdateLawyers(context, model);
|
||||||
consultation.UpdateLawyers(context, model);
|
transaction.Commit();
|
||||||
transaction.Commit();
|
return consult.GetViewModel;
|
||||||
return consultation.GetViewModel;
|
}
|
||||||
}
|
catch
|
||||||
catch
|
{
|
||||||
{
|
throw;
|
||||||
transaction.Rollback();
|
}
|
||||||
throw;
|
}
|
||||||
}
|
public ConsultationViewModel? Delete(ConsultationBindingModel model)
|
||||||
}
|
{
|
||||||
public ConsultationViewModel? Delete(ConsultationBindingModel model)
|
using var context = new LawCompanyDatabase();
|
||||||
{
|
var element = context.Consultations.Include(x => x.Lawyers).FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
using var context = new LawCompanyDatabase();
|
if (element != null)
|
||||||
var element = context.Consultations
|
{
|
||||||
.Include(x => x.Lawyers)
|
context.Consultations.Remove(element);
|
||||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
context.SaveChanges();
|
||||||
if (element != null)
|
return element.GetViewModel;
|
||||||
{
|
}
|
||||||
context.Consultations.Remove(element);
|
return null;
|
||||||
context.SaveChanges();
|
}
|
||||||
return element.GetViewModel;
|
}
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -100,30 +100,31 @@ namespace LawCompanyDatabaseImplement.Implements
|
|||||||
using var transaction = context.Database.BeginTransaction();
|
using var transaction = context.Database.BeginTransaction();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var _case = context.Hearings.FirstOrDefault(rec =>
|
var _case = context.Hearings.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
rec.Id == model.Id);
|
|
||||||
if (_case == null)
|
if (_case == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_case.Update(model);
|
_case.Update(model);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
_case.UpdateLawyers(context, model);
|
if (model.HearingLawyers != null)
|
||||||
|
{
|
||||||
|
_case.UpdateLawyers(context, model);
|
||||||
|
}
|
||||||
|
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
return _case.GetViewModel;
|
return _case.GetViewModel;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
throw;
|
transaction.Rollback();
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public HearingViewModel? Delete(HearingBindingModel model)
|
public HearingViewModel? Delete(HearingBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
using var context = new LawCompanyDatabase();
|
||||||
var element = context.Hearings
|
var element = context.Hearings.Include(x => x.Lawyers).FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
.Include(x => x.Lawyers)
|
|
||||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
context.Hearings.Remove(element);
|
context.Hearings.Remove(element);
|
||||||
|
@ -39,7 +39,8 @@ 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.ExecutorId == model.ExecutorId)
|
.Where(x => x.ExecutorId == model.ExecutorId)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -1,545 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using LawCompanyDatabaseImplement;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace LawCompanyDatabaseImplement.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(LawCompanyDatabase))]
|
|
||||||
[Migration("20240502102425_InitialCreate")]
|
|
||||||
partial class InitialCreate
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "7.0.17")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Case", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("CaseType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("DateImplement")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("ExecutorId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ExecutorId");
|
|
||||||
|
|
||||||
b.ToTable("Cases");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.CaseClient", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("CaseId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("ClientId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("CaseId");
|
|
||||||
|
|
||||||
b.HasIndex("ClientId");
|
|
||||||
|
|
||||||
b.ToTable("CaseClients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("ExecutorId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("FIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Phone")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ExecutorId");
|
|
||||||
|
|
||||||
b.ToTable("Clients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("CaseId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("ConsultationDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<double>("Cost")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<int>("GuarantorId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("CaseId");
|
|
||||||
|
|
||||||
b.HasIndex("GuarantorId");
|
|
||||||
|
|
||||||
b.ToTable("Consultations");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.ConsultationLawyer", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("ConsultationId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("LawyerId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ConsultationId");
|
|
||||||
|
|
||||||
b.HasIndex("LawyerId");
|
|
||||||
|
|
||||||
b.ToTable("ConsultationLawyers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Executor", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("FIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Executors");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Guarantor", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("FIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Guarantors");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Hearing", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("GuarantorId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("HearingDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("Judge")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("GuarantorId");
|
|
||||||
|
|
||||||
b.ToTable("Hearings");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.HearingLawyer", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("HearingId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("LawyerId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("HearingId");
|
|
||||||
|
|
||||||
b.HasIndex("LawyerId");
|
|
||||||
|
|
||||||
b.ToTable("HearingLawyers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Lawyer", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("FIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("GuarantorId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Phone")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("GuarantorId");
|
|
||||||
|
|
||||||
b.ToTable("Lawyers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Visit", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("ExecutorId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("HearingId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("VisitDate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ExecutorId");
|
|
||||||
|
|
||||||
b.HasIndex("HearingId");
|
|
||||||
|
|
||||||
b.ToTable("Visits");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.VisitClient", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("ClientId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("VisitId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ClientId");
|
|
||||||
|
|
||||||
b.HasIndex("VisitId");
|
|
||||||
|
|
||||||
b.ToTable("VisitClients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Case", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", null)
|
|
||||||
.WithMany("Cases")
|
|
||||||
.HasForeignKey("ExecutorId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.CaseClient", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Case", "Case")
|
|
||||||
.WithMany("Clients")
|
|
||||||
.HasForeignKey("CaseId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Client", "Client")
|
|
||||||
.WithMany("CaseClients")
|
|
||||||
.HasForeignKey("ClientId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Case");
|
|
||||||
|
|
||||||
b.Navigation("Client");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", null)
|
|
||||||
.WithMany("Clients")
|
|
||||||
.HasForeignKey("ExecutorId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Case", "Case")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CaseId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
|
||||||
.WithMany("Consultations")
|
|
||||||
.HasForeignKey("GuarantorId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Case");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.ConsultationLawyer", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Consultation", "Consultation")
|
|
||||||
.WithMany("Lawyers")
|
|
||||||
.HasForeignKey("ConsultationId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Lawyer", "Lawyer")
|
|
||||||
.WithMany("ConsultationLawyers")
|
|
||||||
.HasForeignKey("LawyerId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Consultation");
|
|
||||||
|
|
||||||
b.Navigation("Lawyer");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Hearing", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
|
||||||
.WithMany("Hearings")
|
|
||||||
.HasForeignKey("GuarantorId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.HearingLawyer", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Hearing", "Hearing")
|
|
||||||
.WithMany("Lawyers")
|
|
||||||
.HasForeignKey("HearingId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Lawyer", "Lawyer")
|
|
||||||
.WithMany("HearingLawyers")
|
|
||||||
.HasForeignKey("LawyerId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Hearing");
|
|
||||||
|
|
||||||
b.Navigation("Lawyer");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Lawyer", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
|
||||||
.WithMany("Lawyers")
|
|
||||||
.HasForeignKey("GuarantorId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Visit", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", null)
|
|
||||||
.WithMany("Visits")
|
|
||||||
.HasForeignKey("ExecutorId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Hearing", "Hearing")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("HearingId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Hearing");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.VisitClient", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Client", "Client")
|
|
||||||
.WithMany("ClientVisits")
|
|
||||||
.HasForeignKey("ClientId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Visit", "Visit")
|
|
||||||
.WithMany("Clients")
|
|
||||||
.HasForeignKey("VisitId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Client");
|
|
||||||
|
|
||||||
b.Navigation("Visit");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Case", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Clients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("CaseClients");
|
|
||||||
|
|
||||||
b.Navigation("ClientVisits");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Lawyers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Executor", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Cases");
|
|
||||||
|
|
||||||
b.Navigation("Clients");
|
|
||||||
|
|
||||||
b.Navigation("Visits");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Guarantor", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Consultations");
|
|
||||||
|
|
||||||
b.Navigation("Hearings");
|
|
||||||
|
|
||||||
b.Navigation("Lawyers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Hearing", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Lawyers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Lawyer", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("ConsultationLawyers");
|
|
||||||
|
|
||||||
b.Navigation("HearingLawyers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Visit", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Clients");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,413 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace LawCompanyDatabaseImplement.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class InitialCreate : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Executors",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Executors", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Guarantors",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Guarantors", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Cases",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
CaseType = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
||||||
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
||||||
Status = table.Column<int>(type: "int", nullable: false),
|
|
||||||
ExecutorId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Cases", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Cases_Executors_ExecutorId",
|
|
||||||
column: x => x.ExecutorId,
|
|
||||||
principalTable: "Executors",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Clients",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
ExecutorId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Clients", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Clients_Executors_ExecutorId",
|
|
||||||
column: x => x.ExecutorId,
|
|
||||||
principalTable: "Executors",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Hearings",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
HearingDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
||||||
Judge = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
GuarantorId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Hearings", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Hearings_Guarantors_GuarantorId",
|
|
||||||
column: x => x.GuarantorId,
|
|
||||||
principalTable: "Guarantors",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Lawyers",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
GuarantorId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Lawyers", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Lawyers_Guarantors_GuarantorId",
|
|
||||||
column: x => x.GuarantorId,
|
|
||||||
principalTable: "Guarantors",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Consultations",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
Cost = table.Column<double>(type: "float", nullable: false),
|
|
||||||
ConsultationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
||||||
CaseId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
GuarantorId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Consultations", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Consultations_Cases_CaseId",
|
|
||||||
column: x => x.CaseId,
|
|
||||||
principalTable: "Cases",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Consultations_Guarantors_GuarantorId",
|
|
||||||
column: x => x.GuarantorId,
|
|
||||||
principalTable: "Guarantors",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "CaseClients",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
CaseId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
ClientId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_CaseClients", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_CaseClients_Cases_CaseId",
|
|
||||||
column: x => x.CaseId,
|
|
||||||
principalTable: "Cases",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_CaseClients_Clients_ClientId",
|
|
||||||
column: x => x.ClientId,
|
|
||||||
principalTable: "Clients",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.NoAction);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Visits",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
VisitDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
||||||
HearingId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
ExecutorId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Visits", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Visits_Executors_ExecutorId",
|
|
||||||
column: x => x.ExecutorId,
|
|
||||||
principalTable: "Executors",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Visits_Hearings_HearingId",
|
|
||||||
column: x => x.HearingId,
|
|
||||||
principalTable: "Hearings",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "HearingLawyers",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
HearingId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
LawyerId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_HearingLawyers", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_HearingLawyers_Hearings_HearingId",
|
|
||||||
column: x => x.HearingId,
|
|
||||||
principalTable: "Hearings",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_HearingLawyers_Lawyers_LawyerId",
|
|
||||||
column: x => x.LawyerId,
|
|
||||||
principalTable: "Lawyers",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.NoAction);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "ConsultationLawyers",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
ConsultationId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
LawyerId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_ConsultationLawyers", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_ConsultationLawyers_Consultations_ConsultationId",
|
|
||||||
column: x => x.ConsultationId,
|
|
||||||
principalTable: "Consultations",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_ConsultationLawyers_Lawyers_LawyerId",
|
|
||||||
column: x => x.LawyerId,
|
|
||||||
principalTable: "Lawyers",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.NoAction);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "VisitClients",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
VisitId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_VisitClients", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_VisitClients_Clients_ClientId",
|
|
||||||
column: x => x.ClientId,
|
|
||||||
principalTable: "Clients",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_VisitClients_Visits_VisitId",
|
|
||||||
column: x => x.VisitId,
|
|
||||||
principalTable: "Visits",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.NoAction);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_CaseClients_CaseId",
|
|
||||||
table: "CaseClients",
|
|
||||||
column: "CaseId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_CaseClients_ClientId",
|
|
||||||
table: "CaseClients",
|
|
||||||
column: "ClientId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Cases_ExecutorId",
|
|
||||||
table: "Cases",
|
|
||||||
column: "ExecutorId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Clients_ExecutorId",
|
|
||||||
table: "Clients",
|
|
||||||
column: "ExecutorId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_ConsultationLawyers_ConsultationId",
|
|
||||||
table: "ConsultationLawyers",
|
|
||||||
column: "ConsultationId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_ConsultationLawyers_LawyerId",
|
|
||||||
table: "ConsultationLawyers",
|
|
||||||
column: "LawyerId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Consultations_CaseId",
|
|
||||||
table: "Consultations",
|
|
||||||
column: "CaseId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Consultations_GuarantorId",
|
|
||||||
table: "Consultations",
|
|
||||||
column: "GuarantorId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_HearingLawyers_HearingId",
|
|
||||||
table: "HearingLawyers",
|
|
||||||
column: "HearingId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_HearingLawyers_LawyerId",
|
|
||||||
table: "HearingLawyers",
|
|
||||||
column: "LawyerId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Hearings_GuarantorId",
|
|
||||||
table: "Hearings",
|
|
||||||
column: "GuarantorId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Lawyers_GuarantorId",
|
|
||||||
table: "Lawyers",
|
|
||||||
column: "GuarantorId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_VisitClients_ClientId",
|
|
||||||
table: "VisitClients",
|
|
||||||
column: "ClientId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_VisitClients_VisitId",
|
|
||||||
table: "VisitClients",
|
|
||||||
column: "VisitId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Visits_ExecutorId",
|
|
||||||
table: "Visits",
|
|
||||||
column: "ExecutorId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Visits_HearingId",
|
|
||||||
table: "Visits",
|
|
||||||
column: "HearingId");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "CaseClients");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "ConsultationLawyers");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "HearingLawyers");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "VisitClients");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Consultations");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Lawyers");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Clients");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Visits");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Cases");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Hearings");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Executors");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Guarantors");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace LawCompanyDatabaseImplement.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class InitialCreate2 : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Lawyers_Guarantors_GuarantorId",
|
|
||||||
table: "Lawyers");
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "GuarantorId",
|
|
||||||
table: "Lawyers",
|
|
||||||
type: "int",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "int");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Lawyers_Guarantors_GuarantorId",
|
|
||||||
table: "Lawyers",
|
|
||||||
column: "GuarantorId",
|
|
||||||
principalTable: "Guarantors",
|
|
||||||
principalColumn: "Id");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Lawyers_Guarantors_GuarantorId",
|
|
||||||
table: "Lawyers");
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "GuarantorId",
|
|
||||||
table: "Lawyers",
|
|
||||||
type: "int",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "int",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Lawyers_Guarantors_GuarantorId",
|
|
||||||
table: "Lawyers",
|
|
||||||
column: "GuarantorId",
|
|
||||||
principalTable: "Guarantors",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace LawCompanyDatabaseImplement.Migrations
|
namespace LawCompanyDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(LawCompanyDatabase))]
|
[DbContext(typeof(LawCompanyDatabase))]
|
||||||
[Migration("20240526230637_InitialCreate3")]
|
[Migration("20240526230043_test")]
|
||||||
partial class InitialCreate3
|
partial class test
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -117,7 +117,8 @@ namespace LawCompanyDatabaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("CaseId")
|
b.Property<int?>("CaseId")
|
||||||
|
.IsRequired()
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<DateTime>("ConsultationDate")
|
b.Property<DateTime>("ConsultationDate")
|
@ -0,0 +1,410 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace LawCompanyDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class test : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Executors",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Executors", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Guarantors",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Guarantors", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Cases",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
Status = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ExecutorId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Cases", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Cases_Executors_ExecutorId",
|
||||||
|
column: x => x.ExecutorId,
|
||||||
|
principalTable: "Executors",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Clients",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
ExecutorId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Clients", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Clients_Executors_ExecutorId",
|
||||||
|
column: x => x.ExecutorId,
|
||||||
|
principalTable: "Executors",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Hearings",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
HearingDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
Judge = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
GuarantorId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Hearings", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Hearings_Guarantors_GuarantorId",
|
||||||
|
column: x => x.GuarantorId,
|
||||||
|
principalTable: "Guarantors",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Lawyers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
GuarantorId = table.Column<int>(type: "int", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Lawyers", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Lawyers_Guarantors_GuarantorId",
|
||||||
|
column: x => x.GuarantorId,
|
||||||
|
principalTable: "Guarantors",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Consultations",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
Cost = table.Column<double>(type: "float", nullable: false),
|
||||||
|
ConsultationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
CaseId = table.Column<int>(type: "int", nullable: true),
|
||||||
|
GuarantorId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Consultations", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Consultations_Cases_CaseId",
|
||||||
|
column: x => x.CaseId,
|
||||||
|
principalTable: "Cases",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Consultations_Guarantors_GuarantorId",
|
||||||
|
column: x => x.GuarantorId,
|
||||||
|
principalTable: "Guarantors",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "CaseClients",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
CaseId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ClientId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_CaseClients", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CaseClients_Cases_CaseId",
|
||||||
|
column: x => x.CaseId,
|
||||||
|
principalTable: "Cases",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CaseClients_Clients_ClientId",
|
||||||
|
column: x => x.ClientId,
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Visits",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
VisitDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
HearingId = table.Column<int>(type: "int", nullable: true),
|
||||||
|
ExecutorId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Visits", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Visits_Executors_ExecutorId",
|
||||||
|
column: x => x.ExecutorId,
|
||||||
|
principalTable: "Executors",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Visits_Hearings_HearingId",
|
||||||
|
column: x => x.HearingId,
|
||||||
|
principalTable: "Hearings",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "HearingLawyers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
HearingId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
LawyerId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_HearingLawyers", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_HearingLawyers_Hearings_HearingId",
|
||||||
|
column: x => x.HearingId,
|
||||||
|
principalTable: "Hearings",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_HearingLawyers_Lawyers_LawyerId",
|
||||||
|
column: x => x.LawyerId,
|
||||||
|
principalTable: "Lawyers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ConsultationLawyers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ConsultationId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
LawyerId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ConsultationLawyers", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ConsultationLawyers_Consultations_ConsultationId",
|
||||||
|
column: x => x.ConsultationId,
|
||||||
|
principalTable: "Consultations",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ConsultationLawyers_Lawyers_LawyerId",
|
||||||
|
column: x => x.LawyerId,
|
||||||
|
principalTable: "Lawyers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "VisitClients",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
VisitId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_VisitClients", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_VisitClients_Clients_ClientId",
|
||||||
|
column: x => x.ClientId,
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_VisitClients_Visits_VisitId",
|
||||||
|
column: x => x.VisitId,
|
||||||
|
principalTable: "Visits",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CaseClients_CaseId",
|
||||||
|
table: "CaseClients",
|
||||||
|
column: "CaseId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CaseClients_ClientId",
|
||||||
|
table: "CaseClients",
|
||||||
|
column: "ClientId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Cases_ExecutorId",
|
||||||
|
table: "Cases",
|
||||||
|
column: "ExecutorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Clients_ExecutorId",
|
||||||
|
table: "Clients",
|
||||||
|
column: "ExecutorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ConsultationLawyers_ConsultationId",
|
||||||
|
table: "ConsultationLawyers",
|
||||||
|
column: "ConsultationId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ConsultationLawyers_LawyerId",
|
||||||
|
table: "ConsultationLawyers",
|
||||||
|
column: "LawyerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Consultations_CaseId",
|
||||||
|
table: "Consultations",
|
||||||
|
column: "CaseId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Consultations_GuarantorId",
|
||||||
|
table: "Consultations",
|
||||||
|
column: "GuarantorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_HearingLawyers_HearingId",
|
||||||
|
table: "HearingLawyers",
|
||||||
|
column: "HearingId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_HearingLawyers_LawyerId",
|
||||||
|
table: "HearingLawyers",
|
||||||
|
column: "LawyerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Hearings_GuarantorId",
|
||||||
|
table: "Hearings",
|
||||||
|
column: "GuarantorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Lawyers_GuarantorId",
|
||||||
|
table: "Lawyers",
|
||||||
|
column: "GuarantorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_VisitClients_ClientId",
|
||||||
|
table: "VisitClients",
|
||||||
|
column: "ClientId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_VisitClients_VisitId",
|
||||||
|
table: "VisitClients",
|
||||||
|
column: "VisitId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Visits_ExecutorId",
|
||||||
|
table: "Visits",
|
||||||
|
column: "ExecutorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Visits_HearingId",
|
||||||
|
table: "Visits",
|
||||||
|
column: "HearingId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "CaseClients");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ConsultationLawyers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "HearingLawyers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "VisitClients");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Consultations");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Lawyers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Clients");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Visits");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Cases");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Hearings");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Executors");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Guarantors");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,70 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace LawCompanyDatabaseImplement.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class InitialCreate3 : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Visits_Hearings_HearingId",
|
|
||||||
table: "Visits");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "CaseType",
|
|
||||||
table: "Cases");
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "HearingId",
|
|
||||||
table: "Visits",
|
|
||||||
type: "int",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "int");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Visits_Hearings_HearingId",
|
|
||||||
table: "Visits",
|
|
||||||
column: "HearingId",
|
|
||||||
principalTable: "Hearings",
|
|
||||||
principalColumn: "Id");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Visits_Hearings_HearingId",
|
|
||||||
table: "Visits");
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "HearingId",
|
|
||||||
table: "Visits",
|
|
||||||
type: "int",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "int",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "CaseType",
|
|
||||||
table: "Cases",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: "");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Visits_Hearings_HearingId",
|
|
||||||
table: "Visits",
|
|
||||||
column: "HearingId",
|
|
||||||
principalTable: "Hearings",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace LawCompanyDatabaseImplement.Migrations
|
namespace LawCompanyDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(LawCompanyDatabase))]
|
[DbContext(typeof(LawCompanyDatabase))]
|
||||||
[Migration("20240503003222_InitialCreate2")]
|
[Migration("20240811194245_InitialCreate")]
|
||||||
partial class InitialCreate2
|
partial class InitialCreate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -33,10 +33,6 @@ namespace LawCompanyDatabaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<string>("CaseType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
b.Property<DateTime>("DateCreate")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
@ -121,7 +117,7 @@ namespace LawCompanyDatabaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("CaseId")
|
b.Property<int?>("CaseId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<DateTime>("ConsultationDate")
|
b.Property<DateTime>("ConsultationDate")
|
||||||
@ -304,7 +300,7 @@ namespace LawCompanyDatabaseImplement.Migrations
|
|||||||
b.Property<int>("ExecutorId")
|
b.Property<int>("ExecutorId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("HearingId")
|
b.Property<int?>("HearingId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<DateTime>("VisitDate")
|
b.Property<DateTime>("VisitDate")
|
||||||
@ -372,20 +368,20 @@ namespace LawCompanyDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Client", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", null)
|
b.HasOne("LawCompanyDatabaseImplement.Models.Executor", "Executor")
|
||||||
.WithMany("Clients")
|
.WithMany("Clients")
|
||||||
.HasForeignKey("ExecutorId")
|
.HasForeignKey("ExecutorId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Executor");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
modelBuilder.Entity("LawCompanyDatabaseImplement.Models.Consultation", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Case", "Case")
|
b.HasOne("LawCompanyDatabaseImplement.Models.Case", "Case")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CaseId")
|
.HasForeignKey("CaseId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
||||||
.WithMany("Consultations")
|
.WithMany("Consultations")
|
||||||
@ -460,9 +456,7 @@ namespace LawCompanyDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Hearing", "Hearing")
|
b.HasOne("LawCompanyDatabaseImplement.Models.Hearing", "Hearing")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("HearingId")
|
.HasForeignKey("HearingId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Hearing");
|
b.Navigation("Hearing");
|
||||||
});
|
});
|
@ -0,0 +1,409 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace LawCompanyDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class InitialCreate : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Executors",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Executors", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Guarantors",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Guarantors", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Cases",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
Status = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ExecutorId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Cases", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Cases_Executors_ExecutorId",
|
||||||
|
column: x => x.ExecutorId,
|
||||||
|
principalTable: "Executors",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Clients",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
ExecutorId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Clients", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Clients_Executors_ExecutorId",
|
||||||
|
column: x => x.ExecutorId,
|
||||||
|
principalTable: "Executors",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Hearings",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
HearingDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
Judge = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
GuarantorId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Hearings", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Hearings_Guarantors_GuarantorId",
|
||||||
|
column: x => x.GuarantorId,
|
||||||
|
principalTable: "Guarantors",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Lawyers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
GuarantorId = table.Column<int>(type: "int", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Lawyers", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Lawyers_Guarantors_GuarantorId",
|
||||||
|
column: x => x.GuarantorId,
|
||||||
|
principalTable: "Guarantors",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Consultations",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
Cost = table.Column<double>(type: "float", nullable: false),
|
||||||
|
ConsultationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
CaseId = table.Column<int>(type: "int", nullable: true),
|
||||||
|
GuarantorId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Consultations", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Consultations_Cases_CaseId",
|
||||||
|
column: x => x.CaseId,
|
||||||
|
principalTable: "Cases",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Consultations_Guarantors_GuarantorId",
|
||||||
|
column: x => x.GuarantorId,
|
||||||
|
principalTable: "Guarantors",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "CaseClients",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
CaseId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ClientId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_CaseClients", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CaseClients_Cases_CaseId",
|
||||||
|
column: x => x.CaseId,
|
||||||
|
principalTable: "Cases",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CaseClients_Clients_ClientId",
|
||||||
|
column: x => x.ClientId,
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Visits",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
VisitDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
HearingId = table.Column<int>(type: "int", nullable: true),
|
||||||
|
ExecutorId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Visits", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Visits_Executors_ExecutorId",
|
||||||
|
column: x => x.ExecutorId,
|
||||||
|
principalTable: "Executors",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Visits_Hearings_HearingId",
|
||||||
|
column: x => x.HearingId,
|
||||||
|
principalTable: "Hearings",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "HearingLawyers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
HearingId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
LawyerId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_HearingLawyers", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_HearingLawyers_Hearings_HearingId",
|
||||||
|
column: x => x.HearingId,
|
||||||
|
principalTable: "Hearings",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_HearingLawyers_Lawyers_LawyerId",
|
||||||
|
column: x => x.LawyerId,
|
||||||
|
principalTable: "Lawyers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ConsultationLawyers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ConsultationId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
LawyerId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ConsultationLawyers", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ConsultationLawyers_Consultations_ConsultationId",
|
||||||
|
column: x => x.ConsultationId,
|
||||||
|
principalTable: "Consultations",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ConsultationLawyers_Lawyers_LawyerId",
|
||||||
|
column: x => x.LawyerId,
|
||||||
|
principalTable: "Lawyers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "VisitClients",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
VisitId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_VisitClients", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_VisitClients_Clients_ClientId",
|
||||||
|
column: x => x.ClientId,
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_VisitClients_Visits_VisitId",
|
||||||
|
column: x => x.VisitId,
|
||||||
|
principalTable: "Visits",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CaseClients_CaseId",
|
||||||
|
table: "CaseClients",
|
||||||
|
column: "CaseId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CaseClients_ClientId",
|
||||||
|
table: "CaseClients",
|
||||||
|
column: "ClientId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Cases_ExecutorId",
|
||||||
|
table: "Cases",
|
||||||
|
column: "ExecutorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Clients_ExecutorId",
|
||||||
|
table: "Clients",
|
||||||
|
column: "ExecutorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ConsultationLawyers_ConsultationId",
|
||||||
|
table: "ConsultationLawyers",
|
||||||
|
column: "ConsultationId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ConsultationLawyers_LawyerId",
|
||||||
|
table: "ConsultationLawyers",
|
||||||
|
column: "LawyerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Consultations_CaseId",
|
||||||
|
table: "Consultations",
|
||||||
|
column: "CaseId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Consultations_GuarantorId",
|
||||||
|
table: "Consultations",
|
||||||
|
column: "GuarantorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_HearingLawyers_HearingId",
|
||||||
|
table: "HearingLawyers",
|
||||||
|
column: "HearingId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_HearingLawyers_LawyerId",
|
||||||
|
table: "HearingLawyers",
|
||||||
|
column: "LawyerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Hearings_GuarantorId",
|
||||||
|
table: "Hearings",
|
||||||
|
column: "GuarantorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Lawyers_GuarantorId",
|
||||||
|
table: "Lawyers",
|
||||||
|
column: "GuarantorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_VisitClients_ClientId",
|
||||||
|
table: "VisitClients",
|
||||||
|
column: "ClientId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_VisitClients_VisitId",
|
||||||
|
table: "VisitClients",
|
||||||
|
column: "VisitId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Visits_ExecutorId",
|
||||||
|
table: "Visits",
|
||||||
|
column: "ExecutorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Visits_HearingId",
|
||||||
|
table: "Visits",
|
||||||
|
column: "HearingId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "CaseClients");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ConsultationLawyers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "HearingLawyers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "VisitClients");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Consultations");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Lawyers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Clients");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Visits");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Cases");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Hearings");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Executors");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Guarantors");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -114,7 +114,7 @@ namespace LawCompanyDatabaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("CaseId")
|
b.Property<int?>("CaseId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<DateTime>("ConsultationDate")
|
b.Property<DateTime>("ConsultationDate")
|
||||||
@ -378,9 +378,7 @@ namespace LawCompanyDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Case", "Case")
|
b.HasOne("LawCompanyDatabaseImplement.Models.Case", "Case")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CaseId")
|
.HasForeignKey("CaseId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
b.HasOne("LawCompanyDatabaseImplement.Models.Guarantor", null)
|
||||||
.WithMany("Consultations")
|
.WithMany("Consultations")
|
||||||
|
@ -106,5 +106,5 @@ namespace LawCompanyDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
_caseClients = null;
|
_caseClients = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,11 @@ namespace LawCompanyDatabaseImplement.Models
|
|||||||
public double Cost { get; private set; }
|
public double Cost { get; private set; }
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime ConsultationDate { get; private set; }
|
public DateTime ConsultationDate { get; private set; }
|
||||||
[Required]
|
public int? CaseId { get; private set; }
|
||||||
public int CaseId { get; private set; }
|
|
||||||
public Case Case { get; private set; }
|
public Case Case { get; private set; }
|
||||||
public int GuarantorId { get; set; }
|
public int GuarantorId { get; set; }
|
||||||
|
|
||||||
private Dictionary<int, ILawyerModel>? _consultationLawyers = null;
|
private Dictionary<int, ILawyerModel> _consultationLawyers = null;
|
||||||
[ForeignKey("ConsultationId")]
|
[ForeignKey("ConsultationId")]
|
||||||
public virtual List<ConsultationLawyer> Lawyers { get; set; } = new();
|
public virtual List<ConsultationLawyer> Lawyers { get; set; } = new();
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
@ -29,10 +28,7 @@ namespace LawCompanyDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
if (_consultationLawyers == null)
|
if (_consultationLawyers == null)
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
_consultationLawyers = Lawyers.ToDictionary(x => x.LawyerId, x => (x.Lawyer as ILawyerModel));
|
||||||
_consultationLawyers = Lawyers
|
|
||||||
.ToDictionary(x => x.LawyerId, x => (context.Lawyers
|
|
||||||
.FirstOrDefault(y => y.Id == x.LawyerId) as ILawyerModel));
|
|
||||||
}
|
}
|
||||||
return _consultationLawyers;
|
return _consultationLawyers;
|
||||||
}
|
}
|
||||||
@ -43,18 +39,12 @@ namespace LawCompanyDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var consultations = context.Consultations.Where(x => x.CaseId == model.CaseId).ToList();
|
|
||||||
if (consultations.Count > 0)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Consultation()
|
return new Consultation()
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
Cost = model.Cost,
|
Cost = model.Cost,
|
||||||
ConsultationDate = model.ConsultationDate,
|
ConsultationDate = model.ConsultationDate,
|
||||||
CaseId = model.CaseId,
|
CaseId = model.CaseId,
|
||||||
Case = context.Cases.First(x => x.Id == model.CaseId),
|
|
||||||
GuarantorId = model.GuarantorId,
|
GuarantorId = model.GuarantorId,
|
||||||
Lawyers = model.ConsultationLawyers.Select(x => new ConsultationLawyer
|
Lawyers = model.ConsultationLawyers.Select(x => new ConsultationLawyer
|
||||||
{
|
{
|
||||||
@ -81,34 +71,30 @@ namespace LawCompanyDatabaseImplement.Models
|
|||||||
Cost = Cost,
|
Cost = Cost,
|
||||||
ConsultationDate = ConsultationDate,
|
ConsultationDate = ConsultationDate,
|
||||||
CaseId = CaseId,
|
CaseId = CaseId,
|
||||||
GuarantorId = GuarantorId,
|
|
||||||
ConsultationLawyers = ConsultationLawyers
|
|
||||||
};
|
};
|
||||||
public void UpdateLawyers(LawCompanyDatabase context,
|
|
||||||
ConsultationBindingModel model)
|
public void UpdateLawyers(LawCompanyDatabase context, ConsultationBindingModel model)
|
||||||
{
|
{
|
||||||
var consultationLawyers = context.ConsultationLawyers
|
var consultationLawyers = context.ConsultationLawyers.Where(rec => rec.ConsultationId == model.Id).ToList();
|
||||||
.Where(rec => rec.ConsultationId == model.Id)
|
|
||||||
.ToList();
|
|
||||||
if (consultationLawyers != null && consultationLawyers.Count > 0)
|
if (consultationLawyers != null && consultationLawyers.Count > 0)
|
||||||
{
|
{
|
||||||
context.ConsultationLawyers
|
context.ConsultationLawyers.RemoveRange(consultationLawyers.Where(rec => !model.ConsultationLawyers.ContainsKey(rec.LawyerId)));
|
||||||
.RemoveRange(consultationLawyers
|
|
||||||
.Where(rec => !model.ConsultationLawyers
|
|
||||||
.ContainsKey(rec.LawyerId)));
|
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
}
|
|
||||||
|
foreach (var updateMember in consultationLawyers)
|
||||||
|
{
|
||||||
|
model.ConsultationLawyers.Remove(updateMember.LawyerId);
|
||||||
|
}
|
||||||
|
context.SaveChanges();
|
||||||
|
}
|
||||||
var _consultation = context.Consultations.First(x => x.Id == Id);
|
var _consultation = context.Consultations.First(x => x.Id == Id);
|
||||||
foreach (var pc in model.ConsultationLawyers)
|
foreach (var pc in model.ConsultationLawyers)
|
||||||
{
|
{
|
||||||
if (!ConsultationLawyers.ContainsKey(pc.Key))
|
context.ConsultationLawyers.Add(new ConsultationLawyer
|
||||||
{
|
{
|
||||||
context.ConsultationLawyers.Add(new ConsultationLawyer
|
Consultation = _consultation,
|
||||||
{
|
Lawyer = context.Lawyers.First(x => x.Id == pc.Key),
|
||||||
Consultation = _consultation,
|
});
|
||||||
Lawyer = context.Lawyers.First(x => x.Id == pc.Key),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
}
|
}
|
||||||
_consultationLawyers = null;
|
_consultationLawyers = null;
|
||||||
|
@ -16,7 +16,7 @@ namespace LawCompanyDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public string Judge { get; private set; } = string.Empty;
|
public string Judge { get; private set; } = string.Empty;
|
||||||
public int GuarantorId { get; set; }
|
public int GuarantorId { get; set; }
|
||||||
private Dictionary<int, ILawyerModel>? _hearingLawyers = null;
|
private Dictionary<int, ILawyerModel> _hearingLawyers = null;
|
||||||
[ForeignKey("HearingId")]
|
[ForeignKey("HearingId")]
|
||||||
public virtual List<HearingLawyer> Lawyers { get; set; } = new();
|
public virtual List<HearingLawyer> Lawyers { get; set; } = new();
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
@ -26,10 +26,7 @@ namespace LawCompanyDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
if (_hearingLawyers == null)
|
if (_hearingLawyers == null)
|
||||||
{
|
{
|
||||||
using var context = new LawCompanyDatabase();
|
_hearingLawyers = Lawyers.ToDictionary(x => x.LawyerId, x => (x.Lawyer as ILawyerModel));
|
||||||
_hearingLawyers = Lawyers
|
|
||||||
.ToDictionary(x => x.LawyerId, x => (context.Lawyers
|
|
||||||
.FirstOrDefault(y => y.Id == x.LawyerId) as ILawyerModel));
|
|
||||||
}
|
}
|
||||||
return _hearingLawyers;
|
return _hearingLawyers;
|
||||||
}
|
}
|
||||||
@ -66,31 +63,33 @@ namespace LawCompanyDatabaseImplement.Models
|
|||||||
Id = Id,
|
Id = Id,
|
||||||
HearingDate = HearingDate,
|
HearingDate = HearingDate,
|
||||||
Judge = Judge,
|
Judge = Judge,
|
||||||
GuarantorId = GuarantorId,
|
GuarantorId = GuarantorId
|
||||||
HearingLawyers = HearingLawyers
|
|
||||||
};
|
};
|
||||||
public void UpdateLawyers(LawCompanyDatabase context, HearingBindingModel model)
|
public void UpdateLawyers(LawCompanyDatabase context, HearingBindingModel model)
|
||||||
{
|
{
|
||||||
var hearingLawyer = context.HearingLawyers
|
var hearingLawyer = context.HearingLawyers.Where(rec => rec.HearingId == model.Id).ToList();
|
||||||
.Where(rec => rec.HearingId == model.Id)
|
|
||||||
.ToList();
|
|
||||||
if (hearingLawyer != null && hearingLawyer.Count > 0)
|
if (hearingLawyer != null && hearingLawyer.Count > 0)
|
||||||
{
|
{
|
||||||
context.HearingLawyers.RemoveRange(hearingLawyer.Where(rec
|
context.HearingLawyers.RemoveRange(hearingLawyer.Where(rec => !model.HearingLawyers.ContainsKey(rec.LawyerId)));
|
||||||
=> !model.HearingLawyers.ContainsKey(rec.LawyerId)));
|
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
}
|
|
||||||
|
foreach (var updateMember in hearingLawyer)
|
||||||
|
{
|
||||||
|
model.HearingLawyers.Remove(updateMember.LawyerId);
|
||||||
|
}
|
||||||
|
context.SaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
var _hearing = context.Hearings.First(x => x.Id == Id);
|
var _hearing = context.Hearings.First(x => x.Id == Id);
|
||||||
|
|
||||||
foreach (var pc in model.HearingLawyers)
|
foreach (var pc in model.HearingLawyers)
|
||||||
{
|
{
|
||||||
if (!HearingLawyers.ContainsKey(pc.Key))
|
context.HearingLawyers.Add(new HearingLawyer
|
||||||
{
|
{
|
||||||
context.HearingLawyers.Add(new HearingLawyer
|
Hearing = _hearing,
|
||||||
{
|
Lawyer = context.Lawyers.First(x => x.Id == pc.Key),
|
||||||
Hearing = _hearing,
|
});
|
||||||
Lawyer = context.Lawyers.First(x => x.Id == pc.Key),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
}
|
}
|
||||||
_hearingLawyers = null;
|
_hearingLawyers = null;
|
||||||
|
@ -3,7 +3,6 @@ using LawCompanyContracts.ViewModels;
|
|||||||
using LawCompanyDataModels.Models;
|
using LawCompanyDataModels.Models;
|
||||||
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
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using LawCompanyContracts.BindingModels;
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||||
|
using LawCompanyContracts.BindingModels;
|
||||||
using LawCompanyContracts.SearchModels;
|
using LawCompanyContracts.SearchModels;
|
||||||
using LawCompanyContracts.ViewModels;
|
using LawCompanyContracts.ViewModels;
|
||||||
using LawCompanyDataModels.Enums;
|
using LawCompanyDataModels.Enums;
|
||||||
@ -111,5 +112,28 @@ namespace LawCompanyExecutorApp.Controllers
|
|||||||
}
|
}
|
||||||
return View(APIClient.GetRequest<List<ClientViewModel>>($"api/case/getclientlisttocase?caseId={id}"));
|
return View(APIClient.GetRequest<List<ClientViewModel>>($"api/case/getclientlisttocase?caseId={id}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult TopCases()
|
||||||
|
{
|
||||||
|
if (APIClient.Executor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
var cases = APIClient.GetRequest<List<CaseViewModel>>($"api/case/GetCaseList?executorId={APIClient.Executor.Id}");
|
||||||
|
|
||||||
|
var statusCounts = cases
|
||||||
|
.GroupBy(c => c.Status)
|
||||||
|
.Select(g => new
|
||||||
|
{
|
||||||
|
Status = g.Key.ToString(),
|
||||||
|
Count = g.Count()
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
ViewBag.StatusCounts = statusCounts;
|
||||||
|
|
||||||
|
return View();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -138,7 +138,7 @@ namespace LawCompanyExecutorApp.Controllers
|
|||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
ViewBag.Visits = APIClient.GetRequest<List<VisitViewModel>>($"api/visit/GetVisitList?executorId={APIClient.Executor.Id}");
|
ViewBag.Visits = APIClient.GetRequest<List<VisitViewModel>>($"api/visit/GetVisitList?executorId={APIClient.Executor.Id}");
|
||||||
ViewBag.Hearings = APIClient.GetRequest<List<HearingViewModel>>($"api/hearing/GetHearingList");
|
ViewBag.Hearings = APIClient.GetRequest<List<HearingViewModel>>($"api/hearing/GetHearingList?guarantorId={APIClient.Executor.Id}");
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ namespace LawCompanyExecutorApp.Controllers
|
|||||||
VisitDate = roomElem.VisitDate,
|
VisitDate = roomElem.VisitDate,
|
||||||
HearingId = hearing
|
HearingId = hearing
|
||||||
});
|
});
|
||||||
Response.Redirect("Visits");
|
Response.Redirect("Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -206,7 +206,7 @@ namespace LawCompanyExecutorApp.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
APIClient.PostRequest("api/report/CreateOrganiserReportToExcelFile", new ReportExecutorBindingModel
|
APIClient.PostRequest("api/report/CreateExecutorReportToExcelFile", new ReportExecutorBindingModel
|
||||||
{
|
{
|
||||||
Ids = res,
|
Ids = res,
|
||||||
FileName = "C:\\Reports\\excelfile.xlsx"
|
FileName = "C:\\Reports\\excelfile.xlsx"
|
||||||
@ -291,7 +291,6 @@ namespace LawCompanyExecutorApp.Controllers
|
|||||||
_logger.LogError(ex, "Ошибка создания отчета");
|
_logger.LogError(ex, "Ошибка создания отчета");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
double sum = 0;
|
|
||||||
string table = "";
|
string table = "";
|
||||||
table += "<h2 class=\"text-custom-color-1\">Предварительный отчет</h2>";
|
table += "<h2 class=\"text-custom-color-1\">Предварительный отчет</h2>";
|
||||||
table += "<div class=\"table-responsive\">";
|
table += "<div class=\"table-responsive\">";
|
||||||
@ -299,33 +298,37 @@ namespace LawCompanyExecutorApp.Controllers
|
|||||||
table += "<thead class=\"table-dark\">";
|
table += "<thead class=\"table-dark\">";
|
||||||
table += "<tr>";
|
table += "<tr>";
|
||||||
table += "<th scope=\"col\">Клиент</th>";
|
table += "<th scope=\"col\">Клиент</th>";
|
||||||
table += "<th scope=\"col\">Наименование дела</th>";
|
table += "<th scope=\"col\">Дело</th>";
|
||||||
table += "<th scope=\"col\">Статус дела</th>";
|
|
||||||
table += "<th scope=\"col\">Дата консультации</th>";
|
table += "<th scope=\"col\">Дата консультации</th>";
|
||||||
table += "<th scope=\"col\">Цена консультации</th>";
|
|
||||||
table += "</tr>";
|
table += "</tr>";
|
||||||
table += "</thead>";
|
table += "</thead>";
|
||||||
foreach (var report in result)
|
table += "<tbody>";
|
||||||
|
|
||||||
|
foreach (var client in result)
|
||||||
{
|
{
|
||||||
bool IsCost = true;
|
|
||||||
if (report.Cost == 0)
|
|
||||||
{
|
|
||||||
IsCost = false;
|
|
||||||
}
|
|
||||||
table += "<tbody>";
|
|
||||||
table += "<tr>";
|
table += "<tr>";
|
||||||
table += $"<td>{report.FIO}</td>";
|
table += $"<td>{client.FIO}</td>";
|
||||||
table += $"<td>{report.Name}</td>";
|
table += $"<td></td>";
|
||||||
table += $"<td>{report.Status}</td>";
|
table += $"<td></td>";
|
||||||
table += $"<td>{report.ConsultationDate.ToShortDateString()}</td>";
|
|
||||||
table += $"<td>{(IsCost ? report.Cost.ToString() : string.Empty)}</td>";
|
|
||||||
table += "</tr>";
|
table += "</tr>";
|
||||||
table += "</tbody>";
|
foreach (var cons in client.CaseName)
|
||||||
sum += report.Cost;
|
{
|
||||||
|
table += "<tr>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += $"<td>{cons}</td>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += "</tr>";
|
||||||
|
}
|
||||||
|
foreach (var hear in client.VisitDate)
|
||||||
|
{
|
||||||
|
table += "<tr>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += $"<td>{hear}</td>";
|
||||||
|
table += "</tr>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
table += "<tfoot class=\"table-secondary\">";
|
table += "</tbody>";
|
||||||
table += $"<tr><th colspan=\"2\">Итого:</th><th>{sum}</th><th colspan=\"2\"></th></tr>";
|
|
||||||
table += "</tfoot>";
|
|
||||||
table += "</table>";
|
table += "</table>";
|
||||||
table += "</div>";
|
table += "</div>";
|
||||||
return table;
|
return table;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using LawCompanyContracts.BindingModels;
|
using LawCompanyContracts.BindingModels;
|
||||||
using LawCompanyContracts.SearchModels;
|
using LawCompanyContracts.SearchModels;
|
||||||
using LawCompanyContracts.ViewModels;
|
using LawCompanyContracts.ViewModels;
|
||||||
|
using LawCompanyDatabaseImplement;
|
||||||
using LawCompanyDataModels.Models;
|
using LawCompanyDataModels.Models;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
@ -69,8 +70,8 @@ namespace LawCompanyExecutorApp.Controllers
|
|||||||
{
|
{
|
||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/GetClientList?executorId={APIClient.Executor.Id}");
|
ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/GetClientList?executorId={APIClient.Executor.Id}");
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@ -92,7 +93,7 @@ namespace LawCompanyExecutorApp.Controllers
|
|||||||
client.Add(members, new ClientSearchModel { Id = members } as IClientModel);
|
client.Add(members, new ClientSearchModel { Id = members } as IClientModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
APIClient.PostRequest("api/visit/updatevisit", new VisitBindingModel
|
APIClient.PostRequest("api/visit/updatevisit", new VisitBindingModel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
VisitDate = visitDate,
|
VisitDate = visitDate,
|
||||||
@ -101,14 +102,48 @@ namespace LawCompanyExecutorApp.Controllers
|
|||||||
Response.Redirect("/Home/Visits");
|
Response.Redirect("/Home/Visits");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult VisitClients(int id)
|
public IActionResult VisitClients(int id)
|
||||||
{
|
{
|
||||||
if (APIClient.Executor == null)
|
if (APIClient.Executor == null)
|
||||||
{
|
{
|
||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
return View(APIClient.GetRequest<List<ClientViewModel>>($"api/visit/getclientlisttovisit?visitId={id}"));
|
return View(APIClient.GetRequest<List<ClientViewModel>>($"api/visit/getclientlisttovisit?visitId={id}"));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult ClientVisitCounts()
|
||||||
|
{
|
||||||
|
if (APIClient.Executor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var context = new LawCompanyDatabase())
|
||||||
|
{
|
||||||
|
var clients = context.Clients
|
||||||
|
.Where(c => c.ExecutorId == APIClient.Executor.Id)
|
||||||
|
.Select(c => new ClientViewModel
|
||||||
|
{
|
||||||
|
Id = c.Id,
|
||||||
|
FIO = c.FIO,
|
||||||
|
Email = c.Email,
|
||||||
|
Phone = c.Phone,
|
||||||
|
ExecutorId = c.ExecutorId
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var clientVisitCounts = clients.Select(client => new ClientVisitCountViewModel
|
||||||
|
{
|
||||||
|
FIO = client.FIO,
|
||||||
|
VisitCount = context.VisitClients.Count(vc => vc.ClientId == client.Id)
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
ViewBag.ClientVisitCounts = clientVisitCounts;
|
||||||
|
|
||||||
|
return View(clientVisitCounts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace LawCompanyExecutorApp.Controllers
|
|
||||||
{
|
|
||||||
public class VizitController : Controller
|
|
||||||
{
|
|
||||||
public IActionResult Index()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,7 +12,6 @@ using LawCompanyBusinessLogic.BusinessLogics;
|
|||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
builder.Services.AddTransient<IReportExecutorLogic, ReportLogicExecutor>();
|
builder.Services.AddTransient<IReportExecutorLogic, ReportLogicExecutor>();
|
||||||
builder.Services.AddTransient<IReportGuarantorLogic, ReportLogicGuarantor>();
|
|
||||||
builder.Services.AddTransient<ICaseStorage, CaseStorage>();
|
builder.Services.AddTransient<ICaseStorage, CaseStorage>();
|
||||||
builder.Services.AddTransient<IVisitStorage, VisitStorage>();
|
builder.Services.AddTransient<IVisitStorage, VisitStorage>();
|
||||||
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Добавить клиентов";
|
|
||||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
|
||||||
}
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
<div class="text-center">
|
|
||||||
<h2 class="display-4">Добавить клиентов</h2>
|
|
||||||
</div>
|
|
||||||
<form method="post">
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Клиент</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<select id="clientId" name="clientId" class="form-control" asp-items="@(new SelectList(@ViewBag.Clients,"Id", "FIO"))"></select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Дело</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<select id="id" name="id" class="form-control" asp-items="@(new SelectList(@ViewBag.Cases,"Id", "Name"))"></select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-8"></div>
|
|
||||||
<div class="col-4">
|
|
||||||
<input type="submit" value="Создать" class="btn btn-primary" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
46
LawCompany/LawCompanyExecutorApp/Views/Case/TopCases.cshtml
Normal file
46
LawCompany/LawCompanyExecutorApp/Views/Case/TopCases.cshtml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
@using LawCompanyContracts.ViewModels;
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Top Cases";
|
||||||
|
var statusCounts = ViewBag.StatusCounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.onload = function () {
|
||||||
|
var statusCounts = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(statusCounts));
|
||||||
|
var dataPoints = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < statusCounts.length; i++) {
|
||||||
|
dataPoints.push({ label: statusCounts[i].Status, y: statusCounts[i].Count });
|
||||||
|
}
|
||||||
|
|
||||||
|
var chart = new CanvasJS.Chart("chartContainer", {
|
||||||
|
theme: "light2",
|
||||||
|
animationEnabled: true,
|
||||||
|
title: {
|
||||||
|
text: "Топ статусов по делам"
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
type: "pie",
|
||||||
|
startAngle: 240,
|
||||||
|
showInLegend: true,
|
||||||
|
legendText: "{label}",
|
||||||
|
indexLabel: "{label} - #percent%",
|
||||||
|
dataPoints: dataPoints
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
chart.render();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -35,19 +35,23 @@
|
|||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="ClientHearingToFile">Отчёт по слушаниям</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ClientHearingToFile">Отчёт по слушаниям</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="ClientsToPdfFile">Отчёт по слушаниям</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ClientsToPdfFile">Отчёт по слушаниям</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Case" asp-action="TopCases">Топ по делам</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Visit" asp-action="ClientVisitCounts">Топ по визитам</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Добавление клиентов";
|
|
||||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
|
||||||
}
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
<div class="text-center">
|
|
||||||
<h2 class="display-4">Добавить задачи</h2>
|
|
||||||
</div>
|
|
||||||
<form method="post">
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Визит</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<select id="visitId" name="visitId" class="form-control" asp-items="@(new SelectList(@ViewBag.Visits,"Id", "VisitDate"))"></select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Клиент</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<select id="clientId" name="clientId" class="form-control" asp-items="@(new SelectList(@ViewBag.Clients,"Id", "FIO"))"></select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-8"></div>
|
|
||||||
<div class="col-4">
|
|
||||||
<input type="submit" value="Добавить" class="btn btn-primary" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
@ -0,0 +1,44 @@
|
|||||||
|
@using LawCompanyContracts.ViewModels;
|
||||||
|
|
||||||
|
@model List<ClientVisitCountViewModel>
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Количество визитов клиентов";
|
||||||
|
}
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>@ViewData["Title"]</title>
|
||||||
|
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.onload = function () {
|
||||||
|
var clientVisitCounts = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model));
|
||||||
|
var dataPoints = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < clientVisitCounts.length; i++) {
|
||||||
|
dataPoints.push({ label: clientVisitCounts[i].FIO, y: clientVisitCounts[i].VisitCount });
|
||||||
|
}
|
||||||
|
|
||||||
|
var chart = new CanvasJS.Chart("chartContainer", {
|
||||||
|
theme: "light2",
|
||||||
|
animationEnabled: true,
|
||||||
|
title: {
|
||||||
|
text: "Количество визитов по клиентам"
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
type: "column",
|
||||||
|
dataPoints: dataPoints
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
chart.render();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,12 +1,131 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using LawCompanyContracts.BindingModels;
|
||||||
|
using LawCompanyContracts.SearchModels;
|
||||||
|
using LawCompanyContracts.ViewModels;
|
||||||
|
using LawCompanyDatabaseImplement.Models;
|
||||||
|
using LawCompanyDataModels.Models;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LawCompanyGuarantorApp.Controllers
|
namespace LawCompanyGuarantorApp.Controllers
|
||||||
{
|
{
|
||||||
public class ConsultationController : Controller
|
public class ConsultationController : Controller
|
||||||
{
|
{
|
||||||
public IActionResult Index()
|
[HttpGet]
|
||||||
|
public IActionResult ConsultationLawyers(int id)
|
||||||
{
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View(APIClient.GetRequest<List<LawyerViewModel>>($"api/consultation/getlawyerlisttoconsultation?conId={id}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult CreateConsultation()
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
ViewBag.Lawyers = APIClient.GetRequest<List<LawyerViewModel>>($"api/lawyer/GetLawyerList?guarantorId={APIClient.Guarantor.Id}");
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
[HttpPost]
|
||||||
|
public void CreateConsultation(int cost, DateTime date, List<int> clientselect)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<int, ILawyerModel> client = new Dictionary<int, ILawyerModel>();
|
||||||
|
foreach (int members in clientselect)
|
||||||
|
{
|
||||||
|
client.Add(members, new LawyerSearchModel { Id = members } as ILawyerModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest("api/consultation/createconsultation", new ConsultationBindingModel
|
||||||
|
{
|
||||||
|
Cost = cost,
|
||||||
|
ConsultationDate = date,
|
||||||
|
ConsultationLawyers = client,
|
||||||
|
GuarantorId = APIClient.Guarantor.Id,
|
||||||
|
});
|
||||||
|
Response.Redirect("/Home/Consultations");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult UpdateConsultation()
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
ViewBag.Lawyers = APIClient.GetRequest<List<LawyerViewModel>>($"api/lawyer/GetLawyerList?guarantorId={APIClient.Guarantor.Id}");
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void UpdateConsultation(int id, int cost, DateTime date, List<int> clientselect)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<int, ILawyerModel> client = new Dictionary<int, ILawyerModel>();
|
||||||
|
foreach (int members in clientselect)
|
||||||
|
{
|
||||||
|
client.Add(members, new LawyerSearchModel { Id = members } as ILawyerModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest("api/consultation/updateconsultation", new ConsultationBindingModel
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Cost = cost,
|
||||||
|
ConsultationDate = date,
|
||||||
|
ConsultationLawyers = client,
|
||||||
|
GuarantorId = APIClient.Guarantor.Id,
|
||||||
|
});
|
||||||
|
Response.Redirect("/Home/Consultations");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void DeleteConsultation(int id)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest("api/consultation/deleteconsultation", new ConsultationBindingModel
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
});
|
||||||
|
Response.Redirect("/Home/Consultations");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult TopConsultation()
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
var consultation = APIClient.GetRequest<List<ConsultationViewModel>>($"api/consultation/GetConsultationList?guarantorId={APIClient.Guarantor.Id}");
|
||||||
|
|
||||||
|
var statusCounts = consultation
|
||||||
|
.GroupBy(c => c.Cost)
|
||||||
|
.Select(g => new
|
||||||
|
{
|
||||||
|
Cost = g.Key.ToString(),
|
||||||
|
Count = g.Count()
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
ViewBag.StatusCounts = statusCounts;
|
||||||
|
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,12 +1,143 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using LawCompanyContracts.BindingModels;
|
||||||
|
using LawCompanyContracts.SearchModels;
|
||||||
|
using LawCompanyContracts.ViewModels;
|
||||||
|
using LawCompanyDatabaseImplement;
|
||||||
|
using LawCompanyDataModels.Models;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LawCompanyGuarantorApp.Controllers
|
namespace LawCompanyGuarantorApp.Controllers
|
||||||
{
|
{
|
||||||
public class HearingController : Controller
|
public class HearingController : Controller
|
||||||
{
|
{
|
||||||
public IActionResult Index()
|
[HttpGet]
|
||||||
{
|
public IActionResult HearingLawyers(int id)
|
||||||
return View();
|
{
|
||||||
}
|
if (APIClient.Guarantor == null)
|
||||||
}
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View(APIClient.GetRequest<List<LawyerViewModel>>($"api/hearing/getlawyerlisttohearing?hearingId={id}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult CreateHearing()
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
ViewBag.Lawyers = APIClient.GetRequest<List<LawyerViewModel>>($"api/lawyer/GetLawyerList?guarantorId={APIClient.Guarantor.Id}");
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void CreateHearing(DateTime date, string judge, List<int> clientselect)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<int, ILawyerModel> client = new Dictionary<int, ILawyerModel>();
|
||||||
|
foreach (int members in clientselect)
|
||||||
|
{
|
||||||
|
client.Add(members, new LawyerSearchModel { Id = members } as ILawyerModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest("api/hearing/createhearing", new HearingBindingModel
|
||||||
|
{
|
||||||
|
HearingDate = date,
|
||||||
|
Judge = judge,
|
||||||
|
HearingLawyers = client,
|
||||||
|
GuarantorId = APIClient.Guarantor.Id,
|
||||||
|
});
|
||||||
|
Response.Redirect("/Home/Hearings");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult UpdateHearing()
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
ViewBag.Lawyers = APIClient.GetRequest<List<LawyerViewModel>>($"api/lawyer/GetLawyerList?guarantorId={APIClient.Guarantor.Id}");
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void UpdateHearing(int id, DateTime date, string judge, List<int> clientselect)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<int, ILawyerModel> client = new Dictionary<int, ILawyerModel>();
|
||||||
|
foreach (int members in clientselect)
|
||||||
|
{
|
||||||
|
client.Add(members, new LawyerSearchModel { Id = members } as ILawyerModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest("api/hearing/updatehearing", new HearingBindingModel
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
HearingDate = date,
|
||||||
|
Judge = judge,
|
||||||
|
HearingLawyers = client,
|
||||||
|
GuarantorId = APIClient.Guarantor.Id,
|
||||||
|
|
||||||
|
});
|
||||||
|
Response.Redirect("/Home/Hearings");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void DeleteHearing(int id)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest("api/hearing/deletehearing", new HearingBindingModel
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
});
|
||||||
|
Response.Redirect("/Home/Hearings");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult LawyerHearingCounts()
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var context = new LawCompanyDatabase())
|
||||||
|
{
|
||||||
|
var lawyers = context.Lawyers
|
||||||
|
.Where(c => c.GuarantorId == APIClient.Guarantor.Id)
|
||||||
|
.Select(c => new LawyerViewModel
|
||||||
|
{
|
||||||
|
Id = c.Id,
|
||||||
|
FIO = c.FIO,
|
||||||
|
Email = c.Email,
|
||||||
|
Phone = c.Phone,
|
||||||
|
GuarantorId = c.GuarantorId
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var lawyerHearingCounts = lawyers.Select(lawyer => new LawyerHearingCountViewModel
|
||||||
|
{
|
||||||
|
FIO = lawyer.FIO,
|
||||||
|
HearingCount = context.HearingLawyers.Count(vc => vc.LawyerId == lawyer.Id)
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
ViewBag.LawyerHearingCounts = lawyerHearingCounts;
|
||||||
|
|
||||||
|
return View(lawyerHearingCounts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,4 +1,7 @@
|
|||||||
using LawCompanyGuarantorApp.Models;
|
using LawCompanyContracts.BindingModels;
|
||||||
|
using LawCompanyContracts.BusinessLogicContracts;
|
||||||
|
using LawCompanyContracts.ViewModels;
|
||||||
|
using LawCompanyGuarantorApp.Models;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
@ -7,20 +10,338 @@ namespace LawCompanyGuarantorApp.Controllers
|
|||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
|
private readonly IReportGuarantorLogic _report;
|
||||||
|
|
||||||
public HomeController(ILogger<HomeController> logger)
|
public HomeController(ILogger<HomeController> logger, IReportGuarantorLogic report)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_report = report;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IActionResult Register()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void Register(string fio, string email, string password)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(fio) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
|
||||||
|
{
|
||||||
|
throw new Exception("Введите фио, почту и пароль");
|
||||||
|
}
|
||||||
|
APIClient.PostRequest("api/guarantor/register", new ExecutorBindingModel
|
||||||
|
{
|
||||||
|
FIO = fio,
|
||||||
|
Email = email,
|
||||||
|
Password = password,
|
||||||
|
});
|
||||||
|
|
||||||
|
Response.Redirect("Enter");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult Enter()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void Enter(string email, string password)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
|
||||||
|
{
|
||||||
|
throw new Exception("Введите email и пароль");
|
||||||
|
}
|
||||||
|
APIClient.Guarantor = APIClient.GetRequest<GuarantorViewModel>($"api/guarantor/login?login={email}&password={password}");
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Неверный логин/пароль");
|
||||||
|
}
|
||||||
|
Response.Redirect("Index");
|
||||||
|
}
|
||||||
|
|
||||||
public IActionResult Privacy()
|
public IActionResult Privacy()
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View(APIClient.Guarantor);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void Privacy(string fio, string email, string password)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(fio) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
|
||||||
|
{
|
||||||
|
throw new Exception("Введите фио, почту и пароль");
|
||||||
|
}
|
||||||
|
APIClient.PostRequest("api/guarantor/updatedata", new ExecutorBindingModel
|
||||||
|
{
|
||||||
|
Id = APIClient.Guarantor.Id,
|
||||||
|
FIO = fio,
|
||||||
|
Password = password,
|
||||||
|
Email = email,
|
||||||
|
});
|
||||||
|
|
||||||
|
APIClient.Guarantor.FIO = fio;
|
||||||
|
APIClient.Guarantor.Email = email;
|
||||||
|
APIClient.Guarantor.Password = password;
|
||||||
|
Response.Redirect("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
// СТРАНИЦЫ КОНСУЛЬТАЦИЙ
|
||||||
|
public IActionResult Consultations()
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View(APIClient.GetRequest<List<ConsultationViewModel>>($"api/consultation/GetConsultationList?guarantorId={APIClient.Guarantor.Id}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// СТРАНИЦА СЛУШАНИЙ
|
||||||
|
public IActionResult Hearings()
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View(APIClient.GetRequest<List<HearingViewModel>>($"api/hearing/gethearinglist?guarantorId={APIClient.Guarantor.Id}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// СТРАНИЦА ЮРИСТОВ
|
||||||
|
public IActionResult Lawyers()
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View(APIClient.GetRequest<List<LawyerViewModel>>($"api/lawyer/getlawyerlist?guarantorId={APIClient.Guarantor.Id}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult ConsultationCase()
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
ViewBag.Cases = APIClient.GetRequest<List<CaseViewModel>>($"api/case/GetCaseList?executorId={APIClient.Guarantor.Id}");
|
||||||
|
ViewBag.Consultations = APIClient.GetRequest<List<ConsultationViewModel>>($"api/consultation/getconsultationlist?guarantorId={APIClient.Guarantor.Id}");
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void ConsultationCase(int consultation, int cases)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
||||||
|
}
|
||||||
|
var roomElem = APIClient.GetRequest<ConsultationViewModel>($"api/Consultation/GetConsultation?id={consultation}");
|
||||||
|
APIClient.PostRequest("api/Consultation/UpdateConsultation", new ConsultationBindingModel
|
||||||
|
{
|
||||||
|
Id = consultation,
|
||||||
|
GuarantorId = APIClient.Guarantor.Id,
|
||||||
|
Cost = roomElem.Cost,
|
||||||
|
ConsultationDate = roomElem.ConsultationDate,
|
||||||
|
CaseId = cases
|
||||||
|
});
|
||||||
|
Response.Redirect("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult LawyerConsultationToFile()
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View(APIClient.GetRequest<List<LawyerViewModel>>($"api/lawyer/getlawyerlist?guarantorId={APIClient.Guarantor.Id}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void LawyerConsultationToFile(int[] Ids, string type)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Ids.Length <= 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Количество должно быть больше 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(type))
|
||||||
|
{
|
||||||
|
throw new Exception("Неверный тип отчета");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<int> res = new List<int>();
|
||||||
|
|
||||||
|
foreach (var item in Ids)
|
||||||
|
{
|
||||||
|
res.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == "docx")
|
||||||
|
{
|
||||||
|
APIClient.PostRequest("api/report/CreateGuarantorReportToWordFile", new ReportGuarantorBindingModel
|
||||||
|
{
|
||||||
|
Ids = res,
|
||||||
|
FileName = "C:\\Reports\\wordfile.docx"
|
||||||
|
});
|
||||||
|
Response.Redirect("GetWordFile");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
APIClient.PostRequest("api/report/CreateGuarantorReportToExcelFile", new ReportGuarantorBindingModel
|
||||||
|
{
|
||||||
|
Ids = res,
|
||||||
|
FileName = "C:\\Reports\\excelfile.xlsx"
|
||||||
|
});
|
||||||
|
Response.Redirect("GetExcelFile");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult GetWordFile()
|
||||||
|
{
|
||||||
|
return new PhysicalFileResult("C:\\Reports\\wordfile.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult GetExcelFile()
|
||||||
|
{
|
||||||
|
return new PhysicalFileResult("C:\\Reports\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult GetPdfFile()
|
||||||
|
{
|
||||||
|
return new PhysicalFileResult("C:\\Reports\\pdffile.pdf", "application/pdf");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult LawyersToPdfFile()
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View("LawyersToPdfFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void LawyersToPdfFile(DateTime dateFrom, DateTime dateTo, string email)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(email))
|
||||||
|
{
|
||||||
|
throw new Exception("Email пуст");
|
||||||
|
}
|
||||||
|
APIClient.PostRequest("api/report/CreateGuarantorReportToPdfFile", new ReportGuarantorBindingModel
|
||||||
|
{
|
||||||
|
DateFrom = dateFrom,
|
||||||
|
DateTo = dateTo,
|
||||||
|
GuarantorId = APIClient.Guarantor.Id
|
||||||
|
});
|
||||||
|
APIClient.PostRequest("api/report/SendPdfToMail", new MailSendInfoBindingModel
|
||||||
|
{
|
||||||
|
MailAddress = email,
|
||||||
|
Subject = "Отчет по юристам (pdf)",
|
||||||
|
Text = "Отчет по юристам с " + dateFrom.ToShortDateString() + " до " + dateTo.ToShortDateString()
|
||||||
|
});
|
||||||
|
Response.Redirect("LawyersToPdfFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public string GetLawyersReport(DateTime dateFrom, DateTime dateTo)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
List<ReportLawyersViewModel> result;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result = _report.GetLawyers(new ReportGuarantorBindingModel
|
||||||
|
{
|
||||||
|
GuarantorId = APIClient.Guarantor.Id,
|
||||||
|
DateFrom = dateFrom,
|
||||||
|
DateTo = dateTo
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка создания отчета");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
string table = "";
|
||||||
|
table += "<h2 class=\"text-custom-color-1\">Предварительный отчет</h2>";
|
||||||
|
table += "<div class=\"table-responsive\">";
|
||||||
|
table += "<table class=\"table table-striped table-bordered table-hover\">";
|
||||||
|
table += "<thead class=\"table-dark\">";
|
||||||
|
table += "<tr>";
|
||||||
|
table += "<th scope=\"col\">Юрист</th>";
|
||||||
|
table += "<th scope=\"col\">Цена консультации</th>";
|
||||||
|
table += "<th scope=\"col\">Дата консультации</th>";
|
||||||
|
table += "<th scope=\"col\">Суд</th>";
|
||||||
|
table += "<th scope=\"col\">Дата слушания</th>";
|
||||||
|
table += "</tr>";
|
||||||
|
table += "</thead>";
|
||||||
|
foreach (var lawyer in result)
|
||||||
|
{
|
||||||
|
table += "<tbody>";
|
||||||
|
table += "<tr>";
|
||||||
|
table += $"<td>{lawyer.FIO}</td>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += "</tr>";
|
||||||
|
foreach (var cons in lawyer.Consultation)
|
||||||
|
{
|
||||||
|
table += "<tr>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += $"<td>{cons.ConsultationDate}</td>";
|
||||||
|
table += $"<td>{cons.Price}</td>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += "</tr>";
|
||||||
|
}
|
||||||
|
foreach (var hear in lawyer.Hearing)
|
||||||
|
{
|
||||||
|
table += "<tr>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += $"<td></td>";
|
||||||
|
table += $"<td>{hear.Judge}</td>";
|
||||||
|
table += $"<td>{hear.HearingDate}</td>";
|
||||||
|
table += "</tr>";
|
||||||
|
}
|
||||||
|
table += "</tbody>";
|
||||||
|
}
|
||||||
|
table += "</table>";
|
||||||
|
table += "</div>";
|
||||||
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
|
@ -1,12 +1,81 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using LawCompanyContracts.BindingModels;
|
||||||
|
using LawCompanyContracts.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LawCompanyGuarantorApp.Controllers
|
namespace LawCompanyGuarantorApp.Controllers
|
||||||
{
|
{
|
||||||
public class LawyerController : Controller
|
public class LawyerController : Controller
|
||||||
{
|
{
|
||||||
public IActionResult Index()
|
[HttpGet]
|
||||||
{
|
public IActionResult CreateLawyer()
|
||||||
return View();
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void CreateLawyer(string fio, string phone, string email)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest("api/lawyer/createlawyer", new LawyerBindingModel
|
||||||
|
{
|
||||||
|
FIO = fio,
|
||||||
|
Phone = phone,
|
||||||
|
Email = email,
|
||||||
|
GuarantorId = APIClient.Guarantor.Id,
|
||||||
|
});
|
||||||
|
Response.Redirect("/Home/Lawyers");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void DeleteLawyer(int id)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest("api/lawyer/deletelawyer", new LawyerBindingModel
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
});
|
||||||
|
Response.Redirect("/Home/Lawyers");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult UpdateLawyer(int id)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
var lawyer = APIClient.GetRequest<LawyerViewModel>($"api/lawyer/GetLawyerById/{id}");
|
||||||
|
return View(lawyer);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
[HttpPost]
|
||||||
|
public void UpdateLawyer(int id, string fio, string email, string phone)
|
||||||
|
{
|
||||||
|
if (APIClient.Guarantor == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
|
||||||
|
APIClient.PostRequest("api/lawyer/updatelawyer", new LawyerBindingModel
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
FIO = fio,
|
||||||
|
Email = email,
|
||||||
|
Phone = phone,
|
||||||
|
GuarantorId = APIClient.Guarantor.Id,
|
||||||
|
});
|
||||||
|
Response.Redirect("/Home/Lawyers");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -11,8 +11,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\LawCompanyBusinessLogic\LawCompanyBusinessLogic.csproj" />
|
||||||
<ProjectReference Include="..\LawCompanyContracts\LawCompanyContracts.csproj" />
|
<ProjectReference Include="..\LawCompanyContracts\LawCompanyContracts.csproj" />
|
||||||
<ProjectReference Include="..\LawCompanyDatabaseImplement\LawCompanyDatabaseImplement.csproj" />
|
<ProjectReference Include="..\LawCompanyDatabaseImplement\LawCompanyDatabaseImplement.csproj" />
|
||||||
|
<ProjectReference Include="..\LawCompanyDataModels\LawCompanyDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,11 +1,24 @@
|
|||||||
|
using HotelBusinessLogic.BusinessLogics;
|
||||||
|
using LawCompanyBusinessLogic.BusinessLogics;
|
||||||
|
using LawCompanyBusinessLogic.OfficePackage.Implements;
|
||||||
|
using LawCompanyBusinessLogic.OfficePackage;
|
||||||
|
using LawCompanyContracts.BusinessLogicContracts;
|
||||||
using LawCompanyContracts.StoragesContracts;
|
using LawCompanyContracts.StoragesContracts;
|
||||||
using LawCompanyDatabaseImplement.Implements;
|
using LawCompanyDatabaseImplement.Implements;
|
||||||
using LawCompanyGuarantorApp;
|
using LawCompanyGuarantorApp;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
builder.Services.AddTransient<IConsultationStorage, ConsultationStorage>();
|
builder.Services.AddTransient<IReportGuarantorLogic, ReportLogicGuarantor>();
|
||||||
|
builder.Services.AddTransient<ICaseStorage, CaseStorage>();
|
||||||
|
builder.Services.AddTransient<IVisitStorage, VisitStorage>();
|
||||||
|
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
builder.Services.AddTransient<IHearingStorage, HearingStorage>();
|
builder.Services.AddTransient<IHearingStorage, HearingStorage>();
|
||||||
builder.Services.AddTransient<ILawyerStorage, LawyerStorage>();
|
builder.Services.AddTransient<ILawyerStorage, LawyerStorage>();
|
||||||
|
builder.Services.AddTransient<IConsultationStorage, ConsultationStorage>();
|
||||||
|
|
||||||
|
builder.Services.AddTransient<AbstractSaveToWordGuarantor, SaveToWordGuarantor>();
|
||||||
|
builder.Services.AddTransient<AbstractSaveToExcelGuarantor, SaveToExcelGuarantor>();
|
||||||
|
builder.Services.AddTransient<AbstractSaveToPdfGuarantor, SaveToPdfGuarantor>();
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddControllersWithViews();
|
builder.Services.AddControllersWithViews();
|
||||||
@ -14,12 +27,11 @@ var app = builder.Build();
|
|||||||
APIClient.Connect(builder.Configuration);
|
APIClient.Connect(builder.Configuration);
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (!app.Environment.IsDevelopment())
|
|
||||||
{
|
app.UseExceptionHandler("/Home/Error");
|
||||||
app.UseExceptionHandler("/Home/Error");
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
app.UseHsts();
|
||||||
app.UseHsts();
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
@ -30,6 +42,6 @@ app.UseAuthorization();
|
|||||||
|
|
||||||
app.MapControllerRoute(
|
app.MapControllerRoute(
|
||||||
name: "default",
|
name: "default",
|
||||||
pattern: "{controller=Home}/{action=EnterGuarantor}/{id?}");
|
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Добавление юристов";
|
|
||||||
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
|
|
||||||
}
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
<div class="text-center">
|
|
||||||
<h2 class="display-4">Добавить юристов</h2>
|
|
||||||
</div>
|
|
||||||
<form method="post">
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Юрист</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<select id="lawyerId" name="lawyerId" class="form-control" asp-items="@(new SelectList(@ViewBag.Lawyers,"Id", "FIO"))"></select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Консультация</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<select id="conId" name="conId" class="form-control" asp-items="@(new SelectList(@ViewBag.Consultations,"Id", "Cost"))"></select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-8"></div>
|
|
||||||
<div class="col-4">
|
|
||||||
<input type="submit" value="Создать" class="btn btn-primary" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
@ -1,6 +1,8 @@
|
|||||||
@{
|
@using LawCompanyContracts.ViewModels;
|
||||||
|
@using LawCompanyDataModels.Models;
|
||||||
|
|
||||||
|
@{
|
||||||
ViewData["Title"] = "Создание консультацию";
|
ViewData["Title"] = "Создание консультацию";
|
||||||
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@ -10,19 +12,23 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Стоимость</div>
|
<div class="col-4">Стоимость</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<input type="number" id="cost" name="cost">
|
<input type="number" placeholder="Введите стоимость" id="cost" name="cost">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Дата и время</div>
|
<div class="col-4">Дата и время</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<input type="datetime-local" placeholder="Введите дату" name="consultationDate" id="consultationDate">
|
<input type="datetime-local" placeholder="Введите дату" name="date" id="date">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="form-group">
|
||||||
<div class="col-4">Дело</div>
|
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<select id="caseId" name="caseId" class="form-control" asp-items="@(new SelectList(@ViewBag.Cases,"Id", "Id"))"></select>
|
<select name="clientselect" class="form-control" multiple size="6" id="clientselect">
|
||||||
|
@foreach (var member in ViewBag.Lawyers)
|
||||||
|
{
|
||||||
|
<option value="@member.Id">@member.FIO</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
@using LawCompanyContracts.ViewModels;
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Top Consultation";
|
||||||
|
var statusCounts = ViewBag.StatusCounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.onload = function () {
|
||||||
|
var statusCounts = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(statusCounts));
|
||||||
|
var dataPoints = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < statusCounts.length; i++) {
|
||||||
|
dataPoints.push({ label: statusCounts[i].Cost, y: statusCounts[i].Count });
|
||||||
|
}
|
||||||
|
|
||||||
|
var chart = new CanvasJS.Chart("chartContainer", {
|
||||||
|
theme: "light2",
|
||||||
|
animationEnabled: true,
|
||||||
|
title: {
|
||||||
|
text: "Топ консультаций по цене"
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
type: "pie",
|
||||||
|
startAngle: 240,
|
||||||
|
showInLegend: true,
|
||||||
|
legendText: "{label}",
|
||||||
|
indexLabel: "{label} - #percent%",
|
||||||
|
dataPoints: dataPoints
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
chart.render();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,4 +1,8 @@
|
|||||||
@{
|
@using LawCompanyContracts.ViewModels;
|
||||||
|
@using LawCompanyDataModels.Models;
|
||||||
|
|
||||||
|
|
||||||
|
@{
|
||||||
ViewData["Title"] = "Обновление консультации";
|
ViewData["Title"] = "Обновление консультации";
|
||||||
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
|
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
|
||||||
}
|
}
|
||||||
@ -10,19 +14,23 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Стоимость</div>
|
<div class="col-4">Стоимость</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<input type="text" name="cost" id="cost" />
|
<input type="number" placeholder="Введите стоимость" id="cost" name="cost">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Дата</div>
|
<div class="col-4">Дата и время</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<input type="text" name="date" id="date" />
|
<input type="datetime-local" placeholder="Введите дату" name="date" id="date">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="form-group">
|
||||||
<div class="col-4">Дело</div>
|
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<select id="caseId" name="caseId" class="form-control" asp-items="@(new SelectList(@ViewBag.Cases,"Id", "Id"))"></select>
|
<select name="clientselect" class="form-control" multiple size="6" id="clientselect">
|
||||||
|
@foreach (var member in ViewBag.Lawyers)
|
||||||
|
{
|
||||||
|
<option value="@member.Id">@member.FIO</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Добавить юристов";
|
|
||||||
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
|
|
||||||
}
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
<div class="text-center">
|
|
||||||
<h2 class="display-4">Добавить юристов</h2>
|
|
||||||
</div>
|
|
||||||
<form method="post">
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Слушание</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<select id="id" name="id" class="form-control" asp-items="@(new SelectList(@ViewBag.Hearings,"Id", "Name"))"></select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Юрист</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<select id="lawyerId" name="lawyerId" class="form-control" asp-items="@(new SelectList(@ViewBag.Hearings,"Id", "FIO"))"></select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-8"></div>
|
|
||||||
<div class="col-4">
|
|
||||||
<input type="submit" value="Создать" class="btn btn-primary" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
@ -1,4 +1,7 @@
|
|||||||
@{
|
@using LawCompanyContracts.ViewModels;
|
||||||
|
@using LawCompanyDataModels.Models;
|
||||||
|
|
||||||
|
@{
|
||||||
ViewData["Title"] = "Назначение слушания";
|
ViewData["Title"] = "Назначение слушания";
|
||||||
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
|
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
|
||||||
}
|
}
|
||||||
@ -19,6 +22,16 @@
|
|||||||
<input type="text" name="judge" id="judge" />
|
<input type="text" name="judge" id="judge" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-8">
|
||||||
|
<select name="clientselect" class="form-control" multiple size="6" id="clientselect">
|
||||||
|
@foreach (var member in ViewBag.Lawyers)
|
||||||
|
{
|
||||||
|
<option value="@member.Id">@member.FIO</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8"></div>
|
<div class="col-8"></div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
@model List<LawyerViewModel>
|
@model List<LawyerViewModel>
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Юристы";
|
ViewData["Title"] = "Юристы";
|
||||||
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
|
|
||||||
}
|
}
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h1 class="display-4">Юристы</h1>
|
<h1 class="display-4">Юристы</h1>
|
||||||
@ -36,20 +35,16 @@
|
|||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td id="id">
|
<td id="id">
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.Id)
|
||||||
item.Id)
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.FIO)
|
||||||
item.FIO)
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.Email)
|
||||||
item.Email)
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.Phone)
|
||||||
item.Phone)
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
@using LawCompanyContracts.ViewModels;
|
||||||
|
|
||||||
|
@model List<LawyerHearingCountViewModel>
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Количество слушаний юристов";
|
||||||
|
}
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>@ViewData["Title"]</title>
|
||||||
|
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.onload = function () {
|
||||||
|
var lawyerHearingCounts = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model));
|
||||||
|
var dataPoints = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < lawyerHearingCounts.length; i++) {
|
||||||
|
dataPoints.push({ label: lawyerHearingCounts[i].FIO, y: lawyerHearingCounts[i].HearingCount });
|
||||||
|
}
|
||||||
|
|
||||||
|
var chart = new CanvasJS.Chart("chartContainer", {
|
||||||
|
theme: "light2",
|
||||||
|
animationEnabled: true,
|
||||||
|
title: {
|
||||||
|
text: "Количество слушаний юристов"
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
type: "column",
|
||||||
|
dataPoints: dataPoints
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
chart.render();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,6 +1,8 @@
|
|||||||
@{
|
@using LawCompanyContracts.ViewModels;
|
||||||
|
@using LawCompanyDataModels.Models;
|
||||||
|
|
||||||
|
@{
|
||||||
ViewData["Title"] = "UpdateHearing";
|
ViewData["Title"] = "UpdateHearing";
|
||||||
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@ -19,6 +21,16 @@
|
|||||||
<input type="text" name="judge" id="judge" />
|
<input type="text" name="judge" id="judge" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-8">
|
||||||
|
<select name="clientselect" class="form-control" multiple size="6" id="clientselect">
|
||||||
|
@foreach (var member in ViewBag.Lawyers)
|
||||||
|
{
|
||||||
|
<option value="@member.Id">@member.FIO</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8"></div>
|
<div class="col-8"></div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
@using LawCompanyContracts.ViewModels;
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "ConsultationCase";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Связывание консультации и дела</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="consultation">Консультация</label>
|
||||||
|
<select id="consultation" name="consultation" class="form-control" asp-items="@(new SelectList(@ViewBag.Consultations, "Id", "ConsultationDate"))"></select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="cases">Визит</label>
|
||||||
|
<select id="cases" name="cases" class="form-control" asp-items="@(new SelectList(@ViewBag.Cases, "Id", "Name"))"></select>
|
||||||
|
</div>
|
||||||
|
<div class="u-container-layout u-container-layout-2">
|
||||||
|
<input type="submit" value="Сохранить" class="btn btn-primary" />
|
||||||
|
</div>
|
||||||
|
</form>
|
@ -2,7 +2,6 @@
|
|||||||
@model List<ConsultationViewModel>
|
@model List<ConsultationViewModel>
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Create Consultation";
|
ViewData["Title"] = "Create Consultation";
|
||||||
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
|
|
||||||
}
|
}
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h1 class="display-4">Список консультаций</h1>
|
<h1 class="display-4">Список консультаций</h1>
|
||||||
@ -11,7 +10,6 @@
|
|||||||
@{
|
@{
|
||||||
<p>
|
<p>
|
||||||
<a asp-controller="Consultation" asp-action="CreateConsultation">Назначить консультацию</a>
|
<a asp-controller="Consultation" asp-action="CreateConsultation">Назначить консультацию</a>
|
||||||
<a asp-controller="Consultation" asp-action="AddLawyer">Добавить юристов к консультациям</a>
|
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
@ -25,9 +23,6 @@
|
|||||||
<th>
|
<th>
|
||||||
Дата консультации
|
Дата консультации
|
||||||
</th>
|
</th>
|
||||||
<th>
|
|
||||||
Наименование дела
|
|
||||||
</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -35,25 +30,31 @@
|
|||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td id="id">
|
<td id="id">
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.Id)
|
||||||
item.Id)
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.Cost)
|
||||||
item.Cost)
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.ConsultationDate)
|
||||||
item.CaseName)
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" class="btn btn-danger">Удалить</button>
|
<form action="/Consultation/DeleteConsultation" method="post">
|
||||||
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
|
<button type="submit" class="btn btn-danger">Удалить</button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" class="btn btn-danger">Изменить</button>
|
<form action="/Consultation/UpdateConsultation">
|
||||||
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
|
<button type="submit" class="btn btn-danger">Изменить</button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" class="btn btn-danger">Юристы</button>
|
<form action="/Consultation/ConsultationLawyers">
|
||||||
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
|
<button type="submit" class="btn btn-danger">Юристы</button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
@ -2,7 +2,6 @@
|
|||||||
@model List<HearingViewModel>
|
@model List<HearingViewModel>
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Create Hearing";
|
ViewData["Title"] = "Create Hearing";
|
||||||
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
|
|
||||||
}
|
}
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h1 class="display-4">Список слушаний</h1>
|
<h1 class="display-4">Список слушаний</h1>
|
||||||
@ -11,7 +10,6 @@
|
|||||||
@{
|
@{
|
||||||
<p>
|
<p>
|
||||||
<a asp-controller="Hearing" asp-action="CreateHearing">Назначить слушание</a>
|
<a asp-controller="Hearing" asp-action="CreateHearing">Назначить слушание</a>
|
||||||
<a asp-controller="Hearing" asp-action="AddLawyer">Добавить юристов к слушаниям</a>
|
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
@ -32,25 +30,31 @@
|
|||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td id="id">
|
<td id="id">
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.Id)
|
||||||
item.Id)
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.HearingDate)
|
||||||
item.HearingDate)
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.Judge)
|
||||||
item.Judge)
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" class="btn btn-danger">Удалить</button>
|
<form action="/Hearing/DeleteHearing" method="post">
|
||||||
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
|
<button type="submit" class="btn btn-danger">Удалить</button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" class="btn btn-danger">Изменить</button>
|
<form action="/Hearing/UpdateHearing">
|
||||||
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
|
<button type="submit" class="btn btn-danger">Изменить</button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" class="btn btn-danger">Юристы</button>
|
<form action="/Hearing/HearingLawyers">
|
||||||
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
|
<button type="submit" class="btn btn-danger">Юристы</button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
@using LawCompanyContracts.ViewModels
|
||||||
|
|
||||||
|
@model List<LawyerViewModel>
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "LawyerConsultationToFile";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<div class="title">
|
||||||
|
<h2>Создание отчёта по юристам</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<form method="post">
|
||||||
|
<div class="file-format">
|
||||||
|
<label class="form-label">Выберите формат файла:</label>
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="radio" name="type" value="docx" id="docx">
|
||||||
|
<label class="form-check-label" for="docx">Word-файл</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="radio" name="type" value="xlsx" id="xlsx" checked>
|
||||||
|
<label class="form-check-label" for="xlsx">Excel-файл</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="table">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead class="thead-light">
|
||||||
|
<tr>
|
||||||
|
<th scope="col"></th>
|
||||||
|
<th scope="col">ФИО</th>
|
||||||
|
<th scope="col">Почта</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" name="Ids[]" value="@item.Id" id="@item.Id">
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>@Html.DisplayFor(modelItem => item.FIO)</td>
|
||||||
|
<td>@Html.DisplayFor(modelItem => item.Email)</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="d-flex justify-content-center">
|
||||||
|
<button type="submit" class="btn btn-block btn-outline-dark w-100">Создать</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.title {
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-format {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -39,27 +39,29 @@
|
|||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td id="id">
|
<td id="id">
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.Id)
|
||||||
item.Id)
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.FIO)
|
||||||
item.FIO)
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.Phone)
|
||||||
item.Phone)
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem =>
|
@Html.DisplayFor(modelItem => item.Email)
|
||||||
item.Email)
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" class="btn btn-danger">Удалить</button>
|
<form action="/Lawyer/DeleteLawyer" method="post">
|
||||||
</td>
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
|
<button type="submit" class="btn btn-danger">Удалить</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" class="btn btn-danger">Изменить</button>
|
<form action="/Lawyer/UpdateLawyer">
|
||||||
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
|
<button type="submit" class="btn btn-danger">Изменить</button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,72 @@
|
|||||||
|
@using LawCompanyContracts.ViewModels
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "LawyersToPdfFile";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
<h2 class="text-custom-color-1">Отчет по юристам за период</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="dateFrom" class="form-label text-custom-color-1">Начало периода:</label>
|
||||||
|
<input type="datetime-local" id="dateFrom" name="dateFrom" class="form-control" placeholder="Выберите дату начала периода">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="dateTo" class="form-label text-custom-color-1">Окончание периода:</label>
|
||||||
|
<input type="datetime-local" id="dateTo" name="dateTo" class="form-control" placeholder="Выберите дату окончания периода">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mb-4">
|
||||||
|
<label for="email" class="form-label text-custom-color-1">Почта:</label>
|
||||||
|
<input type="email" id="email" name="email" class="form-control" placeholder="Введите вашу почту">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-4">
|
||||||
|
<div class="col-md-8"></div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<button type="submit" class="btn btn-outline-dark w-100 text-center d-flex justify-content-md-center">Отправить на почту</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-4">
|
||||||
|
<div class="col-md-8"></div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<button type="button" id="demonstrate" class="btn btn-outline-dark w-100 text-center d-flex justify-content-md-center">Продемонстрировать</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="report"></div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@section Scripts {
|
||||||
|
<script>
|
||||||
|
function check() {
|
||||||
|
var dateFrom = $('#dateFrom').val();
|
||||||
|
var dateTo = $('#dateTo').val();
|
||||||
|
if (dateFrom && dateTo) {
|
||||||
|
$.ajax({
|
||||||
|
method: "GET",
|
||||||
|
url: "/Home/GetLawyersReport",
|
||||||
|
data: { dateFrom: dateFrom, dateTo: dateTo },
|
||||||
|
success: function (result) {
|
||||||
|
if (result != null) {
|
||||||
|
$('#report').html(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
check();
|
||||||
|
$('#demonstrate').on('click', (e) => check());
|
||||||
|
</script>
|
||||||
|
}
|
@ -16,7 +16,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Номер телефона</div>
|
<div class="col-4">Номер телефона</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<input type="number" id="phone" name="phone" />
|
<input type="text" id="phone" name="phone" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
@{
|
@using LawCompanyContracts.ViewModels
|
||||||
|
@model LawyerViewModel
|
||||||
|
|
||||||
|
@{
|
||||||
ViewData["Title"] = "Обновить юриста";
|
ViewData["Title"] = "Обновить юриста";
|
||||||
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
|
Layout = "~/Views/Shared/_LayoutGuarantor.cshtml";
|
||||||
}
|
}
|
||||||
@ -6,29 +9,31 @@
|
|||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h2 class="display-4">Изменение юриста</h2>
|
<h2 class="display-4">Изменение юриста</h2>
|
||||||
</div>
|
</div>
|
||||||
<form method="post">
|
<form asp-action="UpdateLawyer" method="post">
|
||||||
<div class="row">
|
<input type="hidden" name="id" value="@Model.Id" />
|
||||||
<div class="col-4">ФИО</div>
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-4">ФИО</div>
|
||||||
<input type="text" name="fio" id="fio" />
|
<div class="col-8">
|
||||||
</div>
|
<input type="text" name="fio" id="fio" value="@Model.FIO" />
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
</div>
|
||||||
<div class="col-4">Номер телефона</div>
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-4">Номер телефона</div>
|
||||||
<input type="number" id="phone" name="phone" />
|
<div class="col-8">
|
||||||
</div>
|
<input type="text" id="phone" name="phone" value="@Model.Phone" />
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
</div>
|
||||||
<div class="col-4">E-mail</div>
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-4">E-mail</div>
|
||||||
<input type="text" name="email" id="email" />
|
<div class="col-8">
|
||||||
</div>
|
<input type="text" name="email" id="email" value="@Model.Email" />
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
</div>
|
||||||
<div class="col-8"></div>
|
<div class="row">
|
||||||
<div class="col-4">
|
<div class="col-8"></div>
|
||||||
<input type="submit" value="Обновить" class="btn btn-primary" />
|
<div class="col-4">
|
||||||
</div>
|
<input type="submit" value="Обновить" class="btn btn-primary" />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
@ -20,25 +20,38 @@
|
|||||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||||
<ul class="navbar-nav flex-grow-1">
|
<ul class="navbar-nav flex-grow-1">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Lawyers">Home</a>
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Lawyers">Юристы</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Lawyers">Юристы</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Hearings">Слушания</a>
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Hearings">Слушания</a>
|
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Consultations">Консультации</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Consultations">Консультации</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="PrivacyGuarantor">Личные данные</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ConsultationCase">Связывание</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="RegisterGuarantor">Регистрация</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="EnterGuarantor">Вход</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="LawyerConsultationToFile">Отчёт по слушаниям</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="LawyersToPdfFile">Отчёт по слушаниям</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Consultation" asp-action="TopConsultation">Топ по консультациям</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Hearing" asp-action="LawyerHearingCounts">Топ по слушаниям</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,6 +23,7 @@ namespace LawCompanyRestApi.Controllers
|
|||||||
_lawyerlogic = lawyerLogic;
|
_lawyerlogic = lawyerLogic;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public List<ConsultationViewModel>? GetConsultationList(int guarantorId)
|
public List<ConsultationViewModel>? GetConsultationList(int guarantorId)
|
||||||
{
|
{
|
||||||
@ -40,6 +41,26 @@ namespace LawCompanyRestApi.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public ConsultationViewModel? GetConsultation(int id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var elem = _logic.ReadElement(new ConsultationSearchModel { Id = id, });
|
||||||
|
if (elem == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
elem.ConsultationLawyers = null!;
|
||||||
|
return elem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения списка продуктов");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void CreateConsultation(ConsultationBindingModel model)
|
public void CreateConsultation(ConsultationBindingModel model)
|
||||||
{
|
{
|
||||||
|
@ -16,8 +16,7 @@ namespace LawCompanyRestApi.Controllers
|
|||||||
private readonly IHearingLogic _logic;
|
private readonly IHearingLogic _logic;
|
||||||
private readonly ILawyerLogic _lawyerlogic;
|
private readonly ILawyerLogic _lawyerlogic;
|
||||||
|
|
||||||
public HearingController(IHearingLogic logic, ILogger<HearingController>
|
public HearingController(IHearingLogic logic, ILogger<HearingController> logger, ILawyerLogic lawyerlogic)
|
||||||
logger, ILawyerLogic lawyerlogic)
|
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logic = logic;
|
_logic = logic;
|
||||||
|
@ -34,6 +34,20 @@ namespace LawCompanyRestApi.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("{id}")]
|
||||||
|
public LawyerViewModel? GetLawyerById(int id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _logic.ReadElement(new LawyerSearchModel { Id = id });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения данных клиента");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void CreateLawyer(LawyerBindingModel model)
|
public void CreateLawyer(LawyerBindingModel model)
|
||||||
{
|
{
|
||||||
|
@ -42,20 +42,6 @@ namespace HotelRestApi.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public void SendPdfToMail(MailSendInfoBindingModel model)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_mailWorker.MailSendAsync(model);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка отправки письма");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void CreateExecutorReportToWordFile(ReportExecutorBindingModel model)
|
public void CreateExecutorReportToWordFile(ReportExecutorBindingModel model)
|
||||||
{
|
{
|
||||||
@ -71,7 +57,7 @@ namespace HotelRestApi.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void CreateOrganiserReportToExcelFile(ReportExecutorBindingModel model)
|
public void CreateExecutorReportToExcelFile(ReportExecutorBindingModel model)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -84,12 +70,12 @@ namespace HotelRestApi.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*[HttpPost]
|
[HttpPost]
|
||||||
public void CreateHeadwaiterReportToWordFile(ReportHeadwaiterBindingModel model)
|
public void CreateGuarantorReportToWordFile(ReportGuarantorBindingModel model)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_reportHeadwaiterLogic.SaveLunchRoomToWordFile(model);
|
_reportGuarantorLogic.SaveLawyerHearingToWordFile(model);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -99,11 +85,11 @@ namespace HotelRestApi.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void CreateHeadwaiterReportToExcelFile(ReportHeadwaiterBindingModel model)
|
public void CreateGuarantorReportToExcelFile(ReportGuarantorBindingModel model)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_reportHeadwaiterLogic.SaveLunchRoomToExcelFile(model);
|
_reportGuarantorLogic.SaveLawyerHearingToExcelFile(model);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -113,16 +99,16 @@ namespace HotelRestApi.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void CreateHeadwaiterReportToPdfFile(ReportHeadwaiterBindingModel model)
|
public void CreateGuarantorReportToPdfFile(ReportGuarantorBindingModel model)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_reportHeadwaiterLogic.SaveLunchesToPdfFile(new ReportHeadwaiterBindingModel
|
_reportGuarantorLogic.SaveLawyersToPdfFile(new ReportGuarantorBindingModel
|
||||||
{
|
{
|
||||||
FileName = "C:\\Reports\\pdffile.pdf",
|
FileName = "C:\\Reports\\pdffile.pdf",
|
||||||
DateFrom = model.DateFrom,
|
DateFrom = model.DateFrom,
|
||||||
DateTo = model.DateTo,
|
DateTo = model.DateTo,
|
||||||
HeadwaiterId = model.HeadwaiterId,
|
GuarantorId = model.GuarantorId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -130,6 +116,20 @@ namespace HotelRestApi.Controllers
|
|||||||
_logger.LogError(ex, "Ошибка создания отчета");
|
_logger.LogError(ex, "Ошибка создания отчета");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void SendPdfToMail(MailSendInfoBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_mailWorker.MailSendAsync(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка отправки письма");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,12 +40,17 @@ namespace LawCompanyRestApi.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{id}")]
|
[HttpGet]
|
||||||
public VisitViewModel? GetVisit(int id)
|
public VisitViewModel GetVisit(int id)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return _logic.ReadElement(new VisitSearchModel { Id = id, });
|
var elem = _logic.ReadElement(new VisitSearchModel { Id = id, });
|
||||||
|
if (elem == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return elem;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -46,6 +46,10 @@ builder.Services.AddTransient<AbstractSaveToWordExecutor, SaveToWordExecutor>();
|
|||||||
builder.Services.AddTransient<AbstractSaveToExcelExecutor, SaveToExcelExecutor>();
|
builder.Services.AddTransient<AbstractSaveToExcelExecutor, SaveToExcelExecutor>();
|
||||||
builder.Services.AddTransient<AbstractSaveToPdfExecutor, SaveToPdfExecutor>();
|
builder.Services.AddTransient<AbstractSaveToPdfExecutor, SaveToPdfExecutor>();
|
||||||
|
|
||||||
|
builder.Services.AddTransient<AbstractSaveToWordGuarantor, SaveToWordGuarantor>();
|
||||||
|
builder.Services.AddTransient<AbstractSaveToExcelGuarantor, SaveToExcelGuarantor>();
|
||||||
|
builder.Services.AddTransient<AbstractSaveToPdfGuarantor, SaveToPdfGuarantor>();
|
||||||
|
|
||||||
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
|
Loading…
Reference in New Issue
Block a user