PageRenderTime 37ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/BaliEnterpriseSystems/BaliEnterpriseSystems/Logout.aspx.cs

https://github.com/sirivedula/BEST
C# | 50 lines | 46 code | 4 blank | 0 comment | 7 complexity | fef9af641d64bfb0f59869cf1efe799f MD5 | raw file
  1. using System;
  2. using System.Collections;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.HtmlControls;
  10. using System.Web.UI.WebControls;
  11. using System.Web.UI.WebControls.WebParts;
  12. using System.Xml.Linq;
  13. using BaliEnterpriseSystems.BestObjects;
  14. using System.Collections.Generic;
  15. namespace BaliEnterpriseSystems
  16. {
  17. public partial class Logout : System.Web.UI.Page
  18. {
  19. protected void Page_LoadComplete(object sender, EventArgs e)
  20. {
  21. if (HttpContext.Current.Session["CurrentUser"] != null)
  22. {
  23. var cUser = Utils.User.BestUser;
  24. if (cUser != null)
  25. {
  26. var sessguid = HttpContext.Current.Session["SessionGuid"];
  27. if (sessguid != null)
  28. {
  29. BestField sguid = new BestField() { fieldName = "sessionguid", fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, fieldSize = 40 };
  30. sguid.fieldValue = sessguid.ToString();
  31. BestLogins bslog = new BestLogins();
  32. List<BestField> bparam = new List<BestField>();
  33. bparam.Add(sguid);
  34. bslog.LoadRows("sessionguid=?", bparam);
  35. if (bslog.TableRows.Count > 0)
  36. {
  37. bslog.logoutdate = DateTime.Now;
  38. bslog.CurrentRow.Save();
  39. }
  40. }
  41. }
  42. }
  43. Session.Contents.Abandon();
  44. }
  45. }
  46. }