From ddfe43d8b12588f4a8005e28c394c3852612200c Mon Sep 17 00:00:00 2001 From: gjemiolo-git Date: Sun, 26 Nov 2023 12:44:04 +0000 Subject: [PATCH 1/3] Update equipment allocation to LogisticOperations --- Data/Database.cs | 2 +- MauiProgram.cs | 4 +- Models/AnEquipment.cs | 38 +++++ Models/Equipment.cs | 20 --- Models/LogisticsOperation.cs | 2 + Services/EquipmentService.cs | 2 +- Services/IEquipmentService.cs | 2 +- UndacApp.csproj | 10 +- Views/EquipmentPage.xaml | 99 +++++++++--- Views/EquipmentPage.xaml.cs | 258 ++++++++++++++++++++++---------- Views/EquipmentPage_Old.xaml | 29 ++++ Views/EquipmentPage_Old.xaml.cs | 106 +++++++++++++ 12 files changed, 445 insertions(+), 127 deletions(-) create mode 100644 Models/AnEquipment.cs delete mode 100644 Models/Equipment.cs create mode 100644 Views/EquipmentPage_Old.xaml create mode 100644 Views/EquipmentPage_Old.xaml.cs diff --git a/Data/Database.cs b/Data/Database.cs index cf287af..3ce842e 100644 --- a/Data/Database.cs +++ b/Data/Database.cs @@ -36,7 +36,7 @@ public async Task CreateTablesAsync() await _database.CreateTableAsync(); await _database.CreateTableAsync(); await _database.CreateTableAsync(); - await _database.CreateTableAsync(); + await _database.CreateTableAsync(); await _database.CreateTableAsync(); await _database.CreateTableAsync(); await _database.CreateTableAsync(); diff --git a/MauiProgram.cs b/MauiProgram.cs index d7d9f2b..20781a2 100644 --- a/MauiProgram.cs +++ b/MauiProgram.cs @@ -34,11 +34,9 @@ public static MauiApp CreateMauiApp() builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - + builder.Services.AddSingleton(); #if DEBUG builder.Logging.AddDebug(); diff --git a/Models/AnEquipment.cs b/Models/AnEquipment.cs new file mode 100644 index 0000000..6663ab9 --- /dev/null +++ b/Models/AnEquipment.cs @@ -0,0 +1,38 @@ +namespace UndacApp.Models +{ + /*! + A model structure for Equipment data + +
Data is stored in SQLite database.
*/ + public class AnEquipment : AModel + { + private string? _type = String.Empty; + public string? Type + { + get => _type; + set => SetField(ref _type, value); + } + + private string? _location = String.Empty; + public string? Location + { + get => _location; + set => SetField(ref _location, value); + } + + private string? _currentOperation = String.Empty; + public string? CurrentOperation + { + get => _currentOperation; + set => SetField(ref _currentOperation, value); + } + + private int _quantity = 0; + public int Quantity + { + get => _quantity; + set => SetField(ref _quantity, value); + } + + } +} \ No newline at end of file diff --git a/Models/Equipment.cs b/Models/Equipment.cs deleted file mode 100644 index 2f3ca38..0000000 --- a/Models/Equipment.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace UndacApp.Models -{ - /*! - A model structure for Equipment data - -
Data is stored in SQLite database.
*/ - public class Equipment : AModel - { - - /*! - A private variable, storing Equipment name - */ - private string _name; - public string Name - { - get => _name; - set => SetField(ref _name, value); - } - } -} \ No newline at end of file diff --git a/Models/LogisticsOperation.cs b/Models/LogisticsOperation.cs index b943ff7..1979ec6 100644 --- a/Models/LogisticsOperation.cs +++ b/Models/LogisticsOperation.cs @@ -1,3 +1,5 @@ +using System.Transactions; + namespace UndacApp.Models { public class LogisticsOperation : AModel diff --git a/Services/EquipmentService.cs b/Services/EquipmentService.cs index 20968b8..e78306e 100644 --- a/Services/EquipmentService.cs +++ b/Services/EquipmentService.cs @@ -5,7 +5,7 @@ namespace UndacApp.Services /*! EquipmentService extending IEQuipmentService Interface */ - public class EquipmentService : AService, IEquipmentService + public class EquipmentService : AService, IEquipmentService { } diff --git a/Services/IEquipmentService.cs b/Services/IEquipmentService.cs index 036da07..39e01e9 100644 --- a/Services/IEquipmentService.cs +++ b/Services/IEquipmentService.cs @@ -5,7 +5,7 @@ namespace UndacApp.Services /*! Interface that exposes methods of EquipmentService */ - public interface IEquipmentService : IService + public interface IEquipmentService : IService { } diff --git a/UndacApp.csproj b/UndacApp.csproj index 45d8fd8..ad76a81 100644 --- a/UndacApp.csproj +++ b/UndacApp.csproj @@ -65,6 +65,9 @@ MSBuild:Compile + + MSBuild:Compile + MSBuild:Compile @@ -141,6 +144,9 @@ + + EquipmentPage.xaml + LogisticOperationPage.xaml @@ -189,8 +195,8 @@ RotaPage.xaml - - EquipmentPage.xaml + + EquipmentPage_Old.xaml %(Filename) diff --git a/Views/EquipmentPage.xaml b/Views/EquipmentPage.xaml index e73ce38..bcfc092 100644 --- a/Views/EquipmentPage.xaml +++ b/Views/EquipmentPage.xaml @@ -1,29 +1,86 @@ - - + Title="AddEquipments"> - -