Лабораторная работа №1 (Изменение)

This commit is contained in:
Aidar 2024-11-26 21:13:12 +04:00
parent aa568544d4
commit 36793fef25
30 changed files with 252 additions and 168 deletions

View File

@ -1,6 +1,9 @@
using ProjectAutoenterprise.Entities.Enums; using ProjectAutoenterprise.Entities.Enums;
namespace ProjectAutoenterprise.Entities; namespace ProjectAutoenterprise.Entities;
/// <summary>
/// Сущность-справочник "Автобус"
/// </summary>
public class Bus public class Bus
{ {
public int Id { get; private set; } public int Id { get; private set; }

View File

@ -1,6 +1,8 @@
using System; namespace ProjectAutoenterprise.Entities;
namespace ProjectAutoenterprise.Entities;
/// <summary>
/// Сущность-операция "Ремонт автобуса"
/// </summary>
public class BusRepair public class BusRepair
{ {
public int Id { get; private set; } public int Id { get; private set; }

View File

@ -1,6 +1,9 @@
using ProjectAutoenterprise.Entities.Enums; using ProjectAutoenterprise.Entities.Enums;
namespace ProjectAutoenterprise.Entities; namespace ProjectAutoenterprise.Entities;
/// <summary>
/// Сущность-справочник "Работник"
/// </summary>
public class Employee public class Employee
{ {
public int Id { get; private set; } public int Id { get; private set; }
@ -9,8 +12,7 @@ public class Employee
public DateTime BirthDate { get; private set; } public DateTime BirthDate { get; private set; }
public EmployeePost EmployeePost { get; private set; } public EmployeePost EmployeePost { get; private set; }
public static Employee CreateEntity(int id, string firstName, string lastName, DateTime birthDate, public static Employee CreateEntity(int id, string firstName, string lastName, DateTime birthDate, EmployeePost employeePost)
EmployeePost employeePost)
{ {
return new Employee return new Employee
{ {

View File

@ -1,5 +1,8 @@
namespace ProjectAutoenterprise.Entities; namespace ProjectAutoenterprise.Entities;
/// <summary>
/// Сущность-операция "Маршрутный лист"
/// </summary>
public class Itinerary public class Itinerary
{ {
public int Id { get; private set; } public int Id { get; private set; }
@ -10,7 +13,7 @@ public class Itinerary
public DateTime ItineraryDate { get; private set; } public DateTime ItineraryDate { get; private set; }
public string Description { get; private set; } = string.Empty; 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) IEnumerable<ItineraryRoute> itineraryRoute)
{ {
return new Itinerary return new Itinerary
@ -18,9 +21,10 @@ public class Itinerary
Id = id, Id = id,
BusId = busId, BusId = busId,
ItineraryRoute = itineraryRoute, ItineraryRoute = itineraryRoute,
ConductorId = conductorID, DriverId = driverId,
ConductorId = conductorId,
ItineraryDate = itineraryDate, ItineraryDate = itineraryDate,
Description = description Description = description ?? string.Empty
}; };
} }
} }

View File

@ -1,12 +1,19 @@
namespace ProjectAutoenterprise.Entities; namespace ProjectAutoenterprise.Entities;
/// <summary>
/// Сущность-элемент "Маршрутный лист - Маршрут" реализующий связь многие ко многим между сущностями "Маршрутный лист" и "Маршрут"
/// </summary>
public class ItineraryRoute public class ItineraryRoute
{ {
public int Id { get; private set; } public int ItineraryId { get; private set; }
public int RouteId { 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
};
} }
} }

View File

@ -1,5 +1,8 @@
namespace ProjectAutoenterprise.Entities; namespace ProjectAutoenterprise.Entities;
/// <summary>
/// Сущность-справочник "Маршрут"
/// </summary>
public class Route public class Route
{ {
public int Id { get; private set; } public int Id { get; private set; }
@ -11,8 +14,8 @@ public class Route
return new Route return new Route
{ {
Id = id, Id = id,
BeginRoutePoint = beginRoutePoint, BeginRoutePoint = beginRoutePoint ?? string.Empty,
EndRoutePoint = endRoutePoint EndRoutePoint = endRoutePoint ?? string.Empty
}; };
} }
} }

View File

@ -30,19 +30,19 @@
{ {
menuStrip1 = new MenuStrip(); menuStrip1 = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem(); справочникиToolStripMenuItem = new ToolStripMenuItem();
ToolStripMenuItemItineraries = new ToolStripMenuItem();
ToolStripMenuItemRoutes = new ToolStripMenuItem(); ToolStripMenuItemRoutes = new ToolStripMenuItem();
ToolStripMenuItemEmployees = new ToolStripMenuItem(); ToolStripMenuItemEmployees = new ToolStripMenuItem();
ToolStripMenuItemBuses = new ToolStripMenuItem(); ToolStripMenuItemBuses = new ToolStripMenuItem();
операцииToolStripMenuItem = new ToolStripMenuItem(); ToolStripMenuItemOperation = new ToolStripMenuItem();
ToolStripMenuItemBusRepairs = new ToolStripMenuItem(); ToolStripMenuItemBusRepairs = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem(); ToolStripMenuItemCreatreItinerary = new ToolStripMenuItem();
ToolStripMenuItemReport = new ToolStripMenuItem();
menuStrip1.SuspendLayout(); menuStrip1.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// menuStrip1 // menuStrip1
// //
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem }); menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, ToolStripMenuItemOperation, ToolStripMenuItemReport });
menuStrip1.Location = new Point(0, 0); menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1"; menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(784, 24); menuStrip1.Size = new Size(784, 24);
@ -51,58 +51,58 @@
// //
// справочникиToolStripMenuItem // справочникиToolStripMenuItem
// //
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ToolStripMenuItemItineraries, ToolStripMenuItemRoutes, ToolStripMenuItemEmployees, ToolStripMenuItemBuses }); справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ToolStripMenuItemRoutes, ToolStripMenuItemEmployees, ToolStripMenuItemBuses });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(94, 20); справочникиToolStripMenuItem.Size = new Size(94, 20);
справочникиToolStripMenuItem.Text = "Справочники"; справочникиToolStripMenuItem.Text = "Справочники";
// //
// ToolStripMenuItemItineraries
//
ToolStripMenuItemItineraries.Name = "ToolStripMenuItemItineraries";
ToolStripMenuItemItineraries.Size = new Size(186, 22);
ToolStripMenuItemItineraries.Text = "Маршрутные листы";
ToolStripMenuItemItineraries.Click += ToolStripMenuItemItineraries_Click;
//
// ToolStripMenuItemRoutes // ToolStripMenuItemRoutes
// //
ToolStripMenuItemRoutes.Name = "ToolStripMenuItemRoutes"; ToolStripMenuItemRoutes.Name = "ToolStripMenuItemRoutes";
ToolStripMenuItemRoutes.Size = new Size(186, 22); ToolStripMenuItemRoutes.Size = new Size(180, 22);
ToolStripMenuItemRoutes.Text = "Маршруты"; ToolStripMenuItemRoutes.Text = "Маршруты";
ToolStripMenuItemRoutes.Click += ToolStripMenuItemRoutes_Click; ToolStripMenuItemRoutes.Click += ToolStripMenuItemRoutes_Click;
// //
// ToolStripMenuItemEmployees // ToolStripMenuItemEmployees
// //
ToolStripMenuItemEmployees.Name = "ToolStripMenuItemEmployees"; ToolStripMenuItemEmployees.Name = "ToolStripMenuItemEmployees";
ToolStripMenuItemEmployees.Size = new Size(186, 22); ToolStripMenuItemEmployees.Size = new Size(180, 22);
ToolStripMenuItemEmployees.Text = "Работники"; ToolStripMenuItemEmployees.Text = "Работники";
ToolStripMenuItemEmployees.Click += ToolStripMenuItemEmployees_Click; ToolStripMenuItemEmployees.Click += ToolStripMenuItemEmployees_Click;
// //
// ToolStripMenuItemBuses // ToolStripMenuItemBuses
// //
ToolStripMenuItemBuses.Name = "ToolStripMenuItemBuses"; ToolStripMenuItemBuses.Name = "ToolStripMenuItemBuses";
ToolStripMenuItemBuses.Size = new Size(186, 22); ToolStripMenuItemBuses.Size = new Size(180, 22);
ToolStripMenuItemBuses.Text = "Автобусы"; ToolStripMenuItemBuses.Text = "Автобусы";
ToolStripMenuItemBuses.Click += ToolStripMenuItemBuses_Click; ToolStripMenuItemBuses.Click += ToolStripMenuItemBuses_Click;
// //
// операцииToolStripMenuItem // ToolStripMenuItemOperation
// //
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ToolStripMenuItemBusRepairs }); ToolStripMenuItemOperation.DropDownItems.AddRange(new ToolStripItem[] { ToolStripMenuItemBusRepairs, ToolStripMenuItemCreatreItinerary });
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; ToolStripMenuItemOperation.Name = "ToolStripMenuItemOperation";
операцииToolStripMenuItem.Size = new Size(75, 20); ToolStripMenuItemOperation.Size = new Size(75, 20);
операцииToolStripMenuItem.Text = "Операции"; ToolStripMenuItemOperation.Text = "Операции";
// //
// ToolStripMenuItemBusRepairs // ToolStripMenuItemBusRepairs
// //
ToolStripMenuItemBusRepairs.Name = "ToolStripMenuItemBusRepairs"; ToolStripMenuItemBusRepairs.Name = "ToolStripMenuItemBusRepairs";
ToolStripMenuItemBusRepairs.Size = new Size(174, 22); ToolStripMenuItemBusRepairs.Size = new Size(240, 22);
ToolStripMenuItemBusRepairs.Text = "Ремонт автобусов"; ToolStripMenuItemBusRepairs.Text = "Ремонт автобусов";
ToolStripMenuItemBusRepairs.Click += ToolStripMenuItemBusRepairs_Click; ToolStripMenuItemBusRepairs.Click += ToolStripMenuItemBusRepairs_Click;
// //
// отчетыToolStripMenuItem // ToolStripMenuItemCreatreItinerary
// //
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; ToolStripMenuItemCreatreItinerary.Name = "ToolStripMenuItemCreatreItinerary";
отчетыToolStripMenuItem.Size = new Size(60, 20); ToolStripMenuItemCreatreItinerary.Size = new Size(240, 22);
отчетыToolStripMenuItem.Text = "Отчеты"; ToolStripMenuItemCreatreItinerary.Text = "Создание маршрутного листа";
ToolStripMenuItemCreatreItinerary.Click += ToolStripMenuItemCreatreItinerary_Click;
//
// ToolStripMenuItemReport
//
ToolStripMenuItemReport.Name = "ToolStripMenuItemReport";
ToolStripMenuItemReport.Size = new Size(60, 20);
ToolStripMenuItemReport.Text = "Отчеты";
// //
// FormAutoenterprise // FormAutoenterprise
// //
@ -113,6 +113,7 @@
ClientSize = new Size(784, 411); ClientSize = new Size(784, 411);
Controls.Add(menuStrip1); Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1; MainMenuStrip = menuStrip1;
MinimumSize = new Size(400, 225);
Name = "FormAutoenterprise"; Name = "FormAutoenterprise";
StartPosition = FormStartPosition.CenterScreen; StartPosition = FormStartPosition.CenterScreen;
Text = "Автопредприятие"; Text = "Автопредприятие";
@ -129,9 +130,9 @@
private ToolStripMenuItem ToolStripMenuItemRoutes; private ToolStripMenuItem ToolStripMenuItemRoutes;
private ToolStripMenuItem ToolStripMenuItemEmployees; private ToolStripMenuItem ToolStripMenuItemEmployees;
private ToolStripMenuItem ToolStripMenuItemBuses; private ToolStripMenuItem ToolStripMenuItemBuses;
private ToolStripMenuItem операцииToolStripMenuItem; private ToolStripMenuItem ToolStripMenuItemOperation;
private ToolStripMenuItem ToolStripMenuItemBusRepairs; private ToolStripMenuItem ToolStripMenuItemBusRepairs;
private ToolStripMenuItem отчетыToolStripMenuItem; private ToolStripMenuItem ToolStripMenuItemReport;
private ToolStripMenuItem ToolStripMenuItemItineraries; private ToolStripMenuItem ToolStripMenuItemCreatreItinerary;
} }
} }

View File

@ -1,8 +1,10 @@
using ProjectAutoenterprise.Forms; using ProjectAutoenterprise.Forms;
using Unity; using Unity;
namespace ProjectAutoenterprise;
namespace ProjectAutoenterprise /// <summary>
{ /// Главная форма
/// </summary>
public partial class FormAutoenterprise : Form public partial class FormAutoenterprise : Form
{ {
private readonly IUnityContainer _container; private readonly IUnityContainer _container;
@ -13,6 +15,9 @@ namespace ProjectAutoenterprise
throw new ArgumentNullException(nameof(container)); throw new ArgumentNullException(nameof(container));
} }
/// <summary>
/// Пункт меню "Маршрут" (Нажатие)
/// </summary>
private void ToolStripMenuItemRoutes_Click(object sender, EventArgs e) private void ToolStripMenuItemRoutes_Click(object sender, EventArgs e)
{ {
try try
@ -24,7 +29,9 @@ namespace ProjectAutoenterprise
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
/// <summary>
/// Пункт меню "Работники" (Нажатие)
/// </summary>
private void ToolStripMenuItemEmployees_Click(object sender, EventArgs e) private void ToolStripMenuItemEmployees_Click(object sender, EventArgs e)
{ {
try try
@ -36,7 +43,9 @@ namespace ProjectAutoenterprise
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
/// <summary>
/// Пункт меню "Автобусы" (Нажатие)
/// </summary>
private void ToolStripMenuItemBuses_Click(object sender, EventArgs e) private void ToolStripMenuItemBuses_Click(object sender, EventArgs e)
{ {
try try
@ -48,7 +57,9 @@ namespace ProjectAutoenterprise
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
/// <summary>
/// Пункт меню "Ремонт автобусов" (Нажатие)
/// </summary>
private void ToolStripMenuItemBusRepairs_Click(object sender, EventArgs e) private void ToolStripMenuItemBusRepairs_Click(object sender, EventArgs e)
{ {
try try
@ -60,8 +71,10 @@ namespace ProjectAutoenterprise
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
/// <summary>
private void ToolStripMenuItemItineraries_Click(object sender, EventArgs e) /// Пункт меню "Создание маршрутного листа" (Нажатие)
/// </summary>
private void ToolStripMenuItemCreatreItinerary_Click(object sender, EventArgs e)
{ {
try try
{ {
@ -73,4 +86,3 @@ namespace ProjectAutoenterprise
} }
} }
} }
}

View File

@ -71,7 +71,7 @@
// //
label3.AutoSize = true; label3.AutoSize = true;
label3.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204); 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.Name = "label3";
label3.Size = new Size(106, 21); label3.Size = new Size(106, 21);
label3.TabIndex = 3; label3.TabIndex = 3;
@ -79,7 +79,7 @@
// //
// numericUpDownCapacity // numericUpDownCapacity
// //
numericUpDownCapacity.Location = new Point(113, 145); numericUpDownCapacity.Location = new Point(111, 140);
numericUpDownCapacity.Maximum = new decimal(new int[] { 99, 0, 0, 0 }); numericUpDownCapacity.Maximum = new decimal(new int[] { 99, 0, 0, 0 });
numericUpDownCapacity.Name = "numericUpDownCapacity"; numericUpDownCapacity.Name = "numericUpDownCapacity";
numericUpDownCapacity.Size = new Size(51, 23); numericUpDownCapacity.Size = new Size(51, 23);
@ -95,7 +95,7 @@
// buttonSave // buttonSave
// //
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(12, 184); buttonSave.Location = new Point(12, 173);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(111, 30); buttonSave.Size = new Size(111, 30);
buttonSave.TabIndex = 6; buttonSave.TabIndex = 6;
@ -106,7 +106,7 @@
// buttonCancel // buttonCancel
// //
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(162, 184); buttonCancel.Location = new Point(163, 173);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(112, 30); buttonCancel.Size = new Size(112, 30);
buttonCancel.TabIndex = 7; buttonCancel.TabIndex = 7;
@ -118,7 +118,7 @@
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(283, 222); ClientSize = new Size(284, 211);
Controls.Add(buttonCancel); Controls.Add(buttonCancel);
Controls.Add(buttonSave); Controls.Add(buttonSave);
Controls.Add(textBoxBrand); Controls.Add(textBoxBrand);
@ -127,6 +127,8 @@
Controls.Add(label2); Controls.Add(label2);
Controls.Add(label1); Controls.Add(label1);
Controls.Add(checkedListBoxBusColors); Controls.Add(checkedListBoxBusColors);
MaximumSize = new Size(300, 250);
MinimumSize = new Size(300, 250);
Name = "FormBus"; Name = "FormBus";
StartPosition = FormStartPosition.CenterParent; StartPosition = FormStartPosition.CenterParent;
Text = "Автобус"; Text = "Автобус";

View File

@ -70,6 +70,7 @@
// //
// dateTimePickerRepairDate // dateTimePickerRepairDate
// //
dateTimePickerRepairDate.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
dateTimePickerRepairDate.Enabled = false; dateTimePickerRepairDate.Enabled = false;
dateTimePickerRepairDate.Location = new Point(130, 47); dateTimePickerRepairDate.Location = new Point(130, 47);
dateTimePickerRepairDate.Name = "dateTimePickerRepairDate"; dateTimePickerRepairDate.Name = "dateTimePickerRepairDate";
@ -78,6 +79,7 @@
// //
// textBoxDescription // textBoxDescription
// //
textBoxDescription.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
textBoxDescription.Location = new Point(130, 87); textBoxDescription.Location = new Point(130, 87);
textBoxDescription.Multiline = true; textBoxDescription.Multiline = true;
textBoxDescription.Name = "textBoxDescription"; textBoxDescription.Name = "textBoxDescription";
@ -87,7 +89,7 @@
// buttonCancel // buttonCancel
// //
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(207, 240); buttonCancel.Location = new Point(210, 239);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(112, 30); buttonCancel.Size = new Size(112, 30);
buttonCancel.TabIndex = 9; buttonCancel.TabIndex = 9;
@ -98,7 +100,7 @@
// buttonSave // buttonSave
// //
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(10, 240); buttonSave.Location = new Point(10, 239);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(111, 30); buttonSave.Size = new Size(111, 30);
buttonSave.TabIndex = 8; buttonSave.TabIndex = 8;
@ -108,6 +110,7 @@
// //
// comboBoxBus // comboBoxBus
// //
comboBoxBus.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
comboBoxBus.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxBus.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxBus.FormattingEnabled = true; comboBoxBus.FormattingEnabled = true;
comboBoxBus.Location = new Point(130, 11); comboBoxBus.Location = new Point(130, 11);
@ -119,7 +122,7 @@
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(331, 282); ClientSize = new Size(334, 281);
Controls.Add(comboBoxBus); Controls.Add(comboBoxBus);
Controls.Add(buttonCancel); Controls.Add(buttonCancel);
Controls.Add(buttonSave); Controls.Add(buttonSave);
@ -128,6 +131,8 @@
Controls.Add(label3); Controls.Add(label3);
Controls.Add(label2); Controls.Add(label2);
Controls.Add(label1); Controls.Add(label1);
MaximumSize = new Size(800, 400);
MinimumSize = new Size(350, 320);
Name = "FormBusRepair"; Name = "FormBusRepair";
StartPosition = FormStartPosition.CenterParent; StartPosition = FormStartPosition.CenterParent;
Text = "Ремонт автобусов"; Text = "Ремонт автобусов";

View File

@ -1,6 +1,5 @@
using ProjectAutoenterprise.Entities; using ProjectAutoenterprise.Entities;
using ProjectAutoenterprise.Repositories; using ProjectAutoenterprise.Repositories;
namespace ProjectAutoenterprise.Forms; namespace ProjectAutoenterprise.Forms;
public partial class FormBusRepair : Form public partial class FormBusRepair : Form
@ -12,7 +11,7 @@ public partial class FormBusRepair : Form
_busRepairRepository = busRepairRepository ?? _busRepairRepository = busRepairRepository ??
throw new ArgumentNullException(nameof(busRepairRepository)); throw new ArgumentNullException(nameof(busRepairRepository));
comboBoxBus.DataSource = busRepository.ReadBuses(); comboBoxBus.DataSource = busRepository.ReadBuses();
comboBoxBus.DisplayMember = "Brand"; comboBoxBus.DisplayMember = "Id";
comboBoxBus.ValueMember = "Id"; comboBoxBus.ValueMember = "Id";
} }
private void ButtonSave_Click(object sender, EventArgs e) private void ButtonSave_Click(object sender, EventArgs e)

View File

@ -39,9 +39,9 @@
// //
panel.Controls.Add(buttonAdd); panel.Controls.Add(buttonAdd);
panel.Dock = DockStyle.Right; panel.Dock = DockStyle.Right;
panel.Location = new Point(698, 0); panel.Location = new Point(682, 0);
panel.Name = "panel"; panel.Name = "panel";
panel.Size = new Size(102, 450); panel.Size = new Size(102, 411);
panel.TabIndex = 2; panel.TabIndex = 2;
// //
// buttonAdd // buttonAdd
@ -70,17 +70,19 @@
dataGridViewData.Name = "dataGridViewData"; dataGridViewData.Name = "dataGridViewData";
dataGridViewData.ReadOnly = true; dataGridViewData.ReadOnly = true;
dataGridViewData.RowHeadersVisible = false; dataGridViewData.RowHeadersVisible = false;
dataGridViewData.Size = new Size(698, 450); dataGridViewData.Size = new Size(682, 411);
dataGridViewData.TabIndex = 3; dataGridViewData.TabIndex = 3;
// //
// FormBusRepairs // FormBusRepairs
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(784, 411);
Controls.Add(dataGridViewData); Controls.Add(dataGridViewData);
Controls.Add(panel); Controls.Add(panel);
MinimumSize = new Size(400, 300);
Name = "FormBusRepairs"; Name = "FormBusRepairs";
StartPosition = FormStartPosition.CenterParent;
Text = "FormBusRepairs"; Text = "FormBusRepairs";
Load += FormBusRepairs_Load; Load += FormBusRepairs_Load;
panel.ResumeLayout(false); panel.ResumeLayout(false);

View File

@ -43,16 +43,16 @@
panel.Controls.Add(buttonDelete); panel.Controls.Add(buttonDelete);
panel.Controls.Add(buttonAdd); panel.Controls.Add(buttonAdd);
panel.Dock = DockStyle.Right; panel.Dock = DockStyle.Right;
panel.Location = new Point(698, 0); panel.Location = new Point(682, 0);
panel.Name = "panel"; panel.Name = "panel";
panel.Size = new Size(102, 450); panel.Size = new Size(102, 411);
panel.TabIndex = 1; panel.TabIndex = 1;
// //
// buttonEdit // buttonEdit
// //
buttonEdit.BackgroundImage = Properties.Resources.Edit; buttonEdit.BackgroundImage = Properties.Resources.Edit;
buttonEdit.BackgroundImageLayout = ImageLayout.Stretch; buttonEdit.BackgroundImageLayout = ImageLayout.Stretch;
buttonEdit.Location = new Point(20, 197); buttonEdit.Location = new Point(20, 196);
buttonEdit.Name = "buttonEdit"; buttonEdit.Name = "buttonEdit";
buttonEdit.Size = new Size(70, 70); buttonEdit.Size = new Size(70, 70);
buttonEdit.TabIndex = 3; buttonEdit.TabIndex = 3;
@ -96,17 +96,19 @@
dataGridViewData.Name = "dataGridViewData"; dataGridViewData.Name = "dataGridViewData";
dataGridViewData.ReadOnly = true; dataGridViewData.ReadOnly = true;
dataGridViewData.RowHeadersVisible = false; dataGridViewData.RowHeadersVisible = false;
dataGridViewData.Size = new Size(698, 450); dataGridViewData.Size = new Size(682, 411);
dataGridViewData.TabIndex = 2; dataGridViewData.TabIndex = 2;
// //
// FormBuses // FormBuses
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(784, 411);
Controls.Add(dataGridViewData); Controls.Add(dataGridViewData);
Controls.Add(panel); Controls.Add(panel);
MinimumSize = new Size(400, 300);
Name = "FormBuses"; Name = "FormBuses";
StartPosition = FormStartPosition.CenterParent;
Text = "Автобусы"; Text = "Автобусы";
Load += FormBuses_Load; Load += FormBuses_Load;
panel.ResumeLayout(false); panel.ResumeLayout(false);

View File

@ -94,7 +94,7 @@
// buttonCancel // buttonCancel
// //
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(205, 147); buttonCancel.Location = new Point(235, 147);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(140, 30); buttonCancel.Size = new Size(140, 30);
buttonCancel.TabIndex = 6; buttonCancel.TabIndex = 6;
@ -104,39 +104,43 @@
// //
// comboBoxPost // comboBoxPost
// //
comboBoxPost.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
comboBoxPost.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxPost.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxPost.FormattingEnabled = true; comboBoxPost.FormattingEnabled = true;
comboBoxPost.Location = new Point(142, 110); comboBoxPost.Location = new Point(142, 110);
comboBoxPost.Name = "comboBoxPost"; comboBoxPost.Name = "comboBoxPost";
comboBoxPost.Size = new Size(200, 23); comboBoxPost.Size = new Size(230, 23);
comboBoxPost.TabIndex = 7; comboBoxPost.TabIndex = 7;
// //
// textBoxFirstName // textBoxFirstName
// //
textBoxFirstName.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
textBoxFirstName.Location = new Point(142, 44); textBoxFirstName.Location = new Point(142, 44);
textBoxFirstName.Name = "textBoxFirstName"; textBoxFirstName.Name = "textBoxFirstName";
textBoxFirstName.Size = new Size(200, 23); textBoxFirstName.Size = new Size(230, 23);
textBoxFirstName.TabIndex = 9; textBoxFirstName.TabIndex = 9;
// //
// textBoxLastName // textBoxLastName
// //
textBoxLastName.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
textBoxLastName.Location = new Point(141, 11); textBoxLastName.Location = new Point(141, 11);
textBoxLastName.Name = "textBoxLastName"; textBoxLastName.Name = "textBoxLastName";
textBoxLastName.Size = new Size(200, 23); textBoxLastName.Size = new Size(230, 23);
textBoxLastName.TabIndex = 10; textBoxLastName.TabIndex = 10;
// //
// dateTimePickerBirthDate // dateTimePickerBirthDate
// //
dateTimePickerBirthDate.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
dateTimePickerBirthDate.Location = new Point(142, 75); dateTimePickerBirthDate.Location = new Point(142, 75);
dateTimePickerBirthDate.Name = "dateTimePickerBirthDate"; dateTimePickerBirthDate.Name = "dateTimePickerBirthDate";
dateTimePickerBirthDate.Size = new Size(200, 23); dateTimePickerBirthDate.Size = new Size(230, 23);
dateTimePickerBirthDate.TabIndex = 11; dateTimePickerBirthDate.TabIndex = 11;
// //
// FormEmployee // FormEmployee
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(354, 191); ClientSize = new Size(384, 191);
Controls.Add(dateTimePickerBirthDate); Controls.Add(dateTimePickerBirthDate);
Controls.Add(textBoxLastName); Controls.Add(textBoxLastName);
Controls.Add(textBoxFirstName); Controls.Add(textBoxFirstName);
@ -147,6 +151,8 @@
Controls.Add(label3); Controls.Add(label3);
Controls.Add(label2); Controls.Add(label2);
Controls.Add(label1); Controls.Add(label1);
MaximumSize = new Size(500, 230);
MinimumSize = new Size(400, 230);
Name = "FormEmployee"; Name = "FormEmployee";
StartPosition = FormStartPosition.CenterParent; StartPosition = FormStartPosition.CenterParent;
Text = "Работник"; Text = "Работник";

View File

@ -30,6 +30,7 @@ public partial class FormEmployee : Form
} }
} }
} }
public FormEmployee(IEmployeeRepository employeeRepository) public FormEmployee(IEmployeeRepository employeeRepository)
{ {
InitializeComponent(); InitializeComponent();
@ -37,6 +38,7 @@ public partial class FormEmployee : Form
throw new ArgumentNullException(nameof(employeeRepository)); throw new ArgumentNullException(nameof(employeeRepository));
comboBoxPost.DataSource = Enum.GetValues(typeof(EmployeePost)); comboBoxPost.DataSource = Enum.GetValues(typeof(EmployeePost));
} }
private void ButtonSave_Click(object sender, EventArgs e) private void ButtonSave_Click(object sender, EventArgs e)
{ {
try try

View File

@ -43,9 +43,9 @@
panel.Controls.Add(buttonDelete); panel.Controls.Add(buttonDelete);
panel.Controls.Add(buttonAdd); panel.Controls.Add(buttonAdd);
panel.Dock = DockStyle.Right; panel.Dock = DockStyle.Right;
panel.Location = new Point(698, 0); panel.Location = new Point(682, 0);
panel.Name = "panel"; panel.Name = "panel";
panel.Size = new Size(102, 450); panel.Size = new Size(102, 411);
panel.TabIndex = 0; panel.TabIndex = 0;
// //
// buttonEdit // buttonEdit
@ -96,17 +96,19 @@
dataGridViewData.Name = "dataGridViewData"; dataGridViewData.Name = "dataGridViewData";
dataGridViewData.ReadOnly = true; dataGridViewData.ReadOnly = true;
dataGridViewData.RowHeadersVisible = false; dataGridViewData.RowHeadersVisible = false;
dataGridViewData.Size = new Size(698, 450); dataGridViewData.Size = new Size(682, 411);
dataGridViewData.TabIndex = 1; dataGridViewData.TabIndex = 1;
// //
// FormEmployees // FormEmployees
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(784, 411);
Controls.Add(dataGridViewData); Controls.Add(dataGridViewData);
Controls.Add(panel); Controls.Add(panel);
MinimumSize = new Size(400, 300);
Name = "FormEmployees"; Name = "FormEmployees";
StartPosition = FormStartPosition.CenterParent;
Text = "Работники"; Text = "Работники";
Load += FormEmployees_Load; Load += FormEmployees_Load;
panel.ResumeLayout(false); panel.ResumeLayout(false);

View File

@ -41,9 +41,9 @@
panel.Controls.Add(buttonDelete); panel.Controls.Add(buttonDelete);
panel.Controls.Add(buttonAdd); panel.Controls.Add(buttonAdd);
panel.Dock = DockStyle.Right; panel.Dock = DockStyle.Right;
panel.Location = new Point(698, 0); panel.Location = new Point(682, 0);
panel.Name = "panel"; panel.Name = "panel";
panel.Size = new Size(102, 450); panel.Size = new Size(102, 411);
panel.TabIndex = 2; panel.TabIndex = 2;
// //
// buttonDelete // buttonDelete
@ -83,16 +83,17 @@
dataGridViewData.Name = "dataGridViewData"; dataGridViewData.Name = "dataGridViewData";
dataGridViewData.ReadOnly = true; dataGridViewData.ReadOnly = true;
dataGridViewData.RowHeadersVisible = false; dataGridViewData.RowHeadersVisible = false;
dataGridViewData.Size = new Size(698, 450); dataGridViewData.Size = new Size(682, 411);
dataGridViewData.TabIndex = 3; dataGridViewData.TabIndex = 3;
// //
// FormItineraries // FormItineraries
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(784, 411);
Controls.Add(dataGridViewData); Controls.Add(dataGridViewData);
Controls.Add(panel); Controls.Add(panel);
MinimumSize = new Size(400, 300);
Name = "FormItineraries"; Name = "FormItineraries";
StartPosition = FormStartPosition.CenterParent; StartPosition = FormStartPosition.CenterParent;
Text = "Маршрутные листы"; Text = "Маршрутные листы";

View File

@ -1,6 +1,5 @@
using ProjectAutoenterprise.Repositories; using ProjectAutoenterprise.Repositories;
using Unity; using Unity;
namespace ProjectAutoenterprise.Forms; namespace ProjectAutoenterprise.Forms;
public partial class FormItineraries : Form public partial class FormItineraries : Form
@ -15,6 +14,7 @@ public partial class FormItineraries : Form
_itineraryRepository = itineraryRepository ?? _itineraryRepository = itineraryRepository ??
throw new ArgumentNullException(nameof(itineraryRepository)); throw new ArgumentNullException(nameof(itineraryRepository));
} }
private void FormItinerarys_Load(object sender, EventArgs e) private void FormItinerarys_Load(object sender, EventArgs e)
{ {
try try
@ -26,6 +26,7 @@ public partial class FormItineraries : Form
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void ButtonAdd_Click(object sender, EventArgs e) private void ButtonAdd_Click(object sender, EventArgs e)
{ {
try try
@ -38,6 +39,7 @@ public partial class FormItineraries : Form
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void ButtonDelete_Click(object sender, EventArgs e) private void ButtonDelete_Click(object sender, EventArgs e)
{ {
if (!TryGetIdentifierFromSelectedRow(out var findId)) if (!TryGetIdentifierFromSelectedRow(out var findId))
@ -58,7 +60,9 @@ public partial class FormItineraries : Form
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void LoadList() => dataGridViewData.DataSource = _itineraryRepository.ReadItinerary(); private void LoadList() => dataGridViewData.DataSource = _itineraryRepository.ReadItinerary();
private bool TryGetIdentifierFromSelectedRow(out int id) private bool TryGetIdentifierFromSelectedRow(out int id)
{ {
id = 0; id = 0;

View File

@ -30,7 +30,6 @@
{ {
groupBoxRoutes = new GroupBox(); groupBoxRoutes = new GroupBox();
dataGridViewRoutes = new DataGridView(); dataGridViewRoutes = new DataGridView();
ColumnRoute = new DataGridViewComboBoxColumn();
comboBoxBus = new ComboBox(); comboBoxBus = new ComboBox();
label1 = new Label(); label1 = new Label();
comboBoxDriver = new ComboBox(); comboBoxDriver = new ComboBox();
@ -43,6 +42,7 @@
label5 = new Label(); label5 = new Label();
buttonCancel = new Button(); buttonCancel = new Button();
buttonSave = new Button(); buttonSave = new Button();
ColumnRoute = new DataGridViewComboBoxColumn();
groupBoxRoutes.SuspendLayout(); groupBoxRoutes.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewRoutes).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridViewRoutes).BeginInit();
SuspendLayout(); SuspendLayout();
@ -53,7 +53,7 @@
groupBoxRoutes.Controls.Add(dataGridViewRoutes); groupBoxRoutes.Controls.Add(dataGridViewRoutes);
groupBoxRoutes.Location = new Point(333, 12); groupBoxRoutes.Location = new Point(333, 12);
groupBoxRoutes.Name = "groupBoxRoutes"; groupBoxRoutes.Name = "groupBoxRoutes";
groupBoxRoutes.Size = new Size(256, 207); groupBoxRoutes.Size = new Size(259, 202);
groupBoxRoutes.TabIndex = 0; groupBoxRoutes.TabIndex = 0;
groupBoxRoutes.TabStop = false; groupBoxRoutes.TabStop = false;
groupBoxRoutes.Text = "Маршруты"; groupBoxRoutes.Text = "Маршруты";
@ -66,14 +66,9 @@
dataGridViewRoutes.Dock = DockStyle.Fill; dataGridViewRoutes.Dock = DockStyle.Fill;
dataGridViewRoutes.Location = new Point(3, 19); dataGridViewRoutes.Location = new Point(3, 19);
dataGridViewRoutes.Name = "dataGridViewRoutes"; dataGridViewRoutes.Name = "dataGridViewRoutes";
dataGridViewRoutes.Size = new Size(250, 185); dataGridViewRoutes.Size = new Size(253, 180);
dataGridViewRoutes.TabIndex = 0; dataGridViewRoutes.TabIndex = 0;
// //
// ColumnRoute
//
ColumnRoute.HeaderText = "Маршрут";
ColumnRoute.Name = "ColumnRoute";
//
// comboBoxBus // comboBoxBus
// //
comboBoxBus.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxBus.DropDownStyle = ComboBoxStyle.DropDownList;
@ -87,7 +82,7 @@
// //
label1.AutoSize = true; label1.AutoSize = true;
label1.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204); 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.Name = "label1";
label1.Size = new Size(71, 21); label1.Size = new Size(71, 21);
label1.TabIndex = 11; label1.TabIndex = 11;
@ -106,7 +101,7 @@
// //
label2.AutoSize = true; label2.AutoSize = true;
label2.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204); 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.Name = "label2";
label2.Size = new Size(80, 21); label2.Size = new Size(80, 21);
label2.TabIndex = 13; label2.TabIndex = 13;
@ -125,7 +120,7 @@
// //
label3.AutoSize = true; label3.AutoSize = true;
label3.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204); 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.Name = "label3";
label3.Size = new Size(90, 21); label3.Size = new Size(90, 21);
label3.TabIndex = 15; label3.TabIndex = 15;
@ -143,7 +138,7 @@
// //
label4.AutoSize = true; label4.AutoSize = true;
label4.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 204); 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.Name = "label4";
label4.Size = new Size(47, 21); label4.Size = new Size(47, 21);
label4.TabIndex = 17; label4.TabIndex = 17;
@ -155,7 +150,7 @@
textBoxDescription.Location = new Point(122, 251); textBoxDescription.Location = new Point(122, 251);
textBoxDescription.Multiline = true; textBoxDescription.Multiline = true;
textBoxDescription.Name = "textBoxDescription"; textBoxDescription.Name = "textBoxDescription";
textBoxDescription.Size = new Size(464, 113); textBoxDescription.Size = new Size(467, 108);
textBoxDescription.TabIndex = 20; textBoxDescription.TabIndex = 20;
// //
// label5 // label5
@ -171,7 +166,7 @@
// buttonCancel // buttonCancel
// //
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(146, 404); buttonCancel.Location = new Point(477, 399);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(112, 30); buttonCancel.Size = new Size(112, 30);
buttonCancel.TabIndex = 22; buttonCancel.TabIndex = 22;
@ -182,7 +177,7 @@
// buttonSave // buttonSave
// //
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(17, 404); buttonSave.Location = new Point(17, 399);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(111, 30); buttonSave.Size = new Size(111, 30);
buttonSave.TabIndex = 21; buttonSave.TabIndex = 21;
@ -190,11 +185,17 @@
buttonSave.UseVisualStyleBackColor = true; buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click; buttonSave.Click += ButtonSave_Click;
// //
// ColumnRoute
//
ColumnRoute.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
ColumnRoute.HeaderText = "Маршрут";
ColumnRoute.Name = "ColumnRoute";
//
// FormItinerary // FormItinerary
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(601, 446); ClientSize = new Size(604, 441);
Controls.Add(buttonCancel); Controls.Add(buttonCancel);
Controls.Add(buttonSave); Controls.Add(buttonSave);
Controls.Add(textBoxDescription); Controls.Add(textBoxDescription);
@ -208,6 +209,8 @@
Controls.Add(comboBoxBus); Controls.Add(comboBoxBus);
Controls.Add(label1); Controls.Add(label1);
Controls.Add(groupBoxRoutes); Controls.Add(groupBoxRoutes);
MaximumSize = new Size(800, 500);
MinimumSize = new Size(620, 480);
Name = "FormItinerary"; Name = "FormItinerary";
StartPosition = FormStartPosition.CenterParent; StartPosition = FormStartPosition.CenterParent;
Text = "Маршрутный лист"; Text = "Маршрутный лист";
@ -231,8 +234,8 @@
private Label label4; private Label label4;
private TextBox textBoxDescription; private TextBox textBoxDescription;
private Label label5; private Label label5;
private DataGridViewComboBoxColumn ColumnRoute;
private Button buttonCancel; private Button buttonCancel;
private Button buttonSave; private Button buttonSave;
private DataGridViewComboBoxColumn ColumnRoute;
} }
} }

View File

@ -1,6 +1,6 @@
using ProjectAutoenterprise.Entities; using ProjectAutoenterprise.Entities;
using ProjectAutoenterprise.Entities.Enums;
using ProjectAutoenterprise.Repositories; using ProjectAutoenterprise.Repositories;
namespace ProjectAutoenterprise.Forms; namespace ProjectAutoenterprise.Forms;
public partial class FormItinerary : Form public partial class FormItinerary : Form
@ -17,11 +17,11 @@ public partial class FormItinerary : Form
comboBoxBus.DisplayMember = "Brand"; comboBoxBus.DisplayMember = "Brand";
comboBoxBus.ValueMember = "Id"; comboBoxBus.ValueMember = "Id";
comboBoxDriver.DataSource = employeeRepository.ReadEmployees(); comboBoxDriver.DataSource = employeeRepository.ReadEmployees(EmployeePost.Driver);
comboBoxDriver.DisplayMember = "FirstName"; comboBoxDriver.DisplayMember = "FirstName";
comboBoxDriver.ValueMember = "Id"; comboBoxDriver.ValueMember = "Id";
comboBoxConductor.DataSource = employeeRepository.ReadEmployees(); comboBoxConductor.DataSource = employeeRepository.ReadEmployees(EmployeePost.Conductor);
comboBoxConductor.DisplayMember = "FirstName"; comboBoxConductor.DisplayMember = "FirstName";
comboBoxConductor.ValueMember = "Id"; comboBoxConductor.ValueMember = "Id";
@ -39,8 +39,9 @@ public partial class FormItinerary : Form
{ {
throw new Exception("Имеются незаполненные поля"); throw new Exception("Имеются незаполненные поля");
} }
_itineraryRepository.CreateItinerary(Itinerary.CreateEntity( _itineraryRepository.CreateItinerary(Itinerary.CreateOperation(
0, 0,
(int)comboBoxBus.SelectedValue!,
(int)comboBoxDriver.SelectedValue!, (int)comboBoxDriver.SelectedValue!,
(int)comboBoxConductor.SelectedValue!, (int)comboBoxConductor.SelectedValue!,
dateTimePickerDate.Value, dateTimePickerDate.Value,
@ -63,7 +64,7 @@ public partial class FormItinerary : Form
{ {
continue; 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; return list;
} }

View File

@ -58,6 +58,7 @@
// //
// textBoxBeginRoutePoint // textBoxBeginRoutePoint
// //
textBoxBeginRoutePoint.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
textBoxBeginRoutePoint.Location = new Point(234, 12); textBoxBeginRoutePoint.Location = new Point(234, 12);
textBoxBeginRoutePoint.Name = "textBoxBeginRoutePoint"; textBoxBeginRoutePoint.Name = "textBoxBeginRoutePoint";
textBoxBeginRoutePoint.Size = new Size(265, 23); textBoxBeginRoutePoint.Size = new Size(265, 23);
@ -65,6 +66,7 @@
// //
// textBoxEndRoutePoint // textBoxEndRoutePoint
// //
textBoxEndRoutePoint.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
textBoxEndRoutePoint.Location = new Point(234, 45); textBoxEndRoutePoint.Location = new Point(234, 45);
textBoxEndRoutePoint.Name = "textBoxEndRoutePoint"; textBoxEndRoutePoint.Name = "textBoxEndRoutePoint";
textBoxEndRoutePoint.Size = new Size(265, 23); textBoxEndRoutePoint.Size = new Size(265, 23);
@ -82,6 +84,7 @@
// //
// buttonCancel // buttonCancel
// //
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(359, 80); buttonCancel.Location = new Point(359, 80);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(140, 30); buttonCancel.Size = new Size(140, 30);
@ -101,6 +104,8 @@
Controls.Add(textBoxBeginRoutePoint); Controls.Add(textBoxBeginRoutePoint);
Controls.Add(label2); Controls.Add(label2);
Controls.Add(label1); Controls.Add(label1);
MaximumSize = new Size(600, 160);
MinimumSize = new Size(530, 160);
Name = "FormRoute"; Name = "FormRoute";
StartPosition = FormStartPosition.CenterParent; StartPosition = FormStartPosition.CenterParent;
Text = "Маршрут"; Text = "Маршрут";

View File

@ -32,7 +32,8 @@ public partial class FormRoute : Form
public FormRoute(IRouteRepository routeRepository) public FormRoute(IRouteRepository routeRepository)
{ {
InitializeComponent(); InitializeComponent();
_routeRepository = routeRepository ?? throw new ArgumentNullException(nameof(routeRepository)); _routeRepository = routeRepository ??
throw new ArgumentNullException(nameof(routeRepository));
} }
private void ButtonSave_Click(object sender, EventArgs e) private void ButtonSave_Click(object sender, EventArgs e)

View File

@ -52,7 +52,7 @@
dataGridViewData.Name = "dataGridViewData"; dataGridViewData.Name = "dataGridViewData";
dataGridViewData.ReadOnly = true; dataGridViewData.ReadOnly = true;
dataGridViewData.RowHeadersVisible = false; dataGridViewData.RowHeadersVisible = false;
dataGridViewData.Size = new Size(784, 461); dataGridViewData.Size = new Size(681, 411);
dataGridViewData.TabIndex = 0; dataGridViewData.TabIndex = 0;
// //
// panel // panel
@ -63,7 +63,7 @@
panel.Dock = DockStyle.Right; panel.Dock = DockStyle.Right;
panel.Location = new Point(681, 0); panel.Location = new Point(681, 0);
panel.Name = "panel"; panel.Name = "panel";
panel.Size = new Size(103, 461); panel.Size = new Size(103, 411);
panel.TabIndex = 1; panel.TabIndex = 1;
// //
// buttonEdit // buttonEdit
@ -103,9 +103,10 @@
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(784, 461); ClientSize = new Size(784, 411);
Controls.Add(panel);
Controls.Add(dataGridViewData); Controls.Add(dataGridViewData);
Controls.Add(panel);
MinimumSize = new Size(400, 300);
Name = "FormRoutes"; Name = "FormRoutes";
StartPosition = FormStartPosition.CenterParent; StartPosition = FormStartPosition.CenterParent;
Text = "Маршруты"; Text = "Маршруты";

View File

@ -9,9 +9,12 @@ public partial class FormRoutes : Form
public FormRoutes(IUnityContainer container, IRouteRepository routeRepository) public FormRoutes(IUnityContainer container, IRouteRepository routeRepository)
{ {
InitializeComponent(); InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container)); _container = container ??
_routeRepository = routeRepository ?? throw new ArgumentNullException(nameof(routeRepository)); throw new ArgumentNullException(nameof(container));
_routeRepository = routeRepository ??
throw new ArgumentNullException(nameof(routeRepository));
} }
private void FormRoutes_Load(object sender, EventArgs e) private void FormRoutes_Load(object sender, EventArgs e)
{ {
try try
@ -23,6 +26,7 @@ public partial class FormRoutes : Form
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void ButtonAdd_Click(object sender, EventArgs e) private void ButtonAdd_Click(object sender, EventArgs e)
{ {
try try
@ -35,6 +39,7 @@ public partial class FormRoutes : Form
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void ButtonDelete_Click(object sender, EventArgs e) private void ButtonDelete_Click(object sender, EventArgs e)
{ {
if (!TryGetIdentifierFromSelectedRow(out var findId)) if (!TryGetIdentifierFromSelectedRow(out var findId))
@ -55,6 +60,7 @@ public partial class FormRoutes : Form
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void ButtonEdit_Click(object sender, EventArgs e) private void ButtonEdit_Click(object sender, EventArgs e)
{ {
if (!TryGetIdentifierFromSelectedRow(out var findId)) if (!TryGetIdentifierFromSelectedRow(out var findId))
@ -74,7 +80,9 @@ public partial class FormRoutes : Form
MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void LoadList() => dataGridViewData.DataSource = _routeRepository.ReadRoutes(); private void LoadList() => dataGridViewData.DataSource = _routeRepository.ReadRoutes();
private bool TryGetIdentifierFromSelectedRow(out int id) private bool TryGetIdentifierFromSelectedRow(out int id)
{ {
id = 0; id = 0;

View File

@ -3,7 +3,7 @@ namespace ProjectAutoenterprise.Repositories;
public interface IBusRepairRepository public interface IBusRepairRepository
{ {
void CreateBusRepair(BusRepair busRepair);
IEnumerable<BusRepair> ReadBusRepairs(DateTime? dateForm = null, DateTime? dateTo = null, IEnumerable<BusRepair> ReadBusRepairs(DateTime? dateForm = null, DateTime? dateTo = null,
int? busId = null, string? description = null); int? busId = null, string? description = null);
void CreateBusRepair(BusRepair busRepair);
} }

View File

@ -1,10 +1,12 @@
using ProjectAutoenterprise.Entities; using ProjectAutoenterprise.Entities;
using ProjectAutoenterprise.Entities.Enums;
namespace ProjectAutoenterprise.Repositories; namespace ProjectAutoenterprise.Repositories;
public interface IEmployeeRepository public interface IEmployeeRepository
{ {
IEnumerable<Employee> ReadEmployees(); IEnumerable<Employee> ReadEmployees();
IEnumerable<Employee> ReadEmployees(EmployeePost employeePost);
Employee ReadEmployeeById(int id); Employee ReadEmployeeById(int id);
void CreateEmployee(Employee employee); void CreateEmployee(Employee employee);
void UpdateEmployee(Employee employee); void UpdateEmployee(Employee employee);

View File

@ -1,6 +1,5 @@
using ProjectAutoenterprise.Entities; using ProjectAutoenterprise.Entities;
using ProjectAutoenterprise.Entities.Enums; using ProjectAutoenterprise.Entities.Enums;
namespace ProjectAutoenterprise.Repositories.Implementations; namespace ProjectAutoenterprise.Repositories.Implementations;
internal class EmployeeRepository : IEmployeeRepository internal class EmployeeRepository : IEmployeeRepository
@ -25,6 +24,11 @@ internal class EmployeeRepository : IEmployeeRepository
return []; return [];
} }
public IEnumerable<Employee> ReadEmployees(EmployeePost employeePost)
{
return [];
}
public void UpdateEmployee(Employee employee) public void UpdateEmployee(Employee employee)
{ {