правки
This commit is contained in:
parent
c2696934af
commit
d74bbe43a0
28
TransportEnterprise/TransportEnterprise/Entities/Bus.cs
Normal file
28
TransportEnterprise/TransportEnterprise/Entities/Bus.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using TransportEnterprise.Entities.Enums;
|
||||
|
||||
namespace TransportEnterprise.Entities;
|
||||
|
||||
public class Bus
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Model { get; private set; } = string.Empty;
|
||||
public int Capacity { get; private set; }
|
||||
public string LicensePlate { get; private set; } = string.Empty;
|
||||
public string Brand { get; private set; } = string.Empty;
|
||||
public int Year { get; private set; }
|
||||
public TechnicalCondition TechnicalCondition { get; private set; }
|
||||
|
||||
public static Bus CreateBus(int id, string model, int capacity, string licensePlate, string brand, int year, TechnicalCondition technicalCondition)
|
||||
{
|
||||
return new Bus
|
||||
{
|
||||
Id = id,
|
||||
Model = model ?? string.Empty,
|
||||
Capacity = capacity,
|
||||
LicensePlate = licensePlate ?? string.Empty,
|
||||
Brand = brand ?? string.Empty,
|
||||
Year = year,
|
||||
TechnicalCondition = technicalCondition
|
||||
};
|
||||
}
|
||||
}
|
23
TransportEnterprise/TransportEnterprise/Entities/Employee.cs
Normal file
23
TransportEnterprise/TransportEnterprise/Entities/Employee.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using TransportEnterprise.Entities.Enums;
|
||||
|
||||
namespace TransportEnterprise.Entities;
|
||||
|
||||
public class Employee
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public int Number { get; private set; }
|
||||
public PositionOfEmployee PositionOfEmployee { get; private set; }
|
||||
public string PhoneNumber { get; private set; } = string.Empty;
|
||||
public static Employee CreateEmployee(int id, string name, int number, PositionOfEmployee positionOfEmployee, string phoheNumber)
|
||||
{
|
||||
return new Employee
|
||||
{
|
||||
Id = id,
|
||||
Name = name ?? string.Empty,
|
||||
Number = number,
|
||||
PositionOfEmployee = positionOfEmployee,
|
||||
PhoneNumber = phoheNumber ?? string.Empty
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace TransportEnterprise.Entities.Enums;
|
||||
[Flags]
|
||||
public enum BreakDownType
|
||||
{
|
||||
None = 0,
|
||||
RunningGear =1,
|
||||
Enginee = 2,
|
||||
Backseat = 4
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
namespace TransportEnterprise.Entities.Enums;
|
||||
|
||||
public enum PositionOfEmployee
|
||||
{
|
||||
None = 0,
|
||||
Enginer = 1,
|
||||
Conductor = 2,
|
||||
Driver = 3,
|
||||
Admin = 4
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace TransportEnterprise.Entities.Enums;
|
||||
public enum TechnicalCondition
|
||||
{
|
||||
None = 0,
|
||||
ReadyToGo = 1,
|
||||
RequiresRepair = 2,
|
||||
ReadyToGo_NeedsRepair=4
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using TransportEnterprise.Entities.Enums;
|
||||
|
||||
namespace TransportEnterprise.Entities;
|
||||
|
||||
public class RepairRequest
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int BusId { get; private set; }
|
||||
public BreakDownType BreakDownType { get; private set; }
|
||||
public DateTime Date { get; private set; }
|
||||
public int EmployeeId { get; private set; }
|
||||
public static RepairRequest CreateRepairRequest(int id, int busId, BreakDownType breakDownType, DateTime date, int employeeId)
|
||||
{
|
||||
return new RepairRequest
|
||||
{
|
||||
Id = id,
|
||||
BusId = busId,
|
||||
BreakDownType = breakDownType,
|
||||
Date = date,
|
||||
EmployeeId = employeeId
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
namespace TransportEnterprise.Entities.Repositories;
|
||||
|
||||
public interface IBusRepository
|
||||
{
|
||||
IEnumerable<Bus> ReadBuses();
|
||||
Bus ReadBusById(int id);
|
||||
void CreateBus(Bus bus);
|
||||
void UpdateBus(Bus bus);
|
||||
void DeleteBus(int id);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
namespace TransportEnterprise.Entities.Repositories;
|
||||
|
||||
public interface IEmployeeRepository
|
||||
{
|
||||
IEnumerable<Employee> ReadEmployees();
|
||||
Employee ReadEmployeeById(int id);
|
||||
void CreateEmployee(Employee employee);
|
||||
void UpdateEmployee(Employee employee);
|
||||
void DeleteEmployee(int id);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace TransportEnterprise.Entities.Repositories;
|
||||
|
||||
public interface IRepairRequestRepository
|
||||
{
|
||||
IEnumerable<RepairRequest> ReadRepairRequests();
|
||||
RepairRequest ReadRepairRequestById(int id);
|
||||
void CreateRepairRequest(RepairRequest repairRequest);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace TransportEnterprise.Entities.Repositories;
|
||||
public interface IRouteRepository
|
||||
{
|
||||
IEnumerable<Route> ReadRoutes();
|
||||
Route ReadRouteById(int id);
|
||||
void CreateRoute(Route route);
|
||||
void UpdateRoute(Route route);
|
||||
void DeleteRoute(int id);
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
namespace TransportEnterprise.Entities.Repositories;
|
||||
|
||||
public class IRouteSheetEmployees
|
||||
{
|
||||
public int RouteSheetId { get; private set; }
|
||||
public int EmployeeId { get; private set; }
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace TransportEnterprise.Entities.Repositories;
|
||||
public interface IRouteSheetRepository
|
||||
{
|
||||
IEnumerable<RouteSheet> ReadRouteSheets();
|
||||
RouteSheet ReadRouteSheeteById(int id);
|
||||
void CreateRouteSheet(RouteSheet routeSheet);
|
||||
void UpdateRouteSheet(RouteSheet routeSheet);
|
||||
void DeleteRouteSheet(int id);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
|
||||
using TransportEnterprise.Entities.Enums;
|
||||
|
||||
namespace TransportEnterprise.Entities.Repositories.Implementations;
|
||||
internal class BusRepository : IBusRepository
|
||||
{
|
||||
public void CreateBus(Bus bus)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteBus(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Bus ReadBusById(int id)
|
||||
{
|
||||
return Bus.CreateBus(0, string.Empty, 0, string.Empty, string.Empty, 0, TechnicalCondition.None);
|
||||
}
|
||||
|
||||
public IEnumerable<Bus> ReadBuses()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateBus(Bus bus)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
|
||||
using TransportEnterprise.Entities.Enums;
|
||||
|
||||
namespace TransportEnterprise.Entities.Repositories.Implementations;
|
||||
|
||||
public class EmployeeRepository : IEmployeeRepository
|
||||
{
|
||||
public void CreateEmployee(Employee employee)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteEmployee(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Employee ReadEmployeeById(int id)
|
||||
{
|
||||
return Employee.CreateEmployee(0,string.Empty,0,PositionOfEmployee.None, string.Empty);
|
||||
}
|
||||
|
||||
public IEnumerable<Employee> ReadEmployees()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateEmployee(Employee employee)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
|
||||
using TransportEnterprise.Entities.Enums;
|
||||
|
||||
namespace TransportEnterprise.Entities.Repositories.Implementations;
|
||||
|
||||
public class RepairRequestRepository : IRepairRequestRepository
|
||||
{
|
||||
|
||||
public void CreateRepairRequest(RepairRequest repairRequest)
|
||||
{
|
||||
}
|
||||
|
||||
public RepairRequest ReadRepairRequestById(int id)
|
||||
{
|
||||
return RepairRequest.CreateRepairRequest(0, 0, BreakDownType.None, DateTime.Now, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<RepairRequest> ReadRepairRequests()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
|
||||
namespace TransportEnterprise.Entities.Repositories.Implementations;
|
||||
|
||||
public class RouteRepository : IRouteRepository
|
||||
{
|
||||
public void CreateRoute(Route route)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteRoute(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Route ReadRouteById(int id)
|
||||
{
|
||||
return Route.CreateRoute(0, string.Empty, 0, 0, string.Empty);
|
||||
}
|
||||
|
||||
public IEnumerable<Route> ReadRoutes()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateRoute(Route route)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
|
||||
namespace TransportEnterprise.Entities.Repositories.Implementations;
|
||||
|
||||
public class RouteSheetRepository : IRouteSheetRepository
|
||||
{
|
||||
public void CreateRouteSheet(RouteSheet routeSheet)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteRouteSheet(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public RouteSheet ReadRouteSheeteById(int id)
|
||||
{
|
||||
return RouteSheet.CreateRouteSheet(0, DateTime.Now, 0, 0, []);
|
||||
}
|
||||
|
||||
public IEnumerable<RouteSheet> ReadRouteSheets()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateRouteSheet(RouteSheet routeSheet)
|
||||
{
|
||||
}
|
||||
}
|
21
TransportEnterprise/TransportEnterprise/Entities/Route.cs
Normal file
21
TransportEnterprise/TransportEnterprise/Entities/Route.cs
Normal file
@ -0,0 +1,21 @@
|
||||
namespace TransportEnterprise.Entities;
|
||||
|
||||
public class Route
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public int Number { get; private set; }
|
||||
public int Interval { get; private set; }
|
||||
public string Schedule { get; private set; } = string.Empty;
|
||||
public static Route CreateRoute (int id, string name, int number, int interval, string schedule)
|
||||
{
|
||||
return new Route
|
||||
{
|
||||
Id = id,
|
||||
Name = name ?? string.Empty,
|
||||
Number = number,
|
||||
Interval = interval,
|
||||
Schedule = schedule ?? string.Empty
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
|
||||
namespace TransportEnterprise.Entities;
|
||||
|
||||
public class RouteSheet
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public DateTime DateTime { get; private set; }
|
||||
public int Bus { get; private set; }
|
||||
public int Route { get; private set; }
|
||||
public IEnumerable<RouteSheet_Employee> RouteSheet_Employee { get; private set; } = [];
|
||||
|
||||
|
||||
public static RouteSheet CreateRouteSheet(int id, DateTime dateTime, int bus, int route, IEnumerable<RouteSheet_Employee> routeSheetEmployees)
|
||||
{
|
||||
return new RouteSheet
|
||||
{
|
||||
Id = id,
|
||||
DateTime = dateTime,
|
||||
Bus = bus,
|
||||
Route = route,
|
||||
RouteSheet_Employee = routeSheetEmployees
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
namespace TransportEnterprise.Entities;
|
||||
|
||||
public class RouteSheet_Employee
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int EmployeeId { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
|
||||
public static RouteSheet_Employee CreateOperation(int id, int employeeId, int count)
|
||||
{
|
||||
return new RouteSheet_Employee { Id = id, EmployeeId = employeeId, Count = count};
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
namespace TransportEnterprise
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace TransportEnterprise
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
100
TransportEnterprise/TransportEnterprise/Forms/FormAddingRouteSheet.Designer.cs
generated
Normal file
100
TransportEnterprise/TransportEnterprise/Forms/FormAddingRouteSheet.Designer.cs
generated
Normal file
@ -0,0 +1,100 @@
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
partial class FormAddingRouteSheet
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormAddingRouteSheet));
|
||||
dataGridView = new DataGridView();
|
||||
panel1 = new Panel();
|
||||
buttonAdd = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AllowUserToResizeColumns = false;
|
||||
dataGridView.AllowUserToResizeRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Fill;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 62;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(1119, 832);
|
||||
dataGridView.TabIndex = 3;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(1119, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(194, 832);
|
||||
panel1.TabIndex = 2;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = (Image)resources.GetObject("buttonAdd.BackgroundImage");
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(28, 47);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(127, 108);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// FormAddingRouteSheet
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1313, 832);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormAddingRouteSheet";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Добавление маршрутного листа";
|
||||
Load += FormAddingRouteSheet_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Panel panel1;
|
||||
private Button buttonAdd;
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
|
||||
|
||||
using TransportEnterprise.Entities.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace TransportEnterprise.Forms;
|
||||
|
||||
public partial class FormAddingRouteSheet : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IRouteSheetRepository _routeSheetRepository;
|
||||
public FormAddingRouteSheet(IUnityContainer container, IRouteSheetRepository routeSheetRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_routeSheetRepository = routeSheetRepository ?? throw new ArgumentNullException(nameof(routeSheetRepository));
|
||||
}
|
||||
private void FormAddingRouteSheet_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormRouteSheet>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении",MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridView.DataSource = _routeSheetRepository.ReadRouteSheets();
|
||||
}
|
File diff suppressed because it is too large
Load Diff
212
TransportEnterprise/TransportEnterprise/Forms/FormBus.Designer.cs
generated
Normal file
212
TransportEnterprise/TransportEnterprise/Forms/FormBus.Designer.cs
generated
Normal file
@ -0,0 +1,212 @@
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
partial class FormBus
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
labelModel = new Label();
|
||||
labelBrand = new Label();
|
||||
labelCapacity = new Label();
|
||||
labelLicensePlate = new Label();
|
||||
labelYear = new Label();
|
||||
labelTechnicalCondition = new Label();
|
||||
textBoxBrand = new TextBox();
|
||||
textBoxModel = new TextBox();
|
||||
numericUpDownCapacity = new NumericUpDown();
|
||||
textBoxLicensePlate = new TextBox();
|
||||
numericUpDownYear = new NumericUpDown();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
comboBoxTechnicalCondition = new ComboBox();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownYear).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelModel
|
||||
//
|
||||
labelModel.AutoSize = true;
|
||||
labelModel.Location = new Point(46, 82);
|
||||
labelModel.Name = "labelModel";
|
||||
labelModel.Size = new Size(76, 25);
|
||||
labelModel.TabIndex = 0;
|
||||
labelModel.Text = "Модель";
|
||||
//
|
||||
// labelBrand
|
||||
//
|
||||
labelBrand.AutoSize = true;
|
||||
labelBrand.Location = new Point(46, 38);
|
||||
labelBrand.Name = "labelBrand";
|
||||
labelBrand.Size = new Size(62, 25);
|
||||
labelBrand.TabIndex = 2;
|
||||
labelBrand.Text = "Бренд";
|
||||
//
|
||||
// labelCapacity
|
||||
//
|
||||
labelCapacity.AutoSize = true;
|
||||
labelCapacity.Location = new Point(46, 137);
|
||||
labelCapacity.Name = "labelCapacity";
|
||||
labelCapacity.Size = new Size(117, 25);
|
||||
labelCapacity.TabIndex = 4;
|
||||
labelCapacity.Text = "Вместимость";
|
||||
//
|
||||
// labelLicensePlate
|
||||
//
|
||||
labelLicensePlate.AutoSize = true;
|
||||
labelLicensePlate.Location = new Point(46, 190);
|
||||
labelLicensePlate.Name = "labelLicensePlate";
|
||||
labelLicensePlate.Size = new Size(141, 25);
|
||||
labelLicensePlate.TabIndex = 6;
|
||||
labelLicensePlate.Text = "Номерной знак";
|
||||
//
|
||||
// labelYear
|
||||
//
|
||||
labelYear.AutoSize = true;
|
||||
labelYear.Location = new Point(46, 246);
|
||||
labelYear.Name = "labelYear";
|
||||
labelYear.Size = new Size(114, 25);
|
||||
labelYear.TabIndex = 8;
|
||||
labelYear.Text = "Год выпуска";
|
||||
//
|
||||
// labelTechnicalCondition
|
||||
//
|
||||
labelTechnicalCondition.AutoSize = true;
|
||||
labelTechnicalCondition.Location = new Point(46, 302);
|
||||
labelTechnicalCondition.Name = "labelTechnicalCondition";
|
||||
labelTechnicalCondition.Size = new Size(202, 25);
|
||||
labelTechnicalCondition.TabIndex = 10;
|
||||
labelTechnicalCondition.Text = "Техническое состояние";
|
||||
//
|
||||
// textBoxBrand
|
||||
//
|
||||
textBoxBrand.Location = new Point(291, 38);
|
||||
textBoxBrand.Name = "textBoxBrand";
|
||||
textBoxBrand.Size = new Size(180, 31);
|
||||
textBoxBrand.TabIndex = 11;
|
||||
//
|
||||
// textBoxModel
|
||||
//
|
||||
textBoxModel.Location = new Point(291, 82);
|
||||
textBoxModel.Name = "textBoxModel";
|
||||
textBoxModel.Size = new Size(180, 31);
|
||||
textBoxModel.TabIndex = 12;
|
||||
//
|
||||
// numericUpDownCapacity
|
||||
//
|
||||
numericUpDownCapacity.Location = new Point(291, 131);
|
||||
numericUpDownCapacity.Name = "numericUpDownCapacity";
|
||||
numericUpDownCapacity.Size = new Size(180, 31);
|
||||
numericUpDownCapacity.TabIndex = 13;
|
||||
//
|
||||
// textBoxLicensePlate
|
||||
//
|
||||
textBoxLicensePlate.Location = new Point(291, 187);
|
||||
textBoxLicensePlate.Name = "textBoxLicensePlate";
|
||||
textBoxLicensePlate.Size = new Size(180, 31);
|
||||
textBoxLicensePlate.TabIndex = 14;
|
||||
//
|
||||
// numericUpDownYear
|
||||
//
|
||||
numericUpDownYear.Location = new Point(291, 246);
|
||||
numericUpDownYear.Name = "numericUpDownYear";
|
||||
numericUpDownYear.Size = new Size(180, 31);
|
||||
numericUpDownYear.TabIndex = 15;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(46, 447);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(112, 34);
|
||||
buttonSave.TabIndex = 17;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(359, 447);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(112, 34);
|
||||
buttonCancel.TabIndex = 18;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// comboBoxTechnicalCondition
|
||||
//
|
||||
comboBoxTechnicalCondition.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxTechnicalCondition.FormattingEnabled = true;
|
||||
comboBoxTechnicalCondition.Location = new Point(289, 302);
|
||||
comboBoxTechnicalCondition.Name = "comboBoxTechnicalCondition";
|
||||
comboBoxTechnicalCondition.Size = new Size(182, 33);
|
||||
comboBoxTechnicalCondition.TabIndex = 19;
|
||||
//
|
||||
// FormBus
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(629, 617);
|
||||
Controls.Add(comboBoxTechnicalCondition);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(numericUpDownYear);
|
||||
Controls.Add(textBoxLicensePlate);
|
||||
Controls.Add(numericUpDownCapacity);
|
||||
Controls.Add(textBoxModel);
|
||||
Controls.Add(textBoxBrand);
|
||||
Controls.Add(labelTechnicalCondition);
|
||||
Controls.Add(labelYear);
|
||||
Controls.Add(labelLicensePlate);
|
||||
Controls.Add(labelCapacity);
|
||||
Controls.Add(labelBrand);
|
||||
Controls.Add(labelModel);
|
||||
Name = "FormBus";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Автобус";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownYear).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelModel;
|
||||
private Label labelBrand;
|
||||
private Label labelCapacity;
|
||||
private Label labelLicensePlate;
|
||||
private Label labelYear;
|
||||
private Label labelTechnicalCondition;
|
||||
private TextBox textBoxBrand;
|
||||
private TextBox textBoxModel;
|
||||
private NumericUpDown numericUpDownCapacity;
|
||||
private TextBox textBoxLicensePlate;
|
||||
private NumericUpDown numericUpDownYear;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private ComboBox comboBoxTechnicalCondition;
|
||||
}
|
||||
}
|
81
TransportEnterprise/TransportEnterprise/Forms/FormBus.cs
Normal file
81
TransportEnterprise/TransportEnterprise/Forms/FormBus.cs
Normal file
@ -0,0 +1,81 @@
|
||||
using TransportEnterprise.Entities;
|
||||
using TransportEnterprise.Entities.Enums;
|
||||
using TransportEnterprise.Entities.Repositories;
|
||||
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
public partial class FormBus : Form
|
||||
{
|
||||
private readonly IBusRepository _busRepository;
|
||||
private int? _busId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var bus = _busRepository.ReadBusById(value);
|
||||
if (bus == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(bus));
|
||||
}
|
||||
|
||||
textBoxBrand.Text = bus.Brand;
|
||||
textBoxModel.Text = bus.Model;
|
||||
numericUpDownCapacity.Value = bus.Capacity;
|
||||
numericUpDownYear.Value = bus.Year;
|
||||
comboBoxTechnicalCondition.SelectedItem= bus.TechnicalCondition;
|
||||
|
||||
_busId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormBus(IBusRepository busRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_busRepository = busRepository ?? throw new ArgumentNullException(nameof(busRepository));
|
||||
comboBoxTechnicalCondition.DataSource = Enum.GetValues(typeof(TechnicalCondition)).Cast<TechnicalCondition>().Where(p => p != TechnicalCondition.None).ToArray();
|
||||
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(textBoxModel.Text) || string.IsNullOrWhiteSpace(textBoxLicensePlate.Text) || comboBoxTechnicalCondition.SelectedIndex<1)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_busId.HasValue)
|
||||
{
|
||||
_busRepository.UpdateBus(CreateBus(_busId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_busRepository.CreateBus(CreateBus(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Bus CreateBus(int id) => Bus.CreateBus(id,
|
||||
textBoxModel.Text,
|
||||
Convert.ToInt32(numericUpDownCapacity.Value),
|
||||
textBoxLicensePlate.Text, textBoxBrand.Text,
|
||||
Convert.ToInt32(numericUpDownYear.Value),
|
||||
(TechnicalCondition)comboBoxTechnicalCondition.SelectedItem!);
|
||||
}
|
||||
}
|
128
TransportEnterprise/TransportEnterprise/Forms/FormBuses.Designer.cs
generated
Normal file
128
TransportEnterprise/TransportEnterprise/Forms/FormBuses.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
partial class FormBuses
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormBuses));
|
||||
panel1 = new Panel();
|
||||
buttonUpd = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonUpd);
|
||||
panel1.Controls.Add(buttonDel);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(978, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(300, 894);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = (Image)resources.GetObject("buttonUpd.BackgroundImage");
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpd.Location = new Point(89, 325);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(127, 108);
|
||||
buttonUpd.TabIndex = 2;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += buttonUpd_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = (Image)resources.GetObject("buttonDel.BackgroundImage");
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(89, 184);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(127, 108);
|
||||
buttonDel.TabIndex = 1;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += buttonDel_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = (Image)resources.GetObject("buttonAdd.BackgroundImage");
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(89, 47);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(127, 108);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AllowUserToResizeColumns = false;
|
||||
dataGridView.AllowUserToResizeRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Fill;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 62;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(978, 894);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// FormBuses
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1278, 894);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormBuses";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Автобусы";
|
||||
Load += FormBuses_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonUpd;
|
||||
private Button buttonDel;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
109
TransportEnterprise/TransportEnterprise/Forms/FormBuses.cs
Normal file
109
TransportEnterprise/TransportEnterprise/Forms/FormBuses.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TransportEnterprise.Entities.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
public partial class FormBuses : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IBusRepository _busRepository;
|
||||
public FormBuses(IUnityContainer container, IBusRepository busRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_busRepository = busRepository ?? throw new ArgumentNullException(nameof(busRepository));
|
||||
|
||||
}
|
||||
private void FormBuses_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormBus>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_busRepository.DeleteBus(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void buttonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormBus>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridView.DataSource = _busRepository.ReadBuses();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridView.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
2821
TransportEnterprise/TransportEnterprise/Forms/FormBuses.resx
Normal file
2821
TransportEnterprise/TransportEnterprise/Forms/FormBuses.resx
Normal file
File diff suppressed because it is too large
Load Diff
164
TransportEnterprise/TransportEnterprise/Forms/FormEmployee.Designer.cs
generated
Normal file
164
TransportEnterprise/TransportEnterprise/Forms/FormEmployee.Designer.cs
generated
Normal file
@ -0,0 +1,164 @@
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
partial class FormEmployee
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
textBoxPhoneNumber = new TextBox();
|
||||
numericUpDownNumber = new NumericUpDown();
|
||||
textBoxName = new TextBox();
|
||||
labelPhoneNumber = new Label();
|
||||
labelPositionOfEmployee = new Label();
|
||||
labelNumber = new Label();
|
||||
labelName = new Label();
|
||||
comboBoxPositionOfEmployee = new ComboBox();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownNumber).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(452, 350);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(180, 46);
|
||||
buttonCancel.TabIndex = 19;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(169, 341);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(178, 46);
|
||||
buttonSave.TabIndex = 18;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// textBoxPhoneNumber
|
||||
//
|
||||
textBoxPhoneNumber.Location = new Point(452, 245);
|
||||
textBoxPhoneNumber.Name = "textBoxPhoneNumber";
|
||||
textBoxPhoneNumber.Size = new Size(180, 31);
|
||||
textBoxPhoneNumber.TabIndex = 17;
|
||||
//
|
||||
// numericUpDownNumber
|
||||
//
|
||||
numericUpDownNumber.Location = new Point(452, 114);
|
||||
numericUpDownNumber.Name = "numericUpDownNumber";
|
||||
numericUpDownNumber.Size = new Size(180, 31);
|
||||
numericUpDownNumber.TabIndex = 15;
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(452, 55);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(180, 31);
|
||||
textBoxName.TabIndex = 14;
|
||||
//
|
||||
// labelPhoneNumber
|
||||
//
|
||||
labelPhoneNumber.AutoSize = true;
|
||||
labelPhoneNumber.Location = new Point(169, 245);
|
||||
labelPhoneNumber.Name = "labelPhoneNumber";
|
||||
labelPhoneNumber.Size = new Size(150, 25);
|
||||
labelPhoneNumber.TabIndex = 13;
|
||||
labelPhoneNumber.Text = "Номер телефона";
|
||||
//
|
||||
// labelPositionOfEmployee
|
||||
//
|
||||
labelPositionOfEmployee.AutoSize = true;
|
||||
labelPositionOfEmployee.Location = new Point(169, 181);
|
||||
labelPositionOfEmployee.Name = "labelPositionOfEmployee";
|
||||
labelPositionOfEmployee.Size = new Size(102, 25);
|
||||
labelPositionOfEmployee.TabIndex = 12;
|
||||
labelPositionOfEmployee.Text = "Должность";
|
||||
//
|
||||
// labelNumber
|
||||
//
|
||||
labelNumber.AutoSize = true;
|
||||
labelNumber.Location = new Point(169, 116);
|
||||
labelNumber.Name = "labelNumber";
|
||||
labelNumber.Size = new Size(159, 25);
|
||||
labelNumber.TabIndex = 11;
|
||||
labelNumber.Text = "Табельный номер";
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(169, 55);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(52, 25);
|
||||
labelName.TabIndex = 10;
|
||||
labelName.Text = "ФИО";
|
||||
//
|
||||
// comboBoxPositionOfEmployee
|
||||
//
|
||||
comboBoxPositionOfEmployee.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxPositionOfEmployee.FormattingEnabled = true;
|
||||
comboBoxPositionOfEmployee.Location = new Point(452, 178);
|
||||
comboBoxPositionOfEmployee.Name = "comboBoxPositionOfEmployee";
|
||||
comboBoxPositionOfEmployee.Size = new Size(182, 33);
|
||||
comboBoxPositionOfEmployee.TabIndex = 20;
|
||||
//
|
||||
// FormEmployee
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(comboBoxPositionOfEmployee);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxPhoneNumber);
|
||||
Controls.Add(numericUpDownNumber);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelPhoneNumber);
|
||||
Controls.Add(labelPositionOfEmployee);
|
||||
Controls.Add(labelNumber);
|
||||
Controls.Add(labelName);
|
||||
Name = "FormEmployee";
|
||||
Text = "FormEmployee";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownNumber).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private TextBox textBoxPhoneNumber;
|
||||
private NumericUpDown numericUpDownNumber;
|
||||
private TextBox textBoxName;
|
||||
private Label labelPhoneNumber;
|
||||
private Label labelPositionOfEmployee;
|
||||
private Label labelNumber;
|
||||
private Label labelName;
|
||||
private ComboBox comboBoxPositionOfEmployee;
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
|
||||
using TransportEnterprise.Entities.Repositories;
|
||||
using TransportEnterprise.Entities;
|
||||
using TransportEnterprise.Entities.Enums;
|
||||
|
||||
namespace TransportEnterprise.Forms;
|
||||
|
||||
public partial class FormEmployee : Form
|
||||
{
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
private int? _employeeId;
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var employee =
|
||||
_employeeRepository.ReadEmployeeById(value);
|
||||
if (employee == null)
|
||||
{
|
||||
throw new
|
||||
InvalidDataException(nameof(employee));
|
||||
}
|
||||
textBoxName.Text = employee.Name;
|
||||
numericUpDownNumber.Value = employee.Number;
|
||||
comboBoxPositionOfEmployee.SelectedItem = employee.PositionOfEmployee;
|
||||
_employeeId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormEmployee(IEmployeeRepository employeeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_employeeRepository = employeeRepository ??
|
||||
throw new
|
||||
ArgumentNullException(nameof(employeeRepository));
|
||||
comboBoxPositionOfEmployee.DataSource = Enum.GetValues(typeof(PositionOfEmployee)).Cast<PositionOfEmployee>().Where(p => p != PositionOfEmployee.None).ToArray();
|
||||
}
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text) || comboBoxPositionOfEmployee.SelectedIndex < 1)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
if (_employeeId.HasValue)
|
||||
{
|
||||
_employeeRepository.UpdateEmployee(CreateEmployee(_employeeId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_employeeRepository.CreateEmployee(CreateEmployee(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void bttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
private Employee CreateEmployee(int id) => Employee.CreateEmployee(id,
|
||||
textBoxName.Text,
|
||||
Convert.ToInt32(numericUpDownNumber.Value),
|
||||
(PositionOfEmployee)comboBoxPositionOfEmployee.SelectedItem!,
|
||||
textBoxPhoneNumber.Text);
|
||||
}
|
120
TransportEnterprise/TransportEnterprise/Forms/FormEmployee.resx
Normal file
120
TransportEnterprise/TransportEnterprise/Forms/FormEmployee.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
128
TransportEnterprise/TransportEnterprise/Forms/FormEmployees.Designer.cs
generated
Normal file
128
TransportEnterprise/TransportEnterprise/Forms/FormEmployees.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
partial class FormEmployees
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormEmployees));
|
||||
dataGridView = new DataGridView();
|
||||
panel1 = new Panel();
|
||||
buttonUpd = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonAdd = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AllowUserToResizeColumns = false;
|
||||
dataGridView.AllowUserToResizeRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Fill;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 62;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(978, 894);
|
||||
dataGridView.TabIndex = 3;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonUpd);
|
||||
panel1.Controls.Add(buttonDel);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(978, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(300, 894);
|
||||
panel1.TabIndex = 2;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = (Image)resources.GetObject("buttonUpd.BackgroundImage");
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpd.Location = new Point(89, 325);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(127, 108);
|
||||
buttonUpd.TabIndex = 2;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += buttonUpd_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = (Image)resources.GetObject("buttonDel.BackgroundImage");
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(89, 184);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(127, 108);
|
||||
buttonDel.TabIndex = 1;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += buttonDel_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = (Image)resources.GetObject("buttonAdd.BackgroundImage");
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(89, 47);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(127, 108);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// FormEmployees
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1278, 894);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormEmployees";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Работники";
|
||||
Load += FormEmployees_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Panel panel1;
|
||||
private Button buttonUpd;
|
||||
private Button buttonDel;
|
||||
private Button buttonAdd;
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
using TransportEnterprise.Entities.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace TransportEnterprise.Forms;
|
||||
|
||||
public partial class FormEmployees : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
public FormEmployees(IUnityContainer container, IEmployeeRepository
|
||||
employeeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_employeeRepository = employeeRepository ?? throw new(nameof(employeeRepository));
|
||||
}
|
||||
private void FormEmployees_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormEmployee>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void buttonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormRoute>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void buttonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_employeeRepository.DeleteEmployee(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridView.DataSource = _employeeRepository.ReadEmployees();
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridView.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
2821
TransportEnterprise/TransportEnterprise/Forms/FormEmployees.resx
Normal file
2821
TransportEnterprise/TransportEnterprise/Forms/FormEmployees.resx
Normal file
File diff suppressed because it is too large
Load Diff
166
TransportEnterprise/TransportEnterprise/Forms/FormRepairRequest.Designer.cs
generated
Normal file
166
TransportEnterprise/TransportEnterprise/Forms/FormRepairRequest.Designer.cs
generated
Normal file
@ -0,0 +1,166 @@
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
partial class FormRepairRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
comboBoxBus = new ComboBox();
|
||||
comboBoxEmployee = new ComboBox();
|
||||
dateTimePicker = new DateTimePicker();
|
||||
labelBus = new Label();
|
||||
labelEmployee = new Label();
|
||||
labelDate = new Label();
|
||||
label1 = new Label();
|
||||
checkedListBoxBreakDownType = new CheckedListBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(361, 432);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(181, 60);
|
||||
buttonCancel.TabIndex = 19;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(68, 432);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(181, 60);
|
||||
buttonSave.TabIndex = 18;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// comboBoxBus
|
||||
//
|
||||
comboBoxBus.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxBus.FormattingEnabled = true;
|
||||
comboBoxBus.Location = new Point(242, 35);
|
||||
comboBoxBus.Name = "comboBoxBus";
|
||||
comboBoxBus.Size = new Size(300, 33);
|
||||
comboBoxBus.TabIndex = 17;
|
||||
//
|
||||
// comboBoxEmployee
|
||||
//
|
||||
comboBoxEmployee.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxEmployee.FormattingEnabled = true;
|
||||
comboBoxEmployee.Location = new Point(242, 363);
|
||||
comboBoxEmployee.Name = "comboBoxEmployee";
|
||||
comboBoxEmployee.Size = new Size(300, 33);
|
||||
comboBoxEmployee.TabIndex = 15;
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Location = new Point(242, 276);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(300, 31);
|
||||
dateTimePicker.TabIndex = 14;
|
||||
//
|
||||
// labelBus
|
||||
//
|
||||
labelBus.AutoSize = true;
|
||||
labelBus.Location = new Point(68, 43);
|
||||
labelBus.Name = "labelBus";
|
||||
labelBus.Size = new Size(79, 25);
|
||||
labelBus.TabIndex = 13;
|
||||
labelBus.Text = "Автобус";
|
||||
//
|
||||
// labelEmployee
|
||||
//
|
||||
labelEmployee.AutoSize = true;
|
||||
labelEmployee.Location = new Point(68, 371);
|
||||
labelEmployee.Name = "labelEmployee";
|
||||
labelEmployee.Size = new Size(98, 25);
|
||||
labelEmployee.TabIndex = 12;
|
||||
labelEmployee.Text = "Работники";
|
||||
//
|
||||
// labelDate
|
||||
//
|
||||
labelDate.AutoSize = true;
|
||||
labelDate.Location = new Point(68, 293);
|
||||
labelDate.Name = "labelDate";
|
||||
labelDate.Size = new Size(49, 25);
|
||||
labelDate.TabIndex = 10;
|
||||
labelDate.Text = "Дата";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(68, 114);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(119, 25);
|
||||
label1.TabIndex = 20;
|
||||
label1.Text = "Тип поломки";
|
||||
//
|
||||
// checkedListBoxBreakDownType
|
||||
//
|
||||
checkedListBoxBreakDownType.FormattingEnabled = true;
|
||||
checkedListBoxBreakDownType.Location = new Point(242, 114);
|
||||
checkedListBoxBreakDownType.Name = "checkedListBoxBreakDownType";
|
||||
checkedListBoxBreakDownType.Size = new Size(300, 144);
|
||||
checkedListBoxBreakDownType.TabIndex = 21;
|
||||
//
|
||||
// FormRepairRequest
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(685, 565);
|
||||
Controls.Add(checkedListBoxBreakDownType);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(comboBoxBus);
|
||||
Controls.Add(comboBoxEmployee);
|
||||
Controls.Add(dateTimePicker);
|
||||
Controls.Add(labelBus);
|
||||
Controls.Add(labelEmployee);
|
||||
Controls.Add(labelDate);
|
||||
Name = "FormRepairRequest";
|
||||
Text = "Заявка на ремонт";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private ComboBox comboBoxBus;
|
||||
private ComboBox comboBoxEmployee;
|
||||
private DateTimePicker dateTimePicker;
|
||||
private Label labelBus;
|
||||
private Label labelEmployee;
|
||||
private Label labelDate;
|
||||
private Label label1;
|
||||
private CheckedListBox checkedListBoxBreakDownType;
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
using TransportEnterprise.Entities.Enums;
|
||||
using TransportEnterprise.Entities.Repositories;
|
||||
using TransportEnterprise.Entities;
|
||||
|
||||
namespace TransportEnterprise.Forms;
|
||||
|
||||
public partial class FormRepairRequest : Form
|
||||
{
|
||||
private readonly IRepairRequestRepository _repairRequestRepository;
|
||||
private int? _repairRequestId;
|
||||
|
||||
public FormRepairRequest(IRepairRequestRepository repairRequestRepository, IEmployeeRepository employeeRepository, IBusRepository busRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_repairRequestRepository = repairRequestRepository ?? throw new ArgumentNullException(nameof(repairRequestRepository));
|
||||
comboBoxBus.DataSource = busRepository.ReadBuses();
|
||||
comboBoxBus.DisplayMember = "LicensePlate";
|
||||
comboBoxBus.ValueMember = "Id";
|
||||
|
||||
comboBoxEmployee.DataSource = employeeRepository.ReadEmployees();
|
||||
comboBoxEmployee.DisplayMember = "Name";
|
||||
comboBoxEmployee.ValueMember = "Id";
|
||||
|
||||
foreach (var elem in Enum.GetValues(typeof(BreakDownType)))
|
||||
{
|
||||
if(!elem.Equals(BreakDownType.None)) checkedListBoxBreakDownType.Items.Add(elem);
|
||||
}
|
||||
}
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxBus.SelectedIndex < 1 || comboBoxEmployee.SelectedIndex < 1 || checkedListBoxBreakDownType.CheckedItems.Count == 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
_repairRequestRepository.CreateRepairRequest(CreateRepairRequest(0));
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
private RepairRequest CreateRepairRequest(int id)
|
||||
{
|
||||
BreakDownType breakDownType = BreakDownType.None;
|
||||
foreach (var elem in checkedListBoxBreakDownType.CheckedItems)
|
||||
{
|
||||
breakDownType |= (BreakDownType)elem;
|
||||
}
|
||||
|
||||
return RepairRequest.CreateRepairRequest(id,
|
||||
(int)comboBoxBus.SelectedValue!,
|
||||
breakDownType,
|
||||
dateTimePicker.Value,
|
||||
(int)comboBoxEmployee.SelectedValue!);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
100
TransportEnterprise/TransportEnterprise/Forms/FormRepairRequests.Designer.cs
generated
Normal file
100
TransportEnterprise/TransportEnterprise/Forms/FormRepairRequests.Designer.cs
generated
Normal file
@ -0,0 +1,100 @@
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
partial class FormRepairRequests
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormRepairRequests));
|
||||
dataGridView = new DataGridView();
|
||||
panel1 = new Panel();
|
||||
buttonAdd = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AllowUserToResizeColumns = false;
|
||||
dataGridView.AllowUserToResizeRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Fill;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 62;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(1091, 894);
|
||||
dataGridView.TabIndex = 5;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(1091, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(187, 894);
|
||||
panel1.TabIndex = 4;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = (Image)resources.GetObject("buttonAdd.BackgroundImage");
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(38, 50);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(127, 108);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// FormRepairRequests
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1278, 894);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormRepairRequests";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Заявки на ремонт";
|
||||
Load += FormRepairRequests_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Panel panel1;
|
||||
private Button buttonAdd;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
using TransportEnterprise.Entities.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
public partial class FormRepairRequests: Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IRepairRequestRepository _repairRequestRepository;
|
||||
public FormRepairRequests(IUnityContainer container, IRepairRequestRepository repairRequestRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_repairRequestRepository = repairRequestRepository ?? throw new(nameof(repairRequestRepository));
|
||||
}
|
||||
private void FormRepairRequests_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormRepairRequest>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridView.DataSource = _repairRequestRepository.ReadRepairRequests();
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridView.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
166
TransportEnterprise/TransportEnterprise/Forms/FormRoute.Designer.cs
generated
Normal file
166
TransportEnterprise/TransportEnterprise/Forms/FormRoute.Designer.cs
generated
Normal file
@ -0,0 +1,166 @@
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
partial class FormRoute
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
labelName = new Label();
|
||||
labelNumber = new Label();
|
||||
labelInterval = new Label();
|
||||
labelSchedule = new Label();
|
||||
textBoxName = new TextBox();
|
||||
numericUpDownNumber = new NumericUpDown();
|
||||
numericUpDownInterval = new NumericUpDown();
|
||||
textBoxSchedule = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownNumber).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownInterval).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(68, 70);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(178, 25);
|
||||
labelName.TabIndex = 0;
|
||||
labelName.Text = "Название маршрута";
|
||||
//
|
||||
// labelNumber
|
||||
//
|
||||
labelNumber.AutoSize = true;
|
||||
labelNumber.Location = new Point(68, 131);
|
||||
labelNumber.Name = "labelNumber";
|
||||
labelNumber.Size = new Size(157, 25);
|
||||
labelNumber.TabIndex = 1;
|
||||
labelNumber.Text = "Номер маршрута";
|
||||
//
|
||||
// labelInterval
|
||||
//
|
||||
labelInterval.AutoSize = true;
|
||||
labelInterval.Location = new Point(68, 196);
|
||||
labelInterval.Name = "labelInterval";
|
||||
labelInterval.Size = new Size(90, 25);
|
||||
labelInterval.TabIndex = 2;
|
||||
labelInterval.Text = "Интервал";
|
||||
//
|
||||
// labelSchedule
|
||||
//
|
||||
labelSchedule.AutoSize = true;
|
||||
labelSchedule.Location = new Point(68, 260);
|
||||
labelSchedule.Name = "labelSchedule";
|
||||
labelSchedule.Size = new Size(133, 25);
|
||||
labelSchedule.TabIndex = 3;
|
||||
labelSchedule.Text = "Режим работы";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(351, 70);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(180, 31);
|
||||
textBoxName.TabIndex = 4;
|
||||
//
|
||||
// numericUpDownNumber
|
||||
//
|
||||
numericUpDownNumber.Location = new Point(351, 129);
|
||||
numericUpDownNumber.Name = "numericUpDownNumber";
|
||||
numericUpDownNumber.Size = new Size(180, 31);
|
||||
numericUpDownNumber.TabIndex = 5;
|
||||
//
|
||||
// numericUpDownInterval
|
||||
//
|
||||
numericUpDownInterval.Location = new Point(351, 196);
|
||||
numericUpDownInterval.Name = "numericUpDownInterval";
|
||||
numericUpDownInterval.Size = new Size(180, 31);
|
||||
numericUpDownInterval.TabIndex = 6;
|
||||
//
|
||||
// textBoxSchedule
|
||||
//
|
||||
textBoxSchedule.Location = new Point(351, 260);
|
||||
textBoxSchedule.Name = "textBoxSchedule";
|
||||
textBoxSchedule.Size = new Size(180, 31);
|
||||
textBoxSchedule.TabIndex = 7;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(68, 356);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(178, 46);
|
||||
buttonSave.TabIndex = 8;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(351, 365);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(180, 46);
|
||||
buttonCancel.TabIndex = 9;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormRoute
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(566, 445);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxSchedule);
|
||||
Controls.Add(numericUpDownInterval);
|
||||
Controls.Add(numericUpDownNumber);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelSchedule);
|
||||
Controls.Add(labelInterval);
|
||||
Controls.Add(labelNumber);
|
||||
Controls.Add(labelName);
|
||||
Name = "FormRoute";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Маршрут";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownNumber).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownInterval).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelName;
|
||||
private Label labelNumber;
|
||||
private Label labelInterval;
|
||||
private Label labelSchedule;
|
||||
private TextBox textBoxName;
|
||||
private NumericUpDown numericUpDownNumber;
|
||||
private NumericUpDown numericUpDownInterval;
|
||||
private TextBox textBoxSchedule;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
75
TransportEnterprise/TransportEnterprise/Forms/FormRoute.cs
Normal file
75
TransportEnterprise/TransportEnterprise/Forms/FormRoute.cs
Normal file
@ -0,0 +1,75 @@
|
||||
using TransportEnterprise.Entities.Repositories;
|
||||
using TransportEnterprise.Entities;
|
||||
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
public partial class FormRoute : Form
|
||||
{
|
||||
private readonly IRouteRepository _routeRepository;
|
||||
private int? _routeId;
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var route = _routeRepository.ReadRouteById(value);
|
||||
if (route == null)
|
||||
{
|
||||
throw new
|
||||
InvalidDataException(nameof(route));
|
||||
}
|
||||
textBoxName.Text = route.Name;
|
||||
numericUpDownNumber.Value = route.Number;
|
||||
numericUpDownInterval.Value = route.Interval;
|
||||
textBoxSchedule.Text= route.Schedule;
|
||||
_routeId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormRoute(IRouteRepository routeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_routeRepository = routeRepository ?? throw new ArgumentNullException(nameof(routeRepository));
|
||||
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text) || numericUpDownNumber.Value == 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
if (_routeId.HasValue)
|
||||
{
|
||||
_routeRepository.UpdateRoute(CreateRoute(_routeId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_routeRepository.CreateRoute(CreateRoute(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
private Route CreateRoute(int id) => Route.CreateRoute(id,
|
||||
textBoxName.Text,
|
||||
Convert.ToInt32(numericUpDownNumber.Value),
|
||||
Convert.ToInt32(numericUpDownInterval.Value),
|
||||
textBoxSchedule.Text);
|
||||
}
|
||||
}
|
||||
|
120
TransportEnterprise/TransportEnterprise/Forms/FormRoute.resx
Normal file
120
TransportEnterprise/TransportEnterprise/Forms/FormRoute.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
190
TransportEnterprise/TransportEnterprise/Forms/FormRouteSheet.Designer.cs
generated
Normal file
190
TransportEnterprise/TransportEnterprise/Forms/FormRouteSheet.Designer.cs
generated
Normal file
@ -0,0 +1,190 @@
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
partial class FormRouteSheet
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
labelDate = new Label();
|
||||
labelRoute = new Label();
|
||||
labelEmployee = new Label();
|
||||
labelBus = new Label();
|
||||
dateTimePicker = new DateTimePicker();
|
||||
comboBoxRoute = new ComboBox();
|
||||
comboBoxBus = new ComboBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
dataGridViewEmployees = new DataGridView();
|
||||
ColumnName = new DataGridViewComboBoxColumn();
|
||||
ColumnCount = new DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewEmployees).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelDate
|
||||
//
|
||||
labelDate.AutoSize = true;
|
||||
labelDate.Location = new Point(76, 53);
|
||||
labelDate.Name = "labelDate";
|
||||
labelDate.Size = new Size(49, 25);
|
||||
labelDate.TabIndex = 0;
|
||||
labelDate.Text = "Дата";
|
||||
//
|
||||
// labelRoute
|
||||
//
|
||||
labelRoute.AutoSize = true;
|
||||
labelRoute.Location = new Point(76, 103);
|
||||
labelRoute.Name = "labelRoute";
|
||||
labelRoute.Size = new Size(89, 25);
|
||||
labelRoute.TabIndex = 1;
|
||||
labelRoute.Text = "Маршрут";
|
||||
//
|
||||
// labelEmployee
|
||||
//
|
||||
labelEmployee.AutoSize = true;
|
||||
labelEmployee.Location = new Point(76, 150);
|
||||
labelEmployee.Name = "labelEmployee";
|
||||
labelEmployee.Size = new Size(98, 25);
|
||||
labelEmployee.TabIndex = 2;
|
||||
labelEmployee.Text = "Работники";
|
||||
//
|
||||
// labelBus
|
||||
//
|
||||
labelBus.AutoSize = true;
|
||||
labelBus.Location = new Point(65, 451);
|
||||
labelBus.Name = "labelBus";
|
||||
labelBus.Size = new Size(79, 25);
|
||||
labelBus.TabIndex = 3;
|
||||
labelBus.Text = "Автобус";
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Location = new Point(250, 47);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(300, 31);
|
||||
dateTimePicker.TabIndex = 4;
|
||||
//
|
||||
// comboBoxRoute
|
||||
//
|
||||
comboBoxRoute.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxRoute.FormattingEnabled = true;
|
||||
comboBoxRoute.Location = new Point(250, 95);
|
||||
comboBoxRoute.Name = "comboBoxRoute";
|
||||
comboBoxRoute.Size = new Size(300, 33);
|
||||
comboBoxRoute.TabIndex = 5;
|
||||
//
|
||||
// comboBoxBus
|
||||
//
|
||||
comboBoxBus.FormattingEnabled = true;
|
||||
comboBoxBus.Location = new Point(239, 443);
|
||||
comboBoxBus.Name = "comboBoxBus";
|
||||
comboBoxBus.Size = new Size(300, 33);
|
||||
comboBoxBus.TabIndex = 7;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(65, 531);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(181, 60);
|
||||
buttonSave.TabIndex = 8;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(358, 531);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(181, 60);
|
||||
buttonCancel.TabIndex = 9;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// dataGridViewEmployees
|
||||
//
|
||||
dataGridViewEmployees.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewEmployees.Columns.AddRange(new DataGridViewColumn[] { ColumnName, ColumnCount });
|
||||
dataGridViewEmployees.Location = new Point(250, 150);
|
||||
dataGridViewEmployees.Name = "dataGridViewEmployees";
|
||||
dataGridViewEmployees.RowHeadersVisible = false;
|
||||
dataGridViewEmployees.RowHeadersWidth = 62;
|
||||
dataGridViewEmployees.Size = new Size(300, 225);
|
||||
dataGridViewEmployees.TabIndex = 10;
|
||||
//
|
||||
// ColumnName
|
||||
//
|
||||
ColumnName.HeaderText = "ФИО";
|
||||
ColumnName.MinimumWidth = 8;
|
||||
ColumnName.Name = "ColumnName";
|
||||
ColumnName.Resizable = DataGridViewTriState.True;
|
||||
ColumnName.SortMode = DataGridViewColumnSortMode.Automatic;
|
||||
ColumnName.Width = 150;
|
||||
//
|
||||
// ColumnCount
|
||||
//
|
||||
ColumnCount.HeaderText = "Количество рейсов";
|
||||
ColumnCount.MinimumWidth = 8;
|
||||
ColumnCount.Name = "ColumnCount";
|
||||
ColumnCount.Resizable = DataGridViewTriState.True;
|
||||
ColumnCount.Width = 150;
|
||||
//
|
||||
// FormRouteSheet
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(658, 722);
|
||||
Controls.Add(dataGridViewEmployees);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(comboBoxBus);
|
||||
Controls.Add(comboBoxRoute);
|
||||
Controls.Add(dateTimePicker);
|
||||
Controls.Add(labelBus);
|
||||
Controls.Add(labelEmployee);
|
||||
Controls.Add(labelRoute);
|
||||
Controls.Add(labelDate);
|
||||
Name = "FormRouteSheet";
|
||||
Text = "Маршрутный лист";
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewEmployees).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelDate;
|
||||
private Label labelRoute;
|
||||
private Label labelEmployee;
|
||||
private Label labelBus;
|
||||
private DateTimePicker dateTimePicker;
|
||||
private ComboBox comboBoxRoute;
|
||||
private ComboBox comboBoxBus;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private DataGridView dataGridViewEmployees;
|
||||
private DataGridViewComboBoxColumn ColumnName;
|
||||
private DataGridViewTextBoxColumn ColumnCount;
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
using TransportEnterprise.Entities;
|
||||
using TransportEnterprise.Entities.Repositories;
|
||||
|
||||
namespace TransportEnterprise.Forms;
|
||||
|
||||
public partial class FormRouteSheet : Form
|
||||
{
|
||||
|
||||
private readonly IRouteSheetRepository _routeSheetRepository;
|
||||
public FormRouteSheet(IRouteSheetRepository routeSheetRepository, IEmployeeRepository employeeRepository, IBusRepository busRepository, IRouteRepository routeRepository) {
|
||||
|
||||
InitializeComponent();
|
||||
_routeSheetRepository = routeSheetRepository ?? throw new ArgumentNullException(nameof(routeSheetRepository));
|
||||
comboBoxRoute.DataSource = routeRepository.ReadRoutes();
|
||||
comboBoxRoute.DisplayMember = "Name";
|
||||
comboBoxRoute.ValueMember = "Id";
|
||||
|
||||
ColumnName.DataSource = routeRepository.ReadRoutes();
|
||||
ColumnName.DisplayMember = "Name";
|
||||
ColumnName.ValueMember = "Id";
|
||||
|
||||
|
||||
comboBoxBus.DataSource = busRepository.ReadBuses();
|
||||
comboBoxBus.DisplayMember = "LicensePlate";
|
||||
comboBoxBus.ValueMember = "Id";
|
||||
}
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (dataGridViewEmployees.RowCount < 1)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
|
||||
_routeSheetRepository.CreateRouteSheet(RouteSheet.CreateRouteSheet(
|
||||
0,
|
||||
dateTimePicker.Value,
|
||||
(int)comboBoxBus.SelectedValue!,
|
||||
(int)comboBoxRoute.SelectedValue!,
|
||||
CreateListRouteSheetEmployeeFromDataGrid()));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении",MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private List<RouteSheet_Employee> CreateListRouteSheetEmployeeFromDataGrid()
|
||||
{
|
||||
var list = new List<RouteSheet_Employee>();
|
||||
foreach (DataGridViewRow row in dataGridViewEmployees.Rows)
|
||||
{
|
||||
if (row.Cells["ColumnName"].Value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.Add(RouteSheet_Employee.CreateOperation(0,
|
||||
Convert.ToInt32(row.Cells["ColumnName"].Value),
|
||||
Convert.ToInt32(row.Cells["ColumnCount"].Value)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ColumnName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
128
TransportEnterprise/TransportEnterprise/Forms/FormRoutes.Designer.cs
generated
Normal file
128
TransportEnterprise/TransportEnterprise/Forms/FormRoutes.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
||||
namespace TransportEnterprise.Forms
|
||||
{
|
||||
partial class FormRoutes
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormRoutes));
|
||||
dataGridView = new DataGridView();
|
||||
panel1 = new Panel();
|
||||
buttonUpd = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonAdd = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AllowUserToResizeColumns = false;
|
||||
dataGridView.AllowUserToResizeRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Fill;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 62;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(978, 894);
|
||||
dataGridView.TabIndex = 5;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonUpd);
|
||||
panel1.Controls.Add(buttonDel);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(978, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(300, 894);
|
||||
panel1.TabIndex = 4;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = (Image)resources.GetObject("buttonUpd.BackgroundImage");
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpd.Location = new Point(89, 325);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(127, 108);
|
||||
buttonUpd.TabIndex = 2;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += buttonUpd_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = (Image)resources.GetObject("buttonDel.BackgroundImage");
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(89, 184);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(127, 108);
|
||||
buttonDel.TabIndex = 1;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += buttonDel_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = (Image)resources.GetObject("buttonAdd.BackgroundImage");
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(89, 47);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(127, 108);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// FormRoutes
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1278, 894);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormRoutes";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Маршруты";
|
||||
Load += FormRoutes_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Panel panel1;
|
||||
private Button buttonUpd;
|
||||
private Button buttonDel;
|
||||
private Button buttonAdd;
|
||||
}
|
||||
}
|
91
TransportEnterprise/TransportEnterprise/Forms/FormRoutes.cs
Normal file
91
TransportEnterprise/TransportEnterprise/Forms/FormRoutes.cs
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
using TransportEnterprise.Entities.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace TransportEnterprise.Forms;
|
||||
|
||||
public partial class FormRoutes : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IRouteRepository _routeRepository;
|
||||
public FormRoutes(IUnityContainer container, IRouteRepository routeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_routeRepository = routeRepository ?? throw new(nameof(routeRepository));
|
||||
}
|
||||
private void FormRoutes_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormRoute>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void buttonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormRoute>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void buttonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_routeRepository.DeleteRoute(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridView.DataSource = _routeRepository.ReadRoutes();
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridView.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
2821
TransportEnterprise/TransportEnterprise/Forms/FormRoutes.resx
Normal file
2821
TransportEnterprise/TransportEnterprise/Forms/FormRoutes.resx
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,7 @@
|
||||
using TransportEnterprise.Entities.Repositories;
|
||||
using TransportEnterprise.Entities.Repositories.Implementations;
|
||||
using Unity;
|
||||
|
||||
namespace TransportEnterprise
|
||||
{
|
||||
internal static class Program
|
||||
@ -11,7 +15,20 @@ namespace TransportEnterprise
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
Application.Run(CreateContainer().Resolve<TransportEnterprise>());
|
||||
}
|
||||
|
||||
private static IUnityContainer CreateContainer()
|
||||
{
|
||||
var container = new UnityContainer();
|
||||
|
||||
container.RegisterType<IBusRepository, BusRepository>();
|
||||
container.RegisterType<IEmployeeRepository, EmployeeRepository>();
|
||||
container.RegisterType<IRouteRepository, RouteRepository>();
|
||||
container.RegisterType<IRouteSheetRepository, RouteSheetRepository>();
|
||||
container.RegisterType<IRepairRequestRepository, RepairRequestRepository>();
|
||||
|
||||
return container;
|
||||
}
|
||||
}
|
||||
}
|
93
TransportEnterprise/TransportEnterprise/Properties/Resources.Designer.cs
generated
Normal file
93
TransportEnterprise/TransportEnterprise/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,93 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace TransportEnterprise.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TransportEnterprise.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap PAZ {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("PAZ", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap pngegg__1_ {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("pngegg (1)", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap pngegg__2_ {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("pngegg (2)", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="pngegg (1)" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\pngegg (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="PAZ" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\PAZ.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="pngegg (2)" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\pngegg (2).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
TransportEnterprise/TransportEnterprise/Resources/PAZ.jpg
Normal file
BIN
TransportEnterprise/TransportEnterprise/Resources/PAZ.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 70 KiB |
BIN
TransportEnterprise/TransportEnterprise/Resources/pngegg (1).png
Normal file
BIN
TransportEnterprise/TransportEnterprise/Resources/pngegg (1).png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
TransportEnterprise/TransportEnterprise/Resources/pngegg (2).png
Normal file
BIN
TransportEnterprise/TransportEnterprise/Resources/pngegg (2).png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
139
TransportEnterprise/TransportEnterprise/TransportEnterprise.Designer.cs
generated
Normal file
139
TransportEnterprise/TransportEnterprise/TransportEnterprise.Designer.cs
generated
Normal file
@ -0,0 +1,139 @@
|
||||
namespace TransportEnterprise
|
||||
{
|
||||
partial class TransportEnterprise
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TransportEnterprise));
|
||||
menuStrip1 = new MenuStrip();
|
||||
справочникToolStripMenuItem = new ToolStripMenuItem();
|
||||
RoutesToolStripMenuItem = new ToolStripMenuItem();
|
||||
BusesToolStripMenuItem = new ToolStripMenuItem();
|
||||
EmployeesToolStripMenuItem = new ToolStripMenuItem();
|
||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
||||
AddRouteSheetМарToolStripMenuItem = new ToolStripMenuItem();
|
||||
AddRepairRequestToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.ImageScalingSize = new Size(24, 24);
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникToolStripMenuItem, операцииToolStripMenuItem, отчётыToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(1478, 33);
|
||||
menuStrip1.TabIndex = 0;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// справочникToolStripMenuItem
|
||||
//
|
||||
справочникToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { RoutesToolStripMenuItem, BusesToolStripMenuItem, EmployeesToolStripMenuItem });
|
||||
справочникToolStripMenuItem.Name = "справочникToolStripMenuItem";
|
||||
справочникToolStripMenuItem.Size = new Size(139, 29);
|
||||
справочникToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// RoutesToolStripMenuItem
|
||||
//
|
||||
RoutesToolStripMenuItem.Name = "RoutesToolStripMenuItem";
|
||||
RoutesToolStripMenuItem.Size = new Size(204, 34);
|
||||
RoutesToolStripMenuItem.Text = "Маршруты";
|
||||
RoutesToolStripMenuItem.Click += RoutesToolStripMenuItem_Click;
|
||||
//
|
||||
// BusesToolStripMenuItem
|
||||
//
|
||||
BusesToolStripMenuItem.Name = "BusesToolStripMenuItem";
|
||||
BusesToolStripMenuItem.Size = new Size(204, 34);
|
||||
BusesToolStripMenuItem.Text = "Автобусы";
|
||||
BusesToolStripMenuItem.Click += BusesToolStripMenuItem_Click;
|
||||
//
|
||||
// EmployeesToolStripMenuItem
|
||||
//
|
||||
EmployeesToolStripMenuItem.Name = "EmployeesToolStripMenuItem";
|
||||
EmployeesToolStripMenuItem.Size = new Size(204, 34);
|
||||
EmployeesToolStripMenuItem.Text = "Работники";
|
||||
EmployeesToolStripMenuItem.Click += EmployeesToolStripMenuItem_Click;
|
||||
//
|
||||
// операцииToolStripMenuItem
|
||||
//
|
||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { AddRouteSheetМарToolStripMenuItem, AddRepairRequestToolStripMenuItem });
|
||||
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
||||
операцииToolStripMenuItem.Size = new Size(112, 29);
|
||||
операцииToolStripMenuItem.Text = "Операции";
|
||||
//
|
||||
// AddRouteSheetМарToolStripMenuItem
|
||||
//
|
||||
AddRouteSheetМарToolStripMenuItem.Name = "AddRouteSheetМарToolStripMenuItem";
|
||||
AddRouteSheetМарToolStripMenuItem.Size = new Size(343, 34);
|
||||
AddRouteSheetМарToolStripMenuItem.Text = "Добавить маршрутный лист";
|
||||
AddRouteSheetМарToolStripMenuItem.Click += AddRouteSheetМарToolStripMenuItem_Click;
|
||||
//
|
||||
// AddRepairRequestToolStripMenuItem
|
||||
//
|
||||
AddRepairRequestToolStripMenuItem.Name = "AddRepairRequestToolStripMenuItem";
|
||||
AddRepairRequestToolStripMenuItem.Size = new Size(343, 34);
|
||||
AddRepairRequestToolStripMenuItem.Text = "Добавить заявку на ремонт";
|
||||
AddRepairRequestToolStripMenuItem.Click += AddRepairRequestToolStripMenuItem_Click;
|
||||
//
|
||||
// отчётыToolStripMenuItem
|
||||
//
|
||||
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
||||
отчётыToolStripMenuItem.Size = new Size(88, 29);
|
||||
отчётыToolStripMenuItem.Text = "Отчёты";
|
||||
//
|
||||
// TransportEnterprise
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackgroundImage = (Image)resources.GetObject("$this.BackgroundImage");
|
||||
BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ClientSize = new Size(1478, 794);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Name = "TransportEnterprise";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Автопредприятие";
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem справочникToolStripMenuItem;
|
||||
private ToolStripMenuItem RoutesToolStripMenuItem;
|
||||
private ToolStripMenuItem BusesToolStripMenuItem;
|
||||
private ToolStripMenuItem EmployeesToolStripMenuItem;
|
||||
private ToolStripMenuItem операцииToolStripMenuItem;
|
||||
private ToolStripMenuItem отчётыToolStripMenuItem;
|
||||
private ToolStripMenuItem AddRouteSheetМарToolStripMenuItem;
|
||||
private ToolStripMenuItem AddRepairRequestToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
using System.ComponentModel;
|
||||
using TransportEnterprise.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace TransportEnterprise
|
||||
{
|
||||
public partial class TransportEnterprise : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
public TransportEnterprise(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
|
||||
}
|
||||
|
||||
private void RoutesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormRoutes>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void EmployeesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormEmployees>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void BusesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormBuses>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddRouteSheetÌàðToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormAddingRouteSheet>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddRepairRequestToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormRepairRequests>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -8,4 +8,23 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
1325
TransportEnterprise/TransportEnterprise/TransportEnterprise.resx
Normal file
1325
TransportEnterprise/TransportEnterprise/TransportEnterprise.resx
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user