mirror of
https://github.com/bvanroll/cs-oo-project.git
synced 2025-08-29 12:02:40 +00:00
Merge branch 'master' of https://github.com/beppevanrolleghem/michielC-oo
This commit is contained in:
@@ -21,7 +21,7 @@ namespace Data
|
||||
List<Bet> list = new List<Bet>();
|
||||
try
|
||||
{
|
||||
using (StreamReader file = File.OpenText(@"Data/bets.json"))
|
||||
using (StreamReader file = File.OpenText(@"../../Data/bets.json"))
|
||||
{
|
||||
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
@@ -42,7 +42,7 @@ namespace Data
|
||||
|
||||
try
|
||||
{
|
||||
using (StreamReader file = File.OpenText(@"Data/games.json"))
|
||||
using (StreamReader file = File.OpenText(@"../../Data/games.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
list = (List<Game>)serializer.Deserialize(file, typeof(List<Game>));
|
||||
@@ -61,7 +61,7 @@ namespace Data
|
||||
|
||||
List<Person> list = new List<Person>();
|
||||
try {
|
||||
using (StreamReader file = File.OpenText(@"Data/persons.json"))
|
||||
using (StreamReader file = File.OpenText(@"../../Data/persons.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
list = (List<Person>)serializer.Deserialize(file, typeof(List<Person>));
|
||||
@@ -80,7 +80,7 @@ namespace Data
|
||||
List<Ploeg> list = new List<Ploeg>();
|
||||
try
|
||||
{
|
||||
using (StreamReader file = File.OpenText(@"Data/ploegen.json"))
|
||||
using (StreamReader file = File.OpenText(@"../../Data/ploegen.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
list = (List<Ploeg>)serializer.Deserialize(file, typeof(List<Ploeg>));
|
||||
@@ -96,7 +96,7 @@ namespace Data
|
||||
|
||||
public void saveBets(List<Bet> b)
|
||||
{
|
||||
using (StreamWriter file = File.CreateText(@"Data/bets.json"))
|
||||
using (StreamWriter file = File.CreateText(@"../../Data/bets.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.Serialize(file, b);
|
||||
@@ -105,7 +105,7 @@ namespace Data
|
||||
|
||||
public void saveGames(List<Game> g)
|
||||
{
|
||||
using (StreamWriter file = File.CreateText(@"Data/games.json"))
|
||||
using (StreamWriter file = File.CreateText(@"../../Data/games.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.Serialize(file, g);
|
||||
@@ -114,7 +114,7 @@ namespace Data
|
||||
|
||||
public void savePersons(List<Person> p)
|
||||
{
|
||||
using (StreamWriter file = File.CreateText(@"Data/persons.json"))
|
||||
using (StreamWriter file = File.CreateText(@"../../Data/persons.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.Serialize(file, p);
|
||||
@@ -123,7 +123,7 @@ namespace Data
|
||||
|
||||
public void savePloegen(List<Ploeg> p)
|
||||
{
|
||||
using (StreamWriter file = File.CreateText(@"Data/ploegen.json"))
|
||||
using (StreamWriter file = File.CreateText(@"../../Data/ploegen.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.Serialize(file, p);
|
||||
|
@@ -11,38 +11,62 @@ namespace Globals.classes
|
||||
[JsonConstructor]
|
||||
public Game(int Id, Ploeg home, Ploeg away, DateTime date)
|
||||
{
|
||||
homeSetBool = false;
|
||||
awaySetBool = false;
|
||||
|
||||
this.Id = Id;
|
||||
this.home = home;
|
||||
this.away = away;
|
||||
this.home.scoreChanged += homeSet;
|
||||
this.away.scoreChanged += awaySet;
|
||||
this.date = date;
|
||||
}
|
||||
public Game(Ploeg home, Ploeg away, DateTime d)
|
||||
{
|
||||
homeSetBool = false;
|
||||
awaySetBool = false;
|
||||
|
||||
this.home = home;
|
||||
this.away = away;
|
||||
this.home.scoreChanged += homeSet;
|
||||
this.away.scoreChanged += awaySet;
|
||||
|
||||
this.date = d;
|
||||
}
|
||||
public Game(Ploeg home, Ploeg away, DateTime d, int scoreHome, int scoreAway)
|
||||
{
|
||||
homeSetBool = false;
|
||||
awaySetBool = false;
|
||||
|
||||
this.home = home;
|
||||
this.away = away;
|
||||
this.home.score = scoreHome;
|
||||
this.away.score = scoreAway;
|
||||
this.home.scoreChanged += homeSet;
|
||||
this.away.scoreChanged += awaySet;
|
||||
this.home.setScore(scoreHome);
|
||||
this.away.setScore(scoreAway);
|
||||
this.date = d;
|
||||
}
|
||||
public Game(int id, Ploeg home, Ploeg away)
|
||||
{
|
||||
homeSetBool = false;
|
||||
awaySetBool = false;
|
||||
Id = id;
|
||||
this.home = home ?? throw new ArgumentNullException(nameof(home));
|
||||
this.away = away ?? throw new ArgumentNullException(nameof(away));
|
||||
this.home.scoreChanged += homeSet;
|
||||
this.away.scoreChanged += awaySet;
|
||||
}
|
||||
public Game(int id, Ploeg home, Ploeg away, int scoreHome, int scoreAway)
|
||||
{
|
||||
homeSetBool = false;
|
||||
awaySetBool = false;
|
||||
Id = id;
|
||||
this.home = home ?? throw new ArgumentNullException(nameof(home));
|
||||
this.away = away ?? throw new ArgumentNullException(nameof(away));
|
||||
this.home.score = scoreHome;
|
||||
this.away.score = scoreAway;
|
||||
this.home.scoreChanged += homeSet;
|
||||
this.away.scoreChanged += awaySet;
|
||||
this.home.setScore(scoreHome);
|
||||
this.away.setScore(scoreAway);
|
||||
}
|
||||
[JsonProperty("id")]
|
||||
public int Id { get; set; }
|
||||
@@ -53,6 +77,18 @@ namespace Globals.classes
|
||||
[JsonProperty("Date")]
|
||||
public DateTime date { get; set; } //y m d
|
||||
|
||||
private bool homeSetBool;
|
||||
private bool awaySetBool;
|
||||
private void homeSet (object s, EventArgs e)
|
||||
{
|
||||
homeSetBool = true;
|
||||
|
||||
}
|
||||
private void awaySet(object s, EventArgs e)
|
||||
{
|
||||
awaySetBool = true;
|
||||
}
|
||||
|
||||
public state getWinner()
|
||||
{
|
||||
if (!this.home.scoreSet || !this.away.scoreSet)
|
||||
|
@@ -34,9 +34,11 @@ namespace Globals.classes
|
||||
|
||||
public int Id { get; set; }
|
||||
public string naam { get; set; }
|
||||
public int score { get; set; }
|
||||
public bool scoreSet { get => this.score != int.MinValue; }
|
||||
|
||||
public int score { get; private set; }
|
||||
public bool scoreSet { get; }
|
||||
|
||||
public event EventHandler scoreChanged;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
try
|
||||
@@ -66,5 +68,15 @@ namespace Globals.classes
|
||||
return this.Id + ": " + this.naam + score;
|
||||
}
|
||||
|
||||
public void setScore(int i)
|
||||
{
|
||||
EventHandler h = scoreChanged;
|
||||
if (null != h) h(this, EventArgs.Empty);
|
||||
this.score = i;
|
||||
}
|
||||
public int getScore()
|
||||
{
|
||||
return this.score;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,5 +11,6 @@ namespace Globals.Interfaces
|
||||
Ploeg away { get; set; }
|
||||
DateTime date { get; set; }
|
||||
state getWinner();
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,10 @@ namespace Globals.Interfaces
|
||||
{
|
||||
int Id { get; set; }
|
||||
string naam { get; set; }
|
||||
int score { get; set; }
|
||||
int score { get; }
|
||||
bool scoreSet { get; }
|
||||
event EventHandler scoreChanged;
|
||||
void setScore(int i);
|
||||
int getScore();
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -9,6 +9,18 @@
|
||||
<RootNamespace>Gui</RootNamespace>
|
||||
<AssemblyName>Gui</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>4.0</OldToolsVersion>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<Use64BitIISExpress />
|
||||
<IISExpressSSLPort />
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -51,60 +63,70 @@
|
||||
</Compile>
|
||||
<Compile Include="Default.aspx.cs">
|
||||
<DependentUpon>Default.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Default.aspx.designer.cs">
|
||||
<DependentUpon>Default.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Login.aspx.cs">
|
||||
<DependentUpon>Login.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Login.aspx.designer.cs">
|
||||
<DependentUpon>Login.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="mainForm.aspx.cs">
|
||||
<DependentUpon>mainForm.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="mainForm.aspx.designer.cs">
|
||||
<DependentUpon>mainForm.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Admin.aspx.cs">
|
||||
<DependentUpon>Admin.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Admin.aspx.designer.cs">
|
||||
<DependentUpon>Admin.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="addUser.aspx.cs">
|
||||
<DependentUpon>addUser.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="addUser.aspx.designer.cs">
|
||||
<DependentUpon>addUser.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="addBet.aspx.cs">
|
||||
<DependentUpon>addBet.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="addBet.aspx.designer.cs">
|
||||
<DependentUpon>addBet.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="addMatch.aspx.cs">
|
||||
<DependentUpon>addMatch.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="addMatch.aspx.designer.cs">
|
||||
<DependentUpon>addMatch.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="addPloeg.aspx.cs">
|
||||
<DependentUpon>addPloeg.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="addPloeg.aspx.designer.cs">
|
||||
<DependentUpon>addPloeg.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="addBalance.aspx.cs">
|
||||
<DependentUpon>addBalance.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="addBalance.aspx.designer.cs">
|
||||
<DependentUpon>addBalance.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="updateGame.aspx.cs">
|
||||
<DependentUpon>updateGame.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="updateGame.aspx.designer.cs">
|
||||
<DependentUpon>updateGame.aspx</DependentUpon>
|
||||
@@ -120,9 +142,7 @@
|
||||
<Name>Globals</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Data\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<None Include="Data\persons.json" />
|
||||
<None Include="Data\bets.json" />
|
||||
@@ -136,5 +156,22 @@
|
||||
<XspParameters Port="8080" Address="127.0.0.1" SslMode="None" SslProtocol="Default" KeyType="None" CertFile="" KeyFile="" PasswordOptions="None" Password="" Verbose="True" />
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349C5851-65DF-11DA-9384-00065B846F21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>True</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>0</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:50787/</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
</Project>
|
@@ -13,7 +13,6 @@ namespace Logic
|
||||
public LogicLayer()
|
||||
{
|
||||
d = new dataLayer();
|
||||
|
||||
persons = d.getPersons();
|
||||
bets = d.getBets();
|
||||
ploegen = d.getPloegen();
|
||||
@@ -76,10 +75,6 @@ namespace Logic
|
||||
public void addGame(Game g)
|
||||
{
|
||||
games.Add(g);
|
||||
if (true)
|
||||
{
|
||||
int i = 0;
|
||||
}
|
||||
fixIds();
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,10 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28010.2026
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29123.88
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "old", "old", "{BF8F2852-F325-4C72-AFF6-E0C40808625B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Online Gokkantoor_GUI", "Online Gokkantoor\Online Gokkantoor_GUI.csproj", "{62E2ECA5-72AF-4401-9FE3-D7BD5044D7E9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataLaag", "DataLaag\DataLaag.csproj", "{CA62D8EA-2739-4C85-81B4-FBA040592DAE}"
|
||||
@@ -11,8 +13,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LogicLayer", "LogicLayer\Lo
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp", "Console\ConsoleApp.csproj", "{75E1DDD1-C2F0-4C29-A95A-85A72D8C4948}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "old", "old", "{BF8F2852-F325-4C72-AFF6-E0C40808625B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Data\Data.csproj", "{46C1FC26-4A1F-43E4-8682-853010AB38AC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logic", "Logic\Logic.csproj", "{82F1AF49-F9FA-42A1-BD3B-A37C36E340AD}"
|
||||
|
Reference in New Issue
Block a user