ready for database

This commit is contained in:
Natlinux81
2022-08-20 01:41:56 +02:00
parent fcd1d90292
commit 68f0cec9d0
28 changed files with 356 additions and 36 deletions

View File

@@ -12,4 +12,8 @@
<PackageReference Include="SimpleModal.WPF" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Apollon.Domain\Apollon.Domain.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,6 +1,12 @@
using Apollon.WPF.Models;
using Apollon.Domain.Commands;
using Apollon.Domain.Models;
using Apollon.Domain.Queries;
using Apollon.EntityFramework;
using Apollon.EntityFramework.Commands;
using Apollon.EntityFramework.Queries;
using Apollon.WPF.Stores;
using Apollon.WPF.ViewModels;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Configuration;
@@ -17,14 +23,27 @@ namespace Apollon.WPF
public partial class App : Application
{
private readonly ModalNavigationStore _modalNavigationStore;
private readonly TournamentsDBContextFactory _tournamentsDBContextFactory;
private readonly IGetAllTournamentsQuery _getAllTournamentQuery;
private readonly ICreateTournamentCommand _createTournamentCommand;
private readonly IUpdateTournamentCommand _updateTournamentCommand;
private readonly IDeleteTournamentCommand _deleteTournamentCommand;
private readonly TournamentsStore _tournamentStore;
private readonly SelectedTournamentsStore _selectedTournamentStore;
public App()
{
string connectionString = "Server=NATHALIE-PC\NATLINUXDB;Database=OfficeOrganizer;Trusted_Connection=True;MultipleActiveResultSets=true\";
_modalNavigationStore = new ModalNavigationStore();
_tournamentStore = new TournamentsStore();
_tournamentsDBContextFactory = new TournamentsDBContextFactory(
new DbContextOptionsBuilder().UseSqlServer(connectionString).Options);
_getAllTournamentQuery = new GetAllTournamentsQuery();
_createTournamentCommand = new CreateTournamentCommand();
_updateTournamentCommand = new UpdateTournamentCommand();
_deleteTournamentCommand = new DeleteTournamentCommand();
_tournamentStore = new TournamentsStore(_getAllTournamentQuery, _createTournamentCommand, _updateTournamentCommand, _deleteTournamentCommand);
_selectedTournamentStore = new SelectedTournamentsStore(_tournamentStore);
}
protected override void OnStartup(StartupEventArgs e)

View File

@@ -1,4 +1,4 @@
using Apollon.WPF.Models;
using Apollon.Domain.Models;
using Apollon.WPF.Stores;
using Apollon.WPF.ViewModels;
using System;

View File

@@ -1,4 +1,4 @@
using Apollon.WPF.Models;
using Apollon.Domain.Models;
using Apollon.WPF.Stores;
using Apollon.WPF.ViewModels;
using System;

View File

@@ -1,4 +1,4 @@
using Apollon.WPF.Models;
using Apollon.Domain.Models;
using Apollon.WPF.Stores;
using Apollon.WPF.ViewModels;
using System;

View File

@@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Apollon.WPF.Models
{
public class Competition
{
public Competition(string competitionName, byte competitionImage)
{
CompetitionName = competitionName;
CompetitionImage = competitionImage;
}
public string CompetitionName { get; set; }
public byte CompetitionImage { get; set; }
}
}

View File

@@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Apollon.WPF.Models
{
public class Tournament
{
public Guid Id { get; }
public string Organisation { get; }
public string TournamentName { get; }
public string Competition { get; }
public DateTime StartDate { get; }
public DateTime EndDate { get; }
public string Location { get; }
public int Rounds { get; }
public Tournament(Guid id, string organisation, string tournamentName, string competition, DateTime startDate, DateTime endDate, string location, int rounds = 0)
{
Id = id;
Organisation = organisation;
TournamentName = tournamentName;
Competition = competition;
StartDate = startDate;
EndDate = endDate;
Location = location;
Rounds = rounds;
}
}
}

View File

@@ -1,4 +1,4 @@
using Apollon.WPF.Models;
using Apollon.Domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@@ -1,4 +1,4 @@
using Apollon.WPF.Models;
using Apollon.Domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@@ -1,5 +1,5 @@
using Apollon.WPF.Commands;
using Apollon.WPF.Models;
using Apollon.Domain.Models;
using Apollon.WPF.Stores;
using System;
using System.Collections.Generic;

View File

@@ -1,4 +1,4 @@
using Apollon.WPF.Models;
using Apollon.Domain.Models;
using Apollon.WPF.Stores;
using System;
using System.Collections.Generic;
@@ -40,7 +40,7 @@ namespace Apollon.WPF.ViewModels
private void SelectedTournamentStore_SelectedTournamentChanged()
{
//OnPropertyChanged(nameof(HasSelectedTournament));
OnPropertyChanged(nameof(HasSelectedTournament));
OnPropertyChanged(nameof(Organisation));
OnPropertyChanged(nameof(TournamentName));
OnPropertyChanged(nameof(Competition));

View File

@@ -1,5 +1,5 @@
using Apollon.WPF.Commands;
using Apollon.WPF.Models;
using Apollon.Domain.Models;
using Apollon.WPF.Stores;
using System;
using System.Collections.Generic;

View File

@@ -1,5 +1,5 @@
using Apollon.WPF.Commands;
using Apollon.WPF.Models;
using Apollon.Domain.Models;
using Apollon.WPF.Stores;
using System;
using System.Collections.Generic;

View File

@@ -1,5 +1,5 @@
using Apollon.WPF.Commands;
using Apollon.WPF.Models;
using Apollon.Domain.Models;
using Apollon.WPF.Stores;
using System;
using System.Collections.Generic;