Скока можно
This commit is contained in:
parent
a2be1354e8
commit
3e93c2d19a
@ -10,14 +10,17 @@ public class Passanger
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public string FirstName { get; private set; } = string.Empty;
|
||||
|
||||
public static Passanger CreatePassanger(int id, string name)
|
||||
public string LastName { get; private set; } = string.Empty;
|
||||
|
||||
public static Passanger CreatePassanger(int id, string fname, string lname)
|
||||
{
|
||||
return new Passanger
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
FirstName = fname,
|
||||
LastName = lname
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -11,17 +11,23 @@ public class PreparatoryWork
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public int FlightId { get; private set; }
|
||||
|
||||
public int PlaneId { get; private set; }
|
||||
|
||||
public DateTime StartDate { get; private set; }
|
||||
|
||||
public DateTime EndDate { get; private set; }
|
||||
|
||||
public PreparatoryWorkStatus Status { get; private set; }
|
||||
|
||||
public static PreparatoryWork CreatePrerapatoryWork(int id, DateTime StartDate, DateTime EndDate, PreparatoryWorkStatus Status)
|
||||
public static PreparatoryWork CreatePrerapatoryWork(int id, int FlightId, int PlaneId, DateTime StartDate, DateTime EndDate, PreparatoryWorkStatus Status)
|
||||
{
|
||||
return new PreparatoryWork
|
||||
{
|
||||
Id = id,
|
||||
FlightId = FlightId,
|
||||
PlaneId = PlaneId,
|
||||
StartDate = StartDate,
|
||||
EndDate = EndDate,
|
||||
Status = Status
|
||||
|
145
ProjectAirline/Forms/FormFlight.Designer.cs
generated
145
ProjectAirline/Forms/FormFlight.Designer.cs
generated
@ -28,115 +28,92 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
textBox1 = new TextBox();
|
||||
label4 = new Label();
|
||||
numericUpDown1 = new NumericUpDown();
|
||||
buttonFlightSave = new Button();
|
||||
buttonFlightCancel = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDown1).BeginInit();
|
||||
labelArrivalLocation = new Label();
|
||||
textBoxArrivalLocation = new TextBox();
|
||||
labelTicketPrice = new Label();
|
||||
numericUpDownTicketPrice = new NumericUpDown();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownTicketPrice).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
// labelArrivalLocation
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(32, 35);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(74, 15);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "Дата вылета";
|
||||
labelArrivalLocation.AutoSize = true;
|
||||
labelArrivalLocation.Location = new Point(30, 53);
|
||||
labelArrivalLocation.Name = "labelArrivalLocation";
|
||||
labelArrivalLocation.Size = new Size(100, 15);
|
||||
labelArrivalLocation.TabIndex = 2;
|
||||
labelArrivalLocation.Text = "Место прибытия";
|
||||
//
|
||||
// label2
|
||||
// textBoxArrivalLocation
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(32, 71);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(90, 15);
|
||||
label2.TabIndex = 1;
|
||||
label2.Text = "Дата прибытия";
|
||||
textBoxArrivalLocation.Location = new Point(145, 53);
|
||||
textBoxArrivalLocation.Name = "textBoxArrivalLocation";
|
||||
textBoxArrivalLocation.Size = new Size(100, 23);
|
||||
textBoxArrivalLocation.TabIndex = 3;
|
||||
//
|
||||
// label3
|
||||
// labelTicketPrice
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(32, 109);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(100, 15);
|
||||
label3.TabIndex = 2;
|
||||
label3.Text = "Место прибытия";
|
||||
labelTicketPrice.AutoSize = true;
|
||||
labelTicketPrice.Location = new Point(30, 117);
|
||||
labelTicketPrice.Name = "labelTicketPrice";
|
||||
labelTicketPrice.Size = new Size(76, 15);
|
||||
labelTicketPrice.TabIndex = 4;
|
||||
labelTicketPrice.Text = "Цена билета";
|
||||
//
|
||||
// textBox1
|
||||
// numericUpDownTicketPrice
|
||||
//
|
||||
textBox1.Location = new Point(145, 106);
|
||||
textBox1.Name = "textBox1";
|
||||
textBox1.Size = new Size(100, 23);
|
||||
textBox1.TabIndex = 3;
|
||||
numericUpDownTicketPrice.Location = new Point(145, 115);
|
||||
numericUpDownTicketPrice.Name = "numericUpDownTicketPrice";
|
||||
numericUpDownTicketPrice.Size = new Size(100, 23);
|
||||
numericUpDownTicketPrice.TabIndex = 5;
|
||||
//
|
||||
// label4
|
||||
// buttonSave
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(32, 148);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(76, 15);
|
||||
label4.TabIndex = 4;
|
||||
label4.Text = "Цена билета";
|
||||
buttonSave.Location = new Point(30, 223);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// numericUpDown1
|
||||
// buttonCancel
|
||||
//
|
||||
numericUpDown1.Location = new Point(145, 146);
|
||||
numericUpDown1.Name = "numericUpDown1";
|
||||
numericUpDown1.Size = new Size(100, 23);
|
||||
numericUpDown1.TabIndex = 5;
|
||||
//
|
||||
// buttonFlightSave
|
||||
//
|
||||
buttonFlightSave.Location = new Point(30, 223);
|
||||
buttonFlightSave.Name = "buttonFlightSave";
|
||||
buttonFlightSave.Size = new Size(75, 23);
|
||||
buttonFlightSave.TabIndex = 6;
|
||||
buttonFlightSave.Text = "Сохранить";
|
||||
buttonFlightSave.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonFlightCancel
|
||||
//
|
||||
buttonFlightCancel.Location = new Point(152, 223);
|
||||
buttonFlightCancel.Name = "buttonFlightCancel";
|
||||
buttonFlightCancel.Size = new Size(75, 23);
|
||||
buttonFlightCancel.TabIndex = 7;
|
||||
buttonFlightCancel.Text = "Отмена";
|
||||
buttonFlightCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Location = new Point(152, 223);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormFlight
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(273, 282);
|
||||
Controls.Add(buttonFlightCancel);
|
||||
Controls.Add(buttonFlightSave);
|
||||
Controls.Add(numericUpDown1);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(textBox1);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(numericUpDownTicketPrice);
|
||||
Controls.Add(labelTicketPrice);
|
||||
Controls.Add(textBoxArrivalLocation);
|
||||
Controls.Add(labelArrivalLocation);
|
||||
Name = "FormFlight";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Полет";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDown1).EndInit();
|
||||
Text = "Рейс";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownTicketPrice).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private TextBox textBox1;
|
||||
private Label label4;
|
||||
private NumericUpDown numericUpDown1;
|
||||
private Button buttonFlightSave;
|
||||
private Button buttonFlightCancel;
|
||||
private Label labelArrivalLocation;
|
||||
private TextBox textBoxArrivalLocation;
|
||||
private Label labelTicketPrice;
|
||||
private NumericUpDown numericUpDownTicketPrice;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using ProjectAirline.Entities;
|
||||
using ProjectAirline.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
@ -8,13 +10,70 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectAirline.Forms
|
||||
namespace ProjectAirline.Forms;
|
||||
|
||||
|
||||
public partial class FormFlight : Form
|
||||
{
|
||||
public partial class FormFlight : Form
|
||||
private readonly IFlightRepository _flightRepository;
|
||||
private int? _flightId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
public FormFlight()
|
||||
set
|
||||
{
|
||||
InitializeComponent();
|
||||
try
|
||||
{
|
||||
var flight = _flightRepository.ReadFlightById(value);
|
||||
if (flight == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(flight));
|
||||
}
|
||||
textBoxArrivalLocation.Text = flight.ArrivalLocation;
|
||||
numericUpDownTicketPrice.Value = flight.TicketPrice;
|
||||
_flightId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormFlight(IFlightRepository flightRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_flightRepository = flightRepository ?? throw new ArgumentNullException(nameof(flightRepository));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxArrivalLocation.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_flightId.HasValue)
|
||||
{
|
||||
_flightRepository.UpdateFlight(CreateFlight(_flightId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_flightRepository.CreateFlight(CreateFlight(0));
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Flight CreateFlight(int id) => Flight.CreateFlight(id, DateTime.Now, DateTime.Now.AddHours(2), textBoxArrivalLocation.Text, Convert.ToInt32(numericUpDownTicketPrice.Value));
|
||||
}
|
||||
|
123
ProjectAirline/Forms/FormFlights.Designer.cs
generated
Normal file
123
ProjectAirline/Forms/FormFlights.Designer.cs
generated
Normal file
@ -0,0 +1,123 @@
|
||||
namespace ProjectAirline.Forms
|
||||
{
|
||||
partial class FormFlights
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonAdd = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonUpd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Controls.Add(buttonDel);
|
||||
panel.Controls.Add(buttonUpd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(652, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(148, 450);
|
||||
panel.TabIndex = 0;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Fairytale_button_add_svg;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonAdd.Location = new Point(43, 44);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(70, 59);
|
||||
buttonAdd.TabIndex = 2;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.kisspng_computer_icons_download_5b218289889485_4804831415289227615594;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(43, 244);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(70, 59);
|
||||
buttonDel.TabIndex = 1;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = Properties.Resources.Antu_qtdesigner_svg;
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonUpd.Location = new Point(43, 137);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(70, 59);
|
||||
buttonUpd.TabIndex = 0;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.Size = new Size(652, 450);
|
||||
dataGridViewData.TabIndex = 1;
|
||||
//
|
||||
// FormFlights
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
Name = "FormFlights";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Полеты";
|
||||
Load += FormFlights_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonAdd;
|
||||
private Button buttonDel;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
107
ProjectAirline/Forms/FormFlights.cs
Normal file
107
ProjectAirline/Forms/FormFlights.cs
Normal file
@ -0,0 +1,107 @@
|
||||
using ProjectAirline.Repositories;
|
||||
using ProjectAirline.Repositories.Implementations;
|
||||
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 System.Xml.Linq;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectAirline.Forms;
|
||||
|
||||
public partial class FormFlights : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IFlightRepository _flightRepository;
|
||||
|
||||
public FormFlights(IUnityContainer container, IFlightRepository flightRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_flightRepository = flightRepository ?? throw new ArgumentNullException(nameof(flightRepository));
|
||||
}
|
||||
|
||||
private void FormFlights_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<FormFlight>().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<FormFlight>();
|
||||
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
|
||||
{
|
||||
_flightRepository.DeleteFlight(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _flightRepository.ReadFlights();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
120
ProjectAirline/Forms/FormFlights.resx
Normal file
120
ProjectAirline/Forms/FormFlights.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>
|
117
ProjectAirline/Forms/FormPassanger.Designer.cs
generated
Normal file
117
ProjectAirline/Forms/FormPassanger.Designer.cs
generated
Normal file
@ -0,0 +1,117 @@
|
||||
namespace ProjectAirline.Forms
|
||||
{
|
||||
partial class FormPassanger
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
labelFirstName = new Label();
|
||||
textBoxFirstName = new TextBox();
|
||||
labelLastName = new Label();
|
||||
textBoxLastName = new TextBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(30, 216);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 0;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(164, 216);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 1;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// labelFirstName
|
||||
//
|
||||
labelFirstName.AutoSize = true;
|
||||
labelFirstName.Location = new Point(50, 60);
|
||||
labelFirstName.Name = "labelFirstName";
|
||||
labelFirstName.Size = new Size(31, 15);
|
||||
labelFirstName.TabIndex = 2;
|
||||
labelFirstName.Text = "Имя";
|
||||
//
|
||||
// textBoxFirstName
|
||||
//
|
||||
textBoxFirstName.Location = new Point(129, 57);
|
||||
textBoxFirstName.Name = "textBoxFirstName";
|
||||
textBoxFirstName.Size = new Size(100, 23);
|
||||
textBoxFirstName.TabIndex = 3;
|
||||
//
|
||||
// labelLastName
|
||||
//
|
||||
labelLastName.AutoSize = true;
|
||||
labelLastName.Location = new Point(50, 118);
|
||||
labelLastName.Name = "labelLastName";
|
||||
labelLastName.Size = new Size(58, 15);
|
||||
labelLastName.TabIndex = 4;
|
||||
labelLastName.Text = "Фамилия";
|
||||
//
|
||||
// textBoxLastName
|
||||
//
|
||||
textBoxLastName.Location = new Point(129, 115);
|
||||
textBoxLastName.Name = "textBoxLastName";
|
||||
textBoxLastName.Size = new Size(100, 23);
|
||||
textBoxLastName.TabIndex = 5;
|
||||
//
|
||||
// FormPassanger
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(281, 290);
|
||||
Controls.Add(textBoxLastName);
|
||||
Controls.Add(labelLastName);
|
||||
Controls.Add(textBoxFirstName);
|
||||
Controls.Add(labelFirstName);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Name = "FormPassanger";
|
||||
Text = "FormPassanger";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private Label labelFirstName;
|
||||
private TextBox textBoxFirstName;
|
||||
private Label labelLastName;
|
||||
private TextBox textBoxLastName;
|
||||
}
|
||||
}
|
78
ProjectAirline/Forms/FormPassanger.cs
Normal file
78
ProjectAirline/Forms/FormPassanger.cs
Normal file
@ -0,0 +1,78 @@
|
||||
using ProjectAirline.Entities;
|
||||
using ProjectAirline.Repositories;
|
||||
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;
|
||||
|
||||
namespace ProjectAirline.Forms;
|
||||
|
||||
public partial class FormPassanger : Form
|
||||
{
|
||||
private readonly IPassangerRepository _passangerRepository;
|
||||
private int? _passangerId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var passenger = _passangerRepository.ReadPassangerById(value);
|
||||
if (passenger == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(passenger));
|
||||
}
|
||||
textBoxFirstName.Text = passenger.FirstName;
|
||||
textBoxFirstName.Text = passenger.LastName;
|
||||
_passangerId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormPassanger(IPassangerRepository passengerRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_passangerRepository = passengerRepository ?? throw new ArgumentNullException(nameof(passengerRepository));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxFirstName.Text) || string.IsNullOrWhiteSpace(textBoxFirstName.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_passangerId.HasValue)
|
||||
{
|
||||
_passangerRepository.UpdatePassanger(CreatePassanger(_passangerId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_passangerRepository.CreatePassanger(CreatePassanger(0));
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Passanger CreatePassanger(int id) => Passanger.CreatePassanger(id, textBoxFirstName.Text, textBoxFirstName.Text);
|
||||
}
|
120
ProjectAirline/Forms/FormPassanger.resx
Normal file
120
ProjectAirline/Forms/FormPassanger.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>
|
126
ProjectAirline/Forms/FormPassangers.Designer.cs
generated
Normal file
126
ProjectAirline/Forms/FormPassangers.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
namespace ProjectAirline.Forms
|
||||
{
|
||||
partial class FormPassangers
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonUpd = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonUpd);
|
||||
panel.Controls.Add(buttonDel);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(630, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(170, 450);
|
||||
panel.TabIndex = 0;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = Properties.Resources.Antu_qtdesigner_svg;
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpd.Location = new Point(48, 131);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(73, 68);
|
||||
buttonUpd.TabIndex = 2;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.kisspng_computer_icons_download_5b218289889485_4804831415289227615594;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(48, 227);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(73, 68);
|
||||
buttonDel.TabIndex = 1;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Fairytale_button_add_svg;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(48, 29);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(73, 68);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(630, 450);
|
||||
dataGridViewData.TabIndex = 1;
|
||||
//
|
||||
// FormPassangers
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
Name = "FormPassangers";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Пассажиры";
|
||||
Load += FormPassangers_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonDel;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
105
ProjectAirline/Forms/FormPassangers.cs
Normal file
105
ProjectAirline/Forms/FormPassangers.cs
Normal file
@ -0,0 +1,105 @@
|
||||
using ProjectAirline.Repositories;
|
||||
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 Unity;
|
||||
|
||||
namespace ProjectAirline.Forms;
|
||||
|
||||
public partial class FormPassangers : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IPassangerRepository _passangerRepository;
|
||||
|
||||
public FormPassangers(IUnityContainer container, IPassangerRepository passangerRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_passangerRepository = passangerRepository ?? throw new ArgumentNullException(nameof(passangerRepository));
|
||||
}
|
||||
|
||||
private void FormPassangers_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<FormPassanger>().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<FormPassanger>();
|
||||
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
|
||||
{
|
||||
_passangerRepository.DeletePassanger(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _passangerRepository.ReadPassangers();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
120
ProjectAirline/Forms/FormPassangers.resx
Normal file
120
ProjectAirline/Forms/FormPassangers.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>
|
120
ProjectAirline/Forms/FormPlane.Designer.cs
generated
Normal file
120
ProjectAirline/Forms/FormPlane.Designer.cs
generated
Normal file
@ -0,0 +1,120 @@
|
||||
namespace ProjectAirline.Forms
|
||||
{
|
||||
partial class FormPlane
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
labelName = new Label();
|
||||
labelCapacity = new Label();
|
||||
textBoxName = new TextBox();
|
||||
numericUpDownCapacity = new NumericUpDown();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(49, 233);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 0;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(174, 233);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 1;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(49, 75);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(59, 15);
|
||||
labelName.TabIndex = 2;
|
||||
labelName.Text = "Название";
|
||||
//
|
||||
// labelCapacity
|
||||
//
|
||||
labelCapacity.AutoSize = true;
|
||||
labelCapacity.Location = new Point(49, 132);
|
||||
labelCapacity.Name = "labelCapacity";
|
||||
labelCapacity.Size = new Size(80, 15);
|
||||
labelCapacity.TabIndex = 3;
|
||||
labelCapacity.Text = "Вместимость";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(174, 75);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(105, 23);
|
||||
textBoxName.TabIndex = 4;
|
||||
//
|
||||
// numericUpDownCapacity
|
||||
//
|
||||
numericUpDownCapacity.Location = new Point(174, 130);
|
||||
numericUpDownCapacity.Name = "numericUpDownCapacity";
|
||||
numericUpDownCapacity.Size = new Size(120, 23);
|
||||
numericUpDownCapacity.TabIndex = 5;
|
||||
//
|
||||
// FormPlane
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(325, 321);
|
||||
Controls.Add(numericUpDownCapacity);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelCapacity);
|
||||
Controls.Add(labelName);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Name = "FormPlane";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Самолет";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private Label labelName;
|
||||
private Label labelCapacity;
|
||||
private TextBox textBoxName;
|
||||
private NumericUpDown numericUpDownCapacity;
|
||||
}
|
||||
}
|
78
ProjectAirline/Forms/FormPlane.cs
Normal file
78
ProjectAirline/Forms/FormPlane.cs
Normal file
@ -0,0 +1,78 @@
|
||||
using ProjectAirline.Repositories;
|
||||
using ProjectAirline.Entities;
|
||||
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;
|
||||
|
||||
namespace ProjectAirline.Forms;
|
||||
|
||||
public partial class FormPlane : Form
|
||||
{
|
||||
private readonly IPlaneRepository _planeRepository;
|
||||
private int? _planeId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var plane = _planeRepository.ReadPlaneById(value);
|
||||
if (plane == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(plane));
|
||||
}
|
||||
textBoxName.Text = plane.Name;
|
||||
numericUpDownCapacity.Value = plane.Capacity;
|
||||
_planeId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormPlane(IPlaneRepository planeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_planeRepository = planeRepository ?? throw new ArgumentNullException(nameof(planeRepository));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_planeId.HasValue)
|
||||
{
|
||||
_planeRepository.UpdatePlane(CreatePlane(_planeId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_planeRepository.CreatePlane(CreatePlane(0));
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Plane CreatePlane(int id) => Plane.CreatePlane(id, textBoxName.Text, Convert.ToInt32(numericUpDownCapacity.Value));
|
||||
}
|
120
ProjectAirline/Forms/FormPlane.resx
Normal file
120
ProjectAirline/Forms/FormPlane.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>
|
126
ProjectAirline/Forms/FormPlanes.Designer.cs
generated
Normal file
126
ProjectAirline/Forms/FormPlanes.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
namespace ProjectAirline.Forms
|
||||
{
|
||||
partial class FormPlanes
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridViewData = new DataGridView();
|
||||
panel = new Panel();
|
||||
buttonUpd = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonAdd = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
panel.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.ColumnHeadersVisible = false;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(800, 450);
|
||||
dataGridViewData.TabIndex = 0;
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonUpd);
|
||||
panel.Controls.Add(buttonDel);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(600, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(200, 450);
|
||||
panel.TabIndex = 1;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = Properties.Resources.Antu_qtdesigner_svg;
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonUpd.Location = new Point(54, 133);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(75, 68);
|
||||
buttonUpd.TabIndex = 2;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.kisspng_computer_icons_download_5b218289889485_4804831415289227615594;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(54, 225);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(75, 68);
|
||||
buttonDel.TabIndex = 1;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Fairytale_button_add_svg;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonAdd.Location = new Point(54, 42);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 68);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// FormPlanes
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(panel);
|
||||
Controls.Add(dataGridViewData);
|
||||
Name = "FormPlanes";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Самолеты";
|
||||
Load += FormPlanes_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
panel.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewData;
|
||||
private Panel panel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonDel;
|
||||
private Button buttonAdd;
|
||||
}
|
||||
}
|
105
ProjectAirline/Forms/FormPlanes.cs
Normal file
105
ProjectAirline/Forms/FormPlanes.cs
Normal file
@ -0,0 +1,105 @@
|
||||
using ProjectAirline.Repositories;
|
||||
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 Unity;
|
||||
|
||||
namespace ProjectAirline.Forms;
|
||||
|
||||
public partial class FormPlanes : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IPlaneRepository _planeRepository;
|
||||
|
||||
public FormPlanes(IUnityContainer container, IPlaneRepository planeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_planeRepository = planeRepository ?? throw new ArgumentNullException(nameof(planeRepository));
|
||||
}
|
||||
|
||||
private void FormPlanes_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<FormPlane>().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<FormPlane>();
|
||||
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
|
||||
{
|
||||
_planeRepository.DeletePlane(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _planeRepository.ReadPlanes();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
120
ProjectAirline/Forms/FormPlanes.resx
Normal file
120
ProjectAirline/Forms/FormPlanes.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>
|
145
ProjectAirline/Forms/FormPreparatoryWork.Designer.cs
generated
Normal file
145
ProjectAirline/Forms/FormPreparatoryWork.Designer.cs
generated
Normal file
@ -0,0 +1,145 @@
|
||||
namespace ProjectAirline.Forms
|
||||
{
|
||||
partial class FormPreparatoryWork
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelFlightID = new Label();
|
||||
labelPlaneID = new Label();
|
||||
labelPreparatoryWorkStatus = new Label();
|
||||
comboBoxStatus = new ComboBox();
|
||||
comboBoxFlightId = new ComboBox();
|
||||
comboBoxPlaneId = new ComboBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelFlightID
|
||||
//
|
||||
labelFlightID.AutoSize = true;
|
||||
labelFlightID.Location = new Point(40, 32);
|
||||
labelFlightID.Name = "labelFlightID";
|
||||
labelFlightID.Size = new Size(33, 15);
|
||||
labelFlightID.TabIndex = 0;
|
||||
labelFlightID.Text = "Рейс";
|
||||
//
|
||||
// labelPlaneID
|
||||
//
|
||||
labelPlaneID.AutoSize = true;
|
||||
labelPlaneID.Location = new Point(40, 80);
|
||||
labelPlaneID.Name = "labelPlaneID";
|
||||
labelPlaneID.Size = new Size(55, 15);
|
||||
labelPlaneID.TabIndex = 1;
|
||||
labelPlaneID.Text = "Самолет";
|
||||
//
|
||||
// labelPreparatoryWorkStatus
|
||||
//
|
||||
labelPreparatoryWorkStatus.AutoSize = true;
|
||||
labelPreparatoryWorkStatus.Location = new Point(40, 130);
|
||||
labelPreparatoryWorkStatus.Name = "labelPreparatoryWorkStatus";
|
||||
labelPreparatoryWorkStatus.Size = new Size(43, 15);
|
||||
labelPreparatoryWorkStatus.TabIndex = 2;
|
||||
labelPreparatoryWorkStatus.Text = "Статус";
|
||||
//
|
||||
// comboBoxStatus
|
||||
//
|
||||
comboBoxStatus.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxStatus.FormattingEnabled = true;
|
||||
comboBoxStatus.Location = new Point(142, 130);
|
||||
comboBoxStatus.Name = "comboBoxStatus";
|
||||
comboBoxStatus.Size = new Size(121, 23);
|
||||
comboBoxStatus.TabIndex = 3;
|
||||
//
|
||||
// comboBoxFlightId
|
||||
//
|
||||
comboBoxFlightId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxFlightId.FormattingEnabled = true;
|
||||
comboBoxFlightId.Location = new Point(142, 32);
|
||||
comboBoxFlightId.Name = "comboBoxFlightId";
|
||||
comboBoxFlightId.Size = new Size(121, 23);
|
||||
comboBoxFlightId.TabIndex = 4;
|
||||
//
|
||||
// comboBoxPlaneId
|
||||
//
|
||||
comboBoxPlaneId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxPlaneId.FormattingEnabled = true;
|
||||
comboBoxPlaneId.Location = new Point(142, 80);
|
||||
comboBoxPlaneId.Name = "comboBoxPlaneId";
|
||||
comboBoxPlaneId.Size = new Size(121, 23);
|
||||
comboBoxPlaneId.TabIndex = 5;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(40, 210);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(188, 210);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormPreparatoryWork
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(330, 314);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(comboBoxPlaneId);
|
||||
Controls.Add(comboBoxFlightId);
|
||||
Controls.Add(comboBoxStatus);
|
||||
Controls.Add(labelPreparatoryWorkStatus);
|
||||
Controls.Add(labelPlaneID);
|
||||
Controls.Add(labelFlightID);
|
||||
Name = "FormPreparatoryWork";
|
||||
Text = "Подготовительные работы";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelFlightID;
|
||||
private Label labelPlaneID;
|
||||
private Label labelPreparatoryWorkStatus;
|
||||
private ComboBox comboBoxStatus;
|
||||
private ComboBox comboBoxFlightId;
|
||||
private ComboBox comboBoxPlaneId;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
97
ProjectAirline/Forms/FormPreparatoryWork.cs
Normal file
97
ProjectAirline/Forms/FormPreparatoryWork.cs
Normal file
@ -0,0 +1,97 @@
|
||||
using ProjectAirline.Entities.Enums;
|
||||
using ProjectAirline.Entities;
|
||||
using ProjectAirline.Repositories;
|
||||
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;
|
||||
|
||||
namespace ProjectAirline.Forms;
|
||||
|
||||
public partial class FormPreparatoryWork : Form
|
||||
{
|
||||
private readonly IPreparatoryWorkRepository _preparatoryWorkRepository;
|
||||
private int? _preparatoryWorkId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var preparatoryWork = _preparatoryWorkRepository.ReadPreparatoryWorkById(value);
|
||||
if (preparatoryWork == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(preparatoryWork));
|
||||
}
|
||||
comboBoxFlightId.SelectedItem = preparatoryWork.FlightId;
|
||||
comboBoxPlaneId.SelectedItem = preparatoryWork.PlaneId;
|
||||
comboBoxStatus.SelectedItem = preparatoryWork.Status;
|
||||
_preparatoryWorkId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FormPreparatoryWork(IPreparatoryWorkRepository preparatoryWorkRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_preparatoryWorkRepository = preparatoryWorkRepository ?? throw new ArgumentNullException(nameof(preparatoryWorkRepository));
|
||||
|
||||
// Заполнение comboBoxFlightId и comboBoxPlaneId данными из репозитория
|
||||
comboBoxFlightId.DataSource = _preparatoryWorkRepository.GetFlightIds();
|
||||
comboBoxPlaneId.DataSource = _preparatoryWorkRepository.GetPlaneIds();
|
||||
|
||||
// Заполнение comboBoxStatus данными из перечисления PreparatoryWorkStatus
|
||||
comboBoxStatus.DataSource = Enum.GetValues(typeof(PreparatoryWorkStatus));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxFlightId.SelectedIndex < 0 || comboBoxPlaneId.SelectedIndex < 0 || comboBoxStatus.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_preparatoryWorkId.HasValue)
|
||||
{
|
||||
_preparatoryWorkRepository.UpdatePreparatoryWork(CreatePreparatoryWork(_preparatoryWorkId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_preparatoryWorkRepository.CreatePreparatoryWork(CreatePreparatoryWork(0));
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private PreparatoryWork CreatePreparatoryWork(int id)
|
||||
{
|
||||
return PreparatoryWork.CreatePreparatoryWork(
|
||||
id,
|
||||
(int)comboBoxFlightId.SelectedItem,
|
||||
(int)comboBoxPlaneId.SelectedItem,
|
||||
DateTime.Now,
|
||||
DateTime.Now.AddHours(1),
|
||||
(PreparatoryWorkStatus)comboBoxStatus.SelectedItem
|
||||
);
|
||||
}
|
||||
}
|
120
ProjectAirline/Forms/FormPreparatoryWork.resx
Normal file
120
ProjectAirline/Forms/FormPreparatoryWork.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>
|
125
ProjectAirline/Forms/FormPreparatoryWorks.Designer.cs
generated
Normal file
125
ProjectAirline/Forms/FormPreparatoryWorks.Designer.cs
generated
Normal file
@ -0,0 +1,125 @@
|
||||
namespace ProjectAirline.Forms
|
||||
{
|
||||
partial class FormPreparatoryWorks
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonUpd = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonUpd);
|
||||
panel.Controls.Add(buttonDel);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(600, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(200, 450);
|
||||
panel.TabIndex = 0;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = Properties.Resources.Antu_qtdesigner_svg;
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonUpd.Location = new Point(51, 148);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(79, 65);
|
||||
buttonUpd.TabIndex = 2;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.kisspng_computer_icons_download_5b218289889485_4804831415289227615594;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(51, 248);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(79, 65);
|
||||
buttonDel.TabIndex = 1;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Fairytale_button_add_svg;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonAdd.Location = new Point(51, 44);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(79, 65);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.ColumnHeadersVisible = false;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(600, 450);
|
||||
dataGridViewData.TabIndex = 1;
|
||||
//
|
||||
// FormPreparatoryWorks
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel);
|
||||
Name = "FormPreparatoryWorks";
|
||||
Text = "Подготовительные работы";
|
||||
Load += FormPreparatoryWorks_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonDel;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
105
ProjectAirline/Forms/FormPreparatoryWorks.cs
Normal file
105
ProjectAirline/Forms/FormPreparatoryWorks.cs
Normal file
@ -0,0 +1,105 @@
|
||||
using ProjectAirline.Repositories;
|
||||
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 Unity;
|
||||
|
||||
namespace ProjectAirline.Forms;
|
||||
|
||||
public partial class FormPreparatoryWorks : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IPreparatoryWorkRepository _preparatoryWorkRepository;
|
||||
|
||||
public FormPreparatoryWorks(IUnityContainer container, IPreparatoryWorkRepository preparatoryWorkRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_preparatoryWorkRepository = preparatoryWorkRepository ?? throw new ArgumentNullException(nameof(preparatoryWorkRepository));
|
||||
}
|
||||
|
||||
private void FormPreparatoryWorks_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<FormPreparatoryWork>().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<FormPreparatoryWork>();
|
||||
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
|
||||
{
|
||||
_preparatoryWorkRepository.DeletePreparatoryWork(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _preparatoryWorkRepository.ReadPreparatoryWorks();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
120
ProjectAirline/Forms/FormPreparatoryWorks.resx
Normal file
120
ProjectAirline/Forms/FormPreparatoryWorks.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>
|
30
ProjectAirline/Properties/Resources.Designer.cs
generated
30
ProjectAirline/Properties/Resources.Designer.cs
generated
@ -60,6 +60,36 @@ namespace ProjectAirline.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Antu_qtdesigner_svg {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Antu_qtdesigner.svg", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Fairytale_button_add_svg {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Fairytale_button_add.svg", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap kisspng_computer_icons_download_5b218289889485_4804831415289227615594 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("kisspng-computer-icons-download-5b218289889485.4804831415289227615594", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
@ -121,4 +121,13 @@
|
||||
<data name="scale_1200" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\scale_1200.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Antu_qtdesigner.svg" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Antu_qtdesigner.svg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Fairytale_button_add.svg" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Fairytale_button_add.svg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="kisspng-computer-icons-download-5b218289889485.4804831415289227615594" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\kisspng-computer-icons-download-5b218289889485.4804831415289227615594.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
@ -9,17 +9,19 @@ namespace ProjectAirline.Repositories;
|
||||
|
||||
public interface IFlightRepository
|
||||
{
|
||||
Flight ReadFlightById(int id);
|
||||
|
||||
IEnumerable<Flight> ReadFlights(DateTime? dateFrom = null, DateTime? dateTo = null, int? flightId = null);
|
||||
|
||||
void CreateFlight(Flight flight);
|
||||
|
||||
//IEnumerable<Flight> ReadFlights();
|
||||
|
||||
//Flight ReadFlightById(int id);
|
||||
|
||||
|
||||
//void CreateFlight(Flight flight);
|
||||
|
||||
//void UpdateFlight(Flight flight);
|
||||
void UpdateFlight(Flight flight);
|
||||
|
||||
//void DeleteFlight(int id);
|
||||
void DeleteFlight(int id);
|
||||
}
|
||||
|
@ -9,10 +9,15 @@ namespace ProjectAirline.Repositories;
|
||||
|
||||
public interface IPreparatoryWorkRepository
|
||||
{
|
||||
IEnumerable<PreparatoryWork> ReadPreparatoryWork(DateTime? dateFrom = null, DateTime? dateTo = null, int? preparatoryWorkId = null,
|
||||
IEnumerable<PreparatoryWork> ReadPreparatoryWork(DateTime? dateFrom = null, int? planeId = null, int? flightId = null, DateTime? dateTo = null, int? preparatoryWorkId = null,
|
||||
PreparatoryWork? preparatoryWorkStatus = null);
|
||||
|
||||
void CreatePreparatoryWork(PreparatoryWork preparatoryWork);
|
||||
|
||||
void UpdatePreparatoryWork(PreparatoryWork preparatoryWork);
|
||||
void DeletePreparatoryWork(int id);
|
||||
|
||||
PreparatoryWork ReadPreparatoryWorkById(int id);
|
||||
|
||||
IEnumerable<PreparatoryWork> ReadPreparatoryWorks();
|
||||
}
|
||||
|
@ -19,21 +19,21 @@ public class FlightRepository : IFlightRepository
|
||||
}
|
||||
|
||||
|
||||
//public void DeleteFlight(int id)
|
||||
//{
|
||||
//}
|
||||
public void DeleteFlight(int id)
|
||||
{
|
||||
}
|
||||
|
||||
//public Flight ReadFlightById(int id)
|
||||
//{
|
||||
// return Flight.CreateFlight(0, DateTime.Now, DateTime.Now, string.Empty, 0);
|
||||
//}
|
||||
public Flight ReadFlightById(int id)
|
||||
{
|
||||
return Flight.CreateFlight(0, DateTime.Now, DateTime.Now, string.Empty, 0);
|
||||
}
|
||||
|
||||
//public IEnumerable<Flight> ReadFlights()
|
||||
//{
|
||||
// return [];
|
||||
//}
|
||||
|
||||
//public void UpdateFlight(Flight flight)
|
||||
//{
|
||||
//}
|
||||
public void UpdateFlight(Flight flight)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class PassangerRepository : IPassangerRepository
|
||||
|
||||
public Passanger ReadPassangerById(int id)
|
||||
{
|
||||
return Passanger.CreatePassanger(0, string.Empty);
|
||||
return Passanger.CreatePassanger(0, string.Empty, string.Empty);
|
||||
}
|
||||
|
||||
public IEnumerable<Passanger> ReadPassangers()
|
||||
|
@ -16,8 +16,17 @@ public class PreparatoryWorkRepository : IPreparatoryWorkRepository
|
||||
public void DeletePreparatoryWork(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public void UpdatePreparatoryWork(PreparatoryWork preparatoryWork)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<PreparatoryWork> ReadPreparatoryWork(DateTime? dateFrom = null, DateTime? dateTo = null, int? preparatoryWorkId = null, PreparatoryWork? preparatoryWorkStatus = null)
|
||||
public PreparatoryWork ReadPreparatoryWorkById(int id)
|
||||
{
|
||||
return PreparatoryWork.CreatePrerapatoryWork(0, 0, 0, DateTime.Now, DateTime.Now, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<PreparatoryWork> ReadPreparatoryWork(DateTime? dateFrom = null, int? planeId = null, int? flightId = null, DateTime? dateTo = null, int? preparatoryWorkId = null, PreparatoryWork? preparatoryWorkStatus = null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
BIN
ProjectAirline/Resources/Antu_qtdesigner.svg.png
Normal file
BIN
ProjectAirline/Resources/Antu_qtdesigner.svg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
BIN
ProjectAirline/Resources/Fairytale_button_add.svg.png
Normal file
BIN
ProjectAirline/Resources/Fairytale_button_add.svg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 408 KiB |
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
Loading…
x
Reference in New Issue
Block a user