From 36793fef25345fec56f780504c87a63618df8c46 Mon Sep 17 00:00:00 2001 From: Aidar Date: Tue, 26 Nov 2024 21:13:12 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=20=E2=84=961=20(=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectAutoenterprise/Entities/Bus.cs | 3 + .../Entities/BusRepair.cs | 6 +- .../Entities/Employee.cs | 6 +- .../Entities/Enums/BusColors.cs | 2 +- .../Entities/Itinerary.cs | 10 +- .../Entities/ItineraryRoutes.cs | 13 +- .../ProjectAutoenterprise/Entities/Route.cs | 7 +- .../FormAutoenterprise.Designer.cs | 57 ++++---- .../FormAutoenterprise.cs | 128 ++++++++++-------- .../Forms/FormBus.Designer.cs | 12 +- .../ProjectAutoenterprise/Forms/FormBus.cs | 2 +- .../Forms/FormBusRepair.Designer.cs | 11 +- .../Forms/FormBusRepair.cs | 5 +- .../Forms/FormBusRepairs.Designer.cs | 10 +- .../Forms/FormBuses.Designer.cs | 12 +- .../Forms/FormEmployee.Designer.cs | 18 ++- .../Forms/FormEmployee.cs | 2 + .../Forms/FormEmployees.Designer.cs | 10 +- .../Forms/FormItineraries.Designer.cs | 9 +- .../Forms/FormItineraries.cs | 6 +- .../Forms/FormItinerary.Designer.cs | 37 ++--- .../Forms/FormItinerary.cs | 11 +- .../Forms/FormRoute.Designer.cs | 5 + .../ProjectAutoenterprise/Forms/FormRoute.cs | 3 +- .../Forms/FormRoutes.Designer.cs | 9 +- .../ProjectAutoenterprise/Forms/FormRoutes.cs | 12 +- .../Repositories/IBusRepairRepository.cs | 2 +- .../Repositories/IEmployeeRepository.cs | 2 + .../Implementations/EmployeeRepository.cs | 8 +- .../Implementations/RouteRepository.cs | 2 +- 30 files changed, 252 insertions(+), 168 deletions(-) diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Bus.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Bus.cs index 9afda35..aed6192 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Bus.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Bus.cs @@ -1,6 +1,9 @@ using ProjectAutoenterprise.Entities.Enums; namespace ProjectAutoenterprise.Entities; +/// +/// Сущность-справочник "Автобус" +/// public class Bus { public int Id { get; private set; } diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/BusRepair.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/BusRepair.cs index d8fc73f..cf334f4 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/BusRepair.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/BusRepair.cs @@ -1,6 +1,8 @@ -using System; -namespace ProjectAutoenterprise.Entities; +namespace ProjectAutoenterprise.Entities; +/// +/// Сущность-операция "Ремонт автобуса" +/// public class BusRepair { public int Id { get; private set; } diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Employee.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Employee.cs index f5212c8..76d3efc 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Employee.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Employee.cs @@ -1,6 +1,9 @@ using ProjectAutoenterprise.Entities.Enums; namespace ProjectAutoenterprise.Entities; +/// +/// Сущность-справочник "Работник" +/// 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 { diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Enums/BusColors.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Enums/BusColors.cs index fea5ddb..aed0daa 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Enums/BusColors.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Enums/BusColors.cs @@ -7,5 +7,5 @@ public enum BusColors Yellow = 1, Black = 2, Blue = 4, - Green = 8 + Green = 8 } \ No newline at end of file diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Itinerary.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Itinerary.cs index 2d9fdaf..f39a68b 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Itinerary.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Itinerary.cs @@ -1,5 +1,8 @@ namespace ProjectAutoenterprise.Entities; +/// +/// Сущность-операция "Маршрутный лист" +/// 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) { 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 }; } } \ No newline at end of file diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/ItineraryRoutes.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/ItineraryRoutes.cs index 589c340..b1f147a 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/ItineraryRoutes.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/ItineraryRoutes.cs @@ -1,12 +1,19 @@ namespace ProjectAutoenterprise.Entities; +/// +/// Сущность-элемент "Маршрутный лист - Маршрут" реализующий связь многие ко многим между сущностями "Маршрутный лист" и "Маршрут" +/// 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 + }; } } \ No newline at end of file diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Route.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Route.cs index 4bca98a..3aaafec 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Route.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Entities/Route.cs @@ -1,5 +1,8 @@ namespace ProjectAutoenterprise.Entities; +/// +/// Сущность-справочник "Маршрут" +/// 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 }; } } \ No newline at end of file diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/FormAutoenterprise.Designer.cs b/ProjectAutoenterprise/ProjectAutoenterprise/FormAutoenterprise.Designer.cs index 8d09c86..aa28baa 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/FormAutoenterprise.Designer.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/FormAutoenterprise.Designer.cs @@ -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; } } diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/FormAutoenterprise.cs b/ProjectAutoenterprise/ProjectAutoenterprise/FormAutoenterprise.cs index 3610410..a3f3571 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/FormAutoenterprise.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/FormAutoenterprise.cs @@ -1,76 +1,88 @@ using ProjectAutoenterprise.Forms; using Unity; +namespace ProjectAutoenterprise; -namespace ProjectAutoenterprise +/// +/// +/// +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) + /// + /// "" () + /// + private void ToolStripMenuItemRoutes_Click(object sender, EventArgs e) + { + try { - try - { - _container.Resolve().ShowDialog(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); - } + _container.Resolve().ShowDialog(); } - - private void ToolStripMenuItemEmployees_Click(object sender, EventArgs e) + catch (Exception ex) { - try - { - _container.Resolve().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) + } + /// + /// "" () + /// + private void ToolStripMenuItemEmployees_Click(object sender, EventArgs e) + { + try { - try - { - _container.Resolve().ShowDialog(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); - } + _container.Resolve().ShowDialog(); } - - private void ToolStripMenuItemBusRepairs_Click(object sender, EventArgs e) + catch (Exception ex) { - try - { - _container.Resolve().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) + } + /// + /// "" () + /// + private void ToolStripMenuItemBuses_Click(object sender, EventArgs e) + { + try { - try - { - _container.Resolve().ShowDialog(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); - } + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + /// + /// " " () + /// + private void ToolStripMenuItemBusRepairs_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + /// + /// " " () + /// + private void ToolStripMenuItemCreatreItinerary_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } \ No newline at end of file diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBus.Designer.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBus.Designer.cs index a7634ee..b139da9 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBus.Designer.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBus.Designer.cs @@ -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 = "Автобус"; diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBus.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBus.cs index bd48132..a11287e 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBus.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBus.cs @@ -81,4 +81,4 @@ public partial class FormBus : Form } return Bus.CreateEntity(id, textBoxBrand.Text, Convert.ToInt32(numericUpDownCapacity.Value), busColors); } -} +} \ No newline at end of file diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBusRepair.Designer.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBusRepair.Designer.cs index e856bc8..8423dd5 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBusRepair.Designer.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBusRepair.Designer.cs @@ -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 = "Ремонт автобусов"; diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBusRepair.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBusRepair.cs index 6125a64..9e615ef 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBusRepair.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBusRepair.cs @@ -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) diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBusRepairs.Designer.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBusRepairs.Designer.cs index b03e1b7..eb71e7f 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBusRepairs.Designer.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBusRepairs.Designer.cs @@ -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); diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBuses.Designer.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBuses.Designer.cs index 7e63fcc..0fe813a 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBuses.Designer.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormBuses.Designer.cs @@ -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); diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormEmployee.Designer.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormEmployee.Designer.cs index 7fc06d2..a2db882 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormEmployee.Designer.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormEmployee.Designer.cs @@ -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 = "Работник"; diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormEmployee.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormEmployee.cs index 10ccbf7..c5d6203 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormEmployee.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormEmployee.cs @@ -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 diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormEmployees.Designer.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormEmployees.Designer.cs index 4a947df..0e3f240 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormEmployees.Designer.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormEmployees.Designer.cs @@ -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); diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItineraries.Designer.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItineraries.Designer.cs index 8f0d202..5d64ac1 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItineraries.Designer.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItineraries.Designer.cs @@ -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 = "Маршрутные листы"; diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItineraries.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItineraries.cs index 61248c2..81b73e8 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItineraries.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItineraries.cs @@ -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; diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItinerary.Designer.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItinerary.Designer.cs index db7a652..90b5519 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItinerary.Designer.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItinerary.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItinerary.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItinerary.cs index 4ec44f5..02105ef 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItinerary.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormItinerary.cs @@ -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; } diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoute.Designer.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoute.Designer.cs index b47c00f..364034e 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoute.Designer.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoute.Designer.cs @@ -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 = "Маршрут"; diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoute.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoute.cs index 8ff867d..0335fe7 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoute.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoute.cs @@ -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) diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoutes.Designer.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoutes.Designer.cs index 769a79d..38e378d 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoutes.Designer.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoutes.Designer.cs @@ -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 = "Маршруты"; diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoutes.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoutes.cs index 926acea..0df7128 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoutes.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Forms/FormRoutes.cs @@ -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; diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/IBusRepairRepository.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/IBusRepairRepository.cs index bb3e0f2..ce13e7b 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/IBusRepairRepository.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/IBusRepairRepository.cs @@ -3,7 +3,7 @@ namespace ProjectAutoenterprise.Repositories; public interface IBusRepairRepository { + void CreateBusRepair(BusRepair busRepair); IEnumerable ReadBusRepairs(DateTime? dateForm = null, DateTime? dateTo = null, int? busId = null, string? description = null); - void CreateBusRepair(BusRepair busRepair); } \ No newline at end of file diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/IEmployeeRepository.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/IEmployeeRepository.cs index 40aedec..6877deb 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/IEmployeeRepository.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/IEmployeeRepository.cs @@ -1,10 +1,12 @@ using ProjectAutoenterprise.Entities; +using ProjectAutoenterprise.Entities.Enums; namespace ProjectAutoenterprise.Repositories; public interface IEmployeeRepository { IEnumerable ReadEmployees(); + IEnumerable ReadEmployees(EmployeePost employeePost); Employee ReadEmployeeById(int id); void CreateEmployee(Employee employee); void UpdateEmployee(Employee employee); diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/Implementations/EmployeeRepository.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/Implementations/EmployeeRepository.cs index 20affbe..c9bc573 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/Implementations/EmployeeRepository.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/Implementations/EmployeeRepository.cs @@ -1,6 +1,5 @@ using ProjectAutoenterprise.Entities; using ProjectAutoenterprise.Entities.Enums; - namespace ProjectAutoenterprise.Repositories.Implementations; internal class EmployeeRepository : IEmployeeRepository @@ -25,8 +24,13 @@ internal class EmployeeRepository : IEmployeeRepository return []; } + public IEnumerable ReadEmployees(EmployeePost employeePost) + { + return []; + } + public void UpdateEmployee(Employee employee) { } -} +} \ No newline at end of file diff --git a/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/Implementations/RouteRepository.cs b/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/Implementations/RouteRepository.cs index 073a272..2a4bb07 100644 --- a/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/Implementations/RouteRepository.cs +++ b/ProjectAutoenterprise/ProjectAutoenterprise/Repositories/Implementations/RouteRepository.cs @@ -20,4 +20,4 @@ internal class RouteRepository : IRouteRepository public void UpdateRoute(Route route) { } -} +} \ No newline at end of file