using AircraftPlantContracts.BindingModels;
using AircraftPlantContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AircraftPlantView
{
///
/// Форма формирования отчета по изделиям с расшифровкой по компонентам
///
public partial class FormReportPlaneComponents : Form
{
///
/// Логгер
///
private readonly ILogger _logger;
///
/// Взаимодействие с отчетами
///
private readonly IReportLogic _logic;
///
/// Конструктор
///
public FormReportPlaneComponents(ILogger logger, IReportLogic logic)
{
InitializeComponent();
_logger = logger;
_logic = logic;
}
///
/// Загрузка данных
///
///
///
private void FormReportPlaneComponents_Load(object sender, EventArgs e)
{
try
{
var dict = _logic.GetPlaneComponents();
if (dict != null)
{
dataGridView.Rows.Clear();
foreach (var elem in dict)
{
dataGridView.Rows.Add(new object[] { elem.PlaneName, "", "" });
foreach (var listElem in elem.Components)
{
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
}
dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
dataGridView.Rows.Add(Array.Empty