Guest User

Untitled

a guest
Oct 24th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3. if (!Page.IsPostBack)
  4. {
  5. if (!String.IsNullOrEmpty(Request.QueryString["id"]))
  6. {
  7. string guid = Request.QueryString["id"].ToString();
  8. using (var db = new Entities())
  9. {
  10. var q = from u in db.Users
  11. where u.UniGuid == guid
  12. select u;
  13. if (q.Any())
  14. {
  15. Label1.Text = "You have to fill the blank below to change your password";
  16.  
  17. }
  18. btnReset.Visible = true;
  19. txtPassword.Visible = true;
  20. }
  21. }
  22.  
  23. }
  24. }
  25. protected void btnReset_Click(object sender, EventArgs e)
  26. {
  27.  
  28. string guid = Request.QueryString["id"].ToString();
  29. using (var db = new Entities())
  30. {
  31. var q = from u in db.Users
  32. where u.UniGuid == guid
  33. select u;
  34. if (q.Any())
  35. {
  36. //Users u = new Users();
  37. //u.Password = txtPassword.Text;
  38. q.First().Password = txtPassword.Text;
  39. db.SaveChanges();
  40. }
  41. }
  42.  
  43. }
  44.  
  45. var objUser = db.Users
  46. .FirstOrDefault(x => x.UniGuid.Equals(guid));
Add Comment
Please, Sign In to add comment