/// <summary> /// Gets the string row values. /// </summary> /// <param name="auditLogReport">The audit log report.</param> /// <returns></returns> private static IEnumerable <string> GetStringRowValues(AuditLogReportViewModel auditLogReport) { return(new[] { auditLogReport.AuditLogId.ToString(CultureInfo.InvariantCulture), auditLogReport.LoggedDate.ToString(CultureInfo.InvariantCulture), auditLogReport.UserName, auditLogReport.Action, auditLogReport.ObjectType, auditLogReport.FacilityName, auditLogReport.ModelName, auditLogReport.ContractName, auditLogReport.ServiceTypeName, auditLogReport.Description }); }
//FIXED-NOV15 - In place of 3 argument use AuditLogReport model which has all properties /// <summary> /// Audits the log report. /// </summary> /// <param name="auditLogReport">The audit log report.</param> /// <param name="currentDateTime">The current date time.</param> /// <returns></returns> public ActionResult AuditLogReport(AuditLogReport auditLogReport, string currentDateTime) { string currentUserName = GetCurrentUserName(); auditLogReport.UserName = currentUserName; auditLogReport.CommandTimeoutForAuditLog = Convert.ToInt32(GlobalConfigVariable.CommandTimeoutForClaimAdjudication); auditLogReport.MaxLinesForCsvReport = Convert.ToInt32(GlobalConfigVariable.MaxRecordLimitForExcelReport); auditLogReport.CurrentDateTime = currentDateTime; auditLogReport.FacilityName = GetCurrentFacilityName(); AuditLogReportViewModel auditLogReportViewModelList = Mapper.Map <AuditLogReport, AuditLogReportViewModel>( PostApiResponse <AuditLogReport>(Constants.AuditLogReport, Constants.GetAuditLogReport, auditLogReport)); // Gets the current CST time. auditLogReportViewModelList.CurrentDateTime = Utilities.GetLocalTimeString(currentDateTime); auditLogReportViewModelList.UserName = currentUserName; return(Json(AuditLogReportUtil.GetExportedFileName(auditLogReportViewModelList, GlobalConfigVariable.ReportsFilePath))); }
/// <summary> /// Gets the name of the exported file. /// </summary> /// <param name="auditLogReportViewModel">The audit log report view model.</param> /// <param name="configuredPath">The configured path.</param> /// <returns></returns> public static string GetExportedFileName(AuditLogReportViewModel auditLogReportViewModel, string configuredPath) { if (!Directory.Exists(configuredPath)) { Directory.CreateDirectory(configuredPath); } string fileName; if (auditLogReportViewModel.MaxLinesForCsvReport < 0) { return(Convert.ToString(auditLogReportViewModel.MaxLinesForCsvReport)); } switch (auditLogReportViewModel.AuditLogReportList.Count) { case 0: fileName = Constants.EmptyReportResult; break; default: fileName = GenerateCsvFile(auditLogReportViewModel.AuditLogReportList); break; } return(fileName); }