public byte[] GenerateReportForUserActivity(string physicalPath, string userName) { GenerateReportBase(); l1.Add(HeaderLogo(physicalPath)); l1.Add(SubjectBlock(new Paragraph("Report Name: User Activity with Dates and Times"))); l1.Add(UserName(new Paragraph("User Name: " + userName))); PdfPTable table = new PdfPTable(2); table.AddCell(CellHeader("User Name")); table.AddCell(CellHeader("Date Time")); AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations(); List <UserLoginAuditTrail> userActivityAuditTrails = aNaOps.GetUserActivityAuditTrailsBySpecificUser(aNaOps.GetUserIDByUserName(userName)); int recordsCount = 0; foreach (UserLoginAuditTrail item in userActivityAuditTrails) { table.AddCell(CellData(item.UserName)); table.AddCell(CellData(item.DateTimeLogged.ToString())); if (recordsCount >= pdfReportRecordCount) { break; } recordsCount++; } l1.Add(table); FooterLines.Add("DateTime: " + DateTime.Now.ToString()); l1.Close(); DocumentBytes = PDFStream.GetBuffer(); return(DocumentBytes); }
public static DateTime GetExpiryDate() { String userName = System.Web.Security.Membership.GetUser().UserName; AuthenticationsAndAuthorizationsOperations AuthenticationsAndAuthorizationsOperations = new AuthenticationsAndAuthorizationsOperations(); DateTime expirydate = AuthenticationsAndAuthorizationsOperations.GetExpiryDate(userName); return(expirydate); }