Merged PR 16782: Added logic to display Category and Training Notification fields on PDF

Added logic to display Category and Training Notification fields on PDF

Related work items: #135474, #225483
This commit is contained in:
2025-05-19 22:20:00 +02:00
parent 032c971472
commit 8bae94de96
4 changed files with 148 additions and 77 deletions

View File

@ -883,6 +883,8 @@ public class ECNController : PdfViewController {
string outputFileName = "";
ecn = ecnDMO.GetECNPdf(ecnNumber);
ViewBag.Category = ecnDMO.GetCategoryID(ecn);
ViewBag.TrainingNotificationTo = ecnDMO.GetTrainingNotificationTo(ecn, trainingDMO);
outputFileName = ecnNumber.ToString() + ".pdf";
string ecnFolderPath = _AppSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString();
@ -910,6 +912,8 @@ public class ECNController : PdfViewController {
string outputFileName = "";
ecn = ecnDMO.GetECNPdf(ecnNumber);
ViewBag.Category = ecnDMO.GetCategoryID(ecn);
ViewBag.TrainingNotificationTo = ecnDMO.GetTrainingNotificationTo(ecn, trainingDMO);
outputFileName = ecnNumber.ToString() + ".pdf";
string ecnFolderPath = _AppSettings.AttachmentFolder + "ECN\\" + folderName.ToString();
@ -935,13 +939,15 @@ public class ECNController : PdfViewController {
ECNPdf ecn;
try {
ecn = ecnDMO.GetECNPdf(ecnNumber);
ViewBag.Category = ecnDMO.GetCategoryID(ecn);
ViewBag.TrainingNotificationTo = ecnDMO.GetTrainingNotificationTo(ecn, trainingDMO);
// To render a PDF instead of an HTML, all we need to do is call ViewPdf instead of View. This
// requires the controller to be inherited from MyController instead of MVC's Controller.
return this.ViewPdf("", "ECNPdf", ecn);
} catch (Exception ex) {
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "ECN", OperationType = "Print PDF", Comments = ex.Message });
ecn = null;
return Content("");
return Content("An unexpected error has occurred!");
}
}