diff --git a/src/FlightRecorder.BusinessLogic/FlightRecorder.BusinessLogic.csproj b/src/FlightRecorder.BusinessLogic/FlightRecorder.BusinessLogic.csproj index 8432714..c9966a2 100644 --- a/src/FlightRecorder.BusinessLogic/FlightRecorder.BusinessLogic.csproj +++ b/src/FlightRecorder.BusinessLogic/FlightRecorder.BusinessLogic.csproj @@ -3,7 +3,7 @@ net7.0 FlightRecorder.BusinessLogic - 1.0.4.0 + 1.0.5.0 Dave Walker Copyright (c) Dave Walker 2020, 2021, 2022 Dave Walker @@ -16,7 +16,7 @@ https://github.com/davewalker5/FlightRecorderDb MIT false - 1.0.4.0 + 1.0.5.0 diff --git a/src/FlightRecorder.BusinessLogic/Logic/AircraftManager.cs b/src/FlightRecorder.BusinessLogic/Logic/AircraftManager.cs index 191d351..c35b4dd 100644 --- a/src/FlightRecorder.BusinessLogic/Logic/AircraftManager.cs +++ b/src/FlightRecorder.BusinessLogic/Logic/AircraftManager.cs @@ -219,7 +219,7 @@ public async Task> ListByManufacturerAsync(string man /// /// /// - public Aircraft Add(string registration, string serialNumber, long yearOfManufacture, string modelName, string manufacturerName) + public Aircraft Add(string registration, string serialNumber, long? yearOfManufacture, string modelName, string manufacturerName) { registration = registration.CleanString().ToUpper(); Aircraft aircraft = Get(a => a.Registration == registration); @@ -254,7 +254,7 @@ public Aircraft Add(string registration, string serialNumber, long yearOfManufac /// /// /// - public async Task AddAsync(string registration, string serialNumber, long yearOfManufacture, string modelName, string manufacturerName) + public async Task AddAsync(string registration, string serialNumber, long? yearOfManufacture, string modelName, string manufacturerName) { registration = registration.CleanString().ToUpper(); Aircraft aircraft = await GetAsync(a => a.Registration == registration); diff --git a/src/FlightRecorder.BusinessLogic/Logic/SightingManager.cs b/src/FlightRecorder.BusinessLogic/Logic/SightingManager.cs index f9257f5..439843c 100644 --- a/src/FlightRecorder.BusinessLogic/Logic/SightingManager.cs +++ b/src/FlightRecorder.BusinessLogic/Logic/SightingManager.cs @@ -200,7 +200,7 @@ public async Task AddAsync(long altitude, DateTime date, long location /// public Sighting Add(FlattenedSighting flattened) { - long yearOfManufacture = DateTime.Now.Year - flattened.Age; + long? yearOfManufacture = !string.IsNullOrEmpty(flattened.Age) ? DateTime.Now.Year - long.Parse(flattened.Age) : null; long aircraftId = _factory.Aircraft.Add(flattened.Registration, flattened.SerialNumber, yearOfManufacture, flattened.Model, flattened.Manufacturer).Id; long flightId = _factory.Flights.Add(flattened.FlightNumber, flattened.Embarkation, flattened.Destination, flattened.Airline).Id; long locationId = _factory.Locations.Add(flattened.Location).Id; @@ -214,7 +214,7 @@ public Sighting Add(FlattenedSighting flattened) /// public async Task AddAsync(FlattenedSighting flattened) { - long yearOfManufacture = DateTime.Now.Year - flattened.Age; + long? yearOfManufacture = !string.IsNullOrEmpty(flattened.Age) ? DateTime.Now.Year - long.Parse(flattened.Age) : null; long aircraftId = (await _factory.Aircraft.AddAsync(flattened.Registration, flattened.SerialNumber, yearOfManufacture, flattened.Model, flattened.Manufacturer)).Id; long flightId = (await _factory.Flights.AddAsync(flattened.FlightNumber, flattened.Embarkation, flattened.Destination, flattened.Airline)).Id; long locationId = (await _factory.Locations.AddAsync(flattened.Location)).Id; diff --git a/src/FlightRecorder.Data/FlightRecorder.Data.csproj b/src/FlightRecorder.Data/FlightRecorder.Data.csproj index 73a7cb5..cbcc013 100644 --- a/src/FlightRecorder.Data/FlightRecorder.Data.csproj +++ b/src/FlightRecorder.Data/FlightRecorder.Data.csproj @@ -1,9 +1,9 @@ - + net7.0 FlightRecorder.Data - 1.0.4.0 + 1.0.5.0 Dave Walker Copyright (c) Dave Walker 2020, 2021, 2022 Dave Walker @@ -16,7 +16,7 @@ https://github.com/davewalker5/FlightRecorderDb MIT false - 1.0.4.0 + 1.0.5.0 diff --git a/src/FlightRecorder.DataExchange/FlightRecorder.DataExchange.csproj b/src/FlightRecorder.DataExchange/FlightRecorder.DataExchange.csproj index 5669305..9ed6bef 100644 --- a/src/FlightRecorder.DataExchange/FlightRecorder.DataExchange.csproj +++ b/src/FlightRecorder.DataExchange/FlightRecorder.DataExchange.csproj @@ -3,7 +3,7 @@ net7.0 FlightRecorder.DataExchange - 1.0.4.0 + 1.0.5.0 Dave Walker Copyright (c) Dave Walker 2020, 2021, 2022 Dave Walker @@ -16,7 +16,7 @@ https://github.com/davewalker5/FlightRecorderDb MIT false - 1.0.4.0 + 1.0.5.0 diff --git a/src/FlightRecorder.Entities/DataExchange/FlattenedSighting.cs b/src/FlightRecorder.Entities/DataExchange/FlattenedSighting.cs index 70694e3..afbe94d 100644 --- a/src/FlightRecorder.Entities/DataExchange/FlattenedSighting.cs +++ b/src/FlightRecorder.Entities/DataExchange/FlattenedSighting.cs @@ -14,7 +14,7 @@ public class FlattenedSighting public string SerialNumber { get; set; } public string Manufacturer { get; set; } public string Model { get; set; } - public long Age { get; set; } + public string Age { get; set; } public string Embarkation { get; set; } public string Destination { get; set; } public long Altitude { get; set; } @@ -39,7 +39,7 @@ public static FlattenedSighting FromCsv(string record) SerialNumber = words[3], Manufacturer = words[4], Model = words[5], - Age = long.Parse(words[6]), + Age = words[6], Embarkation = words[7], Destination = words[8], Altitude = long.Parse(words[9]), diff --git a/src/FlightRecorder.Entities/Db/Aircraft.cs b/src/FlightRecorder.Entities/Db/Aircraft.cs index a1e6a9b..fcf1484 100644 --- a/src/FlightRecorder.Entities/Db/Aircraft.cs +++ b/src/FlightRecorder.Entities/Db/Aircraft.cs @@ -11,7 +11,7 @@ public partial class Aircraft public long ModelId { get; set; } public string Registration { get; set; } public string SerialNumber { get; set; } - public long Manufactured { get; set; } + public long? Manufactured { get; set; } public virtual Model Model { get; set; } } diff --git a/src/FlightRecorder.Entities/Db/JobStatus.cs b/src/FlightRecorder.Entities/Db/JobStatus.cs new file mode 100644 index 0000000..6643a0c --- /dev/null +++ b/src/FlightRecorder.Entities/Db/JobStatus.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FlightRecorder.Entities.Db +{ + internal class JobStatus + { + } +} diff --git a/src/FlightRecorder.Entities/Db/Sighting.cs b/src/FlightRecorder.Entities/Db/Sighting.cs index e737725..0e9e545 100644 --- a/src/FlightRecorder.Entities/Db/Sighting.cs +++ b/src/FlightRecorder.Entities/Db/Sighting.cs @@ -30,7 +30,7 @@ public FlattenedSighting Flatten() SerialNumber = Aircraft.SerialNumber, Manufacturer = Aircraft.Model.Manufacturer.Name, Model = Aircraft.Model.Name, - Age = DateTime.Now.Year - Aircraft.Manufactured, + Age = (Aircraft.Manufactured != null) ? (DateTime.Now.Year - Aircraft.Manufactured).ToString() : "", Embarkation = Flight.Embarkation, Destination = Flight.Destination, Altitude = Altitude, diff --git a/src/FlightRecorder.Entities/FlightRecorder.Entities.csproj b/src/FlightRecorder.Entities/FlightRecorder.Entities.csproj index 919d90a..1813c12 100644 --- a/src/FlightRecorder.Entities/FlightRecorder.Entities.csproj +++ b/src/FlightRecorder.Entities/FlightRecorder.Entities.csproj @@ -3,7 +3,7 @@ net7.0 FlightRecorder.Entities - 1.0.4.0 + 1.0.5.0 Dave Walker Copyright (c) Dave Walker 2020, 2021, 2022 Dave Walker @@ -16,7 +16,7 @@ https://github.com/davewalker5/FlightRecorderDb MIT false - 1.0.4.0 + 1.0.5.0 diff --git a/src/FlightRecorder.Entities/Interfaces/IAircraftManager.cs b/src/FlightRecorder.Entities/Interfaces/IAircraftManager.cs index 6f97da4..b1ea1e3 100644 --- a/src/FlightRecorder.Entities/Interfaces/IAircraftManager.cs +++ b/src/FlightRecorder.Entities/Interfaces/IAircraftManager.cs @@ -8,8 +8,8 @@ namespace FlightRecorder.Entities.Interfaces { public interface IAircraftManager { - Aircraft Add(string registration, string serialNumber, long yearOfManufacture, string modelName, string manufacturerName); - Task AddAsync(string registration, string serialNumber, long yearOfManufacture, string modelName, string manufacturerName); + Aircraft Add(string registration, string serialNumber, long? yearOfManufacture, string modelName, string manufacturerName); + Task AddAsync(string registration, string serialNumber, long? yearOfManufacture, string modelName, string manufacturerName); Aircraft Get(Expression> predicate = null); Task GetAsync(Expression> predicate); IEnumerable List(Expression> predicate, int pageNumber, int pageSize); diff --git a/src/FlightRecorder.Manager/FlightRecorder.Manager.csproj b/src/FlightRecorder.Manager/FlightRecorder.Manager.csproj index 05f21f4..f3ddf72 100644 --- a/src/FlightRecorder.Manager/FlightRecorder.Manager.csproj +++ b/src/FlightRecorder.Manager/FlightRecorder.Manager.csproj @@ -3,7 +3,7 @@ Exe net7.0 - 1.0.4.0 + 1.0.5.0 Release;Debug diff --git a/src/FlightRecorder.Tests/DataExchangeTests.cs b/src/FlightRecorder.Tests/DataExchangeTests.cs index b84f7ef..b1a78a6 100644 --- a/src/FlightRecorder.Tests/DataExchangeTests.cs +++ b/src/FlightRecorder.Tests/DataExchangeTests.cs @@ -24,7 +24,7 @@ public class DataExchangeTests private const string ManufacturerName = "Airbus"; private const string Registration = "G-EZFY"; private const string SerialNumber = "4418"; - private const long Age = 9; + private const string Age = "9"; private const long Altitude = 930; private readonly DateTime SightingDate = new DateTime(2019, 9, 22); @@ -77,7 +77,7 @@ public void AddAndGetTest() Assert.IsNotNull(sighting.Aircraft); Assert.AreEqual(Registration, sighting.Aircraft.Registration); Assert.AreEqual(SerialNumber, sighting.Aircraft.SerialNumber); - Assert.AreEqual(DateTime.Now.Year - Age, sighting.Aircraft.Manufactured); + Assert.AreEqual(DateTime.Now.Year - long.Parse(Age), sighting.Aircraft.Manufactured); Assert.IsNotNull(sighting.Aircraft.Model); Assert.AreEqual(ModelName, sighting.Aircraft.Model.Name); diff --git a/src/FlightRecorder.Tests/FlightRecorder.Tests.csproj b/src/FlightRecorder.Tests/FlightRecorder.Tests.csproj index 6cdc493..7a807de 100644 --- a/src/FlightRecorder.Tests/FlightRecorder.Tests.csproj +++ b/src/FlightRecorder.Tests/FlightRecorder.Tests.csproj @@ -4,7 +4,7 @@ net7.0 false - 1.0.4.0 + 1.0.5.0