Compare commits

...

2 Commits

14 changed files with 240 additions and 0 deletions

View File

@ -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
};
}
}

View File

@ -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
};
}
}

View File

@ -0,0 +1,9 @@
namespace FuelAndLubricants.Entities.Enums;
public enum Car_Type
{
None = 0,
Passenger = 1,
Cargo = 2,
Bus = 3
}

View File

@ -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
}

View File

@ -0,0 +1,10 @@
namespace FuelAndLubricants.Entities.Enums;
public enum Fuel_Type
{
None = 0,
Petrol = 1,
Diesel = 2
}

View File

@ -0,0 +1,8 @@
namespace FuelAndLubricants.Entities.Enums;
public enum Shift
{
None = 0,
Day = 1,
Night = 2
}

View File

@ -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
};
}
}

View File

@ -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
};
}
}

View File

@ -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
};
}
}

View File

@ -0,0 +1,16 @@
using FuelAndLubricants.Entities;
namespace FuelAndLubricants.Repositories;
public interface ICarRepository
{
IEnumerable<Car> ReadCars();
Car ReadCarByID(int id);
void CreateCar(Car car);
//void UpdateCar(Car car);
void DeleteCar(int id);
}

View File

@ -0,0 +1,16 @@
using FuelAndLubricants.Entities;
namespace FuelAndLubricants.Repositories;
public interface IDriverRepository
{
IEnumerable<Driver> ReadDrivers();
Driver ReadDriverByID(int id);
void CreateDriver(Driver driver);
void UpdateDriver(Driver driver);
void DeleteDriver(int id);
}

View File

@ -0,0 +1,16 @@
using FuelAndLubricants.Entities;
namespace FuelAndLubricants.Repositories;
public interface IFuelRepository
{
IEnumerable<Fuel_And_Lubricants> ReadFuels();
Fuel_And_Lubricants ReadFuelByID(int id);
void CreateDriver(Fuel_And_Lubricants fuel);
void UpdateFuel(Fuel_And_Lubricants fuel);
void DeleteFuel(int id);
}

View File

@ -0,0 +1,16 @@
using FuelAndLubricants.Entities;
namespace FuelAndLubricants.Repositories;
public interface IRouteRepository
{
IEnumerable<Route> ReadRoutes();
Route ReadRouteByID(int id);
void CreateRoute(Route route);
//void UpdateRoute(Route route);
void DeleteRoute(int id);
}

View File

@ -0,0 +1,16 @@
using FuelAndLubricants.Entities;
namespace FuelAndLubricants.Repositories;
public interface ITripRepository
{
IEnumerable<Trip> ReadTrips();
Trip ReadTripByID(int id);
void CreateTrip(Trip trip);
//void UpdateTrip(Trip trip);
void DeleteTrip(int id);
}