переписали запрос, не починили
This commit is contained in:
parent
30a3f088f7
commit
acf3f56871
@ -5,6 +5,7 @@ using CaseAccountingContracts.BusinessLogicContracts;
|
||||
using CaseAccountingContracts.SearchModels;
|
||||
using CaseAccountingContracts.StoragesContracts;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using CaseAccountingDataBaseImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -54,36 +55,25 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
|
||||
|
||||
public List<ReportLawyerHearingViewModel> GetLawyersHearing(List<LawyerViewModel> lawyers)
|
||||
{
|
||||
var reportRecords = new List<ReportLawyerHearingViewModel>();
|
||||
List <ReportLawyerHearingViewModel> list = new();
|
||||
foreach (var lawyer in lawyers)
|
||||
{
|
||||
var hearings = _lawyerStorage.GetLawyerCases(new() { Id = lawyer.Id })
|
||||
.SelectMany(_case => _caseStorage.GetCaseHearings(new() { Id = _case.Id }))
|
||||
.Select(hearing => hearing.Information)
|
||||
.ToList();
|
||||
ReportLawyerHearingViewModel reportRecord = new()
|
||||
ReportLawyerHearingViewModel report = new ReportLawyerHearingViewModel
|
||||
{
|
||||
Lawyer = lawyer.Name + " " + lawyer.Surname + ", " + lawyer.Patronymic,
|
||||
Hearings = hearings
|
||||
Lawyer = lawyer.Surname + " " + lawyer.Name + " " + lawyer.Patronymic,
|
||||
Hearings = new()
|
||||
};
|
||||
reportRecords.Add(reportRecord);
|
||||
}
|
||||
return reportRecords;
|
||||
}
|
||||
|
||||
public void SaveHearingSpecializationToPdfFile(ReportBindingModel model)
|
||||
var cases = _caseStorage.GetCaseMTM(lawyer.Id);
|
||||
foreach (var caseModel in cases)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SaveLawyerHearingToExcelFile(ReportBindingModel model)
|
||||
foreach (var hearing in _hearingStorage.GetFilteredList(new HearingSearchModel { CaseId = caseModel.Id }))
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
report.Hearings.Add("Номер слушания: " + hearing.Id.ToString());
|
||||
}
|
||||
|
||||
public void SaveLawyerHearingToWordFile(ReportBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
list.Add(report);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public byte[] SaveListFile(LawyerHearingListBindingModel model)
|
||||
|
@ -15,11 +15,5 @@ namespace CaseAccountingContracts.BusinessLogicContracts
|
||||
List<ReportHearingSpecializationViewModel> GetHearingSpecialization(ReportBindingModel model);
|
||||
|
||||
byte[] SaveListFile(LawyerHearingListBindingModel model);
|
||||
|
||||
void SaveLawyerHearingToWordFile(ReportBindingModel model);
|
||||
|
||||
void SaveLawyerHearingToExcelFile(ReportBindingModel model);
|
||||
|
||||
void SaveHearingSpecializationToPdfFile(ReportBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace CaseAccountingContracts.StoragesContracts
|
||||
CaseViewModel? Update(CaseBindingModel model);
|
||||
CaseViewModel? Delete(CaseBindingModel model);
|
||||
|
||||
List<HearingViewModel> GetCaseHearings(CaseSearchModel model);
|
||||
List<CaseViewModel> GetCaseMTM(int lawyerId);
|
||||
List<SpecializationCasesViewModel>? GetSpecializationCases();
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,10 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="wwwroot\js\Report\reportlist.js~RF3ae78116.TMP" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
@ -102,14 +102,14 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public int[]? SpecializationCaselist([FromBody] LawyerHearingListBindingModel listModel)
|
||||
public int[]? HearingLawyerlist([FromBody] LawyerHearingListBindingModel listModel)
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
return Array.Empty<int>();
|
||||
}
|
||||
byte[]? file = APIUser.PostRequestWithResult<LawyerHearingListBindingModel, byte[]>
|
||||
("api/reportprovider/specializationcaselist", listModel);
|
||||
("api/reportcustomer/lawyerhearinglist", listModel);
|
||||
return file!.Select(b => (int)b).ToArray();
|
||||
}
|
||||
|
||||
|
@ -7,15 +7,31 @@ var dataArray = [];
|
||||
const wordMIME = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
||||
const excelMIME = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
$.ajax({
|
||||
url: "/lawyers/getallbyuser",
|
||||
window.addEventListener('load', async () => {
|
||||
try {
|
||||
await $.ajax({
|
||||
url: `/lawyers/getallbyuser`,
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
lawyers = result;
|
||||
lawyers.forEach((lawyer) => createRowForLawyersTable(lawyer));
|
||||
lawyers.forEach((lawyerModel) => {
|
||||
const { id, name, surname, patronymic, experience, specialization } = lawyerModel;
|
||||
const row = tbody.insertRow();
|
||||
row.setAttribute("data-id", id);
|
||||
|
||||
const cells = [name, surname, patronymic, experience, specialization];
|
||||
cells.forEach((value) => {
|
||||
const cell = row.insertCell();
|
||||
cell.textContent = value;
|
||||
});
|
||||
|
||||
row.addEventListener('click', () => addAndRemoveFromList(row));
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
})
|
||||
|
||||
createBtn.addEventListener('click', () => {
|
||||
@ -23,7 +39,6 @@ createBtn.addEventListener('click', () => {
|
||||
"Lawyers": Array.from(dataArray),
|
||||
"FileType": fileType.value
|
||||
};
|
||||
console.log(listModel);
|
||||
$.ajax({
|
||||
url: "/home/hearinglawyerlist",
|
||||
type: "POST",
|
||||
@ -61,38 +76,16 @@ const saveFile = async function (bytes, fileType) {
|
||||
}
|
||||
}
|
||||
|
||||
const createRowForLawyersTable = (lawyer) => {
|
||||
const { id, name, surname, patronymic, experience, specialization } = lawyer;
|
||||
const row = tbody.insertRow();
|
||||
row.setAttribute("data-id", id);
|
||||
|
||||
const cells = [name, surname, patronymic, experience, specialization ];
|
||||
cells.forEach((value) => {
|
||||
const cell = row.insertCell();
|
||||
cell.textContent = value;
|
||||
});
|
||||
|
||||
row.addEventListener('click', () => addAndRemoveFromList(row));
|
||||
};
|
||||
|
||||
const formatDate = (dateString) => {
|
||||
const date = new Date(dateString);
|
||||
const year = date.getFullYear();
|
||||
const month = ('0' + (date.getMonth() + 1)).slice(-2);
|
||||
const day = ('0' + date.getDate()).slice(-2);
|
||||
return `${year}-${month}-${day}`;
|
||||
};
|
||||
|
||||
const addAndRemoveFromList = (row) => {
|
||||
var id = parseInt(row.dataset.id);
|
||||
console.log(lawyers.find(x => x.id === id))
|
||||
var index = dataArray.indexOf(lawyers.find(x => x.id === id));
|
||||
if (index === -1) {
|
||||
dataArray.push(lawyers.find(x => x.id === id));
|
||||
row.classList.add("bg-success");
|
||||
row.classList.add("bg-info");
|
||||
} else {
|
||||
dataArray.splice(index, 1);
|
||||
row.classList.remove("bg-success");
|
||||
row.classList.remove("bg-info");
|
||||
}
|
||||
console.log(dataArray);
|
||||
}
|
@ -171,18 +171,18 @@ namespace CaseAccountingDataBaseImplement.Implements
|
||||
}
|
||||
}
|
||||
|
||||
public List<HearingViewModel> GetCaseHearings(CaseSearchModel model)
|
||||
public List<CaseViewModel> GetCaseMTM(int lawyerId)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new CaseAccountingDatabase();
|
||||
var hearings = context.Hearings
|
||||
.Where(x => x.CaseId == model.Id)
|
||||
var lawyersId = context.CaseLawyers
|
||||
.Where(x => x.LawyerId == lawyerId)
|
||||
.Select(x => x.CaseId).ToList();
|
||||
return context.Cases
|
||||
.Include(x => x.Specialization)
|
||||
.Include(x => x.User)
|
||||
.Where(X => lawyersId.Contains(X.Id))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
return hearings;
|
||||
}
|
||||
|
||||
public List<SpecializationCasesViewModel>? GetSpecializationCases()
|
||||
|
@ -53,7 +53,7 @@ namespace CaseAccountingProviderView.Controllers
|
||||
return Array.Empty<int>();
|
||||
}
|
||||
byte[]? file = APIUser.PostRequestWithResult<CaseSpecializationListBindingModel, byte[]>
|
||||
("api/reportcustomer/lawyerhearinglist", listModel);
|
||||
("api/reportprovider/specializationcaselist", listModel);
|
||||
return file!.Select(b => (int)b).ToArray();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user