Почти готово

This commit is contained in:
maxnes3 2023-04-09 01:01:14 +04:00
parent 7c2a4062fd
commit aca649edf0
7 changed files with 77 additions and 34 deletions

View File

@ -30,6 +30,7 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
{ {
var result = _hearingStorage var result = _hearingStorage
.GetFilteredList(new HearingSearchModel { UserId = model.UserId }) .GetFilteredList(new HearingSearchModel { UserId = model.UserId })
.Where(x => model.DateFrom <= x.Date && model.DateTo >= x.Date)
.Select(hearing => new ReportHearingSpecializationViewModel .Select(hearing => new ReportHearingSpecializationViewModel
{ {
Information = hearing.Information, Information = hearing.Information,
@ -44,9 +45,13 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
return result; return result;
} }
public List<ReportLawyerHearingViewModel> GetLawyerHearing(ReportBindingModel model) public List<ReportLawyerHearingViewModel> GetLawyerHearing(List<LawyerViewModel> models)
{ {
var lawyers = _lawyerStorage.GetFilteredList(new LawyerSearchModel { UserId = model.UserId }); var lawyers = new List<LawyerViewModel>();
foreach (var model in models)
{
lawyers.Add(_lawyerStorage.GetElement(new LawyerSearchModel { Id = model.Id}));
}
var list = new List<ReportLawyerHearingViewModel>(); var list = new List<ReportLawyerHearingViewModel>();
foreach(var lawyer in lawyers) foreach(var lawyer in lawyers)
@ -68,18 +73,6 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
list.Add(record); list.Add(record);
} }
return list; return list;
/* var result = _lawyerStorage
.GetFilteredList(new LawyerSearchModel { UserId = model.UserId })
.Select(lawyer => new ReportLawyerHearingViewModel
{
Name = lawyer.Name,
Surname = lawyer.Surname,
Patronymic = lawyer.Patronymic,
Hearings = new List<(DateTime Date, string Information)>()
})
.ToList();
return result;*/
} }
public void SaveHearingSpecializationToPdfFile(ReportBindingModel model) public void SaveHearingSpecializationToPdfFile(ReportBindingModel model)

View File

@ -1,5 +1,6 @@
using CaseAccountingContracts.BindingModels; using CaseAccountingContracts.BindingModels;
using CaseAccountingContracts.BusinessLogicContracts; using CaseAccountingContracts.BusinessLogicContracts;
using CaseAccountingContracts.SearchModels;
using CaseAccountingContracts.StoragesContracts; using CaseAccountingContracts.StoragesContracts;
using CaseAccountingContracts.ViewModels; using CaseAccountingContracts.ViewModels;
using System; using System;
@ -25,46 +26,59 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
_lawyerStorage = lawyerStorage ?? throw new ArgumentNullException(nameof(lawyerStorage)); _lawyerStorage = lawyerStorage ?? throw new ArgumentNullException(nameof(lawyerStorage));
} }
public List<ReportCaseSpecializationViewModel> GetCaseSpecialization() public List<ReportCaseSpecializationViewModel> GetCaseSpecialization(List<CaseViewModel> models)
{ {
var сases = _caseStorage.GetFullList(); var сases = new List<CaseViewModel>();
var list = new List<ReportCaseSpecializationViewModel>(); foreach (var model in models)
foreach (var c in сases) сases.Add(_caseStorage.GetElement(new CaseSearchModel { Id = model.Id }));
{ return сases.Select(x => new ReportCaseSpecializationViewModel {
var report = new ReportCaseSpecializationViewModel CaseName = x.Name,
{ Applicant = x.Applicant,
CaseName = c.Name, Defendant = x.Defendant,
Applicant = c.Applicant, Date = x.Date,
Defendant = c.Defendant, Specialization = x.Specialization,
Date = c.Date, }).ToList();
Specialization = c.Specialization,
};
list.Add(report);
}
return list;
} }
public List<ReportHearingLawyerViewModel> GetHearingLawyer(ReportBindingModel model) public List<ReportHearingLawyerViewModel> GetHearingLawyer(ReportBindingModel model)
{ {
var hearings = _hearingStorage.GetFullList(); var hearings = _hearingStorage
var lawyers = _lawyerStorage.GetFullList(); .GetFilteredList(new HearingSearchModel { UserId = model.UserId})
.Where(x => model.DateFrom <= x.Date && model.DateTo >= x.Date);
var list = new List<ReportHearingLawyerViewModel>(); var list = new List<ReportHearingLawyerViewModel>();
foreach (var hearing in hearings)
{
var record = new ReportHearingLawyerViewModel
{
Information = hearing.Information,
Date = hearing.Date,
Lawyers = new List<(string Surname, string Name, string Patronymic)>()
};
foreach (var lawyer in _caseStorage.GetElement(new CaseSearchModel { Id = hearing.CaseId }).Lawyers.Values)
{
record.Lawyers.Add((lawyer.Surname, lawyer.Name, lawyer.Patronymic));
}
list.Add(record);
}
return list; return list;
} }
public void SaveCaseSpecializationToExcelFile(ReportBindingModel model) public void SaveCaseSpecializationToExcelFile(ReportBindingModel model)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
//TODO
} }
public void SaveCaseSpecializationToWordFile(ReportBindingModel model) public void SaveCaseSpecializationToWordFile(ReportBindingModel model)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
//TODO
} }
public void SaveHearingLawyerToPdfFile(ReportBindingModel model) public void SaveHearingLawyerToPdfFile(ReportBindingModel model)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
//TODO
} }
} }
} }

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaseAccountingBusinessLogic.OfficePackage
{
public class AbstractSaveToExcelProvider
{
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaseAccountingBusinessLogic.OfficePackage
{
public class AbstractSaveToPdfProvider
{
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaseAccountingBusinessLogic.OfficePackage
{
public class AbstractSaveToWordProvider
{
}
}

View File

@ -10,7 +10,7 @@ namespace CaseAccountingContracts.BusinessLogicContracts
{ {
public interface IReportCustomerLogic public interface IReportCustomerLogic
{ {
List<ReportLawyerHearingViewModel> GetLawyerHearing(ReportBindingModel model); List<ReportLawyerHearingViewModel> GetLawyerHearing(List<LawyerViewModel> models);
List<ReportHearingSpecializationViewModel> GetHearingSpecialization(ReportBindingModel model); List<ReportHearingSpecializationViewModel> GetHearingSpecialization(ReportBindingModel model);

View File

@ -10,7 +10,7 @@ namespace CaseAccountingContracts.BusinessLogicContracts
{ {
public interface IReportProviderLogic public interface IReportProviderLogic
{ {
List<ReportCaseSpecializationViewModel> GetCaseSpecialization(); List<ReportCaseSpecializationViewModel> GetCaseSpecialization(List<CaseViewModel> models);
List<ReportHearingLawyerViewModel> GetHearingLawyer(ReportBindingModel model); List<ReportHearingLawyerViewModel> GetHearingLawyer(ReportBindingModel model);