ISEbd-22_Rozhkov.I.E._Simple/GasStation/FormGasstation.cs

115 lines
3.5 KiB
C#

using GasStation.Forms;
using GasStation.Reports;
using Unity;
namespace GasStation
{
public partial class FormGasStation : System.Windows.Forms.Form
{
private readonly IUnityContainer _container;
public FormGasStation(IUnityContainer container)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
}
private void GasmanToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormGasmen>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè äîáàâëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void SupplierToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormSuppliers>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè äîáàâëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ProductToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormProducts>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè äîáàâëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void SupplyToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormSupplies>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè äîáàâëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void SellingToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormSellings>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè äîáàâëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void DirectoryReportToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormDirectoryReport>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè äîáàâëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ProductReportToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormProductReport>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè äîáàâëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ProductDistToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormSupplyDistRep>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè äîáàâëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}