private void onClick(object sender, EventArgs e) { string s = (sender as Button).ID; DatabaseSingleton.getInstance().DeleteFavour(s); Response.Redirect("User.aspx"); }
protected void Create_Click(object sender, EventArgs e) { string curEmail = DatabaseSingleton.getInstance().getEmail(); string name = favourname.Text; if (curEmail == null) { WarnLog.Visible = true; WarnLog.Text = "You need to log in to create a favour"; } else if (DatabaseSingleton.getInstance().favourExists(curEmail, name)) { WarnLog.Visible = true; WarnLog.Text = "This favour already exists"; } else { WarnLog.Visible = false; string desc = Descr.Text; string cat = Category.Text; System.Diagnostics.Debug.WriteLine(DatabaseSingleton.getInstance().CreateFavour(curEmail, name, 0, cat, desc, null)); favourname.Text = ""; Descr.Text = ""; } }
protected void ChangeDets_Click(object sender, EventArgs e) { string Name = fullName.Text; string Address = address.Text; string Postcode = postcode.Text; DatabaseSingleton.getInstance().editDetails(Name, Address, Postcode); }
protected void Page_Load(object sender, EventArgs e) { List <string> details = DatabaseSingleton.getInstance().getUserDetails(); fullName.Text = details.ElementAt(0); address.Text = details.ElementAt(1); postcode.Text = details.ElementAt(2); }
protected void Button1_Click(object sender, EventArgs e) { List <string>[] favourslist; if (County.Text == "All") { favourslist = DatabaseSingleton.getInstance().DisplayFavours(); } else { favourslist = DatabaseSingleton.getInstance().DisplayCountyFavours(County.Text); } displayData(favourslist); }
private void onClick(object sender, EventArgs e) { if (DatabaseSingleton.getInstance().getEmail() != null) { LogWarn.Visible = false; string s = (sender as Button).ID; int comma = s.IndexOf(","); DatabaseSingleton.getInstance().claimFavour(s.Substring(comma + 1), s.Substring(0, comma), true); Response.Redirect("Default.aspx"); } else { LogWarn.Visible = true; } }
protected void CreateUser_Click(object sender, EventArgs e) { switch (DatabaseSingleton.getInstance().Register(Email.Text, Password.Text, Address.Text, Postcode.Text, Name.Text, County.Text)) { case "success": EmailWarn.Visible = false; Response.Redirect("../Welcome.aspx"); break; case "existingemail": EmailWarn.Text = "That email is already in use"; EmailWarn.Visible = true; break; default: EmailWarn.Text = "Sorry we encountered a problem with our servers"; EmailWarn.Visible = true; break; } }
private void displayCurrentUserFavours() { if (DatabaseSingleton.getInstance().getEmail() != null) { Table favours = new Table(); List <string>[] favourslist = DatabaseSingleton.getInstance().CurrentUserFavours(); for (int i = 0; i < favourslist[0].Count; i++) { TableRow fav = new TableRow(); TableCell a = new TableCell(); a.Text = favourslist[0].ElementAt(i); fav.Cells.Add(a); TableCell b = new TableCell(); b.Text = favourslist[1].ElementAt(i); fav.Cells.Add(b); TableCell c = new TableCell(); c.Text = favourslist[2].ElementAt(i); fav.Cells.Add(c); TableCell delete = new TableCell(); Button btn = new Button(); btn.Text = "Delete"; btn.ID = favourslist[0].ElementAt(i); btn.Click += new System.EventHandler(onClick); delete.Controls.Add(btn); fav.Cells.Add(delete); favours.Rows.Add(fav); } userFavours.Controls.Add(favours); } else { Response.Redirect("Account/Login"); } }
protected void LogIn(object sender, EventArgs e) { switch (DatabaseSingleton.getInstance().Login(Email.Text, Password.Text)) { case "credfail": DatabaseSingleton.getInstance().Logout(); LogWarn.Text = "Your email or password combination was incorrect."; LogWarn.Visible = true; break; case "confail": DatabaseSingleton.getInstance().Logout(); LogWarn.Text = "Sorry we encountered a problem with the server."; LogWarn.Visible = true; break; default: LogWarn.Visible = false; Response.Redirect("../Welcome.aspx"); break; } }
protected void Page_Load(object sender, EventArgs e) { displayData(DatabaseSingleton.getInstance().getUserLeaders()); }
protected void mech_Click(object sender, ImageClickEventArgs e) { List <string>[] favourslist = DatabaseSingleton.getInstance().DisplayCatFavours(County.Text, "Mechanical"); displayData(favourslist); }
protected void Page_Load(object sender, EventArgs e) { List <string>[] favourslist = DatabaseSingleton.getInstance().DisplayFavours(); displayData(favourslist); }
protected void Page_Load(object sender, EventArgs e) { WelcomeText.Text = DatabaseSingleton.getInstance().getUserWelcome(); }