Гуд лак некст тайм
This commit is contained in:
parent
735cb575f9
commit
8ec32cd38e
@ -18,7 +18,7 @@ public class Flight
|
||||
|
||||
public int TicketPrice { get; private set; }
|
||||
|
||||
public static Flight CreateFlight(int id, DateTime dateTimeDeparture, DateTime dateTimeArrival, string arrivalLocation, int ticketPrice)
|
||||
public static Flight CreateOperation(int id, DateTime dateTimeDeparture, DateTime dateTimeArrival, string arrivalLocation, int ticketPrice)
|
||||
{
|
||||
return new Flight
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ public class Passanger
|
||||
|
||||
public string LastName { get; private set; } = string.Empty;
|
||||
|
||||
public static Passanger CreatePassanger(int id, string fname, string lname)
|
||||
public static Passanger CreateEntity(int id, string fname, string lname)
|
||||
{
|
||||
return new Passanger
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ public class Plane
|
||||
|
||||
public int Capacity { get; private set; }
|
||||
|
||||
public static Plane CreatePlane(int id, string name, int capacity)
|
||||
public static Plane CreateEntity(int id, string name, int capacity)
|
||||
{
|
||||
return new Plane
|
||||
{
|
||||
|
@ -15,9 +15,9 @@ public class PreparatoryWork
|
||||
public DateTime StartDate { get; private set; }
|
||||
public DateTime EndDate { get; private set; }
|
||||
public PreparatoryWorkStatus Status { get; private set; }
|
||||
public IEnumerable<PreparatoryWorkPlane> PreparatoryWorkPlanes { get; private set; } = Enumerable.Empty<PreparatoryWorkPlane>();
|
||||
public IEnumerable<PreparatoryWorkPlane> PreparatoryWorkPlanes { get; private set; } = [];
|
||||
|
||||
public static PreparatoryWork CreatePreparatoryWork(int id, int flightId, DateTime startDate, DateTime endDate, PreparatoryWorkStatus status, IEnumerable<PreparatoryWorkPlane> preparatoryWorkPlanes)
|
||||
public static PreparatoryWork CreateOperation(int id, int flightId, DateTime startDate, DateTime endDate, PreparatoryWorkStatus status, IEnumerable<PreparatoryWorkPlane> preparatoryWorkPlanes)
|
||||
{
|
||||
return new PreparatoryWork
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ public class PreparatoryWorkPlane
|
||||
public int PlaneId { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
|
||||
public static PreparatoryWorkPlane CreateElement(int id, int preparatoryWorkId, int planeId, int count)
|
||||
public static PreparatoryWorkPlane CreateOperation(int id, int preparatoryWorkId, int planeId, int count)
|
||||
{
|
||||
return new PreparatoryWorkPlane
|
||||
{
|
@ -15,7 +15,7 @@ public class Ticket
|
||||
|
||||
public TicketStatus Status { get; private set; }
|
||||
|
||||
public static Ticket CreateTicket(int id, TicketStatus status)
|
||||
public static Ticket CreateEntity(int id, TicketStatus status)
|
||||
{
|
||||
return new Ticket
|
||||
{
|
||||
|
@ -1,17 +1,17 @@
|
||||
<?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
|
||||
|
||||
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>
|
||||
@ -26,36 +26,36 @@
|
||||
<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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
@ -117,7 +117,12 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="scale_1200" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\scale_1200.jpg;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
@ -75,5 +75,5 @@ public partial class FormFlight : Form
|
||||
|
||||
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));
|
||||
private Flight CreateFlight(int id) => Flight.CreateOperation(id, DateTime.Now, DateTime.Now.AddHours(2), textBoxArrivalLocation.Text, Convert.ToInt32(numericUpDownTicketPrice.Value));
|
||||
}
|
||||
|
@ -74,5 +74,5 @@ public partial class FormPassanger : Form
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Passanger CreatePassanger(int id) => Passanger.CreatePassanger(id, textBoxFirstName.Text, textBoxFirstName.Text);
|
||||
private Passanger CreatePassanger(int id) => Passanger.CreateEntity(id, textBoxFirstName.Text, textBoxFirstName.Text);
|
||||
}
|
||||
|
@ -74,5 +74,5 @@ public partial class FormPlane : Form
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Plane CreatePlane(int id) => Plane.CreatePlane(id, textBoxName.Text, Convert.ToInt32(numericUpDownCapacity.Value));
|
||||
private Plane CreatePlane(int id) => Plane.CreateEntity(id, textBoxName.Text, Convert.ToInt32(numericUpDownCapacity.Value));
|
||||
}
|
||||
|
@ -64,15 +64,10 @@ public partial class FormPreparatoryWork : Form
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_preparatoryWorkId.HasValue)
|
||||
{
|
||||
_preparatoryWorkRepository.UpdatePreparatoryWork(CreatePreparatoryWork(_preparatoryWorkId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_preparatoryWorkRepository.CreatePreparatoryWork(CreatePreparatoryWork(0));
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// _preparatoryWorkRepository.CreatePreparatoryWork();
|
||||
//}
|
||||
|
||||
Close();
|
||||
}
|
||||
@ -84,15 +79,15 @@ public partial class FormPreparatoryWork : Form
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private PreparatoryWork CreatePreparatoryWork(int id)
|
||||
{
|
||||
return PreparatoryWork.CreatePreparatoryWork(
|
||||
id,
|
||||
(int)comboBoxFlightId.SelectedItem,
|
||||
DateTime.Now,
|
||||
DateTime.Now.AddHours(1),
|
||||
(PreparatoryWorkStatus)comboBoxStatus.SelectedItem
|
||||
|
||||
);
|
||||
}
|
||||
//private PreparatoryWork CreatePreparatoryWork(int id)
|
||||
//{
|
||||
// return PreparatoryWork.CreateOperation(
|
||||
// id,
|
||||
// (int)comboBoxFlightId.SelectedItem,
|
||||
// DateTime.Now,
|
||||
// DateTime.Now.AddHours(1),
|
||||
// (PreparatoryWorkStatus)comboBoxStatus.SelectedItem
|
||||
|
||||
// );
|
||||
//}
|
||||
}
|
||||
|
@ -109,7 +109,6 @@
|
||||
Name = "FormPreparatoryWorks";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Подготовительные работы";
|
||||
Load += FormPreparatoryWorks_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
|
@ -116,7 +116,7 @@ public partial class FormPreparatoryWorks : Form
|
||||
_preparatoryWorkRepository = preparatoryWorkRepository ?? throw new ArgumentNullException(nameof(preparatoryWorkRepository));
|
||||
_planeRepository = planeRepository ?? throw new ArgumentNullException(nameof(planeRepository));
|
||||
|
||||
// Настройка DataGridView
|
||||
|
||||
dataGridViewData.AutoGenerateColumns = false;
|
||||
dataGridViewData.Columns.Add(new DataGridViewComboBoxColumn
|
||||
{
|
||||
@ -146,12 +146,12 @@ public partial class FormPreparatoryWorks : Form
|
||||
|
||||
var preparatoryWorkPlanes = CreateListPreparatoryWorkPlanesFromDataGrid();
|
||||
|
||||
var preparatoryWork = PreparatoryWork.CreatePreparatoryWork(
|
||||
0, // ID будет присвоен при сохранении
|
||||
-1, // FlightId (если нужно, добавьте поле для ввода)
|
||||
DateTime.Now, // StartDate (если нужно, добавьте поле для ввода)
|
||||
DateTime.Now, // EndDate (если нужно, добавьте поле для ввода)
|
||||
PreparatoryWorkStatus.None, // Status (если нужно, добавьте поле для ввода)
|
||||
var preparatoryWork = PreparatoryWork.CreateOperation(
|
||||
0,
|
||||
-1,
|
||||
DateTime.Now,
|
||||
DateTime.Now,
|
||||
PreparatoryWorkStatus.None,
|
||||
preparatoryWorkPlanes
|
||||
);
|
||||
|
||||
@ -179,7 +179,7 @@ public partial class FormPreparatoryWorks : Form
|
||||
var planeId = Convert.ToInt32(row.Cells["ColumnPlane"].Value);
|
||||
var count = Convert.ToInt32(row.Cells["ColumnCount"].Value);
|
||||
|
||||
list.Add(PreparatoryWorkPlane.CreateElement(0, -1, planeId, count));
|
||||
list.Add(PreparatoryWorkPlane.CreateOperation(0, -1, planeId, count));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public partial class FormTicket : Form
|
||||
private Ticket CreateTicket(int id)
|
||||
{
|
||||
var status = GetTicketStatusFromCheckedListBox();
|
||||
return Ticket.CreateTicket(id, status);
|
||||
return Ticket.CreateEntity(id, status);
|
||||
}
|
||||
|
||||
private TicketStatus GetTicketStatusFromCheckedListBox()
|
||||
|
@ -17,10 +17,6 @@ public interface IFlightRepository
|
||||
|
||||
//IEnumerable<Flight> ReadFlights();
|
||||
|
||||
|
||||
|
||||
//void CreateFlight(Flight flight);
|
||||
|
||||
void UpdateFlight(Flight flight);
|
||||
|
||||
void DeleteFlight(int id);
|
||||
|
@ -14,8 +14,6 @@ public interface IPreparatoryWorkRepository
|
||||
|
||||
void CreatePreparatoryWork(PreparatoryWork preparatoryWork);
|
||||
|
||||
void UpdatePreparatoryWork(PreparatoryWork preparatoryWork);
|
||||
|
||||
void DeletePreparatoryWork(int id);
|
||||
|
||||
PreparatoryWork ReadPreparatoryWorkById(int id);
|
||||
|
@ -25,7 +25,7 @@ public class FlightRepository : IFlightRepository
|
||||
|
||||
public Flight ReadFlightById(int id)
|
||||
{
|
||||
return Flight.CreateFlight(0, DateTime.Now, DateTime.Now, string.Empty, 0);
|
||||
return Flight.CreateOperation(0, DateTime.Now, DateTime.Now, string.Empty, 0);
|
||||
}
|
||||
|
||||
//public IEnumerable<Flight> ReadFlights()
|
||||
|
@ -19,7 +19,7 @@ public class PassangerRepository : IPassangerRepository
|
||||
|
||||
public Passanger ReadPassangerById(int id)
|
||||
{
|
||||
return Passanger.CreatePassanger(0, string.Empty, string.Empty);
|
||||
return Passanger.CreateEntity(0, string.Empty, string.Empty);
|
||||
}
|
||||
|
||||
public IEnumerable<Passanger> ReadPassangers()
|
||||
|
@ -18,7 +18,7 @@ public class PlaneRepository : IPlaneRepository
|
||||
|
||||
public Plane ReadPlaneById(int id)
|
||||
{
|
||||
return Plane.CreatePlane(0, string.Empty, 0);
|
||||
return Plane.CreateEntity(0, string.Empty, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Plane> ReadPlanes()
|
||||
|
@ -20,12 +20,9 @@ public class PreparatoryWorkRepository : IPreparatoryWorkRepository
|
||||
public void UpdatePreparatoryWork(PreparatoryWork preparatoryWork)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
public PreparatoryWork ReadPreparatoryWorkById(int id)
|
||||
{
|
||||
return PreparatoryWork.CreatePreparatoryWork(0, 0, DateTime.Now, DateTime.Now, 0);
|
||||
return PreparatoryWork.CreateOperation(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)
|
||||
|
@ -19,7 +19,7 @@ public class TicketRepository : ITicketRepository
|
||||
|
||||
public Ticket ReadTicketById(int id)
|
||||
{
|
||||
return Ticket.CreateTicket(0, 0);
|
||||
return Ticket.CreateEntity(0, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Ticket> ReadTickets()
|
||||
|
Loading…
x
Reference in New Issue
Block a user