From 23607a3d7a8fc5dbfe81e7600fe510c9c276217e Mon Sep 17 00:00:00 2001 From: F1rsTTeaM Date: Tue, 5 Nov 2024 17:35:35 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=81=D1=83=D1=89=D0=BD=D0=BE=D1=81=D1=82=D0=B5=D0=B9?= =?UTF-8?q?=20=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D1=87=D0=B8=D1=81=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FuelAndLubricants/Entities/Car.cs | 26 ++++++++++++++++ .../FuelAndLubricants/Entities/Driver.cs | 22 ++++++++++++++ .../Entities/Enums/Car_Type.cs | 9 ++++++ .../Entities/Enums/Driver_License.cs | 13 ++++++++ .../Entities/Enums/Fuel_Type.cs | 10 +++++++ .../FuelAndLubricants/Entities/Enums/Shift.cs | 8 +++++ .../Entities/Fuel_And_Lubricants.cs | 22 ++++++++++++++ .../FuelAndLubricants/Entities/Route.cs | 20 +++++++++++++ .../FuelAndLubricants/Entities/Trip.cs | 30 +++++++++++++++++++ 9 files changed, 160 insertions(+) create mode 100644 FuelAndLubricants/FuelAndLubricants/Entities/Car.cs create mode 100644 FuelAndLubricants/FuelAndLubricants/Entities/Driver.cs create mode 100644 FuelAndLubricants/FuelAndLubricants/Entities/Enums/Car_Type.cs create mode 100644 FuelAndLubricants/FuelAndLubricants/Entities/Enums/Driver_License.cs create mode 100644 FuelAndLubricants/FuelAndLubricants/Entities/Enums/Fuel_Type.cs create mode 100644 FuelAndLubricants/FuelAndLubricants/Entities/Enums/Shift.cs create mode 100644 FuelAndLubricants/FuelAndLubricants/Entities/Fuel_And_Lubricants.cs create mode 100644 FuelAndLubricants/FuelAndLubricants/Entities/Route.cs create mode 100644 FuelAndLubricants/FuelAndLubricants/Entities/Trip.cs diff --git a/FuelAndLubricants/FuelAndLubricants/Entities/Car.cs b/FuelAndLubricants/FuelAndLubricants/Entities/Car.cs new file mode 100644 index 0000000..139ce94 --- /dev/null +++ b/FuelAndLubricants/FuelAndLubricants/Entities/Car.cs @@ -0,0 +1,26 @@ +using FuelAndLubricants.Entities.Enums; + +namespace FuelAndLubricants.Entities; + +public class Car +{ + public int Car_ID { get; private set; } + public string Car_Mark { get; private set; } = string.Empty; + public string Car_Model { get; private set; } = string.Empty; + public Car_Type Car_Type { get; private set; } + public float Consumption_Rate { get; private set; } + public int Fuel_ID { get; private set; } + + public static Car CreateEntity (int car_ID, string car_mark, string car_model, Car_Type car_type, float consumption, int fuel_id) + { + return new Car + { + Car_ID = car_ID, + Car_Mark = car_mark ?? string.Empty, + Car_Model = car_model ?? string.Empty, + Car_Type = car_type, + Consumption_Rate = consumption, + Fuel_ID = fuel_id + }; + } +} diff --git a/FuelAndLubricants/FuelAndLubricants/Entities/Driver.cs b/FuelAndLubricants/FuelAndLubricants/Entities/Driver.cs new file mode 100644 index 0000000..7899494 --- /dev/null +++ b/FuelAndLubricants/FuelAndLubricants/Entities/Driver.cs @@ -0,0 +1,22 @@ +using FuelAndLubricants.Entities.Enums; + +namespace FuelAndLubricants.Entities; + +public class Driver +{ + public int Driver_ID { get; private set; } + public string Firstname { get; private set; } = string.Empty; + public string Secondname { get; private set; } = string.Empty; + public Driver_License Driver_License { get; private set; } + + public static Driver CreateEntity (int driver_ID, string firstname, string secondname, Driver_License license) + { + return new Driver + { + Driver_ID = driver_ID, + Firstname = firstname ?? string.Empty, + Secondname = secondname ?? string.Empty, + Driver_License = license + }; + } +} diff --git a/FuelAndLubricants/FuelAndLubricants/Entities/Enums/Car_Type.cs b/FuelAndLubricants/FuelAndLubricants/Entities/Enums/Car_Type.cs new file mode 100644 index 0000000..a700a41 --- /dev/null +++ b/FuelAndLubricants/FuelAndLubricants/Entities/Enums/Car_Type.cs @@ -0,0 +1,9 @@ +namespace FuelAndLubricants.Entities.Enums; + +public enum Car_Type +{ + None = 0, + Passenger = 1, + Cargo = 2, + Bus = 3 +} diff --git a/FuelAndLubricants/FuelAndLubricants/Entities/Enums/Driver_License.cs b/FuelAndLubricants/FuelAndLubricants/Entities/Enums/Driver_License.cs new file mode 100644 index 0000000..ae865a1 --- /dev/null +++ b/FuelAndLubricants/FuelAndLubricants/Entities/Enums/Driver_License.cs @@ -0,0 +1,13 @@ +namespace FuelAndLubricants.Entities.Enums; + +[Flags] +public enum Driver_License +{ + None = 0, + A = 1, + B = 2, + C = 4, + D = 8, + BE = 16, + CE = 32 +} diff --git a/FuelAndLubricants/FuelAndLubricants/Entities/Enums/Fuel_Type.cs b/FuelAndLubricants/FuelAndLubricants/Entities/Enums/Fuel_Type.cs new file mode 100644 index 0000000..b408283 --- /dev/null +++ b/FuelAndLubricants/FuelAndLubricants/Entities/Enums/Fuel_Type.cs @@ -0,0 +1,10 @@ +namespace FuelAndLubricants.Entities.Enums; + +public enum Fuel_Type +{ + None = 0, + + Petrol = 1, + + Diesel = 2 +} diff --git a/FuelAndLubricants/FuelAndLubricants/Entities/Enums/Shift.cs b/FuelAndLubricants/FuelAndLubricants/Entities/Enums/Shift.cs new file mode 100644 index 0000000..a05e003 --- /dev/null +++ b/FuelAndLubricants/FuelAndLubricants/Entities/Enums/Shift.cs @@ -0,0 +1,8 @@ +namespace FuelAndLubricants.Entities.Enums; + +public enum Shift +{ + None = 0, + Day = 1, + Night = 2 +} diff --git a/FuelAndLubricants/FuelAndLubricants/Entities/Fuel_And_Lubricants.cs b/FuelAndLubricants/FuelAndLubricants/Entities/Fuel_And_Lubricants.cs new file mode 100644 index 0000000..5928429 --- /dev/null +++ b/FuelAndLubricants/FuelAndLubricants/Entities/Fuel_And_Lubricants.cs @@ -0,0 +1,22 @@ +using FuelAndLubricants.Entities.Enums; + +namespace FuelAndLubricants.Entities; + +public class Fuel_And_Lubricants +{ + public int Fuel_ID { get; private set; } + public Fuel_Type Fuel_Type { get; private set; } + public float Price_Per_Liter { get; private set; } + public float Amount { get; private set; } + + public static Fuel_And_Lubricants CreateEntity(int fuel_id, Fuel_Type type, float price, float amount) + { + return new Fuel_And_Lubricants + { + Fuel_ID = fuel_id, + Fuel_Type = type, + Price_Per_Liter = price, + Amount = amount + }; + } +} diff --git a/FuelAndLubricants/FuelAndLubricants/Entities/Route.cs b/FuelAndLubricants/FuelAndLubricants/Entities/Route.cs new file mode 100644 index 0000000..25af9ec --- /dev/null +++ b/FuelAndLubricants/FuelAndLubricants/Entities/Route.cs @@ -0,0 +1,20 @@ +namespace FuelAndLubricants.Entities; + +public class Route +{ + public int Route_ID { get; private set; } + public string Start_Point { get; private set; } = string.Empty; + public string End_Point { get; private set;} = string.Empty; + public float Route_Length { get; private set; } + + public static Route CreateEntity (int route_id, string start_point, string end_point, float length) + { + return new Route + { + Route_ID = route_id, + Start_Point = start_point ?? string.Empty, + End_Point = end_point ?? string.Empty, + Route_Length = length + }; + } +} diff --git a/FuelAndLubricants/FuelAndLubricants/Entities/Trip.cs b/FuelAndLubricants/FuelAndLubricants/Entities/Trip.cs new file mode 100644 index 0000000..218d322 --- /dev/null +++ b/FuelAndLubricants/FuelAndLubricants/Entities/Trip.cs @@ -0,0 +1,30 @@ +using FuelAndLubricants.Entities.Enums; + +namespace FuelAndLubricants.Entities; + +public class Trip +{ + public int Trip_ID { get; private set; } + public DateTime Start_Date { get; private set; } + public DateTime End_Date { get; private set; } + public Shift Shift { get; private set; } + public float Fuel_Consumption { get; private set; } + public int Car_ID { get; private set; } + public int Driver_ID { get; private set; } + public int Route_ID { get; private set; } + + public static Trip CreateEntity(int trip_id, DateTime start_date, DateTime end_date, Shift shift, float consumption, int car_id, int driver_id, int route_id) + { + return new Trip + { + Trip_ID = trip_id, + Start_Date = start_date, + End_Date = end_date, + Shift = shift, + Fuel_Consumption = consumption, + Car_ID = car_id, + Driver_ID = driver_id, + Route_ID = route_id + }; + } +}