From 4a47b178f45f3465f5e734f95d081da4734add09 Mon Sep 17 00:00:00 2001 From: Natlinux <97396587+Natlinux81@users.noreply.github.com> Date: Sun, 13 Nov 2022 19:54:03 +0100 Subject: [PATCH] CleanUp --- Apollon.Domain/Models/NameList.cs | 14 +- Apollon.Domain/Models/Tournament.cs | 4 +- .../Commands/CreateTournamentCommand.cs | 1 + .../Commands/UpdateTournamentCommand.cs | 1 + Apollon.EntityFramework/DTOs/NameListDto.cs | 1 + Apollon.EntityFramework/DTOs/TournamentDto.cs | 1 + .../20221113173340_Targets.Designer.cs | 118 +++++++++++++++++ .../Migrations/20221113173340_Targets.cs | 54 ++++++++ .../20221113173650_Target.Designer.cs | 121 +++++++++++++++++ .../Migrations/20221113173650_Target.cs | 26 ++++ .../Migrations/20221113174443_T.Designer.cs | 121 +++++++++++++++++ .../Migrations/20221113174443_T.cs | 19 +++ .../20221113175434_quali.Designer.cs | 124 ++++++++++++++++++ .../Migrations/20221113175434_quali.cs | 26 ++++ .../TournamentsDbContextModelSnapshot.cs | 57 ++++++++ .../Queries/GetAllNamesQuery.cs | 3 +- .../Queries/GetAllTournamentsQuery.cs | 3 +- Apollon.WPF/Commands/AddTournamentCommand.cs | 3 +- Apollon.WPF/Commands/EditTournamentCommand.cs | 3 +- .../ViewModels/AddEditDetailsViewModel.cs | 14 ++ .../ViewModels/EditTournamentViewModel.cs | 1 + Apollon.WPF/ViewModels/NameListViewModel.cs | 14 ++ ...cs => NavBarTournamentDetailsViewModel.cs} | 2 +- .../ViewModels/OverviewDetailsViewModel.cs | 6 +- .../ViewModels/TournamentDetailsViewModel.cs | 1 + .../Views/Components/AddEditDetails.xaml | 19 ++- ....xaml => NavBarTournamentDetailsView.xaml} | 0 ...cs => NavBarTournamentDetailsView.xaml.cs} | 0 .../Views/Components/OverviewDetails.xaml | 92 +++++++++++-- Apollon.WPF/Views/NameListView.xaml | 3 +- 30 files changed, 827 insertions(+), 25 deletions(-) create mode 100644 Apollon.EntityFramework/Migrations/20221113173340_Targets.Designer.cs create mode 100644 Apollon.EntityFramework/Migrations/20221113173340_Targets.cs create mode 100644 Apollon.EntityFramework/Migrations/20221113173650_Target.Designer.cs create mode 100644 Apollon.EntityFramework/Migrations/20221113173650_Target.cs create mode 100644 Apollon.EntityFramework/Migrations/20221113174443_T.Designer.cs create mode 100644 Apollon.EntityFramework/Migrations/20221113174443_T.cs create mode 100644 Apollon.EntityFramework/Migrations/20221113175434_quali.Designer.cs create mode 100644 Apollon.EntityFramework/Migrations/20221113175434_quali.cs rename Apollon.WPF/ViewModels/{NavigationBarViewModel.cs => NavBarTournamentDetailsViewModel.cs} (81%) rename Apollon.WPF/Views/Components/{NavBarView.xaml => NavBarTournamentDetailsView.xaml} (100%) rename Apollon.WPF/Views/Components/{NavBarView.xaml.cs => NavBarTournamentDetailsView.xaml.cs} (100%) diff --git a/Apollon.Domain/Models/NameList.cs b/Apollon.Domain/Models/NameList.cs index aaacbc3..8219c53 100644 --- a/Apollon.Domain/Models/NameList.cs +++ b/Apollon.Domain/Models/NameList.cs @@ -8,7 +8,7 @@ namespace Apollon.Domain.Models { public class NameList { - public NameList(Guid id,string firstName, string lastName, int passNumber, string society, int societyNumber, string birthday, string country) + public NameList(Guid id, string firstName, string lastName, int passNumber, string society, int societyNumber, string birthday, string country, int qualification) { Id = id; FirstName = firstName; @@ -18,15 +18,17 @@ namespace Apollon.Domain.Models SocietyNumber = societyNumber; Birthday = birthday; Country = country; + Qualification = qualification; } public Guid Id { get; } public string FirstName { get; } public string LastName { get; } public int PassNumber { get; } - public string Society { get; } - public int SocietyNumber { get; } - public string Birthday { get; } - public string Country { get; } - } + public string Society { get; } + public int SocietyNumber { get; } + public string Birthday { get; } + public string Country { get; } + public int Qualification { get; } + } } diff --git a/Apollon.Domain/Models/Tournament.cs b/Apollon.Domain/Models/Tournament.cs index b78c5f1..847c982 100644 --- a/Apollon.Domain/Models/Tournament.cs +++ b/Apollon.Domain/Models/Tournament.cs @@ -8,7 +8,7 @@ namespace Apollon.Domain.Models { public class Tournament { - public Tournament(Guid id, string logo, string organisation, string tournamentName, string competition, string competitionImage, DateTime startDate, DateTime endDate, string location, int rounds) + public Tournament(Guid id, string logo, string organisation, string tournamentName, string competition, string competitionImage, DateTime startDate, DateTime endDate, string location, int rounds, int targets) { Id = id; Logo = logo; @@ -20,6 +20,7 @@ namespace Apollon.Domain.Models EndDate = endDate; Location = location; Rounds = rounds; + Targets = targets; } public Guid Id { get; } @@ -32,6 +33,7 @@ namespace Apollon.Domain.Models public DateTime EndDate { get; } public string Location { get; } public int Rounds { get; } + public int Targets { get; } } } diff --git a/Apollon.EntityFramework/Commands/CreateTournamentCommand.cs b/Apollon.EntityFramework/Commands/CreateTournamentCommand.cs index 6ff9c28..5ddc074 100644 --- a/Apollon.EntityFramework/Commands/CreateTournamentCommand.cs +++ b/Apollon.EntityFramework/Commands/CreateTournamentCommand.cs @@ -35,6 +35,7 @@ namespace Apollon.EntityFramework.Commands EndDate = tournament.EndDate, Location = tournament.Location, Rounds = tournament.Rounds, + Targets = tournament.Targets, }; context.Tournaments.Add(tournamentDto); diff --git a/Apollon.EntityFramework/Commands/UpdateTournamentCommand.cs b/Apollon.EntityFramework/Commands/UpdateTournamentCommand.cs index cf88789..98926d7 100644 --- a/Apollon.EntityFramework/Commands/UpdateTournamentCommand.cs +++ b/Apollon.EntityFramework/Commands/UpdateTournamentCommand.cs @@ -34,6 +34,7 @@ namespace Apollon.EntityFramework.Commands EndDate = tournament.EndDate, Location = tournament.Location, Rounds = tournament.Rounds, + Targets = tournament.Targets, }; context.Tournaments.Update(tournamentDto); diff --git a/Apollon.EntityFramework/DTOs/NameListDto.cs b/Apollon.EntityFramework/DTOs/NameListDto.cs index 986197e..e0072c7 100644 --- a/Apollon.EntityFramework/DTOs/NameListDto.cs +++ b/Apollon.EntityFramework/DTOs/NameListDto.cs @@ -16,5 +16,6 @@ namespace Apollon.EntityFramework.DTOs public int SocietyNumber { get; set; } public string Birthday { get; set; } public string Country { get; set; } + public int Qualification { get; set; } } } diff --git a/Apollon.EntityFramework/DTOs/TournamentDto.cs b/Apollon.EntityFramework/DTOs/TournamentDto.cs index fd4d40a..308cc5e 100644 --- a/Apollon.EntityFramework/DTOs/TournamentDto.cs +++ b/Apollon.EntityFramework/DTOs/TournamentDto.cs @@ -18,5 +18,6 @@ namespace Apollon.EntityFramework.DTOs public DateTime EndDate { get; set; } public string Location { get; set; } public int Rounds { get; set; } + public int Targets { get; set; } } } diff --git a/Apollon.EntityFramework/Migrations/20221113173340_Targets.Designer.cs b/Apollon.EntityFramework/Migrations/20221113173340_Targets.Designer.cs new file mode 100644 index 0000000..d58981d --- /dev/null +++ b/Apollon.EntityFramework/Migrations/20221113173340_Targets.Designer.cs @@ -0,0 +1,118 @@ +// +using System; +using Apollon.EntityFramework; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Apollon.EntityFramework.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20221113173340_Targets")] + partial class Targets + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.CompetitionDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("CompetitionImage") + .HasColumnType("nvarchar(max)"); + + b.Property("CompetitionName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Competition"); + }); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.NameListDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Birthday") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("nvarchar(max)"); + + b.Property("FirstName") + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.Property("PassNumber") + .HasColumnType("int"); + + b.Property("Society") + .HasColumnType("nvarchar(max)"); + + b.Property("SocietyNumber") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("NameList"); + }); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.TournamentDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Competition") + .HasColumnType("nvarchar(max)"); + + b.Property("CompetitionImage") + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("Location") + .HasColumnType("nvarchar(max)"); + + b.Property("Logo") + .HasColumnType("nvarchar(max)"); + + b.Property("Organisation") + .HasColumnType("nvarchar(max)"); + + b.Property("Rounds") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("TournamentName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Tournaments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Apollon.EntityFramework/Migrations/20221113173340_Targets.cs b/Apollon.EntityFramework/Migrations/20221113173340_Targets.cs new file mode 100644 index 0000000..f82faec --- /dev/null +++ b/Apollon.EntityFramework/Migrations/20221113173340_Targets.cs @@ -0,0 +1,54 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Apollon.EntityFramework.Migrations +{ + public partial class Targets : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Competition", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CompetitionName = table.Column(type: "nvarchar(max)", nullable: true), + CompetitionImage = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Competition", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "NameList", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + FirstName = table.Column(type: "nvarchar(max)", nullable: true), + LastName = table.Column(type: "nvarchar(max)", nullable: true), + PassNumber = table.Column(type: "int", nullable: false), + Society = table.Column(type: "nvarchar(max)", nullable: true), + SocietyNumber = table.Column(type: "int", nullable: false), + Birthday = table.Column(type: "nvarchar(max)", nullable: true), + Country = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_NameList", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Competition"); + + migrationBuilder.DropTable( + name: "NameList"); + } + } +} diff --git a/Apollon.EntityFramework/Migrations/20221113173650_Target.Designer.cs b/Apollon.EntityFramework/Migrations/20221113173650_Target.Designer.cs new file mode 100644 index 0000000..7864f21 --- /dev/null +++ b/Apollon.EntityFramework/Migrations/20221113173650_Target.Designer.cs @@ -0,0 +1,121 @@ +// +using System; +using Apollon.EntityFramework; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Apollon.EntityFramework.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20221113173650_Target")] + partial class Target + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.CompetitionDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("CompetitionImage") + .HasColumnType("nvarchar(max)"); + + b.Property("CompetitionName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Competition"); + }); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.NameListDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Birthday") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("nvarchar(max)"); + + b.Property("FirstName") + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.Property("PassNumber") + .HasColumnType("int"); + + b.Property("Society") + .HasColumnType("nvarchar(max)"); + + b.Property("SocietyNumber") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("NameList"); + }); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.TournamentDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Competition") + .HasColumnType("nvarchar(max)"); + + b.Property("CompetitionImage") + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("Location") + .HasColumnType("nvarchar(max)"); + + b.Property("Logo") + .HasColumnType("nvarchar(max)"); + + b.Property("Organisation") + .HasColumnType("nvarchar(max)"); + + b.Property("Rounds") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("Targets") + .HasColumnType("int"); + + b.Property("TournamentName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Tournaments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Apollon.EntityFramework/Migrations/20221113173650_Target.cs b/Apollon.EntityFramework/Migrations/20221113173650_Target.cs new file mode 100644 index 0000000..c0ecc4d --- /dev/null +++ b/Apollon.EntityFramework/Migrations/20221113173650_Target.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Apollon.EntityFramework.Migrations +{ + public partial class Target : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Targets", + table: "Tournaments", + type: "int", + nullable: false, + defaultValue: 0); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Targets", + table: "Tournaments"); + } + } +} diff --git a/Apollon.EntityFramework/Migrations/20221113174443_T.Designer.cs b/Apollon.EntityFramework/Migrations/20221113174443_T.Designer.cs new file mode 100644 index 0000000..4af790c --- /dev/null +++ b/Apollon.EntityFramework/Migrations/20221113174443_T.Designer.cs @@ -0,0 +1,121 @@ +// +using System; +using Apollon.EntityFramework; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Apollon.EntityFramework.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20221113174443_T")] + partial class T + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.CompetitionDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("CompetitionImage") + .HasColumnType("nvarchar(max)"); + + b.Property("CompetitionName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Competition"); + }); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.NameListDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Birthday") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("nvarchar(max)"); + + b.Property("FirstName") + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.Property("PassNumber") + .HasColumnType("int"); + + b.Property("Society") + .HasColumnType("nvarchar(max)"); + + b.Property("SocietyNumber") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("NameList"); + }); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.TournamentDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Competition") + .HasColumnType("nvarchar(max)"); + + b.Property("CompetitionImage") + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("Location") + .HasColumnType("nvarchar(max)"); + + b.Property("Logo") + .HasColumnType("nvarchar(max)"); + + b.Property("Organisation") + .HasColumnType("nvarchar(max)"); + + b.Property("Rounds") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("Targets") + .HasColumnType("int"); + + b.Property("TournamentName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Tournaments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Apollon.EntityFramework/Migrations/20221113174443_T.cs b/Apollon.EntityFramework/Migrations/20221113174443_T.cs new file mode 100644 index 0000000..480f1ec --- /dev/null +++ b/Apollon.EntityFramework/Migrations/20221113174443_T.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Apollon.EntityFramework.Migrations +{ + public partial class T : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/Apollon.EntityFramework/Migrations/20221113175434_quali.Designer.cs b/Apollon.EntityFramework/Migrations/20221113175434_quali.Designer.cs new file mode 100644 index 0000000..57404bb --- /dev/null +++ b/Apollon.EntityFramework/Migrations/20221113175434_quali.Designer.cs @@ -0,0 +1,124 @@ +// +using System; +using Apollon.EntityFramework; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Apollon.EntityFramework.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20221113175434_quali")] + partial class quali + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.CompetitionDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("CompetitionImage") + .HasColumnType("nvarchar(max)"); + + b.Property("CompetitionName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Competition"); + }); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.NameListDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Birthday") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("nvarchar(max)"); + + b.Property("FirstName") + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.Property("PassNumber") + .HasColumnType("int"); + + b.Property("Qualification") + .HasColumnType("int"); + + b.Property("Society") + .HasColumnType("nvarchar(max)"); + + b.Property("SocietyNumber") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("NameList"); + }); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.TournamentDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Competition") + .HasColumnType("nvarchar(max)"); + + b.Property("CompetitionImage") + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("Location") + .HasColumnType("nvarchar(max)"); + + b.Property("Logo") + .HasColumnType("nvarchar(max)"); + + b.Property("Organisation") + .HasColumnType("nvarchar(max)"); + + b.Property("Rounds") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("Targets") + .HasColumnType("int"); + + b.Property("TournamentName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Tournaments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Apollon.EntityFramework/Migrations/20221113175434_quali.cs b/Apollon.EntityFramework/Migrations/20221113175434_quali.cs new file mode 100644 index 0000000..e6fb0e4 --- /dev/null +++ b/Apollon.EntityFramework/Migrations/20221113175434_quali.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Apollon.EntityFramework.Migrations +{ + public partial class quali : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Qualification", + table: "NameList", + type: "int", + nullable: false, + defaultValue: 0); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Qualification", + table: "NameList"); + } + } +} diff --git a/Apollon.EntityFramework/Migrations/TournamentsDbContextModelSnapshot.cs b/Apollon.EntityFramework/Migrations/TournamentsDbContextModelSnapshot.cs index e4097ba..2369c5e 100644 --- a/Apollon.EntityFramework/Migrations/TournamentsDbContextModelSnapshot.cs +++ b/Apollon.EntityFramework/Migrations/TournamentsDbContextModelSnapshot.cs @@ -22,6 +22,60 @@ namespace Apollon.EntityFramework.Migrations SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + modelBuilder.Entity("Apollon.EntityFramework.DTOs.CompetitionDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("CompetitionImage") + .HasColumnType("nvarchar(max)"); + + b.Property("CompetitionName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Competition"); + }); + + modelBuilder.Entity("Apollon.EntityFramework.DTOs.NameListDto", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Birthday") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("nvarchar(max)"); + + b.Property("FirstName") + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.Property("PassNumber") + .HasColumnType("int"); + + b.Property("Qualification") + .HasColumnType("int"); + + b.Property("Society") + .HasColumnType("nvarchar(max)"); + + b.Property("SocietyNumber") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("NameList"); + }); + modelBuilder.Entity("Apollon.EntityFramework.DTOs.TournamentDto", b => { b.Property("Id") @@ -52,6 +106,9 @@ namespace Apollon.EntityFramework.Migrations b.Property("StartDate") .HasColumnType("datetime2"); + b.Property("Targets") + .HasColumnType("int"); + b.Property("TournamentName") .HasColumnType("nvarchar(max)"); diff --git a/Apollon.EntityFramework/Queries/GetAllNamesQuery.cs b/Apollon.EntityFramework/Queries/GetAllNamesQuery.cs index 9b2e829..c13b2cd 100644 --- a/Apollon.EntityFramework/Queries/GetAllNamesQuery.cs +++ b/Apollon.EntityFramework/Queries/GetAllNamesQuery.cs @@ -33,7 +33,8 @@ namespace Apollon.EntityFramework.Queries y.Society, y.SocietyNumber, y.Birthday, - y.Country)); + y.Country, + y.Qualification)); } } } diff --git a/Apollon.EntityFramework/Queries/GetAllTournamentsQuery.cs b/Apollon.EntityFramework/Queries/GetAllTournamentsQuery.cs index f1397c7..ee2ef18 100644 --- a/Apollon.EntityFramework/Queries/GetAllTournamentsQuery.cs +++ b/Apollon.EntityFramework/Queries/GetAllTournamentsQuery.cs @@ -35,7 +35,8 @@ namespace Apollon.EntityFramework.Queries y.StartDate, y.EndDate, y.Location, - y.Rounds)); + y.Rounds, + y.Targets)); } } } diff --git a/Apollon.WPF/Commands/AddTournamentCommand.cs b/Apollon.WPF/Commands/AddTournamentCommand.cs index 9feb836..3cfd5a8 100644 --- a/Apollon.WPF/Commands/AddTournamentCommand.cs +++ b/Apollon.WPF/Commands/AddTournamentCommand.cs @@ -44,7 +44,8 @@ namespace Apollon.WPF.Commands detailsViewModel.StartDate, detailsViewModel.EndDate, detailsViewModel.Location, - detailsViewModel.Rounds); + detailsViewModel.Rounds, + detailsViewModel.Targets); try { diff --git a/Apollon.WPF/Commands/EditTournamentCommand.cs b/Apollon.WPF/Commands/EditTournamentCommand.cs index 11849e3..26672c9 100644 --- a/Apollon.WPF/Commands/EditTournamentCommand.cs +++ b/Apollon.WPF/Commands/EditTournamentCommand.cs @@ -39,7 +39,8 @@ namespace Apollon.WPF.Commands detailsViewModel.StartDate, detailsViewModel.EndDate, detailsViewModel.Location, - detailsViewModel.Rounds); + detailsViewModel.Rounds, + detailsViewModel.Targets); try { diff --git a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs index a982f18..2df4dca 100644 --- a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs @@ -162,6 +162,20 @@ namespace Apollon.WPF.ViewModels } } + private int _targets; + public int Targets + { + get + { + return _targets; + } + set + { + _targets = value; + OnPropertyChanged(nameof(Targets)); + } + } + private bool _isSubmitting; public bool IsSubmitting { diff --git a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs index 6371b5d..7c19040 100644 --- a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs +++ b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs @@ -33,6 +33,7 @@ namespace Apollon.WPF.ViewModels EndDate = tournament.EndDate, Location = tournament.Location, Rounds = tournament.Rounds, + Targets = tournament.Targets, }; } diff --git a/Apollon.WPF/ViewModels/NameListViewModel.cs b/Apollon.WPF/ViewModels/NameListViewModel.cs index d71a39e..8b89a4b 100644 --- a/Apollon.WPF/ViewModels/NameListViewModel.cs +++ b/Apollon.WPF/ViewModels/NameListViewModel.cs @@ -105,5 +105,19 @@ namespace Apollon.WPF.ViewModels OnPropertyChanged(nameof(Country)); } } + + private int _qualification; + public int Qualification + { + get + { + return _qualification; + } + set + { + _qualification = value; + OnPropertyChanged(nameof(Qualification)); + } + } } } diff --git a/Apollon.WPF/ViewModels/NavigationBarViewModel.cs b/Apollon.WPF/ViewModels/NavBarTournamentDetailsViewModel.cs similarity index 81% rename from Apollon.WPF/ViewModels/NavigationBarViewModel.cs rename to Apollon.WPF/ViewModels/NavBarTournamentDetailsViewModel.cs index b83533f..468f1a8 100644 --- a/Apollon.WPF/ViewModels/NavigationBarViewModel.cs +++ b/Apollon.WPF/ViewModels/NavBarTournamentDetailsViewModel.cs @@ -7,7 +7,7 @@ using System.Windows.Input; namespace Apollon.WPF.ViewModels { - public class NavigationBarViewModel : ViewModelBase + public class NavBarTournamentDetailsViewModel : ViewModelBase { public ICommand NavigateNameListCommand { get;} public ICommand GroupsCommand { get;} diff --git a/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs b/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs index 964f8ec..323fac2 100644 --- a/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs @@ -25,8 +25,9 @@ namespace Apollon.WPF.ViewModels public string EndDate => SelectedTournament?.EndDate.ToString("d") ?? "kein Datum"; public string Location => SelectedTournament?.Location ?? "kein Ort"; public int Rounds => SelectedTournament?.Rounds ?? 0; + public int Targets => SelectedTournament?.Targets ?? 0; - public ICommand NavigateNavBarCommand { get; } + public ICommand NavigateTournamentDetailsCommand { get; } public OverviewDetailsViewModel(SelectedTournamentsStore selectedTournamentStore, NavigationStore navigationStore, ModalNavigationStore modalNavigationStore,TournamentsStore tournamentsStore) { @@ -34,7 +35,7 @@ namespace Apollon.WPF.ViewModels _selectedTournamentStore.SelectedTournamentChanged += SelectedTournamentStore_SelectedTournamentChanged; - NavigateNavBarCommand = new NavigateCommand(navigationStore, () => new TournamentDetailsViewModel(navigationStore, selectedTournamentStore, modalNavigationStore, tournamentsStore)); + NavigateTournamentDetailsCommand = new NavigateCommand(navigationStore, () => new TournamentDetailsViewModel(navigationStore, selectedTournamentStore, modalNavigationStore, tournamentsStore)); } protected override void Dispose() @@ -57,6 +58,7 @@ namespace Apollon.WPF.ViewModels OnPropertyChanged(nameof(EndDate)); OnPropertyChanged(nameof(Location)); OnPropertyChanged(nameof(Rounds)); + OnPropertyChanged(nameof(Targets)); } } } diff --git a/Apollon.WPF/ViewModels/TournamentDetailsViewModel.cs b/Apollon.WPF/ViewModels/TournamentDetailsViewModel.cs index 82da260..cb6416d 100644 --- a/Apollon.WPF/ViewModels/TournamentDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/TournamentDetailsViewModel.cs @@ -27,6 +27,7 @@ namespace Apollon.WPF.ViewModels public string EndDate => SelectedTournament?.EndDate.ToString("d") ?? "kein Datum"; public string Location => SelectedTournament?.Location ?? "kein Ort"; public int Rounds => SelectedTournament?.Rounds ?? 0; + public int Targets => SelectedTournament?.Targets ?? 0; public ICommand NavigateOverviewCommand { get; } public TournamentDetailsViewModel(NavigationStore navigationStore, SelectedTournamentsStore selectedTournamentsStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore) diff --git a/Apollon.WPF/Views/Components/AddEditDetails.xaml b/Apollon.WPF/Views/Components/AddEditDetails.xaml index ce890e7..3bf2954 100644 --- a/Apollon.WPF/Views/Components/AddEditDetails.xaml +++ b/Apollon.WPF/Views/Components/AddEditDetails.xaml @@ -144,8 +144,10 @@ HorizontalAlignment="Left" VerticalContentAlignment="Center" Background="LightGray"/> - + + + + + - + + Margin="5"> + + + + + + + + + + + + diff --git a/Apollon.WPF/Views/NameListView.xaml b/Apollon.WPF/Views/NameListView.xaml index c8e25c3..c955c6e 100644 --- a/Apollon.WPF/Views/NameListView.xaml +++ b/Apollon.WPF/Views/NameListView.xaml @@ -17,7 +17,8 @@ - + +