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 byte[] GenerateReportForDocumentsDownloadedBySpecificUser(string physicalPath, string userName) { GenerateReportBase(); l1.Add(HeaderLogo(physicalPath)); l1.Add(SubjectBlock(new Paragraph("Report Name: Documents Downloaded with Dates and Times"))); l1.Add(UserName(new Paragraph("User Name: " + userName))); PdfPTable table = new PdfPTable(2); table.AddCell(CellHeader("Document Name")); table.AddCell(CellHeader("Date Time")); List <FilesDownloadAuditTrail> filesDownloadedList = (new AuditTrailOperations()).GetFilesDownloadedAuditTrailsBySpecificUser(userName); int recordsCount = 0; foreach (FilesDownloadAuditTrail item in filesDownloadedList) { table.AddCell(CellData(item.FileName)); table.AddCell(CellData(item.DateTimeDownloaded.ToString())); if (recordsCount >= pdfReportRecordCount) { break; } recordsCount++; } l1.Add(table); FooterLines.Add("DateTime: " + DateTime.Now.ToString()); l1.Close(); DocumentBytes = PDFStream.GetBuffer(); return(DocumentBytes); }