This commit is contained in:
Beppe
2019-07-04 01:05:11 +02:00
parent 60eb72bd30
commit df39b0392c
67 changed files with 2147 additions and 31 deletions

View File

@@ -0,0 +1,17 @@
<%@ Page Language="C#" Inherits="Gui.Admin" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Admin</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Button id="addUser" OnClick="addUser_Click" runat="server" Text="addUser"/>
<asp:Button id="addMatch" OnClick="addMatch_Click" runat="server" Text="addMatch"/>
<asp:Button id="addPloeg" OnClick="addPloeg_Click" runat="server" Text="addPloeg"/>
<p>games:</p>
<asp:ListBox id="listGames" runat="server"/>
<asp:Button id="updateGame" OnClick="updateGame_Click" runat="server" Text="updateGame"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using Globals.classes;
using Logic;
namespace Gui
{
public partial class Admin : System.Web.UI.Page
{
LogicLayer logic;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
listGames.DataSource = logic.games;
listGames.DataBind();
}
}
public void addUser_Click(object sender, EventArgs args)
{
Server.Transfer("addUser.aspx");
}
public void addBet_Click(object sender, EventArgs args)
{
Server.Transfer("addBet.aspx");
}
public void addMatch_Click(object sender, EventArgs args)
{
Server.Transfer("addMatch.aspx");
}
public void addPloeg_Click(object sender, EventArgs args)
{
Server.Transfer("addPloeg.aspx");
}
public void updateGame_Click(object sender, EventArgs args)
{
IList<Game> boundList2 = (IList<Game>)listGames.DataSource;
HttpContext.Current.Application["currGame"] = boundList2[listGames.SelectedIndex];
Server.Transfer("updateGame.aspx");
}
}
}

View File

@@ -0,0 +1,28 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Gui {
public partial class Admin {
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected System.Web.UI.WebControls.Button addUser;
protected System.Web.UI.WebControls.Button addMatch;
protected System.Web.UI.WebControls.Button addPloeg;
protected System.Web.UI.WebControls.ListBox listGames;
protected System.Web.UI.WebControls.Button updateGame;
}
}

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1 @@
[{"Id":0,"name":"beppe","lastname":"vanrolleghem","adress":"123 straat","gsm":"1929192919","balance":0.0}]

View File

@@ -0,0 +1 @@
[{"Id":0,"naam":"bepkes","score":-2147483648,"scoreSet":false},{"Id":1,"naam":"selmakes","score":-2147483648,"scoreSet":false}]

View File

@@ -0,0 +1,14 @@
<%@ Page Language="C#" Inherits="Gui.Default" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Default</title>
</head>
<body>
<p>lorem ipsum</p>
<form id="form1" runat="server">
<asp:Button id="button1" runat="server" Text="Login" OnClick="button1Clicked" />
<asp:Button id="adminBtn" runat="server" Text="admin" OnClick="buttonAdminClicked" />
</form>
</body>
</html>

View File

@@ -0,0 +1,19 @@
using System;
using System.Web;
using System.Web.UI;
namespace Gui
{
public partial class Default : System.Web.UI.Page
{
public void button1Clicked(object sender, EventArgs args)
{
Server.Transfer("Login.aspx");
}
public void buttonAdminClicked(object sender, EventArgs args)
{
Server.Transfer("Admin.aspx");
}
}
}

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Gui {
public partial class Default {
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected System.Web.UI.WebControls.Button button1;
protected System.Web.UI.WebControls.Button adminBtn;
}
}

View File

@@ -0,0 +1 @@
<%@ Application Inherits="Gui.Global" %>

View File

@@ -0,0 +1,16 @@
using System.Web;
using Logic;
namespace Gui
{
public class Global : HttpApplication
{
protected void Application_Start()
{
System.Web.HttpContext.Current.Application["logic"] = new LogicLayer();
System.Web.HttpContext.Current.Application["debug"] = false;
}
}
}

View File

@@ -0,0 +1,140 @@
<?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>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{62B345B0-420C-4926-9E6E-9B532AFD3713}</ProjectGuid>
<ProjectTypeGuids>{349C5851-65DF-11DA-9384-00065B846F21};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>Gui</RootNamespace>
<AssemblyName>Gui</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Web.Services" />
</ItemGroup>
<ItemGroup>
<Content Include="Global.asax" />
<Content Include="Web.config" />
<Content Include="Default.aspx" />
<Content Include="Login.aspx" />
<Content Include="mainForm.aspx" />
<Content Include="Admin.aspx" />
<Content Include="addUser.aspx" />
<Content Include="addBet.aspx" />
<Content Include="addMatch.aspx" />
<Content Include="addPloeg.aspx" />
<Content Include="addBalance.aspx" />
<Content Include="updateGame.aspx" />
</ItemGroup>
<ItemGroup>
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Default.aspx.cs">
<DependentUpon>Default.aspx</DependentUpon>
</Compile>
<Compile Include="Default.aspx.designer.cs">
<DependentUpon>Default.aspx</DependentUpon>
</Compile>
<Compile Include="Login.aspx.cs">
<DependentUpon>Login.aspx</DependentUpon>
</Compile>
<Compile Include="Login.aspx.designer.cs">
<DependentUpon>Login.aspx</DependentUpon>
</Compile>
<Compile Include="mainForm.aspx.cs">
<DependentUpon>mainForm.aspx</DependentUpon>
</Compile>
<Compile Include="mainForm.aspx.designer.cs">
<DependentUpon>mainForm.aspx</DependentUpon>
</Compile>
<Compile Include="Admin.aspx.cs">
<DependentUpon>Admin.aspx</DependentUpon>
</Compile>
<Compile Include="Admin.aspx.designer.cs">
<DependentUpon>Admin.aspx</DependentUpon>
</Compile>
<Compile Include="addUser.aspx.cs">
<DependentUpon>addUser.aspx</DependentUpon>
</Compile>
<Compile Include="addUser.aspx.designer.cs">
<DependentUpon>addUser.aspx</DependentUpon>
</Compile>
<Compile Include="addBet.aspx.cs">
<DependentUpon>addBet.aspx</DependentUpon>
</Compile>
<Compile Include="addBet.aspx.designer.cs">
<DependentUpon>addBet.aspx</DependentUpon>
</Compile>
<Compile Include="addMatch.aspx.cs">
<DependentUpon>addMatch.aspx</DependentUpon>
</Compile>
<Compile Include="addMatch.aspx.designer.cs">
<DependentUpon>addMatch.aspx</DependentUpon>
</Compile>
<Compile Include="addPloeg.aspx.cs">
<DependentUpon>addPloeg.aspx</DependentUpon>
</Compile>
<Compile Include="addPloeg.aspx.designer.cs">
<DependentUpon>addPloeg.aspx</DependentUpon>
</Compile>
<Compile Include="addBalance.aspx.cs">
<DependentUpon>addBalance.aspx</DependentUpon>
</Compile>
<Compile Include="addBalance.aspx.designer.cs">
<DependentUpon>addBalance.aspx</DependentUpon>
</Compile>
<Compile Include="updateGame.aspx.cs">
<DependentUpon>updateGame.aspx</DependentUpon>
</Compile>
<Compile Include="updateGame.aspx.designer.cs">
<DependentUpon>updateGame.aspx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Logic\Logic.csproj">
<Project>{82F1AF49-F9FA-42A1-BD3B-A37C36E340AD}</Project>
<Name>Logic</Name>
</ProjectReference>
<ProjectReference Include="..\Globals\Globals.csproj">
<Project>{3643BC50-8412-4C17-99E0-9D4BF7EDEB78}</Project>
<Name>Globals</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Data\" />
</ItemGroup>
<ItemGroup>
<None Include="Data\persons.json" />
<None Include="Data\bets.json" />
<None Include="Data\ploegen.json" />
<None Include="Data\games.json" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties>
<XspParameters Port="8080" Address="127.0.0.1" SslMode="None" SslProtocol="Default" KeyType="None" CertFile="" KeyFile="" PasswordOptions="None" Password="" Verbose="True" />
</Properties>
</MonoDevelop>
</ProjectExtensions>
</Project>

View File

@@ -0,0 +1,14 @@
<%@ Page Language="C#" Inherits="Gui.Login" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Login</title>
</head>
<body>
<h1>HI</h1>
<form id="form1" runat="server">
<asp:ListBox id="lstUsers" runat="server"/>
<asp:Button id="LoginBtn" runat="server" OnClick="Login_Click"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using Logic;
namespace Gui
{
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
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);
}
public void Login_Click(object o, EventArgs e)
{
HttpContext.Current.Application["user"] = lstUsers.SelectedItem;
Server.Transfer("mainForm.aspx");
}
}
}

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Gui {
public partial class Login {
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected System.Web.UI.WebControls.ListBox lstUsers;
protected System.Web.UI.WebControls.Button LoginBtn;
}
}

View File

@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!--
Web.config file for Gui.
The settings that can be used in this file are documented at
http://www.mono-project.com/Config_system.web and
http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5">
<assemblies />
</compilation>
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>

View File

@@ -0,0 +1,15 @@
<%@ Page Language="C#" Inherits="Gui.addBalance" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>addBalance</title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox id="balans" runat="server"/>
<asp:Label id="statusLabel" runat="server"/>
<asp:Button id="confirm" OnClick="add" runat="server"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,27 @@
using System;
using System.Web;
using System.Web.UI;
using Globals.classes;
namespace Gui
{
public partial class addBalance : System.Web.UI.Page
{
public void add(Object o, EventArgs e)
{
try
{
double bal = double.Parse(balans.Text);
((Person)HttpContext.Current.Application["user"]).balance += bal;
Response.Redirect("mainForm.aspx");
}
catch (Exception ex)
{
statusLabel.Text = "There was a problem parsing the balance, try again. (format 0.00)";
return;
}
}
}
}

View File

@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Gui {
public partial class addBalance {
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected System.Web.UI.WebControls.TextBox balans;
protected System.Web.UI.WebControls.Label statusLabel;
protected System.Web.UI.WebControls.Button confirm;
}
}

View File

@@ -0,0 +1,21 @@
<%@ Page Language="C#" Inherits="Gui.addBet" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>addBet</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label id="gameinfo" runat="server"/>
<p>Amount</p>
<asp:TextBox id="amount" runat="server"/>
<p>on</p>
<asp:DropDownList id="teams" runat="server"/>
<p>BetType</p>
<asp:DropDownList id="type" runat="server"/>
<asp:Label id="lblStatus" runat="server"/>
<asp:Button id="PlaceBet" runat="server" OnClick="placeBet"/>
<asp:Button id="cancel" runat="server" OnClick="ret"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using Globals.classes;
using Logic;
using static Globals.main;
namespace Gui
{
public partial class addBet : System.Web.UI.Page
{
LogicLayer logic;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
Game currGame = (Game)HttpContext.Current.Application["currGame"];
teams.DataSource = new List<state> { state.home, state.away, state.draw };
gameinfo.Text = currGame.ToString();
}
}
public void placeBet(object sender, EventArgs e)
{
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];
double cash = double.Parse(amount.Text);
Person currPers = (Person)HttpContext.Current.Application["user"];
if (cash > currPers.balance)
{
lblStatus.Text = "You dont have enough cash my guy.";
}else
{
currPers.balance -= cash;
logic.updatePerson(currPers);
}
Bet b = new Bet(currGame, currPers, cash, currPloeg);
logic.addBet(b);
lblStatus.Text = "Bet placed";
HttpContext.Current.Application["user"] = currPers;
return;
} catch (Exception ex)
{
lblStatus.Text = ex.Message;
return;
}
}
public void ret(object sender, EventArgs e)
{
Response.Redirect("mainForm.aspx");
}
}
}

View File

@@ -0,0 +1,32 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Gui {
public partial class addBet {
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected System.Web.UI.WebControls.Label gameinfo;
protected System.Web.UI.WebControls.TextBox amount;
protected System.Web.UI.WebControls.DropDownList teams;
protected System.Web.UI.WebControls.DropDownList type;
protected System.Web.UI.WebControls.Label lblStatus;
protected System.Web.UI.WebControls.Button PlaceBet;
protected System.Web.UI.WebControls.Button cancel;
}
}

View File

@@ -0,0 +1,34 @@
<%@ Page Language="C#" Inherits="Gui.addMatch" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>addMatch</title>
</head>
<body>
<form id="form1" runat="server">
<p>leave score blank for non scores</p>
<p>Ploeg1</p>
<asp:DropDownList id="ploeg1" runat="server" />
<p>score</p>
<asp:TextBox id="score1" runat="server" />
<p>Ploeg2</p>
<asp:DropDownList id="ploeg2" runat="server" />
<p>score</p>
<asp:TextBox id="score2" runat="server" />
<p>dag</p>
<asp:DropDownList id="dag" runat="server"/>
<p>maand</p>
<asp:DropDownList id="maand" runat="server" />
<p>year</p>
<asp:DropDownList id="jaar" runat="server"/>
<p>status:</p>
<asp:Label id="statusLabel" runat="server" />
<asp:Button id="matchadd" OnClick="matchadd_Click" runat="server" Text="AddMatch"/>
<asp:Button id="returnHome" OnClick="ret" runat="server" Text="Return home" />
</form>
</body>
</html>

View File

@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using Globals.classes;
using Logic;
namespace Gui
{
public partial class addMatch : System.Web.UI.Page
{
LogicLayer logic;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
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;
ploeg1.DataBind();
ploeg2.DataSource = logic.ploegen;
ploeg2.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];
int d, m, y = 0;
if (home == away)
{
statusLabel.Text = "selecteer nie dezelfde ploege pls";
return;
}
try
{
if (score1.Text != "" || score2.Text != "")
{
home.score = int.Parse(score1.Text);
away.score = int.Parse(score2.Text);
}
d = int.Parse(dag.Text);
m = int.Parse(maand.Text);
y = int.Parse(jaar.Text);
}
catch (Exception ex)
{
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);
logic.save();
System.Web.HttpContext.Current.Application["logic"] = this.logic;
}
public void ret(object sender, EventArgs e)
{
Response.Redirect("Admin.aspx");
}
}
}

View File

@@ -0,0 +1,38 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Gui {
public partial class addMatch {
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected System.Web.UI.WebControls.DropDownList ploeg1;
protected System.Web.UI.WebControls.TextBox score1;
protected System.Web.UI.WebControls.DropDownList ploeg2;
protected System.Web.UI.WebControls.TextBox score2;
protected System.Web.UI.WebControls.DropDownList dag;
protected System.Web.UI.WebControls.DropDownList maand;
protected System.Web.UI.WebControls.DropDownList jaar;
protected System.Web.UI.WebControls.Label statusLabel;
protected System.Web.UI.WebControls.Button matchadd;
protected System.Web.UI.WebControls.Button returnHome;
}
}

View File

@@ -0,0 +1,16 @@
<%@ Page Language="C#" Inherits="Gui.addPloeg" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>addPloeg</title>
</head>
<body>
<form id="form1" runat="server">
<p>naam</p>
<asp:TextBox id="naam" runat="server"/>
<asp:Label id="status" runat="server" />
<asp:Button id="confirm" runat="server" Text="confirm" OnClick="confirm_Click"/>
<asp:Button id="ret" runat="server" Text="Return" OnClick="ret_Click"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,35 @@
using System;
using System.Web;
using System.Web.UI;
using Globals.classes;
using Logic;
namespace Gui
{
public partial class addPloeg : System.Web.UI.Page
{
LogicLayer logic;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
}
}
public void confirm_Click(object sender, EventArgs e)
{
Ploeg p = new Ploeg(naam.Text);
logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
logic.addPloeg(p);
logic.save();
HttpContext.Current.Application["logic"] = logic;
}
public void ret_Click(object sender, EventArgs e)
{
Response.Redirect("Admin.aspx");
}
}
}

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Gui {
public partial class addPloeg {
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected System.Web.UI.WebControls.TextBox naam;
protected System.Web.UI.WebControls.Label status;
protected System.Web.UI.WebControls.Button confirm;
protected System.Web.UI.WebControls.Button ret;
}
}

View File

@@ -0,0 +1,25 @@
<%@ Page Language="C#" Inherits="Gui.addUser" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>addUser</title>
</head>
<body>
<form id="form1" runat="server">
<p>Naam</p>
<asp:TextBox id="txtName" runat="server"/>
<p>Achternaam</p>
<asp:TextBox id="txtLastName" runat="server"/>
<p>addr</p>
<asp:TextBox id="txtAddr" runat="server"/>
<p>gsm</p>
<asp:TextBox id="txtGsm" runat="server"/>
<p>balans</p>
<asp:TextBox id="txtBalance" runat="server"/>
<asp:Label id="alertlabel" runat="server" />
<asp:Button id="addusr" OnClick="test" runat="server" Text="Add User"/>
<p></p>
<asp:Button id="return" OnClick="ret" runat="server" Text="Return"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,57 @@
using System;
using System.Diagnostics;
using System.Web;
using System.Web.UI;
using Globals.classes;
using Logic;
namespace Gui
{
public partial class addUser : System.Web.UI.Page
{
private LogicLayer logic;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
}
}
public void test(object sender, EventArgs e)
{
this.logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
string name = txtName.Text;
string lastname = txtLastName.Text;
string adress = txtAddr.Text;
string gsm = txtGsm.Text;
double balance = 0;
try
{
balance = double.Parse(txtBalance.Text);
}
catch (Exception ex)
{
if ((bool)System.Web.HttpContext.Current.Application["debug"])
{
alertlabel.Text = ex.ToString();
return;
}
alertlabel.Text = "There was a problem parsing your balance. Try formatting the balance as {0.00}";
return;
}
Person p = new Person(name, lastname, adress, gsm, balance);
logic.addPerson(p);
logic.save();
System.Web.HttpContext.Current.Application["logic"] = logic;
}
public void ret(object sender, EventArgs e)
{
Response.Redirect("Admin.aspx");
}
}
}

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Gui {
public partial class addUser {
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected System.Web.UI.WebControls.TextBox txtName;
protected System.Web.UI.WebControls.TextBox txtLastName;
protected System.Web.UI.WebControls.TextBox txtAddr;
protected System.Web.UI.WebControls.TextBox txtGsm;
protected System.Web.UI.WebControls.TextBox txtBalance;
protected System.Web.UI.WebControls.Label alertlabel;
protected System.Web.UI.WebControls.Button addusr;
protected System.Web.UI.WebControls.Button @return;
}
}

View File

@@ -0,0 +1,22 @@
<%@ Page Language="C#" Inherits="Gui.mainForm" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>mainForm</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label runat="server" id="labelNaam"/>
<asp:Label id="labelAdress" runat="server"/>
<asp:Label id="labelGsm" runat="server"/>
<asp:Label id="labelBalance" runat="server"/>
<asp:Button id="btnAddBalance" runat="server" Text="add balance" OnClick='btnAddBalance_Click'/>
<asp:Label id="labelTitleGamebox" runat="server" />
<asp:ListBox id ="listGames" runat="server"/>
<asp:Button id="btnPlaceBet" runat="server" Text="Place Bet On Selected Game" OnClick="placeBet_Click"/>
<p>your current bets:</p>
<asp:ListBox id="listBets" runat="server"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,33 @@
using System;
using System.Web;
using System.Web.UI;
using Logic;
namespace Gui
{
public partial class mainForm : System.Web.UI.Page
{
LogicLayer logic;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
listGames.DataSource = logic.games;
listGames.DataBind();
}
}
public void btnAddBalance_Click(object o, EventArgs e)
{
}
public void placeBet_Click(object o, EventArgs e)
{
}
}
}

View File

@@ -0,0 +1,36 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Gui {
public partial class mainForm {
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected System.Web.UI.WebControls.Label labelNaam;
protected System.Web.UI.WebControls.Label labelAdress;
protected System.Web.UI.WebControls.Label labelGsm;
protected System.Web.UI.WebControls.Label labelBalance;
protected System.Web.UI.WebControls.Button btnAddBalance;
protected System.Web.UI.WebControls.Label labelTitleGamebox;
protected System.Web.UI.WebControls.ListBox listGames;
protected System.Web.UI.WebControls.Button btnPlaceBet;
protected System.Web.UI.WebControls.ListBox listBets;
}
}

View File

@@ -0,0 +1,17 @@
<%@ Page Language="C#" Inherits="Gui.updateGame" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>updateGame</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label id="thuis" runat="server"/>
<asp:TextBox id="scoreThuis" runat="server"/>
<asp:Label id="uit" runat="server"/>
<asp:TextBox id="scoreUit" runat="server"/>
<asp:Button id="finish" OnClick="scores" runat="server" Text="confirm"/>
<asp:Button id="cancel" OnClick="ret" runat="server" Text="cancel"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,41 @@
using System;
using System.Web;
using System.Web.UI;
using Globals.classes;
using Logic;
namespace Gui
{
public partial class updateGame : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Game g = (Game)System.Web.HttpContext.Current.Application["currGame"];
thuis.Text = g.home.ToString();
uit.Text = g.away.ToString();
}
}
public void scores(Object o, EventArgs e)
{
Game g = (Game)System.Web.HttpContext.Current.Application["currGame"];
LogicLayer logic = (LogicLayer)System.Web.HttpContext.Current.Application["logic"];
try
{
int a = int.Parse(scoreThuis.Text);
int b = int.Parse(scoreUit.Text);
g.home.score = a;
g.away.score = b;
} catch (Exception ex)
{
}
}
}
}

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Gui {
public partial class updateGame {
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected System.Web.UI.WebControls.Label thuis;
protected System.Web.UI.WebControls.TextBox scoreThuis;
protected System.Web.UI.WebControls.Label uit;
protected System.Web.UI.WebControls.TextBox scoreUit;
protected System.Web.UI.WebControls.Button finish;
protected System.Web.UI.WebControls.Button cancel;
}
}