You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.8 KiB

  1. using System;
  2. using System.Data;
  3. using System.Text;
  4. using System.Web.UI;
  5. using Swift.DAL.BL.System.Notification;
  6. using Swift.web.Library;
  7. namespace Swift.web.SwiftSystem.Notification.LoginLogs
  8. {
  9. public partial class Manage : System.Web.UI.Page
  10. {
  11. private readonly ApplicationLogsDao _apllicationLogsDao = new ApplicationLogsDao();
  12. private readonly RemittanceLibrary _swiftLibrary = new RemittanceLibrary();
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. Authenticate();
  16. if (!IsPostBack)
  17. {
  18. if (GetLogId() > 0)
  19. {
  20. PopulateOperation();
  21. }
  22. }
  23. }
  24. private long GetLogId()
  25. {
  26. return (Request.QueryString["log_Id"] != null ? long.Parse(Request.QueryString["log_Id"]) : 0);
  27. }
  28. private void PopulateOperation()
  29. {
  30. DataTable dt = _apllicationLogsDao.PopulateLoginLogById(GetLogId().ToString());
  31. if (dt == null || dt.Rows.Count < 1)
  32. return;
  33. DataRow dr = dt.Rows[0];
  34. createdDate.Text = dr["createdDate"].ToString();
  35. lblReason.Text = dr["Reason"].ToString();
  36. dataId.Text = dr["log_id"].ToString();
  37. lblInput.Text = dr["UserData"].ToString();
  38. createdBy.Text = dr["createdBy"].ToString();
  39. logType.Text = dr["logType"].ToString();
  40. if (dr["logType"].ToString().ToLower() != "logout")
  41. {
  42. changeDetails.Visible = true;
  43. PrintChanges(dt);
  44. }
  45. else
  46. {
  47. changeDetails.Visible = false;
  48. }
  49. }
  50. private void PrintChanges(DataTable dt)
  51. {
  52. if (dt.Rows.Count == 0)
  53. {
  54. rpt_grid.InnerHtml = "<center><b></b><center>";
  55. return;
  56. }
  57. DataRow dr = dt.Rows[0];
  58. DataTable dt2 = GetStatic.GetStringToTable(dr["fieldvalue"].ToString());
  59. var str =new StringBuilder("<table border=\"0\" class=\"table table-bordered table-striped\" cellpadding=\"0\" cellspacing=\"0\" >");
  60. str.Append("<tr>");
  61. str.Append("<th align=\"left\">Category</th>");
  62. str.Append("<th align=\"left\">Value</th>");
  63. str.Append("</tr>");
  64. foreach (DataRow dr2 in dt2.Rows)
  65. {
  66. str.Append("<tr>");
  67. str.Append("<td align=\"left\">" + dr2[0] + "</td>");
  68. str.Append("<td align=\"left\">" + dr2[1] + "</td>");
  69. str.Append("</tr>");
  70. }
  71. str.Append("</table>");
  72. rpt_grid.InnerHtml = str.ToString();
  73. }
  74. private void Authenticate()
  75. {
  76. _swiftLibrary.CheckAuthentication("10121100");
  77. }
  78. }
  79. }