mirror of
https://github.com/bvanroll/cs-oo-project.git
synced 2025-12-12 13:26:10 +00:00
Deep Shallow copy moe nog gebeuren
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Globals.classes
|
|||||||
{
|
{
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Game(int Id, Ploeg home, Ploeg away, DateTime date)
|
public Game(int Id, PloegInMatch home, PloegInMatch away, DateTime date)
|
||||||
{
|
{
|
||||||
homeSetBool = false;
|
homeSetBool = false;
|
||||||
awaySetBool = false;
|
awaySetBool = false;
|
||||||
@@ -21,7 +21,7 @@ namespace Globals.classes
|
|||||||
this.away.scoreChanged += awaySet;
|
this.away.scoreChanged += awaySet;
|
||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
public Game(Ploeg home, Ploeg away, DateTime d)
|
public Game(PloegInMatch home, PloegInMatch away, DateTime d)
|
||||||
{
|
{
|
||||||
homeSetBool = false;
|
homeSetBool = false;
|
||||||
awaySetBool = false;
|
awaySetBool = false;
|
||||||
@@ -38,15 +38,15 @@ namespace Globals.classes
|
|||||||
homeSetBool = false;
|
homeSetBool = false;
|
||||||
awaySetBool = false;
|
awaySetBool = false;
|
||||||
|
|
||||||
this.home = home;
|
this.home = (PloegInMatch) home; //cast de oorspronkelijke klasse naar deze subklasse
|
||||||
this.away = away;
|
this.away = (PloegInMatch) away;
|
||||||
this.home.scoreChanged += homeSet;
|
this.home.scoreChanged += homeSet;
|
||||||
this.away.scoreChanged += awaySet;
|
this.away.scoreChanged += awaySet;
|
||||||
this.home.setScore(scoreHome);
|
this.home.setScore(scoreHome);
|
||||||
this.away.setScore(scoreAway);
|
this.away.setScore(scoreAway);
|
||||||
this.date = d;
|
this.date = d;
|
||||||
}
|
}
|
||||||
public Game(int id, Ploeg home, Ploeg away)
|
public Game(int id, PloegInMatch home, PloegInMatch away)
|
||||||
{
|
{
|
||||||
homeSetBool = false;
|
homeSetBool = false;
|
||||||
awaySetBool = false;
|
awaySetBool = false;
|
||||||
@@ -71,9 +71,9 @@ namespace Globals.classes
|
|||||||
[JsonProperty("id")]
|
[JsonProperty("id")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[JsonProperty("home")]
|
[JsonProperty("home")]
|
||||||
public Ploeg home { get; set; }
|
public PloegInMatch home { get; set; }
|
||||||
[JsonProperty("away")]
|
[JsonProperty("away")]
|
||||||
public Ploeg away { get; set; }
|
public PloegInMatch away { get; set; }
|
||||||
[JsonProperty("Date")]
|
[JsonProperty("Date")]
|
||||||
public DateTime date { get; set; } //y m d
|
public DateTime date { get; set; } //y m d
|
||||||
|
|
||||||
|
|||||||
@@ -6,77 +6,28 @@ namespace Globals.classes
|
|||||||
{
|
{
|
||||||
public class Ploeg : IPloeg
|
public class Ploeg : IPloeg
|
||||||
{
|
{
|
||||||
[JsonConstructor]
|
public Ploeg(int id, string naam)
|
||||||
public Ploeg(int Id, string naam, int score)
|
|
||||||
{
|
{
|
||||||
this.Id = Id;
|
Id = id;
|
||||||
this.naam = naam;
|
this.naam = naam;
|
||||||
this.score = score;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ploeg(string naam)
|
public Ploeg(Ploeg p)
|
||||||
{
|
{
|
||||||
this.naam = naam;
|
this.Id = p.Id;
|
||||||
this.score = int.MinValue;
|
this.naam = p.naam;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ploeg(string naam, int score) : this(naam)
|
|
||||||
{
|
|
||||||
this.score = score;
|
|
||||||
}
|
|
||||||
public Ploeg(string naam, int score, int Id)
|
|
||||||
{
|
|
||||||
this.score = score;
|
|
||||||
this.naam = naam;
|
|
||||||
this.Id = Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string naam { get; set; }
|
public string naam { get; set; }
|
||||||
public int score { get; private set; }
|
|
||||||
public bool scoreSet { get; }
|
|
||||||
|
|
||||||
public event EventHandler scoreChanged;
|
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
try
|
return base.Equals(obj);
|
||||||
{
|
|
||||||
Ploeg te = (Ploeg)obj;
|
|
||||||
|
|
||||||
} catch (Exception e)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Ploeg t = (Ploeg)obj;
|
|
||||||
return this.Id == t.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return base.GetHashCode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
string score = "";
|
return this.naam;
|
||||||
if (this.score != int.MinValue)
|
|
||||||
{
|
|
||||||
score = ":" + this.score;
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,37 +5,47 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Globals.Classes
|
namespace Globals.classes
|
||||||
{
|
{
|
||||||
public class PloegInMatch : Ploeg
|
public class PloegInMatch : Ploeg
|
||||||
{
|
{
|
||||||
|
public PloegInMatch(int id, string naam) : base(id, naam)
|
||||||
|
|
||||||
public int score;
|
|
||||||
|
|
||||||
public PloegInMatch(int score)
|
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public PloegInMatch(int id, string naam, int score) : base(id, naam)
|
||||||
|
{
|
||||||
|
setScore(score);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PloegInMatch(Ploeg p) : base(p)
|
||||||
|
{
|
||||||
|
this.Id = p.Id;
|
||||||
|
this.naam = p.naam;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public PloegInMatch(Ploeg p, int score) : base(p)
|
||||||
|
{
|
||||||
|
this.Id = p.Id;
|
||||||
|
this.naam = p.naam;
|
||||||
|
setScore(score);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int score { get; private set; }
|
||||||
|
public bool scoreSet { get; private set; }
|
||||||
|
public event EventHandler scoreChanged;
|
||||||
|
|
||||||
|
public void setScore(int score)
|
||||||
|
{
|
||||||
|
EventHandler h = scoreChanged;
|
||||||
|
if (null != h) h(this, EventArgs.Empty);
|
||||||
this.score = score;
|
this.score = score;
|
||||||
|
this.scoreSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override zegMijnNaam(string naam)
|
|
||||||
{
|
|
||||||
return "blabla " + naam;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
|
||||||
{
|
|
||||||
return base.Equals(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return base.GetHashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return base.ToString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Classes\ploegInMatch.cs" />
|
<Compile Include="Classes\PloegInMatch.cs" />
|
||||||
<Compile Include="MyClass.cs" />
|
<Compile Include="MyClass.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Classes\Bet.cs" />
|
<Compile Include="Classes\Bet.cs" />
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ namespace Globals.Interfaces
|
|||||||
public interface IGame
|
public interface IGame
|
||||||
{
|
{
|
||||||
int Id { get; set; }
|
int Id { get; set; }
|
||||||
Ploeg home { get; set; }
|
PloegInMatch home { get; set; }
|
||||||
Ploeg away { get; set; }
|
PloegInMatch away { get; set; }
|
||||||
DateTime date { get; set; }
|
DateTime date { get; set; }
|
||||||
state getWinner();
|
state getWinner();
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
using System;
|
|
||||||
namespace Globals
|
|
||||||
{
|
|
||||||
public class MyClass
|
|
||||||
{
|
|
||||||
public MyClass()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
VisualStudioVersion = 16.0.29123.88
|
VisualStudioVersion = 16.0.29123.88
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "old", "old", "{BF8F2852-F325-4C72-AFF6-E0C40808625B}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "old", "old", "{BF8F2852-F325-4C72-AFF6-E0C40808625B}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
Ploeg.cs = Ploeg.cs
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Online Gokkantoor_GUI", "Online Gokkantoor\Online Gokkantoor_GUI.csproj", "{62E2ECA5-72AF-4401-9FE3-D7BD5044D7E9}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Online Gokkantoor_GUI", "Online Gokkantoor\Online Gokkantoor_GUI.csproj", "{62E2ECA5-72AF-4401-9FE3-D7BD5044D7E9}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|||||||
82
Online Gokkantoor/Ploeg.cs
Normal file
82
Online Gokkantoor/Ploeg.cs
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
using System;
|
||||||
|
using Globals.Interfaces;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Globals.classes
|
||||||
|
{
|
||||||
|
public class Ploeg : IPloeg
|
||||||
|
{
|
||||||
|
[JsonConstructor]
|
||||||
|
public Ploeg(int Id, string naam, int score)
|
||||||
|
{
|
||||||
|
this.Id = Id;
|
||||||
|
this.naam = naam;
|
||||||
|
this.score = score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ploeg(string naam)
|
||||||
|
{
|
||||||
|
this.naam = naam;
|
||||||
|
this.score = int.MinValue;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ploeg(string naam, int score) : this(naam)
|
||||||
|
{
|
||||||
|
this.score = score;
|
||||||
|
}
|
||||||
|
public Ploeg(string naam, int score, int Id)
|
||||||
|
{
|
||||||
|
this.score = score;
|
||||||
|
this.naam = naam;
|
||||||
|
this.Id = Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string naam { get; set; }
|
||||||
|
public int score { get; private set; }
|
||||||
|
public bool scoreSet { get; }
|
||||||
|
|
||||||
|
public event EventHandler scoreChanged;
|
||||||
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Ploeg te = (Ploeg)obj;
|
||||||
|
|
||||||
|
} catch (Exception e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Ploeg t = (Ploeg)obj;
|
||||||
|
return this.Id == t.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return base.GetHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
string score = "";
|
||||||
|
if (this.score != int.MinValue)
|
||||||
|
{
|
||||||
|
score = ":" + this.score;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user