45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
|
using Microsoft.Extensions.Logging;
|
|||
|
using SushiBarContracts.BusinessLogicsContracts;
|
|||
|
|
|||
|
namespace SushiBarView
|
|||
|
{
|
|||
|
public partial class FormMails : Form
|
|||
|
{
|
|||
|
private readonly ILogger logger;
|
|||
|
private readonly IMessageInfoLogic messageInfoLogic;
|
|||
|
public FormMails(ILogger<FormMails> logger, IMessageInfoLogic messageInfoLogic)
|
|||
|
{
|
|||
|
this.logger = logger;
|
|||
|
this.messageInfoLogic = messageInfoLogic;
|
|||
|
InitializeComponent();
|
|||
|
}
|
|||
|
|
|||
|
private void LoadData()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var list = messageInfoLogic.ReadList(null);
|
|||
|
if (list != null)
|
|||
|
{
|
|||
|
dataGridView.DataSource = list;
|
|||
|
dataGridView.Columns["ClientId"].Visible = false;
|
|||
|
dataGridView.Columns["MessageId"].Visible = false;
|
|||
|
dataGridView.Columns["Body"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|||
|
}
|
|||
|
logger.LogInformation("Load list of mails");
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK);
|
|||
|
logger.LogError("Load list of mails failed");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void FormMails_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
LoadData();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|