PIbd-21_Abakarov_A.A_Repair.../ProjectRepairWork/FormRepairWork.cs
2024-12-24 17:10:38 +04:00

137 lines
4.2 KiB
C#

using ProjectRepairWork.Forms;
using System.ComponentModel;
using Unity;
namespace ProjectRepairWork
{
public partial class FormRepairWork : Form
{
private readonly IUnityContainer _container;
public FormRepairWork(IUnityContainer container)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
}
private void WorksToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormWorks>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void CostToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormCosts>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void PremisesToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormPremises>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ContractorsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormContractors>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void RepairToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormRepairs>().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 BuildingMaterialsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormBuildingMaterials>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void MaterialProcurementToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormMaterialProcurements>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ContractorReportToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormRepairReport>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ReceiptMaterialsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormMaterialsReport>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}