public string Generate(int studyId) { ReportObject report = new ReportObject(studyId,false); if(report.Load()) { string filePath = ConfigurationManager.AppSettings["ReportPath"]; string fileName = Guid.NewGuid().ToString(); string completePath = filePath + "\\" + fileName + ".pdf"; Document doc = new Document(); doc.SetMargins(103f,103f,103f,103f); PdfWriter.GetInstance(doc, new FileStream(completePath,FileMode.Create)); doc.Open(); PdfPTable table = new PdfPTable(2); table.WidthPercentage = 100; table.DefaultCell.Colspan = 2; table.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; table.AddCell(report.ClientName); table.AddCell(report.ClientAddress); table.AddCell(report.HospitalName); table.DefaultCell.Colspan = 1; table.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; table.AddCell("PATIENT NAME:"); table.AddCell(report.PatientName); table.AddCell("DATE OF BIRTH:"); table.AddCell(report.DateOfBirth); table.AddCell("DATE OF EXAM:"); table.AddCell(report.StudyDate); table.AddCell("TYPE OF EXAM:"); table.AddCell(report.Modality); table.AddCell("REFERRING PHYSICAN:"); table.AddCell(report.ReferringPhysician); table.AddCell("REPORT DATE:"); table.AddCell(report.ReportDate); table.DefaultCell.Colspan = 2; table.AddCell(report.Transcription); table.AddCell(report.Radiologist); table.AddCell(report.ReportDateTime); table.AddCell("Report Status: " + report.Status); table.AddCell(report.ManualStatus); doc.Add(table); doc.Close(); return completePath; } return null; }
protected override void Page_Load_Extended(object sender, EventArgs e) { int studyId = int.Parse(Request[ParameterNames.Request.StudyId]); report = new ReportObject(studyId,true); if (report.Load()) { if (IsPostBack == false) { faxBtn.OnClientClick = ClientClickForFaxBtn(); } lblClientName.Text = report.ClientName; lblClientAddress.Text = report.ClientAddress; lblModality.Text = report.Modality; lblManualStatus.Text = report.ManualStatus; lblPatientName.Text = report.PatientName; lblDOB.Text = report.DateOfBirth; lblRefPhy.Text = report.ReferringPhysician; lblStudyDate.Text = report.StudyDate; lblTranscription.Text = report.Transcription; lblReportDateTime.Text = report.ReportDateTime; lblReportDate.Text = report.ReportDate; lblRadiologist.Text = report.Radiologist; lblStatus.Text = report.Status; lblHospitalName.Text = report.HospitalName; LogObject log = new LogObject(); log.UserId.Value = loggedInUserId; log.StudyId.Value = studyId; log.PatientId.Value = report.PatientId; log.Action.Value = Constants.LogActions.ViewedStudy; log.ActionTime.Value = DateTime.Now; log.Save(); } }