SUBD_PIbd-21_Balberova_D.N./BeautySaloon/BeautySaloonView/FormReportServices.cs

37 lines
1.0 KiB
C#
Raw Normal View History

2023-03-30 13:59:00 +04:00
using BeautySaloonContracts.BusinessLogicsContracts;
using BeautySaloonContracts.SearchModels;
using System.Windows.Forms;
namespace BeautySaloonView
{
public partial class FormReportServices : Form
{
private readonly IServiceLogic _logic;
public FormReportServices(IServiceLogic logic)
{
InitializeComponent();
_logic = logic;
}
private void FormReportServices_Load(object sender, EventArgs e)
{
LoadData();
}
private void LoadData()
{
try
{
var list = _logic.ReadMostPopular();
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}