mirror of
https://github.com/bvanroll/cs-oo-project.git
synced 2025-08-29 20:12:40 +00:00
yup
This commit is contained in:
57
Online Gokkantoor/Gui/addUser.aspx.cs
Normal file
57
Online Gokkantoor/Gui/addUser.aspx.cs
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user