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

94 lines
3.0 KiB
C#
Raw Normal View History

2023-03-29 20:00:53 +04:00
using BeautySaloonContracts.BusinessLogicsContracts;
2023-03-27 23:58:06 +04:00
namespace BeautySaloonView
{
2023-03-28 17:32:55 +04:00
public partial class FormMain : Form
2023-03-27 23:58:06 +04:00
{
2023-03-29 20:00:53 +04:00
private readonly IOrderLogic _orderLogic;
public FormMain(IOrderLogic orderLogic)
2023-03-27 23:58:06 +04:00
{
InitializeComponent();
2023-03-29 20:00:53 +04:00
_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, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 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();
}
2023-03-27 23:58:06 +04:00
}
2023-03-30 02:29:40 +04:00
private void ButtonTest_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormTest));
if (service is FormTest form)
{
form.ShowDialog();
}
}
2023-03-30 13:59:00 +04:00
private void ReportServicesToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportServices));
if (service is FormReportServices form)
{
form.ShowDialog();
}
}
2023-03-27 23:58:06 +04:00
}
}