Почти готово

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
.GetFilteredList(new HearingSearchModel { UserId = model.UserId })
.Where(x => model.DateFrom <= x.Date && model.DateTo >= x.Date)
.Select(hearing => new ReportHearingSpecializationViewModel
{
Information = hearing.Information,
@ -44,9 +45,13 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
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>();
foreach(var lawyer in lawyers)
@ -68,18 +73,6 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
list.Add(record);
}
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)

View File

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

View File

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