ISEbd-21_Melnikov_I.O._CarS.../CarService/CarServiceView/FormWorkTest.cs

48 lines
1000 B
C#

using CarServiceContracts.BusinessLogicsContracts;
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 CarServiceView
{
public partial class FormWorkTest : Form
{
IWorkLogic _workLogic;
public FormWorkTest(IWorkLogic workLogic)
{
_workLogic = workLogic;
InitializeComponent();
}
private void FormWorkTest_Load(object sender, EventArgs e)
{
LoadData();
}
private void LoadData()
{
var list = _workLogic.ReadList(null);
dataGridView.DataSource = list;
}
private void addToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormAddWorkTest));
if (service is FormAddWorkTest form)
{
form.ShowDialog();
LoadData();
}
}
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
}
}
}