mirror of
https://github.com/bvanroll/cs-oo-project.git
synced 2025-08-29 20:12:40 +00:00
euh
This commit is contained in:
@@ -30,7 +30,7 @@ namespace Data
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
return list;
|
||||
@@ -51,6 +51,7 @@ namespace Data
|
||||
} catch (Exception e)
|
||||
{
|
||||
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -68,6 +69,7 @@ namespace Data
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
throw new Exception(e.Message);
|
||||
|
||||
}
|
||||
return list;
|
||||
@@ -86,6 +88,7 @@ namespace Data
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
throw new Exception(e.Message);
|
||||
|
||||
}
|
||||
return list;
|
||||
|
@@ -24,7 +24,7 @@ namespace Globals.classes
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
Bet b = (Bet)obj;
|
||||
return b.game == this.game && this.person == b.person && b.cash == this.cash && this.ploeg == b.ploeg;
|
||||
return this.Id == b.Id;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
@@ -51,7 +51,7 @@ namespace Globals.classes
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return person.ToString() + ":" + this.cash + "$ on " + this.game.ToString();
|
||||
return this.Id + ": " + person.ToString() + ":" + this.cash + "$ on " + this.game.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -71,8 +71,9 @@ namespace Globals.classes
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
Game g = (Game)obj;
|
||||
return this.home == g.away;
|
||||
|
||||
Game ga = (Game)obj;
|
||||
return this.Id == ga.Id;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
@@ -83,7 +84,7 @@ namespace Globals.classes
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.home.ToString() + " / " + this.away.ToString();
|
||||
return this.Id + ": " + this.home.ToString() + " / " + this.away.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ namespace Globals.classes
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.name + " " + this.lastname;
|
||||
return this.Id + ": " +this.name + " " + this.lastname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -16,6 +16,12 @@ namespace Globals.classes
|
||||
{
|
||||
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; }
|
||||
@@ -24,6 +30,14 @@ namespace Globals.classes
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -40,7 +54,7 @@ namespace Globals.classes
|
||||
{
|
||||
score = ":" + this.score;
|
||||
}
|
||||
return this.naam + score;
|
||||
return this.Id + ": " + this.naam + score;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -21,5 +21,9 @@ namespace Globals.Interfaces
|
||||
void save();
|
||||
void updateGame(Game g);
|
||||
void updatePerson(Person p);
|
||||
Person getPersonByString(string s);
|
||||
Ploeg getPloegByString(string s);
|
||||
Game getGameByString(string s);
|
||||
Bet getBetByString(string s);
|
||||
}
|
||||
}
|
||||
|
@@ -6,4 +6,5 @@ namespace Globals
|
||||
{
|
||||
public enum state { draw, home, away };
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -46,9 +46,9 @@ namespace Gui
|
||||
|
||||
public void updateGame_Click(object sender, EventArgs args)
|
||||
{
|
||||
logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
|
||||
|
||||
IList<Game> boundList2 = (IList<Game>)listGames.DataSource;
|
||||
HttpContext.Current.Application["currGame"] = boundList2[listGames.SelectedIndex];
|
||||
HttpContext.Current.Application["currGame"] = logic.getGameByString(listGames.SelectedValue);
|
||||
Server.Transfer("updateGame.aspx");
|
||||
}
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
[]
|
||||
[{"date":"2015-01-01T00:00:00","Id":0
|
@@ -1 +1 @@
|
||||
[{"Id":0,"naam":"bepkes","score":-2147483648,"scoreSet":false},{"Id":1,"naam":"selmakes","score":-2147483648,"scoreSet":false}]
|
||||
[{"Id":0,"naam":"jfkldjslkfj","score":-2147483648,"scoreSet":false},{"Id":1,"naam":"vdvdvd","score":-2147483648,"scoreSet":false}]
|
@@ -14,22 +14,35 @@ namespace Gui
|
||||
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnInitComplete(EventArgs e)
|
||||
{
|
||||
base.OnInitComplete(e);
|
||||
LogicLayer logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
|
||||
lstUsers.DataSource = logic.persons;
|
||||
lstUsers.DataBind();
|
||||
}
|
||||
}
|
||||
protected override void OnInitComplete(EventArgs e)
|
||||
{
|
||||
base.OnInitComplete(e);
|
||||
}
|
||||
protected override void OnPreLoad(EventArgs e)
|
||||
{
|
||||
base.OnPreLoad(e);
|
||||
LogicLayer logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
|
||||
lstUsers.DataSource = logic.persons;
|
||||
lstUsers.DataBind();
|
||||
}
|
||||
protected override void OnLoadComplete(EventArgs e)
|
||||
{
|
||||
base.OnLoadComplete(e);
|
||||
LogicLayer logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
|
||||
lstUsers.DataSource = logic.persons;
|
||||
lstUsers.DataBind();
|
||||
}
|
||||
public void Login_Click(object o, EventArgs e)
|
||||
{
|
||||
HttpContext.Current.Application["user"] = lstUsers.SelectedItem;
|
||||
LogicLayer logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
|
||||
HttpContext.Current.Application["user"] = logic.getPersonByString(lstUsers.SelectedValue);
|
||||
Server.Transfer("mainForm.aspx");
|
||||
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using Globals;
|
||||
using Globals.classes;
|
||||
using Logic;
|
||||
using static Globals.main;
|
||||
@@ -29,12 +30,8 @@ namespace Gui
|
||||
logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
|
||||
try
|
||||
{
|
||||
|
||||
Game currGame = (Game)HttpContext.Current.Application["currGame"];
|
||||
|
||||
IList<state> boundList2 = (IList<state>)teams.DataSource;
|
||||
state currPloeg = boundList2[teams.SelectedIndex];
|
||||
|
||||
state currPloeg = (state)Enum.Parse(typeof(state), teams.SelectedValue);
|
||||
double cash = double.Parse(amount.Text);
|
||||
Person currPers = (Person)HttpContext.Current.Application["user"];
|
||||
if (cash > currPers.balance)
|
||||
|
@@ -12,6 +12,8 @@ namespace Gui
|
||||
public partial class addMatch : System.Web.UI.Page
|
||||
{
|
||||
LogicLayer logic;
|
||||
static List<Ploeg> p;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -19,24 +21,25 @@ namespace Gui
|
||||
{
|
||||
logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
|
||||
dag.DataSource = Enumerable.Range(1, 31).ToArray<int>();
|
||||
dag.DataBind();
|
||||
maand.DataSource= Enumerable.Range(1, 12).ToArray<int>();
|
||||
maand.DataBind();
|
||||
jaar.DataSource = Enumerable.Range(2015, 10).ToArray<int>();
|
||||
jaar.DataBind();
|
||||
ploeg1.DataSource = logic.ploegen;
|
||||
p = logic.ploegen;
|
||||
ploeg1.DataSource = p;
|
||||
ploeg2.DataSource = p;
|
||||
ploeg1.DataBind();
|
||||
ploeg2.DataSource = logic.ploegen;
|
||||
ploeg2.DataBind();
|
||||
jaar.DataBind();
|
||||
maand.DataBind();
|
||||
dag.DataBind();
|
||||
}
|
||||
}
|
||||
|
||||
public void matchadd_Click(object sender, EventArgs e)
|
||||
{
|
||||
IList<Ploeg> p1l = (IList<Ploeg>)ploeg1.DataSource;
|
||||
IList<Ploeg> p2l = (IList<Ploeg>)ploeg2.DataSource;
|
||||
Ploeg home = p1l[ploeg1.SelectedIndex];
|
||||
Ploeg away = p2l[ploeg2.SelectedIndex];
|
||||
|
||||
logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
|
||||
Ploeg home = logic.getPloegByString(ploeg1.SelectedValue);
|
||||
Ploeg away = logic.getPloegByString(ploeg2.SelectedValue);
|
||||
int d, m, y = 0;
|
||||
if (home == away)
|
||||
{
|
||||
@@ -62,9 +65,6 @@ namespace Gui
|
||||
statusLabel.Text = "There was a problem parsing the data try again";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Game g = new Game(home, away, new DateTime(y, m, d));
|
||||
logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
|
||||
logic.addGame(g);
|
||||
|
@@ -26,6 +26,7 @@ namespace Gui
|
||||
logic.addPloeg(p);
|
||||
logic.save();
|
||||
HttpContext.Current.Application["logic"] = logic;
|
||||
Response.Redirect("Admin.aspx");
|
||||
}
|
||||
public void ret_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using Globals.classes;
|
||||
using Logic;
|
||||
|
||||
namespace Gui
|
||||
@@ -17,6 +19,8 @@ namespace Gui
|
||||
logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
|
||||
listGames.DataSource = logic.games;
|
||||
listGames.DataBind();
|
||||
Person test = (Globals.classes.Person)HttpContext.Current.Application["user"];
|
||||
Debug.Print(test.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -171,5 +171,44 @@ namespace Logic
|
||||
{
|
||||
persons[persons.FindIndex(e => e.Id == p.Id)] = p;
|
||||
}
|
||||
|
||||
public Person getPersonByString(string s)
|
||||
{
|
||||
foreach (Person p in persons)
|
||||
{
|
||||
if (p.ToString() == s)
|
||||
{
|
||||
return p;
|
||||
}
|
||||
}
|
||||
throw new Exception("No person by that personString found");
|
||||
}
|
||||
|
||||
public Ploeg getPloegByString(string s)
|
||||
{
|
||||
foreach (Ploeg p in ploegen)
|
||||
{
|
||||
if (p.ToString() == s) return p;
|
||||
}
|
||||
throw new Exception("No ploeg by that ploegString was found");
|
||||
}
|
||||
|
||||
public Game getGameByString(string s)
|
||||
{
|
||||
foreach (Game g in games)
|
||||
{
|
||||
if (g.ToString() == s) return g;
|
||||
}
|
||||
throw new Exception("No game by that gameString found");
|
||||
}
|
||||
|
||||
public Bet getBetByString(string s)
|
||||
{
|
||||
foreach (Bet b in bets)
|
||||
{
|
||||
if (b.ToString() == s) return b;
|
||||
}
|
||||
throw new Exception("No bet by that betString was found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user