Лабораторная работа №1 (Изменение)
This commit is contained in:
parent
aa568544d4
commit
36793fef25
@ -1,6 +1,9 @@
|
||||
using ProjectAutoenterprise.Entities.Enums;
|
||||
namespace ProjectAutoenterprise.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Сущность-справочник "Автобус"
|
||||
/// </summary>
|
||||
public class Bus
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
namespace ProjectAutoenterprise.Entities;
|
||||
namespace ProjectAutoenterprise.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Сущность-операция "Ремонт автобуса"
|
||||
/// </summary>
|
||||
public class BusRepair
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
@ -1,6 +1,9 @@
|
||||
using ProjectAutoenterprise.Entities.Enums;
|
||||
namespace ProjectAutoenterprise.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Сущность-справочник "Работник"
|
||||
/// </summary>
|
||||
public class Employee
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
@ -9,8 +12,7 @@ public class Employee
|
||||
public DateTime BirthDate { get; private set; }
|
||||
public EmployeePost EmployeePost { get; private set; }
|
||||
|
||||
public static Employee CreateEntity(int id, string firstName, string lastName, DateTime birthDate,
|
||||
EmployeePost employeePost)
|
||||
public static Employee CreateEntity(int id, string firstName, string lastName, DateTime birthDate, EmployeePost employeePost)
|
||||
{
|
||||
return new Employee
|
||||
{
|
||||
|
@ -1,5 +1,8 @@
|
||||
namespace ProjectAutoenterprise.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Сущность-операция "Маршрутный лист"
|
||||
/// </summary>
|
||||
public class Itinerary
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
@ -10,7 +13,7 @@ public class Itinerary
|
||||
public DateTime ItineraryDate { get; private set; }
|
||||
public string Description { get; private set; } = string.Empty;
|
||||
|
||||
public static Itinerary CreateEntity(int id, int busId, int conductorID, DateTime itineraryDate, string description,
|
||||
public static Itinerary CreateOperation(int id, int busId, int driverId, int conductorId, DateTime itineraryDate, string description,
|
||||
IEnumerable<ItineraryRoute> itineraryRoute)
|
||||
{
|
||||
return new Itinerary
|
||||
@ -18,9 +21,10 @@ public class Itinerary
|
||||
Id = id,
|
||||
BusId = busId,
|
||||
ItineraryRoute = itineraryRoute,
|
||||
ConductorId = conductorID,
|
||||
DriverId = driverId,
|
||||
ConductorId = conductorId,
|
||||
ItineraryDate = itineraryDate,
|
||||
Description = description
|
||||
Description = description ?? string.Empty
|
||||
};
|
||||
}
|
||||
}
|
@ -1,12 +1,19 @@
|
||||
namespace ProjectAutoenterprise.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Сущность-элемент "Маршрутный лист - Маршрут" реализующий связь многие ко многим между сущностями "Маршрутный лист" и "Маршрут"
|
||||
/// </summary>
|
||||
public class ItineraryRoute
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int ItineraryId { get; private set; }
|
||||
public int RouteId { get; private set; }
|
||||
|
||||
public static ItineraryRoute CreateElement(int id, int routeId)
|
||||
public static ItineraryRoute CreateElement(int itineraryId, int routeId)
|
||||
{
|
||||
return new ItineraryRoute { Id = id, RouteId = routeId };
|
||||
return new ItineraryRoute
|
||||
{
|
||||
ItineraryId = itineraryId,
|
||||
RouteId = routeId
|
||||
};
|
||||
}
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
namespace ProjectAutoenterprise.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Сущность-справочник "Маршрут"
|
||||
/// </summary>
|
||||
public class Route
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
@ -11,8 +14,8 @@ public class Route
|
||||
return new Route
|
||||
{
|
||||
Id = id,
|
||||
BeginRoutePoint = beginRoutePoint,
|
||||
EndRoutePoint = endRoutePoint
|
||||
BeginRoutePoint = beginRoutePoint ?? string.Empty,
|
||||
EndRoutePoint = endRoutePoint ?? string.Empty
|
||||
};
|
||||
}
|
||||
}
|
@ -30,19 +30,19 @@
|
||||
{
|
||||
menuStrip1 = new MenuStrip();
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
ToolStripMenuItemItineraries = new ToolStripMenuItem();
|
||||
ToolStripMenuItemRoutes = new ToolStripMenuItem();
|
||||
ToolStripMenuItemEmployees = new ToolStripMenuItem();
|
||||
ToolStripMenuItemBuses = new ToolStripMenuItem();
|
||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
||||
ToolStripMenuItemOperation = new ToolStripMenuItem();
|
||||
ToolStripMenuItemBusRepairs = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
ToolStripMenuItemCreatreItinerary = new ToolStripMenuItem();
|
||||
ToolStripMenuItemReport = new ToolStripMenuItem();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, ToolStripMenuItemOperation, ToolStripMenuItemReport });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(784, 24);
|
||||
@ -51,58 +51,58 @@
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ToolStripMenuItemItineraries, ToolStripMenuItemRoutes, ToolStripMenuItemEmployees, ToolStripMenuItemBuses });
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ToolStripMenuItemRoutes, ToolStripMenuItemEmployees, ToolStripMenuItemBuses });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// ToolStripMenuItemItineraries
|
||||
//
|
||||
ToolStripMenuItemItineraries.Name = "ToolStripMenuItemItineraries";
|
||||
ToolStripMenuItemItineraries.Size = new Size(186, 22);
|
||||
ToolStripMenuItemItineraries.Text = "Маршрутные листы";
|
||||
ToolStripMenuItemItineraries.Click += ToolStripMenuItemItineraries_Click;
|
||||
//
|
||||
// ToolStripMenuItemRoutes
|
||||
//
|
||||
ToolStripMenuItemRoutes.Name = "ToolStripMenuItemRoutes";
|
||||
ToolStripMenuItemRoutes.Size = new Size(186, 22);
|
||||
ToolStripMenuItemRoutes.Size = new Size(180, 22);
|
||||
ToolStripMenuItemRoutes.Text = "Маршруты";
|
||||
ToolStripMenuItemRoutes.Click += ToolStripMenuItemRoutes_Click;
|
||||
//
|
||||
// ToolStripMenuItemEmployees
|
||||
//
|
||||
ToolStripMenuItemEmployees.Name = "ToolStripMenuItemEmployees";
|
||||
ToolStripMenuItemEmployees.Size = new Size(186, 22);
|
||||
ToolStripMenuItemEmployees.Size = new Size(180, 22);
|
||||
ToolStripMenuItemEmployees.Text = "Работники";
|
||||
ToolStripMenuItemEmployees.Click += ToolStripMenuItemEmployees_Click;
|
||||
//
|
||||
// ToolStripMenuItemBuses
|
||||
//
|
||||
ToolStripMenuItemBuses.Name = "ToolStripMenuItemBuses";
|
||||
ToolStripMenuItemBuses.Size = new Size(186, 22);
|
||||
ToolStripMenuItemBuses.Size = new Size(180, 22);
|
||||
ToolStripMenuItemBuses.Text = "Автобусы";
|
||||
ToolStripMenuItemBuses.Click += ToolStripMenuItemBuses_Click;
|
||||
//
|
||||
// операцииToolStripMenuItem
|
||||
// ToolStripMenuItemOperation
|
||||
//
|
||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ToolStripMenuItemBusRepairs });
|
||||
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
||||
операцииToolStripMenuItem.Size = new Size(75, 20);
|
||||
операцииToolStripMenuItem.Text = "Операции";
|
||||
ToolStripMenuItemOperation.DropDownItems.AddRange(new ToolStripItem[] { ToolStripMenuItemBusRepairs, ToolStripMenuItemCreatreItinerary });
|
||||
ToolStripMenuItemOperation.Name = "ToolStripMenuItemOperation";
|
||||
ToolStripMenuItemOperation.Size = new Size(75, 20);
|
||||
ToolStripMenuItemOperation.Text = "Операции";
|
||||
//
|
||||
// ToolStripMenuItemBusRepairs
|
||||
//
|
||||
ToolStripMenuItemBusRepairs.Name = "ToolStripMenuItemBusRepairs";
|
||||
ToolStripMenuItemBusRepairs.Size = new Size(174, 22);
|
||||
ToolStripMenuItemBusRepairs.Size = new Size(240, 22);
|
||||
ToolStripMenuItemBusRepairs.Text = "Ремонт автобусов";
|
||||
ToolStripMenuItemBusRepairs.Click += ToolStripMenuItemBusRepairs_Click;
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
// ToolStripMenuItemCreatreItinerary
|
||||
//
|
||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
ToolStripMenuItemCreatreItinerary.Name = "ToolStripMenuItemCreatreItinerary";
|
||||
ToolStripMenuItemCreatreItinerary.Size = new Size(240, 22);
|
||||
ToolStripMenuItemCreatreItinerary.Text = "Создание маршрутного листа";
|
||||
ToolStripMenuItemCreatreItinerary.Click += ToolStripMenuItemCreatreItinerary_Click;
|
||||
//
|
||||
// ToolStripMenuItemReport
|
||||
//
|
||||
ToolStripMenuItemReport.Name = "ToolStripMenuItemReport";
|
||||
ToolStripMenuItemReport.Size = new Size(60, 20);
|
||||
ToolStripMenuItemReport.Text = "Отчеты";
|
||||
//
|
||||
// FormAutoenterprise
|
||||
//
|
||||
@ -113,6 +113,7 @@
|
||||
ClientSize = new Size(784, 411);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
MinimumSize = new Size(400, 225);
|
||||
Name = "FormAutoenterprise";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Автопредприятие";
|
||||
@ -129,9 +130,9 @@
|
||||
private ToolStripMenuItem ToolStripMenuItemRoutes;
|
||||
private ToolStripMenuItem ToolStripMenuItemEmployees;
|
||||
private ToolStripMenuItem ToolStripMenuItemBuses;
|
||||
private ToolStripMenuItem операцииToolStripMenuItem;
|
||||
private ToolStripMenuItem ToolStripMenuItemOperation;
|
||||
private ToolStripMenuItem ToolStripMenuItemBusRepairs;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem ToolStripMenuItemItineraries;
|
||||
private ToolStripMenuItem ToolStripMenuItemReport;
|
||||
private ToolStripMenuItem ToolStripMenuItemCreatreItinerary;
|
||||
}
|
||||
}
|
||||
|
@ -1,76 +1,88 @@
|
||||
using ProjectAutoenterprise.Forms;
|
||||
using Unity;
|
||||
namespace ProjectAutoenterprise;
|
||||
|
||||
namespace ProjectAutoenterprise
|
||||
/// <summary>
|
||||
/// Ãëàâíàÿ ôîðìà
|
||||
/// </summary>
|
||||
public partial class FormAutoenterprise : Form
|
||||
{
|
||||
public partial class FormAutoenterprise : Form
|
||||
private readonly IUnityContainer _container;
|
||||
public FormAutoenterprise(IUnityContainer container)
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
public FormAutoenterprise(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
private void ToolStripMenuItemRoutes_Click(object sender, EventArgs e)
|
||||
/// <summary>
|
||||
/// Ïóíêò ìåíþ "Ìàðøðóò" (Íàæàòèå)
|
||||
/// </summary>
|
||||
private void ToolStripMenuItemRoutes_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormRoutes>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
_container.Resolve<FormRoutes>().ShowDialog();
|
||||
}
|
||||
|
||||
private void ToolStripMenuItemEmployees_Click(object sender, EventArgs e)
|
||||
catch (Exception ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormEmployees>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
private void ToolStripMenuItemBuses_Click(object sender, EventArgs e)
|
||||
}
|
||||
/// <summary>
|
||||
/// Ïóíêò ìåíþ "Ðàáîòíèêè" (Íàæàòèå)
|
||||
/// </summary>
|
||||
private void ToolStripMenuItemEmployees_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormBuses>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
_container.Resolve<FormEmployees>().ShowDialog();
|
||||
}
|
||||
|
||||
private void ToolStripMenuItemBusRepairs_Click(object sender, EventArgs e)
|
||||
catch (Exception ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormBusRepairs>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
private void ToolStripMenuItemItineraries_Click(object sender, EventArgs e)
|
||||
}
|
||||
/// <summary>
|
||||
/// Ïóíêò ìåíþ "Àâòîáóñû" (Íàæàòèå)
|
||||
/// </summary>
|
||||
private void ToolStripMenuItemBuses_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormItineraries>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
_container.Resolve<FormBuses>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Ïóíêò ìåíþ "Ðåìîíò àâòîáóñîâ" (Íàæàòèå)
|
||||
/// </summary>
|
||||
private void ToolStripMenuItemBusRepairs_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormBusRepairs>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Ïóíêò ìåíþ "Ñîçäàíèå ìàðøðóòíîãî ëèñòà" (Íàæàòèå)
|
||||
/// </summary>
|
||||
private void ToolStripMenuItemCreatreItinerary_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormItineraries>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
@ -71,7 +71,7 @@
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label3.Location = new Point(1, 142);
|
||||
label3.Location = new Point(-1, 137);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(106, 21);
|
||||
label3.TabIndex = 3;
|
||||
@ -79,7 +79,7 @@
|
||||
//
|
||||
// numericUpDownCapacity
|
||||
//
|
||||
numericUpDownCapacity.Location = new Point(113, 145);
|
||||
numericUpDownCapacity.Location = new Point(111, 140);
|
||||
numericUpDownCapacity.Maximum = new decimal(new int[] { 99, 0, 0, 0 });
|
||||
numericUpDownCapacity.Name = "numericUpDownCapacity";
|
||||
numericUpDownCapacity.Size = new Size(51, 23);
|
||||
@ -95,7 +95,7 @@
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonSave.Location = new Point(12, 184);
|
||||
buttonSave.Location = new Point(12, 173);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(111, 30);
|
||||
buttonSave.TabIndex = 6;
|
||||
@ -106,7 +106,7 @@
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.Location = new Point(162, 184);
|
||||
buttonCancel.Location = new Point(163, 173);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(112, 30);
|
||||
buttonCancel.TabIndex = 7;
|
||||
@ -118,7 +118,7 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(283, 222);
|
||||
ClientSize = new Size(284, 211);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxBrand);
|
||||
@ -127,6 +127,8 @@
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(checkedListBoxBusColors);
|
||||
MaximumSize = new Size(300, 250);
|
||||
MinimumSize = new Size(300, 250);
|
||||
Name = "FormBus";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Автобус";
|
||||
|
@ -70,6 +70,7 @@
|
||||
//
|
||||
// dateTimePickerRepairDate
|
||||
//
|
||||
dateTimePickerRepairDate.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dateTimePickerRepairDate.Enabled = false;
|
||||
dateTimePickerRepairDate.Location = new Point(130, 47);
|
||||
dateTimePickerRepairDate.Name = "dateTimePickerRepairDate";
|
||||
@ -78,6 +79,7 @@
|
||||
//
|
||||
// textBoxDescription
|
||||
//
|
||||
textBoxDescription.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBoxDescription.Location = new Point(130, 87);
|
||||
textBoxDescription.Multiline = true;
|
||||
textBoxDescription.Name = "textBoxDescription";
|
||||
@ -87,7 +89,7 @@
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.Location = new Point(207, 240);
|
||||
buttonCancel.Location = new Point(210, 239);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(112, 30);
|
||||
buttonCancel.TabIndex = 9;
|
||||
@ -98,7 +100,7 @@
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonSave.Location = new Point(10, 240);
|
||||
buttonSave.Location = new Point(10, 239);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(111, 30);
|
||||
buttonSave.TabIndex = 8;
|
||||
@ -108,6 +110,7 @@
|
||||
//
|
||||
// comboBoxBus
|
||||
//
|
||||
comboBoxBus.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxBus.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxBus.FormattingEnabled = true;
|
||||
comboBoxBus.Location = new Point(130, 11);
|
||||
@ -119,7 +122,7 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(331, 282);
|
||||
ClientSize = new Size(334, 281);
|
||||
Controls.Add(comboBoxBus);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
@ -128,6 +131,8 @@
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
MaximumSize = new Size(800, 400);
|
||||
MinimumSize = new Size(350, 320);
|
||||
Name = "FormBusRepair";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Ремонт автобусов";
|
||||
|
@ -1,6 +1,5 @@
|
||||
using ProjectAutoenterprise.Entities;
|
||||
using ProjectAutoenterprise.Repositories;
|
||||
|
||||
namespace ProjectAutoenterprise.Forms;
|
||||
|
||||
public partial class FormBusRepair : Form
|
||||
@ -12,7 +11,7 @@ public partial class FormBusRepair : Form
|
||||
_busRepairRepository = busRepairRepository ??
|
||||
throw new ArgumentNullException(nameof(busRepairRepository));
|
||||
comboBoxBus.DataSource = busRepository.ReadBuses();
|
||||
comboBoxBus.DisplayMember = "Brand";
|
||||
comboBoxBus.DisplayMember = "Id";
|
||||
comboBoxBus.ValueMember = "Id";
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
@ -23,7 +22,7 @@ public partial class FormBusRepair : Form
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_busRepairRepository.CreateBusRepair(BusRepair.CreateOperation( 0, (int)comboBoxBus.SelectedValue!, textBoxDescription.Text));
|
||||
_busRepairRepository.CreateBusRepair(BusRepair.CreateOperation(0, (int)comboBoxBus.SelectedValue!, textBoxDescription.Text));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -39,9 +39,9 @@
|
||||
//
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(698, 0);
|
||||
panel.Location = new Point(682, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(102, 450);
|
||||
panel.Size = new Size(102, 411);
|
||||
panel.TabIndex = 2;
|
||||
//
|
||||
// buttonAdd
|
||||
@ -70,17 +70,19 @@
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.Size = new Size(698, 450);
|
||||
dataGridViewData.Size = new Size(682, 411);
|
||||
dataGridViewData.TabIndex = 3;
|
||||
//
|
||||
// FormBusRepairs
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
ClientSize = new Size(784, 411);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
MinimumSize = new Size(400, 300);
|
||||
Name = "FormBusRepairs";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "FormBusRepairs";
|
||||
Load += FormBusRepairs_Load;
|
||||
panel.ResumeLayout(false);
|
||||
|
@ -43,16 +43,16 @@
|
||||
panel.Controls.Add(buttonDelete);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(698, 0);
|
||||
panel.Location = new Point(682, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(102, 450);
|
||||
panel.Size = new Size(102, 411);
|
||||
panel.TabIndex = 1;
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
buttonEdit.BackgroundImage = Properties.Resources.Edit;
|
||||
buttonEdit.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonEdit.Location = new Point(20, 197);
|
||||
buttonEdit.Location = new Point(20, 196);
|
||||
buttonEdit.Name = "buttonEdit";
|
||||
buttonEdit.Size = new Size(70, 70);
|
||||
buttonEdit.TabIndex = 3;
|
||||
@ -96,17 +96,19 @@
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.Size = new Size(698, 450);
|
||||
dataGridViewData.Size = new Size(682, 411);
|
||||
dataGridViewData.TabIndex = 2;
|
||||
//
|
||||
// FormBuses
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
ClientSize = new Size(784, 411);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
MinimumSize = new Size(400, 300);
|
||||
Name = "FormBuses";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Автобусы";
|
||||
Load += FormBuses_Load;
|
||||
panel.ResumeLayout(false);
|
||||
|
@ -94,7 +94,7 @@
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.Location = new Point(205, 147);
|
||||
buttonCancel.Location = new Point(235, 147);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(140, 30);
|
||||
buttonCancel.TabIndex = 6;
|
||||
@ -104,39 +104,43 @@
|
||||
//
|
||||
// comboBoxPost
|
||||
//
|
||||
comboBoxPost.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxPost.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxPost.FormattingEnabled = true;
|
||||
comboBoxPost.Location = new Point(142, 110);
|
||||
comboBoxPost.Name = "comboBoxPost";
|
||||
comboBoxPost.Size = new Size(200, 23);
|
||||
comboBoxPost.Size = new Size(230, 23);
|
||||
comboBoxPost.TabIndex = 7;
|
||||
//
|
||||
// textBoxFirstName
|
||||
//
|
||||
textBoxFirstName.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBoxFirstName.Location = new Point(142, 44);
|
||||
textBoxFirstName.Name = "textBoxFirstName";
|
||||
textBoxFirstName.Size = new Size(200, 23);
|
||||
textBoxFirstName.Size = new Size(230, 23);
|
||||
textBoxFirstName.TabIndex = 9;
|
||||
//
|
||||
// textBoxLastName
|
||||
//
|
||||
textBoxLastName.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBoxLastName.Location = new Point(141, 11);
|
||||
textBoxLastName.Name = "textBoxLastName";
|
||||
textBoxLastName.Size = new Size(200, 23);
|
||||
textBoxLastName.Size = new Size(230, 23);
|
||||
textBoxLastName.TabIndex = 10;
|
||||
//
|
||||
// dateTimePickerBirthDate
|
||||
//
|
||||
dateTimePickerBirthDate.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dateTimePickerBirthDate.Location = new Point(142, 75);
|
||||
dateTimePickerBirthDate.Name = "dateTimePickerBirthDate";
|
||||
dateTimePickerBirthDate.Size = new Size(200, 23);
|
||||
dateTimePickerBirthDate.Size = new Size(230, 23);
|
||||
dateTimePickerBirthDate.TabIndex = 11;
|
||||
//
|
||||
// FormEmployee
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(354, 191);
|
||||
ClientSize = new Size(384, 191);
|
||||
Controls.Add(dateTimePickerBirthDate);
|
||||
Controls.Add(textBoxLastName);
|
||||
Controls.Add(textBoxFirstName);
|
||||
@ -147,6 +151,8 @@
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
MaximumSize = new Size(500, 230);
|
||||
MinimumSize = new Size(400, 230);
|
||||
Name = "FormEmployee";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Работник";
|
||||
|
@ -30,6 +30,7 @@ public partial class FormEmployee : Form
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormEmployee(IEmployeeRepository employeeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -37,6 +38,7 @@ public partial class FormEmployee : Form
|
||||
throw new ArgumentNullException(nameof(employeeRepository));
|
||||
comboBoxPost.DataSource = Enum.GetValues(typeof(EmployeePost));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
|
@ -43,9 +43,9 @@
|
||||
panel.Controls.Add(buttonDelete);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(698, 0);
|
||||
panel.Location = new Point(682, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(102, 450);
|
||||
panel.Size = new Size(102, 411);
|
||||
panel.TabIndex = 0;
|
||||
//
|
||||
// buttonEdit
|
||||
@ -96,17 +96,19 @@
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.Size = new Size(698, 450);
|
||||
dataGridViewData.Size = new Size(682, 411);
|
||||
dataGridViewData.TabIndex = 1;
|
||||
//
|
||||
// FormEmployees
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
ClientSize = new Size(784, 411);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
MinimumSize = new Size(400, 300);
|
||||
Name = "FormEmployees";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Работники";
|
||||
Load += FormEmployees_Load;
|
||||
panel.ResumeLayout(false);
|
||||
|
@ -41,9 +41,9 @@
|
||||
panel.Controls.Add(buttonDelete);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(698, 0);
|
||||
panel.Location = new Point(682, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(102, 450);
|
||||
panel.Size = new Size(102, 411);
|
||||
panel.TabIndex = 2;
|
||||
//
|
||||
// buttonDelete
|
||||
@ -83,16 +83,17 @@
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.Size = new Size(698, 450);
|
||||
dataGridViewData.Size = new Size(682, 411);
|
||||
dataGridViewData.TabIndex = 3;
|
||||
//
|
||||
// FormItineraries
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
ClientSize = new Size(784, 411);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
MinimumSize = new Size(400, 300);
|
||||
Name = "FormItineraries";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Маршрутные листы";
|
||||
|
@ -1,6 +1,5 @@
|
||||
using ProjectAutoenterprise.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectAutoenterprise.Forms;
|
||||
|
||||
public partial class FormItineraries : Form
|
||||
@ -15,6 +14,7 @@ public partial class FormItineraries : Form
|
||||
_itineraryRepository = itineraryRepository ??
|
||||
throw new ArgumentNullException(nameof(itineraryRepository));
|
||||
}
|
||||
|
||||
private void FormItinerarys_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
@ -26,6 +26,7 @@ public partial class FormItineraries : Form
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
@ -38,6 +39,7 @@ public partial class FormItineraries : Form
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
@ -58,7 +60,9 @@ public partial class FormItineraries : Form
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _itineraryRepository.ReadItinerary();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
|
@ -30,7 +30,6 @@
|
||||
{
|
||||
groupBoxRoutes = new GroupBox();
|
||||
dataGridViewRoutes = new DataGridView();
|
||||
ColumnRoute = new DataGridViewComboBoxColumn();
|
||||
comboBoxBus = new ComboBox();
|
||||
label1 = new Label();
|
||||
comboBoxDriver = new ComboBox();
|
||||
@ -43,6 +42,7 @@
|
||||
label5 = new Label();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
ColumnRoute = new DataGridViewComboBoxColumn();
|
||||
groupBoxRoutes.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewRoutes).BeginInit();
|
||||
SuspendLayout();
|
||||
@ -53,7 +53,7 @@
|
||||
groupBoxRoutes.Controls.Add(dataGridViewRoutes);
|
||||
groupBoxRoutes.Location = new Point(333, 12);
|
||||
groupBoxRoutes.Name = "groupBoxRoutes";
|
||||
groupBoxRoutes.Size = new Size(256, 207);
|
||||
groupBoxRoutes.Size = new Size(259, 202);
|
||||
groupBoxRoutes.TabIndex = 0;
|
||||
groupBoxRoutes.TabStop = false;
|
||||
groupBoxRoutes.Text = "Маршруты";
|
||||
@ -66,14 +66,9 @@
|
||||
dataGridViewRoutes.Dock = DockStyle.Fill;
|
||||
dataGridViewRoutes.Location = new Point(3, 19);
|
||||
dataGridViewRoutes.Name = "dataGridViewRoutes";
|
||||
dataGridViewRoutes.Size = new Size(250, 185);
|
||||
dataGridViewRoutes.Size = new Size(253, 180);
|
||||
dataGridViewRoutes.TabIndex = 0;
|
||||
//
|
||||
// ColumnRoute
|
||||
//
|
||||
ColumnRoute.HeaderText = "Маршрут";
|
||||
ColumnRoute.Name = "ColumnRoute";
|
||||
//
|
||||
// comboBoxBus
|
||||
//
|
||||
comboBoxBus.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
@ -87,7 +82,7 @@
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label1.Location = new Point(18, 29);
|
||||
label1.Location = new Point(36, 29);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(71, 21);
|
||||
label1.TabIndex = 11;
|
||||
@ -106,7 +101,7 @@
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label2.Location = new Point(32, 84);
|
||||
label2.Location = new Point(27, 84);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(80, 21);
|
||||
label2.TabIndex = 13;
|
||||
@ -125,7 +120,7 @@
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label3.Location = new Point(22, 139);
|
||||
label3.Location = new Point(17, 139);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(90, 21);
|
||||
label3.TabIndex = 15;
|
||||
@ -143,7 +138,7 @@
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label4.Location = new Point(69, 194);
|
||||
label4.Location = new Point(60, 194);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(47, 21);
|
||||
label4.TabIndex = 17;
|
||||
@ -155,7 +150,7 @@
|
||||
textBoxDescription.Location = new Point(122, 251);
|
||||
textBoxDescription.Multiline = true;
|
||||
textBoxDescription.Name = "textBoxDescription";
|
||||
textBoxDescription.Size = new Size(464, 113);
|
||||
textBoxDescription.Size = new Size(467, 108);
|
||||
textBoxDescription.TabIndex = 20;
|
||||
//
|
||||
// label5
|
||||
@ -171,7 +166,7 @@
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.Location = new Point(146, 404);
|
||||
buttonCancel.Location = new Point(477, 399);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(112, 30);
|
||||
buttonCancel.TabIndex = 22;
|
||||
@ -182,7 +177,7 @@
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonSave.Location = new Point(17, 404);
|
||||
buttonSave.Location = new Point(17, 399);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(111, 30);
|
||||
buttonSave.TabIndex = 21;
|
||||
@ -190,11 +185,17 @@
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// ColumnRoute
|
||||
//
|
||||
ColumnRoute.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
ColumnRoute.HeaderText = "Маршрут";
|
||||
ColumnRoute.Name = "ColumnRoute";
|
||||
//
|
||||
// FormItinerary
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(601, 446);
|
||||
ClientSize = new Size(604, 441);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxDescription);
|
||||
@ -208,6 +209,8 @@
|
||||
Controls.Add(comboBoxBus);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(groupBoxRoutes);
|
||||
MaximumSize = new Size(800, 500);
|
||||
MinimumSize = new Size(620, 480);
|
||||
Name = "FormItinerary";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Маршрутный лист";
|
||||
@ -231,8 +234,8 @@
|
||||
private Label label4;
|
||||
private TextBox textBoxDescription;
|
||||
private Label label5;
|
||||
private DataGridViewComboBoxColumn ColumnRoute;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private DataGridViewComboBoxColumn ColumnRoute;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
using ProjectAutoenterprise.Entities;
|
||||
using ProjectAutoenterprise.Entities.Enums;
|
||||
using ProjectAutoenterprise.Repositories;
|
||||
|
||||
namespace ProjectAutoenterprise.Forms;
|
||||
|
||||
public partial class FormItinerary : Form
|
||||
@ -17,11 +17,11 @@ public partial class FormItinerary : Form
|
||||
comboBoxBus.DisplayMember = "Brand";
|
||||
comboBoxBus.ValueMember = "Id";
|
||||
|
||||
comboBoxDriver.DataSource = employeeRepository.ReadEmployees();
|
||||
comboBoxDriver.DataSource = employeeRepository.ReadEmployees(EmployeePost.Driver);
|
||||
comboBoxDriver.DisplayMember = "FirstName";
|
||||
comboBoxDriver.ValueMember = "Id";
|
||||
|
||||
comboBoxConductor.DataSource = employeeRepository.ReadEmployees();
|
||||
comboBoxConductor.DataSource = employeeRepository.ReadEmployees(EmployeePost.Conductor);
|
||||
comboBoxConductor.DisplayMember = "FirstName";
|
||||
comboBoxConductor.ValueMember = "Id";
|
||||
|
||||
@ -39,8 +39,9 @@ public partial class FormItinerary : Form
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_itineraryRepository.CreateItinerary(Itinerary.CreateEntity(
|
||||
_itineraryRepository.CreateItinerary(Itinerary.CreateOperation(
|
||||
0,
|
||||
(int)comboBoxBus.SelectedValue!,
|
||||
(int)comboBoxDriver.SelectedValue!,
|
||||
(int)comboBoxConductor.SelectedValue!,
|
||||
dateTimePickerDate.Value,
|
||||
@ -63,7 +64,7 @@ public partial class FormItinerary : Form
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.Add(ItineraryRoute.CreateElement(0,Convert.ToInt32(row.Cells["ColumnFeed"].Value)));
|
||||
list.Add(ItineraryRoute.CreateElement(0,Convert.ToInt32(row.Cells["ColumnRoute"].Value)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -58,6 +58,7 @@
|
||||
//
|
||||
// textBoxBeginRoutePoint
|
||||
//
|
||||
textBoxBeginRoutePoint.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBoxBeginRoutePoint.Location = new Point(234, 12);
|
||||
textBoxBeginRoutePoint.Name = "textBoxBeginRoutePoint";
|
||||
textBoxBeginRoutePoint.Size = new Size(265, 23);
|
||||
@ -65,6 +66,7 @@
|
||||
//
|
||||
// textBoxEndRoutePoint
|
||||
//
|
||||
textBoxEndRoutePoint.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBoxEndRoutePoint.Location = new Point(234, 45);
|
||||
textBoxEndRoutePoint.Name = "textBoxEndRoutePoint";
|
||||
textBoxEndRoutePoint.Size = new Size(265, 23);
|
||||
@ -82,6 +84,7 @@
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.Location = new Point(359, 80);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(140, 30);
|
||||
@ -101,6 +104,8 @@
|
||||
Controls.Add(textBoxBeginRoutePoint);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
MaximumSize = new Size(600, 160);
|
||||
MinimumSize = new Size(530, 160);
|
||||
Name = "FormRoute";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Маршрут";
|
||||
|
@ -32,7 +32,8 @@ public partial class FormRoute : Form
|
||||
public FormRoute(IRouteRepository routeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_routeRepository = routeRepository ?? throw new ArgumentNullException(nameof(routeRepository));
|
||||
_routeRepository = routeRepository ??
|
||||
throw new ArgumentNullException(nameof(routeRepository));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
|
@ -52,7 +52,7 @@
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.Size = new Size(784, 461);
|
||||
dataGridViewData.Size = new Size(681, 411);
|
||||
dataGridViewData.TabIndex = 0;
|
||||
//
|
||||
// panel
|
||||
@ -63,7 +63,7 @@
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(681, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(103, 461);
|
||||
panel.Size = new Size(103, 411);
|
||||
panel.TabIndex = 1;
|
||||
//
|
||||
// buttonEdit
|
||||
@ -103,9 +103,10 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(784, 461);
|
||||
Controls.Add(panel);
|
||||
ClientSize = new Size(784, 411);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
MinimumSize = new Size(400, 300);
|
||||
Name = "FormRoutes";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Маршруты";
|
||||
|
@ -9,9 +9,12 @@ public partial class FormRoutes : Form
|
||||
public FormRoutes(IUnityContainer container, IRouteRepository routeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_routeRepository = routeRepository ?? throw new ArgumentNullException(nameof(routeRepository));
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_routeRepository = routeRepository ??
|
||||
throw new ArgumentNullException(nameof(routeRepository));
|
||||
}
|
||||
|
||||
private void FormRoutes_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
@ -23,6 +26,7 @@ public partial class FormRoutes : Form
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
@ -35,6 +39,7 @@ public partial class FormRoutes : Form
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
@ -55,6 +60,7 @@ public partial class FormRoutes : Form
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
@ -74,7 +80,9 @@ public partial class FormRoutes : Form
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _routeRepository.ReadRoutes();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
|
@ -3,7 +3,7 @@ namespace ProjectAutoenterprise.Repositories;
|
||||
|
||||
public interface IBusRepairRepository
|
||||
{
|
||||
void CreateBusRepair(BusRepair busRepair);
|
||||
IEnumerable<BusRepair> ReadBusRepairs(DateTime? dateForm = null, DateTime? dateTo = null,
|
||||
int? busId = null, string? description = null);
|
||||
void CreateBusRepair(BusRepair busRepair);
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
using ProjectAutoenterprise.Entities;
|
||||
using ProjectAutoenterprise.Entities.Enums;
|
||||
|
||||
namespace ProjectAutoenterprise.Repositories;
|
||||
|
||||
public interface IEmployeeRepository
|
||||
{
|
||||
IEnumerable<Employee> ReadEmployees();
|
||||
IEnumerable<Employee> ReadEmployees(EmployeePost employeePost);
|
||||
Employee ReadEmployeeById(int id);
|
||||
void CreateEmployee(Employee employee);
|
||||
void UpdateEmployee(Employee employee);
|
||||
|
@ -1,6 +1,5 @@
|
||||
using ProjectAutoenterprise.Entities;
|
||||
using ProjectAutoenterprise.Entities.Enums;
|
||||
|
||||
namespace ProjectAutoenterprise.Repositories.Implementations;
|
||||
|
||||
internal class EmployeeRepository : IEmployeeRepository
|
||||
@ -25,6 +24,11 @@ internal class EmployeeRepository : IEmployeeRepository
|
||||
return [];
|
||||
}
|
||||
|
||||
public IEnumerable<Employee> ReadEmployees(EmployeePost employeePost)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateEmployee(Employee employee)
|
||||
{
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user