From 4caeb21b0de8f48d67e8d2b47447593aa884df07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommy=20=C3=96man?= Date: Wed, 3 Sep 2025 23:38:57 +0200 Subject: [PATCH] =?UTF-8?q?Lagt=20till=20nya=20entiteter=20f=C3=B6r=20Game?= =?UTF-8?q?round=20och=20GamePoints=20Migrerat=20och=20byggt=20ut=20databa?= =?UTF-8?q?sen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataClasses/GamePointRepository.cs | 2 +- .../DataClasses/GameRoundRepository.cs | 61 ++++++ GreadyPoang.DataLayer/Database/DataContext.cs | 17 +- ...062957_FixHeatToRoundParameter.Designer.cs | 135 +++++++++++++ .../20250903062957_FixHeatToRoundParameter.cs | 22 +++ ...903070200_FixHeatToRoundParams.Designer.cs | 135 +++++++++++++ .../20250903070200_FixHeatToRoundParams.cs | 38 ++++ ...20250903074537_AddedStatusEnum.Designer.cs | 135 +++++++++++++ .../20250903074537_AddedStatusEnum.cs | 22 +++ ...903195147_AddedTableGameRounds.Designer.cs | 179 ++++++++++++++++++ .../20250903195147_AddedTableGameRounds.cs | 115 +++++++++++ ...35_ChangedUpdateOrderInSeeding.Designer.cs | 179 ++++++++++++++++++ ...50903195935_ChangedUpdateOrderInSeeding.cs | 22 +++ .../Migrations/DataContextModelSnapshot.cs | 80 ++++++-- .../EntityClasses/GamePoint.cs | 43 +++-- .../EntityClasses/GameRound.cs | 57 ++++++ .../Enums/GamePointStatus.cs | 9 + GreadyPoang.Migrations/Program.cs | 5 +- .../ViewModelClasses/ParticipantViewModel.cs | 4 - GreadyPoang/App.xaml.cs | 7 +- GreadyPoang/AppShell.xaml | 4 + GreadyPoang/GreadyPoang.csproj | 3 + GreadyPoang/MauiProgram.cs | 1 - .../Platforms/Windows/Package.appxmanifest | 15 +- GreadyPoang/Resources/Styles/AppStyles.xaml | 2 +- GreadyPoang/Views/ParticipantListView.xaml | 5 +- GreadyPoang/Views/RoundStartingView.xaml | 32 ++++ GreadyPoang/Views/RoundStartingView.xaml.cs | 9 + GreadyPoang/ViewsPartial/HeaderView.xaml | 6 +- 29 files changed, 1288 insertions(+), 56 deletions(-) create mode 100644 GreadyPoang.DataLayer/DataClasses/GameRoundRepository.cs create mode 100644 GreadyPoang.DataLayer/Migrations/20250903062957_FixHeatToRoundParameter.Designer.cs create mode 100644 GreadyPoang.DataLayer/Migrations/20250903062957_FixHeatToRoundParameter.cs create mode 100644 GreadyPoang.DataLayer/Migrations/20250903070200_FixHeatToRoundParams.Designer.cs create mode 100644 GreadyPoang.DataLayer/Migrations/20250903070200_FixHeatToRoundParams.cs create mode 100644 GreadyPoang.DataLayer/Migrations/20250903074537_AddedStatusEnum.Designer.cs create mode 100644 GreadyPoang.DataLayer/Migrations/20250903074537_AddedStatusEnum.cs create mode 100644 GreadyPoang.DataLayer/Migrations/20250903195147_AddedTableGameRounds.Designer.cs create mode 100644 GreadyPoang.DataLayer/Migrations/20250903195147_AddedTableGameRounds.cs create mode 100644 GreadyPoang.DataLayer/Migrations/20250903195935_ChangedUpdateOrderInSeeding.Designer.cs create mode 100644 GreadyPoang.DataLayer/Migrations/20250903195935_ChangedUpdateOrderInSeeding.cs create mode 100644 GreadyPoang.EntityLayer/EntityClasses/GameRound.cs create mode 100644 GreadyPoang.EntityLayer/Enums/GamePointStatus.cs create mode 100644 GreadyPoang/Views/RoundStartingView.xaml create mode 100644 GreadyPoang/Views/RoundStartingView.xaml.cs diff --git a/GreadyPoang.DataLayer/DataClasses/GamePointRepository.cs b/GreadyPoang.DataLayer/DataClasses/GamePointRepository.cs index 574a401..051a5da 100644 --- a/GreadyPoang.DataLayer/DataClasses/GamePointRepository.cs +++ b/GreadyPoang.DataLayer/DataClasses/GamePointRepository.cs @@ -24,7 +24,7 @@ public class GamePointRepository : IRepository public async Task Save(GamePoint entity) { var res = false; - if ((entity.GameHeatRegNr == 0) + if ((entity.GameRoundRegNr == 0) || (entity.GameRegPoints == 0)) { return res; // Validation failed diff --git a/GreadyPoang.DataLayer/DataClasses/GameRoundRepository.cs b/GreadyPoang.DataLayer/DataClasses/GameRoundRepository.cs new file mode 100644 index 0000000..1e54b88 --- /dev/null +++ b/GreadyPoang.DataLayer/DataClasses/GameRoundRepository.cs @@ -0,0 +1,61 @@ +using Common.Library; +using GreadyPoang.DataLayer.Database; +using GreadyPoang.EntityLayer; +using Microsoft.EntityFrameworkCore; + +namespace GreadyPoang.DataLayer; + +public class GameRoundRepository : IRepository +{ + private readonly DataContext _dataContext; + + public GameRoundRepository(DataContext dataContext) + { + _dataContext = dataContext; + } + + public bool Delete(GameRound entity) + { + var res = false; + try + { + _dataContext.GameRounds.Remove(entity); + _dataContext.SaveChanges(); + res = true; + } + catch (Exception ex) + { + System.Diagnostics.Debug.WriteLine($"Error deleting GameRound: {ex.Message}"); + res = false; + } + return res; + } + + public async Task> Get() + { + return await _dataContext.GameRounds.ToListAsync(); + } + + public async Task Get(int id) + { + return await _dataContext.GameRounds.FindAsync(id); + } + + public async Task Save(GameRound entity) + { + var res = false; + if (entity.GameRoundId == 0) + { + _dataContext.GameRounds.Add(entity); + await _dataContext.SaveChangesAsync(); + res = true; + } + else + { + _dataContext.GameRounds.Update(entity); + await _dataContext.SaveChangesAsync(); + res = true; + } + return res; + } +} diff --git a/GreadyPoang.DataLayer/Database/DataContext.cs b/GreadyPoang.DataLayer/Database/DataContext.cs index 9793b4c..63d5843 100644 --- a/GreadyPoang.DataLayer/Database/DataContext.cs +++ b/GreadyPoang.DataLayer/Database/DataContext.cs @@ -12,6 +12,7 @@ public class DataContext : DbContext //public DbSet Users => Set(); public DbSet Participants { get; set; } public DbSet GamePoints { get; set; } + public DbSet GameRounds { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { @@ -21,12 +22,18 @@ public class DataContext : DbContext new Participant { ParticipantId = 2, FirstName = "Jane", LastName = "Black", Email = "jb@gmail.com" }, new Participant { ParticipantId = 3, FirstName = "Mary", LastName = "White", Email = "mw@gmail.com" } ); - modelBuilder.Entity().HasData( - new GamePoint { GamePointId = 1, ParticipantId = 1, GameHeatId = 0, GameDate = new DateTime(2025, 10, 15, 20, 10, 15), GameHeatRegNr = 1, GameRegPoints = 1050 }, - new GamePoint { GamePointId = 2, ParticipantId = 1, GameHeatId = 0, GameDate = new DateTime(2025, 10, 15, 20, 15, 15), GameHeatRegNr = 3, GameRegPoints = 350 }, - new GamePoint { GamePointId = 3, ParticipantId = 3, GameHeatId = 0, GameDate = new DateTime(2025, 10, 15, 20, 12, 15), GameHeatRegNr = 2, GameRegPoints = 1000 }, - new GamePoint { GamePointId = 4, ParticipantId = 3, GameHeatId = 0, GameDate = new DateTime(2025, 10, 15, 20, 20, 15), GameHeatRegNr = 4, GameRegPoints = 400 } + modelBuilder.Entity().HasData( + new GameRound { GameRoundId = 1, GameRoundStartDate = new DateTime(2025, 10, 15, 19, 10, 15), GameRoundFinished = DateTime.MinValue }, + new GameRound { GameRoundId = 2, GameRoundStartDate = new DateTime(2025, 09, 15, 19, 10, 15), GameRoundFinished = DateTime.MinValue }, + new GameRound { GameRoundId = 3, GameRoundStartDate = new DateTime(2025, 09, 20, 19, 10, 15), GameRoundFinished = DateTime.MinValue } ); + modelBuilder.Entity().HasData( + new GamePoint { GamePointId = 1, ParticipantId = 1, GameRoundId = 2, GameDate = new DateTime(2025, 10, 15, 20, 10, 15), GameRoundRegNr = 1, GameRegPoints = 1050, PointStatus = GamePointStatus.New }, + new GamePoint { GamePointId = 2, ParticipantId = 1, GameRoundId = 2, GameDate = new DateTime(2025, 10, 15, 20, 15, 15), GameRoundRegNr = 3, GameRegPoints = 350, PointStatus = GamePointStatus.New }, + new GamePoint { GamePointId = 3, ParticipantId = 3, GameRoundId = 2, GameDate = new DateTime(2025, 10, 15, 20, 12, 15), GameRoundRegNr = 2, GameRegPoints = 1000, PointStatus = GamePointStatus.New }, + new GamePoint { GamePointId = 4, ParticipantId = 3, GameRoundId = 2, GameDate = new DateTime(2025, 10, 15, 20, 20, 15), GameRoundRegNr = 4, GameRegPoints = 400, PointStatus = GamePointStatus.New } + ); + } } diff --git a/GreadyPoang.DataLayer/Migrations/20250903062957_FixHeatToRoundParameter.Designer.cs b/GreadyPoang.DataLayer/Migrations/20250903062957_FixHeatToRoundParameter.Designer.cs new file mode 100644 index 0000000..8092022 --- /dev/null +++ b/GreadyPoang.DataLayer/Migrations/20250903062957_FixHeatToRoundParameter.Designer.cs @@ -0,0 +1,135 @@ +// +using System; +using GreadyPoang.DataLayer.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace GreadyPoang.DataLayer.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20250903062957_FixHeatToRoundParameter")] + partial class FixHeatToRoundParameter + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "9.0.8"); + + modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b => + { + b.Property("GamePointId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GameDate") + .HasColumnType("TEXT"); + + b.Property("GameHeatId") + .HasColumnType("INTEGER"); + + b.Property("GameHeatRegNr") + .HasColumnType("INTEGER"); + + b.Property("GameRegPoints") + .HasColumnType("INTEGER"); + + b.Property("ParticipantId") + .HasColumnType("INTEGER"); + + b.HasKey("GamePointId"); + + b.ToTable("GamePoints"); + + b.HasData( + new + { + GamePointId = 1, + GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified), + GameHeatId = 0, + GameHeatRegNr = 1, + GameRegPoints = 1050, + ParticipantId = 1 + }, + new + { + GamePointId = 2, + GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified), + GameHeatId = 0, + GameHeatRegNr = 3, + GameRegPoints = 350, + ParticipantId = 1 + }, + new + { + GamePointId = 3, + GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified), + GameHeatId = 0, + GameHeatRegNr = 2, + GameRegPoints = 1000, + ParticipantId = 3 + }, + new + { + GamePointId = 4, + GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified), + GameHeatId = 0, + GameHeatRegNr = 4, + GameRegPoints = 400, + ParticipantId = 3 + }); + }); + + modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b => + { + b.Property("ParticipantId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("ParticipantId"); + + b.ToTable("Participants"); + + b.HasData( + new + { + ParticipantId = 1, + Email = "John.Doe@gmail.com", + FirstName = "John", + LastName = "Doe" + }, + new + { + ParticipantId = 2, + Email = "jb@gmail.com", + FirstName = "Jane", + LastName = "Black" + }, + new + { + ParticipantId = 3, + Email = "mw@gmail.com", + FirstName = "Mary", + LastName = "White" + }); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/GreadyPoang.DataLayer/Migrations/20250903062957_FixHeatToRoundParameter.cs b/GreadyPoang.DataLayer/Migrations/20250903062957_FixHeatToRoundParameter.cs new file mode 100644 index 0000000..8f10e1c --- /dev/null +++ b/GreadyPoang.DataLayer/Migrations/20250903062957_FixHeatToRoundParameter.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace GreadyPoang.DataLayer.Migrations +{ + /// + public partial class FixHeatToRoundParameter : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/GreadyPoang.DataLayer/Migrations/20250903070200_FixHeatToRoundParams.Designer.cs b/GreadyPoang.DataLayer/Migrations/20250903070200_FixHeatToRoundParams.Designer.cs new file mode 100644 index 0000000..0ced9ca --- /dev/null +++ b/GreadyPoang.DataLayer/Migrations/20250903070200_FixHeatToRoundParams.Designer.cs @@ -0,0 +1,135 @@ +// +using System; +using GreadyPoang.DataLayer.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace GreadyPoang.DataLayer.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20250903070200_FixHeatToRoundParams")] + partial class FixHeatToRoundParams + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "9.0.8"); + + modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b => + { + b.Property("GamePointId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GameDate") + .HasColumnType("TEXT"); + + b.Property("GameRegPoints") + .HasColumnType("INTEGER"); + + b.Property("GameRoundId") + .HasColumnType("INTEGER"); + + b.Property("GameRoundRegNr") + .HasColumnType("INTEGER"); + + b.Property("ParticipantId") + .HasColumnType("INTEGER"); + + b.HasKey("GamePointId"); + + b.ToTable("GamePoints"); + + b.HasData( + new + { + GamePointId = 1, + GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 1050, + GameRoundId = 0, + GameRoundRegNr = 1, + ParticipantId = 1 + }, + new + { + GamePointId = 2, + GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 350, + GameRoundId = 0, + GameRoundRegNr = 3, + ParticipantId = 1 + }, + new + { + GamePointId = 3, + GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 1000, + GameRoundId = 0, + GameRoundRegNr = 2, + ParticipantId = 3 + }, + new + { + GamePointId = 4, + GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 400, + GameRoundId = 0, + GameRoundRegNr = 4, + ParticipantId = 3 + }); + }); + + modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b => + { + b.Property("ParticipantId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("ParticipantId"); + + b.ToTable("Participants"); + + b.HasData( + new + { + ParticipantId = 1, + Email = "John.Doe@gmail.com", + FirstName = "John", + LastName = "Doe" + }, + new + { + ParticipantId = 2, + Email = "jb@gmail.com", + FirstName = "Jane", + LastName = "Black" + }, + new + { + ParticipantId = 3, + Email = "mw@gmail.com", + FirstName = "Mary", + LastName = "White" + }); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/GreadyPoang.DataLayer/Migrations/20250903070200_FixHeatToRoundParams.cs b/GreadyPoang.DataLayer/Migrations/20250903070200_FixHeatToRoundParams.cs new file mode 100644 index 0000000..b51d2a6 --- /dev/null +++ b/GreadyPoang.DataLayer/Migrations/20250903070200_FixHeatToRoundParams.cs @@ -0,0 +1,38 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace GreadyPoang.DataLayer.Migrations +{ + /// + public partial class FixHeatToRoundParams : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "GameHeatRegNr", + table: "GamePoints", + newName: "GameRoundRegNr"); + + migrationBuilder.RenameColumn( + name: "GameHeatId", + table: "GamePoints", + newName: "GameRoundId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "GameRoundRegNr", + table: "GamePoints", + newName: "GameHeatRegNr"); + + migrationBuilder.RenameColumn( + name: "GameRoundId", + table: "GamePoints", + newName: "GameHeatId"); + } + } +} diff --git a/GreadyPoang.DataLayer/Migrations/20250903074537_AddedStatusEnum.Designer.cs b/GreadyPoang.DataLayer/Migrations/20250903074537_AddedStatusEnum.Designer.cs new file mode 100644 index 0000000..ea5f5eb --- /dev/null +++ b/GreadyPoang.DataLayer/Migrations/20250903074537_AddedStatusEnum.Designer.cs @@ -0,0 +1,135 @@ +// +using System; +using GreadyPoang.DataLayer.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace GreadyPoang.DataLayer.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20250903074537_AddedStatusEnum")] + partial class AddedStatusEnum + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "9.0.8"); + + modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b => + { + b.Property("GamePointId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GameDate") + .HasColumnType("TEXT"); + + b.Property("GameRegPoints") + .HasColumnType("INTEGER"); + + b.Property("GameRoundId") + .HasColumnType("INTEGER"); + + b.Property("GameRoundRegNr") + .HasColumnType("INTEGER"); + + b.Property("ParticipantId") + .HasColumnType("INTEGER"); + + b.HasKey("GamePointId"); + + b.ToTable("GamePoints"); + + b.HasData( + new + { + GamePointId = 1, + GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 1050, + GameRoundId = 0, + GameRoundRegNr = 1, + ParticipantId = 1 + }, + new + { + GamePointId = 2, + GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 350, + GameRoundId = 0, + GameRoundRegNr = 3, + ParticipantId = 1 + }, + new + { + GamePointId = 3, + GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 1000, + GameRoundId = 0, + GameRoundRegNr = 2, + ParticipantId = 3 + }, + new + { + GamePointId = 4, + GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 400, + GameRoundId = 0, + GameRoundRegNr = 4, + ParticipantId = 3 + }); + }); + + modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b => + { + b.Property("ParticipantId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("ParticipantId"); + + b.ToTable("Participants"); + + b.HasData( + new + { + ParticipantId = 1, + Email = "John.Doe@gmail.com", + FirstName = "John", + LastName = "Doe" + }, + new + { + ParticipantId = 2, + Email = "jb@gmail.com", + FirstName = "Jane", + LastName = "Black" + }, + new + { + ParticipantId = 3, + Email = "mw@gmail.com", + FirstName = "Mary", + LastName = "White" + }); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/GreadyPoang.DataLayer/Migrations/20250903074537_AddedStatusEnum.cs b/GreadyPoang.DataLayer/Migrations/20250903074537_AddedStatusEnum.cs new file mode 100644 index 0000000..7a05ec8 --- /dev/null +++ b/GreadyPoang.DataLayer/Migrations/20250903074537_AddedStatusEnum.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace GreadyPoang.DataLayer.Migrations +{ + /// + public partial class AddedStatusEnum : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/GreadyPoang.DataLayer/Migrations/20250903195147_AddedTableGameRounds.Designer.cs b/GreadyPoang.DataLayer/Migrations/20250903195147_AddedTableGameRounds.Designer.cs new file mode 100644 index 0000000..db2a9d7 --- /dev/null +++ b/GreadyPoang.DataLayer/Migrations/20250903195147_AddedTableGameRounds.Designer.cs @@ -0,0 +1,179 @@ +// +using System; +using GreadyPoang.DataLayer.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace GreadyPoang.DataLayer.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20250903195147_AddedTableGameRounds")] + partial class AddedTableGameRounds + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "9.0.8"); + + modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b => + { + b.Property("GamePointId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GameDate") + .HasColumnType("TEXT"); + + b.Property("GameRegPoints") + .HasColumnType("INTEGER"); + + b.Property("GameRoundId") + .HasColumnType("INTEGER"); + + b.Property("GameRoundRegNr") + .HasColumnType("INTEGER"); + + b.Property("ParticipantId") + .HasColumnType("INTEGER"); + + b.Property("PointStatus") + .HasColumnType("INTEGER"); + + b.HasKey("GamePointId"); + + b.ToTable("GamePoints"); + + b.HasData( + new + { + GamePointId = 1, + GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 1050, + GameRoundId = 2, + GameRoundRegNr = 1, + ParticipantId = 1, + PointStatus = 0 + }, + new + { + GamePointId = 2, + GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 350, + GameRoundId = 2, + GameRoundRegNr = 3, + ParticipantId = 1, + PointStatus = 0 + }, + new + { + GamePointId = 3, + GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 1000, + GameRoundId = 2, + GameRoundRegNr = 2, + ParticipantId = 3, + PointStatus = 0 + }, + new + { + GamePointId = 4, + GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 400, + GameRoundId = 2, + GameRoundRegNr = 4, + ParticipantId = 3, + PointStatus = 0 + }); + }); + + modelBuilder.Entity("GreadyPoang.EntityLayer.GameRound", b => + { + b.Property("GameRoundId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GameRoundFinished") + .HasColumnType("TEXT"); + + b.Property("GameRoundStartDate") + .HasColumnType("TEXT"); + + b.HasKey("GameRoundId"); + + b.ToTable("GameRounds"); + + b.HasData( + new + { + GameRoundId = 1, + GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + GameRoundStartDate = new DateTime(2025, 10, 15, 19, 10, 15, 0, DateTimeKind.Unspecified) + }, + new + { + GameRoundId = 2, + GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + GameRoundStartDate = new DateTime(2025, 9, 15, 19, 10, 15, 0, DateTimeKind.Unspecified) + }, + new + { + GameRoundId = 3, + GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + GameRoundStartDate = new DateTime(2025, 9, 20, 19, 10, 15, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b => + { + b.Property("ParticipantId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("ParticipantId"); + + b.ToTable("Participants"); + + b.HasData( + new + { + ParticipantId = 1, + Email = "John.Doe@gmail.com", + FirstName = "John", + LastName = "Doe" + }, + new + { + ParticipantId = 2, + Email = "jb@gmail.com", + FirstName = "Jane", + LastName = "Black" + }, + new + { + ParticipantId = 3, + Email = "mw@gmail.com", + FirstName = "Mary", + LastName = "White" + }); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/GreadyPoang.DataLayer/Migrations/20250903195147_AddedTableGameRounds.cs b/GreadyPoang.DataLayer/Migrations/20250903195147_AddedTableGameRounds.cs new file mode 100644 index 0000000..d01a536 --- /dev/null +++ b/GreadyPoang.DataLayer/Migrations/20250903195147_AddedTableGameRounds.cs @@ -0,0 +1,115 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace GreadyPoang.DataLayer.Migrations +{ + /// + public partial class AddedTableGameRounds : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "PointStatus", + table: "GamePoints", + type: "INTEGER", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateTable( + name: "GameRounds", + columns: table => new + { + GameRoundId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + GameRoundFinished = table.Column(type: "TEXT", nullable: true), + GameRoundStartDate = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GameRounds", x => x.GameRoundId); + }); + + migrationBuilder.UpdateData( + table: "GamePoints", + keyColumn: "GamePointId", + keyValue: 1, + columns: new[] { "GameRoundId", "PointStatus" }, + values: new object[] { 2, 0 }); + + migrationBuilder.UpdateData( + table: "GamePoints", + keyColumn: "GamePointId", + keyValue: 2, + columns: new[] { "GameRoundId", "PointStatus" }, + values: new object[] { 2, 0 }); + + migrationBuilder.UpdateData( + table: "GamePoints", + keyColumn: "GamePointId", + keyValue: 3, + columns: new[] { "GameRoundId", "PointStatus" }, + values: new object[] { 2, 0 }); + + migrationBuilder.UpdateData( + table: "GamePoints", + keyColumn: "GamePointId", + keyValue: 4, + columns: new[] { "GameRoundId", "PointStatus" }, + values: new object[] { 2, 0 }); + + migrationBuilder.InsertData( + table: "GameRounds", + columns: new[] { "GameRoundId", "GameRoundFinished", "GameRoundStartDate" }, + values: new object[,] + { + { 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2025, 10, 15, 19, 10, 15, 0, DateTimeKind.Unspecified) }, + { 2, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2025, 9, 15, 19, 10, 15, 0, DateTimeKind.Unspecified) }, + { 3, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2025, 9, 20, 19, 10, 15, 0, DateTimeKind.Unspecified) } + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "GameRounds"); + + migrationBuilder.DropColumn( + name: "PointStatus", + table: "GamePoints"); + + migrationBuilder.UpdateData( + table: "GamePoints", + keyColumn: "GamePointId", + keyValue: 1, + column: "GameRoundId", + value: 0); + + migrationBuilder.UpdateData( + table: "GamePoints", + keyColumn: "GamePointId", + keyValue: 2, + column: "GameRoundId", + value: 0); + + migrationBuilder.UpdateData( + table: "GamePoints", + keyColumn: "GamePointId", + keyValue: 3, + column: "GameRoundId", + value: 0); + + migrationBuilder.UpdateData( + table: "GamePoints", + keyColumn: "GamePointId", + keyValue: 4, + column: "GameRoundId", + value: 0); + } + } +} diff --git a/GreadyPoang.DataLayer/Migrations/20250903195935_ChangedUpdateOrderInSeeding.Designer.cs b/GreadyPoang.DataLayer/Migrations/20250903195935_ChangedUpdateOrderInSeeding.Designer.cs new file mode 100644 index 0000000..13e9a6c --- /dev/null +++ b/GreadyPoang.DataLayer/Migrations/20250903195935_ChangedUpdateOrderInSeeding.Designer.cs @@ -0,0 +1,179 @@ +// +using System; +using GreadyPoang.DataLayer.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace GreadyPoang.DataLayer.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20250903195935_ChangedUpdateOrderInSeeding")] + partial class ChangedUpdateOrderInSeeding + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "9.0.8"); + + modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b => + { + b.Property("GamePointId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GameDate") + .HasColumnType("TEXT"); + + b.Property("GameRegPoints") + .HasColumnType("INTEGER"); + + b.Property("GameRoundId") + .HasColumnType("INTEGER"); + + b.Property("GameRoundRegNr") + .HasColumnType("INTEGER"); + + b.Property("ParticipantId") + .HasColumnType("INTEGER"); + + b.Property("PointStatus") + .HasColumnType("INTEGER"); + + b.HasKey("GamePointId"); + + b.ToTable("GamePoints"); + + b.HasData( + new + { + GamePointId = 1, + GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 1050, + GameRoundId = 2, + GameRoundRegNr = 1, + ParticipantId = 1, + PointStatus = 0 + }, + new + { + GamePointId = 2, + GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 350, + GameRoundId = 2, + GameRoundRegNr = 3, + ParticipantId = 1, + PointStatus = 0 + }, + new + { + GamePointId = 3, + GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 1000, + GameRoundId = 2, + GameRoundRegNr = 2, + ParticipantId = 3, + PointStatus = 0 + }, + new + { + GamePointId = 4, + GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified), + GameRegPoints = 400, + GameRoundId = 2, + GameRoundRegNr = 4, + ParticipantId = 3, + PointStatus = 0 + }); + }); + + modelBuilder.Entity("GreadyPoang.EntityLayer.GameRound", b => + { + b.Property("GameRoundId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GameRoundFinished") + .HasColumnType("TEXT"); + + b.Property("GameRoundStartDate") + .HasColumnType("TEXT"); + + b.HasKey("GameRoundId"); + + b.ToTable("GameRounds"); + + b.HasData( + new + { + GameRoundId = 1, + GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + GameRoundStartDate = new DateTime(2025, 10, 15, 19, 10, 15, 0, DateTimeKind.Unspecified) + }, + new + { + GameRoundId = 2, + GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + GameRoundStartDate = new DateTime(2025, 9, 15, 19, 10, 15, 0, DateTimeKind.Unspecified) + }, + new + { + GameRoundId = 3, + GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + GameRoundStartDate = new DateTime(2025, 9, 20, 19, 10, 15, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b => + { + b.Property("ParticipantId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("ParticipantId"); + + b.ToTable("Participants"); + + b.HasData( + new + { + ParticipantId = 1, + Email = "John.Doe@gmail.com", + FirstName = "John", + LastName = "Doe" + }, + new + { + ParticipantId = 2, + Email = "jb@gmail.com", + FirstName = "Jane", + LastName = "Black" + }, + new + { + ParticipantId = 3, + Email = "mw@gmail.com", + FirstName = "Mary", + LastName = "White" + }); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/GreadyPoang.DataLayer/Migrations/20250903195935_ChangedUpdateOrderInSeeding.cs b/GreadyPoang.DataLayer/Migrations/20250903195935_ChangedUpdateOrderInSeeding.cs new file mode 100644 index 0000000..840f094 --- /dev/null +++ b/GreadyPoang.DataLayer/Migrations/20250903195935_ChangedUpdateOrderInSeeding.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace GreadyPoang.DataLayer.Migrations +{ + /// + public partial class ChangedUpdateOrderInSeeding : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/GreadyPoang.DataLayer/Migrations/DataContextModelSnapshot.cs b/GreadyPoang.DataLayer/Migrations/DataContextModelSnapshot.cs index 7474492..a0e2054 100644 --- a/GreadyPoang.DataLayer/Migrations/DataContextModelSnapshot.cs +++ b/GreadyPoang.DataLayer/Migrations/DataContextModelSnapshot.cs @@ -26,18 +26,21 @@ namespace GreadyPoang.DataLayer.Migrations b.Property("GameDate") .HasColumnType("TEXT"); - b.Property("GameHeatId") - .HasColumnType("INTEGER"); - - b.Property("GameHeatRegNr") - .HasColumnType("INTEGER"); - b.Property("GameRegPoints") .HasColumnType("INTEGER"); + b.Property("GameRoundId") + .HasColumnType("INTEGER"); + + b.Property("GameRoundRegNr") + .HasColumnType("INTEGER"); + b.Property("ParticipantId") .HasColumnType("INTEGER"); + b.Property("PointStatus") + .HasColumnType("INTEGER"); + b.HasKey("GamePointId"); b.ToTable("GamePoints"); @@ -47,37 +50,78 @@ namespace GreadyPoang.DataLayer.Migrations { GamePointId = 1, GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified), - GameHeatId = 0, - GameHeatRegNr = 1, GameRegPoints = 1050, - ParticipantId = 1 + GameRoundId = 2, + GameRoundRegNr = 1, + ParticipantId = 1, + PointStatus = 0 }, new { GamePointId = 2, GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified), - GameHeatId = 0, - GameHeatRegNr = 3, GameRegPoints = 350, - ParticipantId = 1 + GameRoundId = 2, + GameRoundRegNr = 3, + ParticipantId = 1, + PointStatus = 0 }, new { GamePointId = 3, GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified), - GameHeatId = 0, - GameHeatRegNr = 2, GameRegPoints = 1000, - ParticipantId = 3 + GameRoundId = 2, + GameRoundRegNr = 2, + ParticipantId = 3, + PointStatus = 0 }, new { GamePointId = 4, GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified), - GameHeatId = 0, - GameHeatRegNr = 4, GameRegPoints = 400, - ParticipantId = 3 + GameRoundId = 2, + GameRoundRegNr = 4, + ParticipantId = 3, + PointStatus = 0 + }); + }); + + modelBuilder.Entity("GreadyPoang.EntityLayer.GameRound", b => + { + b.Property("GameRoundId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GameRoundFinished") + .HasColumnType("TEXT"); + + b.Property("GameRoundStartDate") + .HasColumnType("TEXT"); + + b.HasKey("GameRoundId"); + + b.ToTable("GameRounds"); + + b.HasData( + new + { + GameRoundId = 1, + GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + GameRoundStartDate = new DateTime(2025, 10, 15, 19, 10, 15, 0, DateTimeKind.Unspecified) + }, + new + { + GameRoundId = 2, + GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + GameRoundStartDate = new DateTime(2025, 9, 15, 19, 10, 15, 0, DateTimeKind.Unspecified) + }, + new + { + GameRoundId = 3, + GameRoundFinished = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + GameRoundStartDate = new DateTime(2025, 9, 20, 19, 10, 15, 0, DateTimeKind.Unspecified) }); }); diff --git a/GreadyPoang.EntityLayer/EntityClasses/GamePoint.cs b/GreadyPoang.EntityLayer/EntityClasses/GamePoint.cs index 877da13..9fb1653 100644 --- a/GreadyPoang.EntityLayer/EntityClasses/GamePoint.cs +++ b/GreadyPoang.EntityLayer/EntityClasses/GamePoint.cs @@ -9,18 +9,20 @@ public class GamePoint : EntityBase { _gamePointId = 0; _participantId = 0; - _gameHeatId = 0; + _gameRoundId = 0; _gameDate = DateTime.Now; - _gameHeatRegNr = 0; + _gameRoundRegNr = 0; _gameRegPoints = 0; + _pointStatus = GamePointStatus.New; } private int _gamePointId; private int _participantId; - private int _gameHeatId; + private int _gameRoundId; private DateTime _gameDate; - private int _gameHeatRegNr; + private int _gameRoundRegNr; private int _gameRegPoints; + private GamePointStatus _pointStatus; [PrimaryKey] [AutoIncrement] @@ -45,14 +47,14 @@ public class GamePoint : EntityBase RaisePropertyChanged(nameof(ParticipantId)); } } - [Column("GameHeatId")] - public int GameHeatId + [Column("GameRoundId")] + public int GameRoundId { - get { return _gameHeatId; } + get { return _gameRoundId; } set { - _gameHeatId = value; - RaisePropertyChanged(nameof(GameHeatId)); + _gameRoundId = value; + RaisePropertyChanged(nameof(GameRoundId)); } } @@ -67,14 +69,14 @@ public class GamePoint : EntityBase } } - [Column("GameHeatRegNr")] - public int GameHeatRegNr + [Column("GameRoundRegNr")] + public int GameRoundRegNr { - get { return _gameHeatRegNr; } + get { return _gameRoundRegNr; } set { - _gameHeatRegNr = value; - RaisePropertyChanged(nameof(GameHeatRegNr)); + _gameRoundRegNr = value; + RaisePropertyChanged(nameof(GameRoundRegNr)); } } @@ -88,4 +90,17 @@ public class GamePoint : EntityBase RaisePropertyChanged(nameof(GameRegPoints)); } } + + [Column("PointStatus")] + public GamePointStatus PointStatus + { + get { return _pointStatus; } + set + { + _pointStatus = value; + RaisePropertyChanged(nameof(PointStatus)); + } + } + + } diff --git a/GreadyPoang.EntityLayer/EntityClasses/GameRound.cs b/GreadyPoang.EntityLayer/EntityClasses/GameRound.cs new file mode 100644 index 0000000..88d3058 --- /dev/null +++ b/GreadyPoang.EntityLayer/EntityClasses/GameRound.cs @@ -0,0 +1,57 @@ +using Common.Library; +using SQLite; + +namespace GreadyPoang.EntityLayer; + + +[Table("GameRound")] + +public class GameRound : EntityBase +{ + public GameRound() + { + _gameRoundId = 0; + _gameRoundStartDate = DateTime.Now; + _gameRoundFinished = null; + } + + private int _gameRoundId; + private DateTime _gameRoundStartDate; + private DateTime? _gameRoundFinished; + + [Column("GameRoundFinished")] + public DateTime? GameRoundFinished + { + get { return _gameRoundFinished; } + set + { + _gameRoundFinished = value; + RaisePropertyChanged(nameof(GameRoundFinished)); + } + } + + [Column("GameRoundStartDate")] + public DateTime GameRoundStartDate + { + get { return _gameRoundStartDate; } + set + { + _gameRoundStartDate = value; + RaisePropertyChanged(nameof(GameRoundStartDate)); + } + } + + [PrimaryKey] + [AutoIncrement] + [Column("GameRoundId")] + public int GameRoundId + { + get { return _gameRoundId; } + set + { + _gameRoundId = value; + RaisePropertyChanged(nameof(GameRoundId)); + } + } + +} diff --git a/GreadyPoang.EntityLayer/Enums/GamePointStatus.cs b/GreadyPoang.EntityLayer/Enums/GamePointStatus.cs new file mode 100644 index 0000000..8b2f684 --- /dev/null +++ b/GreadyPoang.EntityLayer/Enums/GamePointStatus.cs @@ -0,0 +1,9 @@ +namespace GreadyPoang.EntityLayer; + +public enum GamePointStatus +{ + New = 0, + InProgress = 1, + Completed = 2, + Cancelled = 3 +} diff --git a/GreadyPoang.Migrations/Program.cs b/GreadyPoang.Migrations/Program.cs index 5f83079..d82150b 100644 --- a/GreadyPoang.Migrations/Program.cs +++ b/GreadyPoang.Migrations/Program.cs @@ -27,4 +27,7 @@ class Program services.AddDbContext(options => options.UseSqlite($"Data Source={dbPath}")); }); -} \ No newline at end of file +} + +// dotnet ef migrations add FixHeatToRoundParams --project GreadyPoang.DataLayer --startup-project GreadyPoang.Migrations +// dotnet ef database update --project GreadyPoang.DataLayer --startup-project GreadyPoang.Migrations \ No newline at end of file diff --git a/GreadyPoang.ViewModelLayer/ViewModelClasses/ParticipantViewModel.cs b/GreadyPoang.ViewModelLayer/ViewModelClasses/ParticipantViewModel.cs index 62363d1..637f8be 100644 --- a/GreadyPoang.ViewModelLayer/ViewModelClasses/ParticipantViewModel.cs +++ b/GreadyPoang.ViewModelLayer/ViewModelClasses/ParticipantViewModel.cs @@ -18,10 +18,6 @@ public class ParticipantViewModel : ViewModelBase Repository = repo; } - //public ParticipantViewModel(IRepository repo) : base() - //{ - // Repository = repo; - //} #endregion #region Private Variables diff --git a/GreadyPoang/App.xaml.cs b/GreadyPoang/App.xaml.cs index 45aa98f..bd8dfde 100644 --- a/GreadyPoang/App.xaml.cs +++ b/GreadyPoang/App.xaml.cs @@ -1,10 +1,13 @@ -namespace GreadyPoang +using GreadyPoang.DataLayer.Database; + +namespace GreadyPoang { public partial class App : Application { - public App() + public App(DataContext dataContext) { InitializeComponent(); + dataContext.Database.EnsureCreated(); } protected override Window CreateWindow(IActivationState? activationState) diff --git a/GreadyPoang/AppShell.xaml b/GreadyPoang/AppShell.xaml index a3bc75c..4d223a3 100644 --- a/GreadyPoang/AppShell.xaml +++ b/GreadyPoang/AppShell.xaml @@ -17,6 +17,10 @@ Title="Deltagare" ContentTemplate="{DataTemplate views:ParticipantListView}" Route="ParticipantListView" /> + diff --git a/GreadyPoang/GreadyPoang.csproj b/GreadyPoang/GreadyPoang.csproj index b261f6d..3839bbb 100644 --- a/GreadyPoang/GreadyPoang.csproj +++ b/GreadyPoang/GreadyPoang.csproj @@ -88,6 +88,9 @@ MSBuild:Compile + + MSBuild:Compile + diff --git a/GreadyPoang/MauiProgram.cs b/GreadyPoang/MauiProgram.cs index 6b13bdb..fe35987 100644 --- a/GreadyPoang/MauiProgram.cs +++ b/GreadyPoang/MauiProgram.cs @@ -29,7 +29,6 @@ public static class MauiProgram { File.WriteAllText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "MauiDataPath_GreadyPoang.txt"), MauiDataPath); } - //var dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "PoangDB.db"); var dbPath = Path.Combine(MauiDataPath, "PoangDB.db"); options.UseSqlite($"Data Source={dbPath}"); }); diff --git a/GreadyPoang/Platforms/Windows/Package.appxmanifest b/GreadyPoang/Platforms/Windows/Package.appxmanifest index d52e865..b99e85f 100644 --- a/GreadyPoang/Platforms/Windows/Package.appxmanifest +++ b/GreadyPoang/Platforms/Windows/Package.appxmanifest @@ -6,15 +6,22 @@ xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" IgnorableNamespaces="uap rescap"> - + - + + GreadyPoang + Idoit4u + - + + + diff --git a/GreadyPoang/Resources/Styles/AppStyles.xaml b/GreadyPoang/Resources/Styles/AppStyles.xaml index f44d9a7..ed314da 100644 --- a/GreadyPoang/Resources/Styles/AppStyles.xaml +++ b/GreadyPoang/Resources/Styles/AppStyles.xaml @@ -21,7 +21,7 @@