ПИбд-23 Ладягин П.Д. Первая л.р. #1

Open
F1rsTTeaM wants to merge 20 commits from LabWork01 into main
5 changed files with 152 additions and 54 deletions
Showing only changes of commit 93b8827935 - Show all commits

View File

@ -30,14 +30,14 @@
{
menuStrip = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem();
CarsToolStripMenuItem = new ToolStripMenuItem();
DriversToolStripMenuItem = new ToolStripMenuItem();
FuelToolStripMenuItem = new ToolStripMenuItem();
RoutesToolStripMenuItem = new ToolStripMenuItem();
операцииToolStripMenuItem = new ToolStripMenuItem();
RefillToolStripMenuItem = new ToolStripMenuItem();
TripToolStripMenuItem = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem();
машиныToolStripMenuItem = new ToolStripMenuItem();
водителиToolStripMenuItem = new ToolStripMenuItem();
топливоToolStripMenuItem = new ToolStripMenuItem();
маршрутыToolStripMenuItem = new ToolStripMenuItem();
заправкаToolStripMenuItem = new ToolStripMenuItem();
поездкаToolStripMenuItem = new ToolStripMenuItem();
menuStrip.SuspendLayout();
SuspendLayout();
//
@ -52,60 +52,66 @@
//
// справочникиToolStripMenuItem
//
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { машиныToolStripMenuItem, водителиToolStripMenuItem, топливоToolStripMenuItem, маршрутыToolStripMenuItem });
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CarsToolStripMenuItem, DriversToolStripMenuItem, FuelToolStripMenuItem, RoutesToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(94, 20);
справочникиToolStripMenuItem.Text = "Справочники";
//
// CarsToolStripMenuItem
//
CarsToolStripMenuItem.Name = "CarsToolStripMenuItem";
CarsToolStripMenuItem.Size = new Size(180, 22);
CarsToolStripMenuItem.Text = "Машины";
CarsToolStripMenuItem.Click += CarsToolStripMenuItem_Click;
//
// DriversToolStripMenuItem
//
DriversToolStripMenuItem.Name = "DriversToolStripMenuItem";
DriversToolStripMenuItem.Size = new Size(180, 22);
DriversToolStripMenuItem.Text = "Водители";
DriversToolStripMenuItem.Click += DriversToolStripMenuItem_Click;
//
// FuelToolStripMenuItem
//
FuelToolStripMenuItem.Name = "FuelToolStripMenuItem";
FuelToolStripMenuItem.Size = new Size(180, 22);
FuelToolStripMenuItem.Text = "Топливо";
FuelToolStripMenuItem.Click += FuelToolStripMenuItem_Click;
//
// RoutesToolStripMenuItem
//
RoutesToolStripMenuItem.Name = "RoutesToolStripMenuItem";
RoutesToolStripMenuItem.Size = new Size(180, 22);
RoutesToolStripMenuItem.Text = "Маршруты";
RoutesToolStripMenuItem.Click += RoutesToolStripMenuItem_Click;
//
// операцииToolStripMenuItem
//
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { заправкаToolStripMenuItem, поездкаToolStripMenuItem });
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { RefillToolStripMenuItem, TripToolStripMenuItem });
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
операцииToolStripMenuItem.Size = new Size(75, 20);
операцииToolStripMenuItem.Text = "Операции";
//
// RefillToolStripMenuItem
//
RefillToolStripMenuItem.Name = "RefillToolStripMenuItem";
RefillToolStripMenuItem.Size = new Size(180, 22);
RefillToolStripMenuItem.Text = "Заправка";
RefillToolStripMenuItem.Click += RefillToolStripMenuItem_Click;
//
// TripToolStripMenuItem
//
TripToolStripMenuItem.Name = "TripToolStripMenuItem";
TripToolStripMenuItem.Size = new Size(180, 22);
TripToolStripMenuItem.Text = "Поездка";
TripToolStripMenuItem.Click += TripToolStripMenuItem_Click;
//
// отчетыToolStripMenuItem
//
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(60, 20);
отчетыToolStripMenuItem.Text = "Отчеты";
//
// машиныToolStripMenuItem
//
машиныToolStripMenuItem.Name = ашиныToolStripMenuItem";
машиныToolStripMenuItem.Size = new Size(180, 22);
машиныToolStripMenuItem.Text = "Машины";
//
// водителиToolStripMenuItem
//
водителиToolStripMenuItem.Name = одителиToolStripMenuItem";
водителиToolStripMenuItem.Size = new Size(180, 22);
водителиToolStripMenuItem.Text = "Водители";
//
// топливоToolStripMenuItem
//
топливоToolStripMenuItem.Name = опливоToolStripMenuItem";
топливоToolStripMenuItem.Size = new Size(180, 22);
топливоToolStripMenuItem.Text = "Топливо";
//
// маршрутыToolStripMenuItem
//
маршрутыToolStripMenuItem.Name = аршрутыToolStripMenuItem";
маршрутыToolStripMenuItem.Size = new Size(180, 22);
маршрутыToolStripMenuItem.Text = "Маршруты";
//
// заправкаToolStripMenuItem
//
заправкаToolStripMenuItem.Name = аправкаToolStripMenuItem";
заправкаToolStripMenuItem.Size = new Size(180, 22);
заправкаToolStripMenuItem.Text = "Заправка";
//
// поездкаToolStripMenuItem
//
поездкаToolStripMenuItem.Name = "поездкаToolStripMenuItem";
поездкаToolStripMenuItem.Size = new Size(180, 22);
поездкаToolStripMenuItem.Text = "Поездка";
//
// FormFuelAndLubricants
//
AutoScaleDimensions = new SizeF(7F, 15F);
@ -128,13 +134,13 @@
private MenuStrip menuStrip;
private ToolStripMenuItem справочникиToolStripMenuItem;
private ToolStripMenuItem машиныToolStripMenuItem;
private ToolStripMenuItem водителиToolStripMenuItem;
private ToolStripMenuItem топливоToolStripMenuItem;
private ToolStripMenuItem маршрутыToolStripMenuItem;
private ToolStripMenuItem CarsToolStripMenuItem;
private ToolStripMenuItem DriversToolStripMenuItem;
private ToolStripMenuItem FuelToolStripMenuItem;
private ToolStripMenuItem RoutesToolStripMenuItem;
private ToolStripMenuItem операцииToolStripMenuItem;
private ToolStripMenuItem заправкаToolStripMenuItem;
private ToolStripMenuItem поездкаToolStripMenuItem;
private ToolStripMenuItem RefillToolStripMenuItem;
private ToolStripMenuItem TripToolStripMenuItem;
private ToolStripMenuItem отчетыToolStripMenuItem;
}
}

View File

@ -1,10 +1,102 @@
using FuelAndLubricants.Forms;
using Unity;
namespace FuelAndLubricants
{
public partial class FormFuelAndLubricants : Form
{
public FormFuelAndLubricants()
private readonly IUnityContainer _container;
public FormFuelAndLubricants(IUnityContainer container)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
}
private void CarsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormCars>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void DriversToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormDrivers>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FuelToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormFuels>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void RoutesToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormRoutes>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void RefillToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormRefills>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void TripToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormTrips>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

@ -22,7 +22,7 @@ namespace FuelAndLubricants
{
var container = new UnityContainer();
container.RegisterType<IRouteRepository, CarRepository>();
container.RegisterType<ICarRepository, CarRepository>();
container.RegisterType<IDriverRepository, DriverRepository>();
container.RegisterType<IFuelRepository, FuelRepository>();
container.RegisterType<IRefillRepository, RefillRepository>();

View File

@ -2,7 +2,7 @@
namespace FuelAndLubricants.Repositories.Implementations;
public class CarRepository : IRouteRepository
public class CarRepository : ICarRepository
{
public void CreateCar(Car car)
{

View File

@ -4,7 +4,7 @@ namespace FuelAndLubricants.Repositories.Implementations;
public class FuelRepository : IFuelRepository
{
public void CreateDriver(Fuel_And_Lubricants fuel)
public void CreateFuel(Fuel_And_Lubricants fuel)
{
}