Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7.  
  8. public partial class LoginPage : System.Web.UI.Page
  9. {
  10. Shop myShop;
  11.  
  12. protected void Page_Load(object sender, EventArgs e)
  13. {
  14. //checks if there is a session vairable present - should only run once at the start of the website use
  15. if(Session["myShop"] == null)
  16. {
  17. myShop = new Shop();
  18. myShop.loadPeopleFromDb();
  19. //saves a variable into the session
  20. Session["myShop"] = myShop;
  21. }
  22. else
  23. {
  24. myShop = (Shop)Session["myShop"];
  25. }
  26.  
  27.  
  28. }
  29.  
  30.  
  31. protected void SubmitBtn_Click(object sender, EventArgs e)
  32. {
  33. string username = UsernameTxt.Text;
  34. string password = PasswordTxt.Text;
  35.  
  36. myShop.login(username, password);
  37.  
  38. }
  39.  
  40. protected void ClearBtn_Click(object sender, EventArgs e)
  41. {
  42. Response.Redirect("LoginPage.aspx");
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement