точно готовая 4 лаба

This commit is contained in:
a.puchkina 2024-04-10 10:56:44 +04:00
parent a014064ce1
commit 1b62d53fc4
7 changed files with 14 additions and 8 deletions

View File

@ -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
});

View File

@ -53,6 +53,7 @@ namespace TravelCompanyView
}
}
//1
private void ButtonSaveToExcel_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" };

View File

@ -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

View File

@ -14,6 +14,8 @@ namespace TravelCompanyBusinessLogic.OfficePackage
/// Создание отчета
/// </summary>
/// <param name="info"></param>
///
/// //3
public void CreateReport(ExcelInfo info)
{
CreateExcel(info);

View File

@ -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",

View File

@ -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();
}
}

View File

@ -25,7 +25,7 @@ namespace TravelCompanyContracts.BusinessLogicsContracts
/// Сохранение компонент в файл-Word
/// </summary>
/// <param name="model"></param>
void SaveComponentsToWordFile(ReportBindingModel model);
void SaveTravelsToWordFile(ReportBindingModel model);
/// <summary>
/// Сохранение компонент с указаеним продуктов в файл-Excel
/// </summary>