точно готовая 4 лаба
This commit is contained in:
parent
a014064ce1
commit
1b62d53fc4
@ -162,7 +162,7 @@ namespace TravelCompanyView
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel
|
||||
_reportLogic.SaveTravelsToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = dialog.FileName
|
||||
});
|
||||
|
@ -53,6 +53,7 @@ namespace TravelCompanyView
|
||||
}
|
||||
}
|
||||
|
||||
//1
|
||||
private void ButtonSaveToExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" };
|
||||
|
@ -75,15 +75,16 @@ namespace TravelCompanyBusinessLogic.BusinessLogic
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public void SaveComponentsToWordFile(ReportBindingModel model)
|
||||
public void SaveTravelsToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список компонентов",
|
||||
Components = _componentStorage.GetFullList()
|
||||
Title = "Список изделий",
|
||||
Travels = _TravelStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
//2
|
||||
public void SaveTravelComponentToExcelFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
|
@ -14,6 +14,8 @@ namespace TravelCompanyBusinessLogic.OfficePackage
|
||||
/// Создание отчета
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
///
|
||||
/// //3
|
||||
public void CreateReport(ExcelInfo info)
|
||||
{
|
||||
CreateExcel(info);
|
||||
|
@ -22,11 +22,13 @@ namespace TravelCompanyBusinessLogic.OfficePackage
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
foreach (var component in info.Components)
|
||||
foreach (var component in info.Travels)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (component.ComponentName, new WordTextProperties { Size = "24", }) },
|
||||
Texts = new List<(string, WordTextProperties)> { (component.TravelName, new WordTextProperties { Size = "24", Bold = true }),
|
||||
(" стоит " + component.Price.ToString() + " рубликов", new WordTextProperties { Size = "24"})
|
||||
},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
|
@ -11,6 +11,6 @@ namespace TravelCompanyBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ComponentViewModel> Components { get; set; } = new();
|
||||
public List<TravelViewModel> Travels { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace TravelCompanyContracts.BusinessLogicsContracts
|
||||
/// Сохранение компонент в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveComponentsToWordFile(ReportBindingModel model);
|
||||
void SaveTravelsToWordFile(ReportBindingModel model);
|
||||
/// <summary>
|
||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user