From a2be1354e8d252a6564ba6fb026071b3e94dc78c Mon Sep 17 00:00:00 2001 From: ivans Date: Tue, 26 Nov 2024 01:43:42 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B5=D0=A9=D0=95=20=D0=92=D0=9E=D0=97=D0=9D?= =?UTF-8?q?=D0=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/Enums/PreparatoryWorkStatus.cs | 20 ++++++++++++ ProjectAirline/Entities/Enums/TicketStatus.cs | 19 +++++++++++ ProjectAirline/Entities/PreparatoryWork.cs | 20 +++++++++++- ProjectAirline/Entities/Ticket.cs | 1 - .../Repositories/IFlightRepository.cs | 14 +++++--- .../IPreparatoryWorkRepository.cs | 9 +++++- .../Implementations/FlightRepository.cs | 32 +++++++++++-------- .../PreparatoryWorkRepository.cs | 14 +++++++- 8 files changed, 107 insertions(+), 22 deletions(-) create mode 100644 ProjectAirline/Entities/Enums/PreparatoryWorkStatus.cs create mode 100644 ProjectAirline/Entities/Enums/TicketStatus.cs diff --git a/ProjectAirline/Entities/Enums/PreparatoryWorkStatus.cs b/ProjectAirline/Entities/Enums/PreparatoryWorkStatus.cs new file mode 100644 index 0000000..90a704b --- /dev/null +++ b/ProjectAirline/Entities/Enums/PreparatoryWorkStatus.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAirline.Entities.Enums; + +public enum PreparatoryWorkStatus +{ + None = 0, + + Waiting = 1, + + InProgress = 2, + + Completed = 3, + + Canceled = 4 +} diff --git a/ProjectAirline/Entities/Enums/TicketStatus.cs b/ProjectAirline/Entities/Enums/TicketStatus.cs new file mode 100644 index 0000000..1bf7ebc --- /dev/null +++ b/ProjectAirline/Entities/Enums/TicketStatus.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAirline.Entities.Enums; + +[Flags] +public enum TicketStatus +{ + None = 0, + + Paid = 1, + + Canceled = 2, + + Refunded = 4 +} diff --git a/ProjectAirline/Entities/PreparatoryWork.cs b/ProjectAirline/Entities/PreparatoryWork.cs index 1e9b3a3..c9dae7b 100644 --- a/ProjectAirline/Entities/PreparatoryWork.cs +++ b/ProjectAirline/Entities/PreparatoryWork.cs @@ -1,4 +1,5 @@ -using System; +using ProjectAirline.Entities.Enums; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -8,5 +9,22 @@ namespace ProjectAirline.Entities; public class PreparatoryWork { + public int Id { 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) + { + return new PreparatoryWork + { + Id = id, + StartDate = StartDate, + EndDate = EndDate, + Status = Status + }; + } } diff --git a/ProjectAirline/Entities/Ticket.cs b/ProjectAirline/Entities/Ticket.cs index 90275ca..dec91ee 100644 --- a/ProjectAirline/Entities/Ticket.cs +++ b/ProjectAirline/Entities/Ticket.cs @@ -20,5 +20,4 @@ public class Ticket DateBuy = DateTime.Now, }; } - } diff --git a/ProjectAirline/Repositories/IFlightRepository.cs b/ProjectAirline/Repositories/IFlightRepository.cs index bbc7ea1..88490e6 100644 --- a/ProjectAirline/Repositories/IFlightRepository.cs +++ b/ProjectAirline/Repositories/IFlightRepository.cs @@ -9,13 +9,17 @@ namespace ProjectAirline.Repositories; public interface IFlightRepository { - IEnumerable ReadFlights(); - - Flight ReadFlightById(int id); + IEnumerable ReadFlights(DateTime? dateFrom = null, DateTime? dateTo = null, int? flightId = null); void CreateFlight(Flight flight); + + //IEnumerable ReadFlights(); - void UpdateFlight(Flight flight); + //Flight ReadFlightById(int id); - void DeleteFlight(int id); + //void CreateFlight(Flight flight); + + //void UpdateFlight(Flight flight); + + //void DeleteFlight(int id); } diff --git a/ProjectAirline/Repositories/IPreparatoryWorkRepository.cs b/ProjectAirline/Repositories/IPreparatoryWorkRepository.cs index 97b0113..4f6fa00 100644 --- a/ProjectAirline/Repositories/IPreparatoryWorkRepository.cs +++ b/ProjectAirline/Repositories/IPreparatoryWorkRepository.cs @@ -1,4 +1,5 @@ -using System; +using ProjectAirline.Entities; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -8,4 +9,10 @@ namespace ProjectAirline.Repositories; public interface IPreparatoryWorkRepository { + IEnumerable ReadPreparatoryWork(DateTime? dateFrom = null, DateTime? dateTo = null, int? preparatoryWorkId = null, + PreparatoryWork? preparatoryWorkStatus = null); + + void CreatePreparatoryWork(PreparatoryWork preparatoryWork); + + void DeletePreparatoryWork(int id); } diff --git a/ProjectAirline/Repositories/Implementations/FlightRepository.cs b/ProjectAirline/Repositories/Implementations/FlightRepository.cs index 6e65879..0660a0b 100644 --- a/ProjectAirline/Repositories/Implementations/FlightRepository.cs +++ b/ProjectAirline/Repositories/Implementations/FlightRepository.cs @@ -13,21 +13,27 @@ public class FlightRepository : IFlightRepository { } - public void DeleteFlight(int id) - { - } - - public Flight ReadFlightById(int id) - { - return Flight.CreateFlight(0, DateTime.Now, DateTime.Now, string.Empty, 0); - } - - public IEnumerable ReadFlights() + public IEnumerable ReadFlights(DateTime? dateFrom = null, DateTime? dateTo = null, int? flightId = null) { return []; } - public void UpdateFlight(Flight flight) - { - } + + //public void DeleteFlight(int id) + //{ + //} + + //public Flight ReadFlightById(int id) + //{ + // return Flight.CreateFlight(0, DateTime.Now, DateTime.Now, string.Empty, 0); + //} + + //public IEnumerable ReadFlights() + //{ + // return []; + //} + + //public void UpdateFlight(Flight flight) + //{ + //} } diff --git a/ProjectAirline/Repositories/Implementations/PreparatoryWorkRepository.cs b/ProjectAirline/Repositories/Implementations/PreparatoryWorkRepository.cs index 33926eb..6914af7 100644 --- a/ProjectAirline/Repositories/Implementations/PreparatoryWorkRepository.cs +++ b/ProjectAirline/Repositories/Implementations/PreparatoryWorkRepository.cs @@ -1,4 +1,5 @@ -using System; +using ProjectAirline.Entities; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -8,5 +9,16 @@ namespace ProjectAirline.Repositories.Implementations; public class PreparatoryWorkRepository : IPreparatoryWorkRepository { + public void CreatePreparatoryWork(PreparatoryWork preparatoryWork) + { + } + public void DeletePreparatoryWork(int id) + { + } + + public IEnumerable ReadPreparatoryWork(DateTime? dateFrom = null, DateTime? dateTo = null, int? preparatoryWorkId = null, PreparatoryWork? preparatoryWorkStatus = null) + { + return []; + } }