PIBD_21_Basalov_A_D_Project.../project/ProjectTourAgency/FormTourAgency.cs

76 lines
2.0 KiB
C#

using ProjectTourAgency.Forms;
using Unity;
namespace ProjectTourAgency;
public partial class FormTourAgency : Form
{
private readonly IUnityContainer _container;
public FormTourAgency(IUnityContainer container)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
}
private void ClientsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormClients>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ToursToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormTours>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ReceiptsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormReceipts>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void DiscountsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormDiscounts>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void CLientTourToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormClientTour>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}