ворд и эксель
This commit is contained in:
parent
fa99a0d913
commit
1d592d32ad
@ -131,9 +131,9 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<ReportVisitLawyerViewModel> GetVisitLawyer(ReportBindingModel model)
|
||||
public List<ReportVisitLawyerViewModel> GetVisitLawyer(ReportVisitLawyerBindingModel model)
|
||||
{
|
||||
var list = new List<ReportVisitLawyerViewModel>();
|
||||
/*var list = new List<ReportVisitLawyerViewModel>();
|
||||
var lawyers = _lawyerStorage.GetFilteredList(new LawyerSearchModel
|
||||
{
|
||||
Id = model.LawyerId
|
||||
@ -165,6 +165,35 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
}
|
||||
list.Add(record);
|
||||
}
|
||||
return list;*/
|
||||
|
||||
var lawyers = _lawyerStorage.GetFilteredList(new LawyerSearchModel { Id = model.LawyerId });
|
||||
var hearings = _hearingStorage.GetFilteredList(new HearingSearchModel { GuarantorId = model.GuarantorId });
|
||||
var visits = _visitStorage.GetFullList();
|
||||
|
||||
var list = new List<ReportVisitLawyerViewModel>();
|
||||
foreach (var lawyer in lawyers)
|
||||
{
|
||||
var record = new ReportVisitLawyerViewModel
|
||||
{
|
||||
LawyerFIO = lawyer.FIO,
|
||||
};
|
||||
foreach (var hear in hearings)
|
||||
{
|
||||
if (hear.HearingLawyers.ContainsKey(lawyer.Id))
|
||||
{
|
||||
foreach (var vis in visits)
|
||||
{
|
||||
if (vis.HearingId.Equals(hear.Id))
|
||||
{
|
||||
record.VisitDate = vis.VisitDate;
|
||||
record.Visits.Add(new(vis.Id, vis.VisitDate));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
list.Add(record);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -244,7 +273,7 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveVisitLawyerToWordFile(ReportBindingModel model)
|
||||
public void SaveVisitLawyerToWordFile(ReportVisitLawyerBindingModel model)
|
||||
{
|
||||
_saveToWordVisitLawyer.CreateDoc(new WordVisitLawyerInfo
|
||||
{
|
||||
@ -254,7 +283,7 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveVisitLawyerToExcelFile(ReportBindingModel model)
|
||||
public void SaveVisitLawyerToExcelFile(ReportVisitLawyerBindingModel model)
|
||||
{
|
||||
_saveToExcelVisitLawyer.CreateReport(new ExcelVisitsLawyerInfo
|
||||
{
|
||||
|
@ -19,31 +19,61 @@ namespace LawFirmBusinessLogic.OfficePackages
|
||||
Text = info.Title,
|
||||
StyleInfo = ExcelStyleInfoType.Title
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 2,
|
||||
Text = "Юрист",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = 2,
|
||||
Text = "Номер визита",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = 2,
|
||||
Text = "Дата визита",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "C1"
|
||||
});
|
||||
uint rowIndex = 2;
|
||||
uint rowIndex = 4;
|
||||
|
||||
foreach (var vl in info.VisitLawyer)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = vl.LawyerName,
|
||||
Text = vl.LawyerFIO,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
foreach (var hearing in vl.Visits)
|
||||
foreach (var visit in vl.Visits)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = hearing.ToString(),
|
||||
Text = visit.Id.ToString(),
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
ExcelStyleInfoType.Text
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = visit.VisitDate.ToString(),
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -21,16 +21,21 @@ namespace LawFirmBusinessLogic.OfficePackages
|
||||
});
|
||||
foreach (var visitLawyer in info.VisitLawyer)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
foreach (var visit in visitLawyer.Visits)
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> {
|
||||
(visitLawyer.LawyerName, new WordTextProperties { Size = "24", Bold=true}), (" " + visitLawyer.Visits.ToString(), new WordTextProperties { Size = "24"})},
|
||||
TextProperties = new WordTextProperties
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
Texts = new List<(string, WordTextProperties)> {
|
||||
(visitLawyer.LawyerFIO, new WordTextProperties { Size = "24", Bold=true}),
|
||||
(" Номер визита: " + visit.Id.ToString(), new WordTextProperties { Size = "24"}),
|
||||
(" Дата визита: " + visit.VisitDate.ToString(), new WordTextProperties { Size = "24"})},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
SaveWord(info);
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
using LawFirmContracts.ViewModels;
|
||||
|
||||
namespace LawFirmContracts.BindingModels
|
||||
{
|
||||
public class ReportVisitLawyerBindingModel
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public int? LawyerId { get; set; }
|
||||
public int? GuarantorId { get; set; }
|
||||
}
|
||||
}
|
@ -7,13 +7,13 @@ namespace LawFirmContracts.BusinessLogicContracts
|
||||
{
|
||||
List<ReportClientsConsultationViewModel> GetClientsConsultation(ReportBindingModel model);
|
||||
List<ReportClientsViewModel> GetGetClients(ReportBindingModel model);
|
||||
List<ReportVisitLawyerViewModel> GetVisitLawyer(ReportBindingModel model);
|
||||
List<ReportVisitLawyerViewModel> GetVisitLawyer(ReportVisitLawyerBindingModel model);
|
||||
List<ReportConsultationHearingViewModel> GetConsultationHearing(ReportConsultationHearingBindingModel model);
|
||||
|
||||
void SaveClientsConsultationToWordFile(ReportBindingModel model);
|
||||
void SaveClientsConsultationToExcelFile(ReportBindingModel model);
|
||||
void SaveVisitLawyerToWordFile(ReportBindingModel model);
|
||||
void SaveVisitLawyerToExcelFile(ReportBindingModel model);
|
||||
void SaveVisitLawyerToWordFile(ReportVisitLawyerBindingModel model);
|
||||
void SaveVisitLawyerToExcelFile(ReportVisitLawyerBindingModel model);
|
||||
void SaveConsultationHearingToPdfFile(ReportConsultationHearingBindingModel model);
|
||||
void SaveClientsToPdfFile(ReportBindingModel model);
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
{
|
||||
public class ReportVisitLawyerViewModel
|
||||
{
|
||||
public string LawyerName { get; set; } = string.Empty;
|
||||
public List<DateTime> Visits { get; set; } = new();
|
||||
public string LawyerFIO { get; set; } = string.Empty;
|
||||
public DateTime? VisitDate { get; set; }
|
||||
public List<(int Id, DateTime VisitDate)> Visits { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -42,11 +42,11 @@ namespace LawFirmRestApi.Controllers
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void SaveVisitLawyerToWordFile(ReportBindingModel report)
|
||||
public void SaveVisitLawyerToWordFile(ReportVisitLawyerBindingModel report)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportLogic.SaveVisitLawyerToWordFile(new ReportBindingModel { GuarantorId = report.GuarantorId, FileName = "D:\\CourseWork\\wordVisitLawyerReport.docx", ClientId = report.ClientId });
|
||||
_reportLogic.SaveVisitLawyerToWordFile(new ReportVisitLawyerBindingModel { GuarantorId = report.GuarantorId, FileName = "D:\\CourseWork\\wordVisitLawyerReport.docx", LawyerId = report.LawyerId });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -55,11 +55,11 @@ namespace LawFirmRestApi.Controllers
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void SaveVisitLawyerToExcelFile(ReportBindingModel report)
|
||||
public void SaveVisitLawyerToExcelFile(ReportVisitLawyerBindingModel report)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportLogic.SaveVisitLawyerToExcelFile(new ReportBindingModel { GuarantorId = report.GuarantorId, FileName = "D:\\CourseWork\\excelVisitLawyerReport.xlsx", ClientId = report.ClientId });
|
||||
_reportLogic.SaveVisitLawyerToExcelFile(new ReportVisitLawyerBindingModel { GuarantorId = report.GuarantorId, FileName = "D:\\CourseWork\\excelVisitLawyerReport.xlsx", LawyerId = report.LawyerId });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user