From 0289e62e9f495ad600f1d63ddf031509da9b09bc Mon Sep 17 00:00:00 2001 From: Chase Tucker Date: Mon, 30 Oct 2023 13:42:08 -0700 Subject: [PATCH] Rejected CA notifications include who and why --- .../Controllers/CorrectiveActionController.cs | 19 ++++++++++++------- .../CorrectiveActionSectionRejection.txt | 7 +++++-- Fab2ApprovalSystem/Web.config | 5 +++-- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Fab2ApprovalSystem/Controllers/CorrectiveActionController.cs b/Fab2ApprovalSystem/Controllers/CorrectiveActionController.cs index fd661d8..725f284 100644 --- a/Fab2ApprovalSystem/Controllers/CorrectiveActionController.cs +++ b/Fab2ApprovalSystem/Controllers/CorrectiveActionController.cs @@ -1870,9 +1870,9 @@ namespace Fab2ApprovalSystem.Controllers int assigneeId = ca.D1AssigneeID; int requestorId = ca.RequestorID; int qaId = ca.QAID; - NotifySectionRejection(issueID, assigneeId, dSection); - NotifySectionRejection(issueID, requestorId, dSection); - NotifySectionRejection(issueID, qaId, dSection); + NotifySectionRejection(issueID, assigneeId, userID, dSection, comments); + NotifySectionRejection(issueID, requestorId, userID, dSection, comments); + NotifySectionRejection(issueID, qaId, userID, dSection, comments); return Content("Successfully Saved"); } @@ -1893,11 +1893,14 @@ namespace Fab2ApprovalSystem.Controllers return Content(e.Message); } } - public void NotifySectionRejection(int issueID, int userId, string section) + public void NotifySectionRejection(int issueID, int recipientUserId, int loggedInUserId, string section, string comment) { try { - string userEmail = userDMO.GetUserEmailByID(userId.ToString()); + LoginModel recipient = userDMO.GetUserByID(recipientUserId); + string recipientEmail = recipient.Email; + + LoginModel loggedInUser = userDMO.GetUserByID(loggedInUserId); string emailTemplate = "CorrectiveActionSectionRejection.txt"; //string userEmail = string.Empty; @@ -1906,16 +1909,18 @@ namespace Fab2ApprovalSystem.Controllers //subject = "Corrective Action Assignment"; EmailNotification en = new EmailNotification(subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]); - string[] emailparams = new string[4]; + string[] emailparams = new string[6]; emailparams[0] = Functions.ReturnCANoStringFormat(issueID); emailparams[1] = issueID.ToString(); emailparams[2] = GlobalVars.hostURL; emailparams[3] = section; + emailparams[4] = loggedInUser.FirstName + " " + loggedInUser.LastName; + emailparams[5] = comment; //#if(DEBUG) // userEmail = "rkotian1@irf.com"; //#endif - en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams); + en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, recipientEmail, null, subject, emailparams); try { diff --git a/Fab2ApprovalSystem/EmailTemplates/CorrectiveActionSectionRejection.txt b/Fab2ApprovalSystem/EmailTemplates/CorrectiveActionSectionRejection.txt index 5fe8a7c..885b0ee 100644 --- a/Fab2ApprovalSystem/EmailTemplates/CorrectiveActionSectionRejection.txt +++ b/Fab2ApprovalSystem/EmailTemplates/CorrectiveActionSectionRejection.txt @@ -1,13 +1,16 @@ *****Please DO NOT reply to this email*****

-Corrective Action# {0} section {3} has been rejected. +Corrective Action# {0} section {3} has been rejected by {4}. +

+ +Rejection reason: {5}

Please log on to the Approval website to view the section and act accordingly

-https://messa016ec.infineon.com/CorrectiveAction/Edit?issueID={1} +{2}/CorrectiveAction/Edit?issueID={1}

If you have any questions or trouble logging on please contact a site administrator. diff --git a/Fab2ApprovalSystem/Web.config b/Fab2ApprovalSystem/Web.config index a715c66..e98b91f 100644 --- a/Fab2ApprovalSystem/Web.config +++ b/Fab2ApprovalSystem/Web.config @@ -62,9 +62,9 @@ - + - + @@ -80,6 +80,7 @@ --> +