public ScreeningMatrixReport GetScreeningMatrix(ScreeningMatrixReport report) { try { report = screeningData.GetScreeningMatrixReport(report, staff); } catch (Exception ex) { clsError.WriteException(ex); } return(report); }
public PartialViewResult GetScreeningMatrixReport(ScreeningMatrixReport screeningMatrixReport) { try { long _centerId = 0; screeningMatrixReport.SkipRows = screeningMatrixReport.GetSkipRows(); screeningMatrixReport.CenterID = string.Join(",", screeningMatrixReport.CenterID.Split(',').Select(x => long.TryParse(x, out _centerId) ? x : EncryptDecrypt.Decrypt64(x)).ToArray()); screeningMatrixReport = GetScreeningMatrix(screeningMatrixReport); } catch (Exception ex) { clsError.WriteException(ex); } return(PartialView("~/Views/Screening/_ScreeningMatrix.cshtml", screeningMatrixReport)); }
public ScreeningMatrixReport GetScreeningMatrixReport(ScreeningMatrixReport matrixReport, StaffDetails staff) { try { matrixReport.ScreeningMatrix = FactoryInstance.Instance.CreateInstance<List<ScreeningMatrix>>(); matrixReport.CenterID = string.IsNullOrEmpty(matrixReport.CenterID) ? "0" : matrixReport.CenterID; matrixReport.ClassroomID = string.IsNullOrEmpty(matrixReport.ClassroomID) ? "0" : matrixReport.ClassroomID; matrixReport.ScreeningID = string.IsNullOrEmpty(matrixReport.ScreeningID) ? "0" : matrixReport.ScreeningID; // var dbManager = new DBManager(connection.ConnectionString); var parameters = new IDbDataParameter[] { dbManager.CreateParameter("@AgencyID",staff.AgencyId,DbType.Guid), dbManager.CreateParameter("@RoleID",staff.RoleId,DbType.Guid), dbManager.CreateParameter("@UserID",staff.UserId,DbType.Guid), dbManager.CreateParameter("@CenterIDs",matrixReport.CenterID,DbType.AnsiString), dbManager.CreateParameter("@ClassroomIDs",matrixReport.ClassroomID,DbType.AnsiString), dbManager.CreateParameter("@ScreeningIDs", matrixReport.ScreeningID, DbType.AnsiString), dbManager.CreateParameter("@Take",matrixReport.PageSize,DbType.Int32), dbManager.CreateParameter("@Skip",matrixReport.SkipRows,DbType.Int32), dbManager.CreateParameter("@SortOrder",matrixReport.SortOrder,DbType.String), dbManager.CreateParameter("@SortColumn",matrixReport.SortColumn,DbType.String), dbManager.CreateParameter("@SearchTerm",matrixReport.SearchTerm,DbType.String), dbManager.CreateParameter("@TotalRecord",int.MaxValue,0,DbType.Int32,ParameterDirection.Output) }; //DataSet datset = dbManager.GetDataSet("USP_GetScreeningMatrixReport", CommandType.StoredProcedure, parameters); reader = dbManager.GetDataReader("USP_GetScreeningMatrixReport", CommandType.StoredProcedure, parameters, out dbConnection); try { while (reader.Read()) { matrixReport.ScreeningMatrix.Add(new ScreeningMatrix { CenterID =reader["CenterID"]==DBNull.Value?"0": EncryptDecrypt.Encrypt64(Convert.ToString(reader["CenterID"])), CenterName =reader["CenterName"]==DBNull.Value?string.Empty: Convert.ToString(reader["CenterName"]), ClassroomID=reader["ClassroomID"]==DBNull.Value?"0": EncryptDecrypt.Encrypt64(Convert.ToString(reader["ClassroomID"])), ClassroomName=reader["ClassroomName"]==DBNull.Value?string.Empty: Convert.ToString(reader["ClassroomName"]), ScreeningID =reader["ScreeningID"]==DBNull.Value?0: Convert.ToInt32(reader["ScreeningID"]), ScreeningName=reader["ScreeningName"]==DBNull.Value?string.Empty: Convert.ToString(reader["ScreeningName"]), UptoDate = reader["UptoDate"]==DBNull.Value?0: Convert.ToInt64(reader["UptoDate"]), Missing =reader["Missing"]==DBNull.Value?0: Convert.ToInt64(reader["Missing"]), Expired = reader["Expired"]==DBNull.Value?0:Convert.ToInt64(reader["Expired"]), Expiring =reader["Expiring"]==DBNull.Value?0: Convert.ToInt64(reader["Expiring"]), StepUpToQualityStars=reader["StepUpToQualityStars"]==DBNull.Value?string.Empty:Convert.ToString(reader["StepUpToQualityStars"]) }); } } catch (Exception ex) { clsError.WriteException(ex); } finally { reader.Close(); dbManager.CloseConnection(dbConnection); } matrixReport.TotalRecord = Convert.ToInt32(parameters.Where(x => x.ParameterName == "@TotalRecord" && x.Direction == ParameterDirection.Output).Select(x => x.Value).First()); } catch (Exception ex) { clsError.WriteException(ex); } return matrixReport; }
//[CustAuthFilter()] //[HttpPost] //[ValidateInput(false)] public void ExportScreeningMatrixReport(ScreeningMatrixReport screeningMatrixReport, int reportFormatType) { try { screeningMatrixReport.RequestedPage = 0; screeningMatrixReport.PageSize = 0; screeningMatrixReport.SkipRows = screeningMatrixReport.GetSkipRows(); screeningMatrixReport.SortColumn = "Classroom"; screeningMatrixReport.SortOrder = "ASC"; long _centerId = 0; screeningMatrixReport.SkipRows = screeningMatrixReport.GetSkipRows(); screeningMatrixReport.CenterID = string.Join(",", screeningMatrixReport.CenterID.Split(',').Select(x => long.TryParse(x, out _centerId) ? x : EncryptDecrypt.Decrypt64(x)).ToArray()); screeningMatrixReport = GetScreeningMatrix(screeningMatrixReport); #region Itextsharp PDF generation Region string imagePath = Server.MapPath("~/Images/"); if (EnumHelper.GetEnumByStringValue <FingerprintsModel.Enums.ReportFormatType>(reportFormatType.ToString()) == FingerprintsModel.Enums.ReportFormatType.Pdf) { MemoryStream workStream = Fingerprints.Common.FactoryInstance.Instance.CreateInstance <Export>().ExportScreeningMatrixReportPdf(screeningMatrixReport, imagePath); byte[] bytes = workStream.ToArray(); workStream.Close(); Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", "attachment; filename=Screening_Matrix_Report " + DateTime.Now.ToString("MM/dd/yyyy") + ".pdf"); Response.Buffer = true; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.BinaryWrite(bytes); Response.End(); Response.Close(); } else if (EnumHelper.GetEnumByStringValue <FingerprintsModel.Enums.ReportFormatType>(reportFormatType.ToString()) == FingerprintsModel.Enums.ReportFormatType.Xls) { Response.Clear(); Response.Buffer = true; Response.Charset = ""; Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attachment;filename=Screening_Matrix_Report " + DateTime.Now.ToString("MM/dd/yyyy") + ".xlsx"); MemoryStream ms = Fingerprints.Common.FactoryInstance.Instance.CreateInstance <Export>().ExportScreeningMatrixReportExcel(screeningMatrixReport, imagePath); ms.WriteTo(Response.OutputStream); Response.Flush(); Response.End(); } #endregion } catch (Exception ex) { clsError.WriteException(ex); } }