using BeautySaloonContracts.BusinessLogicsContracts; namespace BeautySaloonView { public partial class FormMain : Form { private readonly IOrderLogic _orderLogic; public FormMain(IOrderLogic orderLogic) { InitializeComponent(); _orderLogic = orderLogic; } private void FormMain_Load(object sender, EventArgs e) { LoadData(); } private void LoadData() { try { var list = _orderLogic.ReadList(null); if (list != null) { dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView.DataSource = list; dataGridView.Columns["ClientId"].Visible = false; dataGridView.Columns["EmployeeId"].Visible = false; dataGridView.Columns["OrderServices"].Visible = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void ButtonRef_Click(object sender, EventArgs e) { LoadData(); } private void PositionsToolStripMenuItem_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormPositions)); if (service is FormPositions form) { form.ShowDialog(); } } private void ServicesToolStripMenuItem_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormServices)); if (service is FormServices form) { form.ShowDialog(); } } private void EmployeesToolStripMenuItem_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormEmployees)); if (service is FormEmployees form) { form.ShowDialog(); } } private void ClientsToolStripMenuItem_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormClients)); if (service is FormClients form) { form.ShowDialog(); } } private void ButtonTest_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormTest)); if (service is FormTest form) { form.ShowDialog(); } } } }