SUBD_PIbd-21_Balberova_D.N./BeautySaloon/BeautySaloonView/FormMain.cs
2023-03-29 20:00:53 +04:00

76 lines
2.4 KiB
C#

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();
}
}
}
}