Removed nugetSource from pipeline Removed more comments Created Static Classes for most DMO / Controller Classes Push ConfigurationManager.AppSettings to controller Align Tests with other Projects
67 lines
2.7 KiB
C#
67 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
using Fab2ApprovalSystem.Models;
|
|
|
|
namespace Fab2ApprovalSystem.Misc;
|
|
|
|
public class HomeHelper {
|
|
|
|
public static void NotifyApprover(AppSettings appSettings, string toEmail, string title, int issueId, string docType) {
|
|
string emailSentList = "";
|
|
string senderName = docType;
|
|
string subject = string.Empty;
|
|
string userEmail = string.Empty;
|
|
string emailTemplate = "ApprovalReminders.txt";
|
|
|
|
subject = docType + " Approval Reminder: " + title;
|
|
|
|
EmailNotification en = new(appSettings, subject);
|
|
string[] emailparams = new string[4];
|
|
emailparams[0] = docType;
|
|
emailparams[1] = title;
|
|
emailparams[2] = issueId.ToString();
|
|
userEmail = toEmail;
|
|
|
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, "jonathan.ouellette@infineon.com", subject, emailparams);
|
|
}
|
|
|
|
public static void NotifyDelegation(AppSettings appSettings, DateTime startDate, DateTime endDate, LoginModel delegateFrom, LoginModel delegateTo, List<string> emailList) {
|
|
string userEmail = string.Empty;
|
|
string senderName = "Mesa Approval";
|
|
string emailTemplate = "DelegationOn.txt";
|
|
string subject = "Mesa Approval Delegation Notification";
|
|
|
|
foreach (string email in emailList) {
|
|
EmailNotification en = new(appSettings, subject);
|
|
string[] emailparams = new string[5];
|
|
emailparams[0] = delegateFrom.FullName;
|
|
emailparams[1] = delegateTo.FullName;
|
|
emailparams[2] = startDate.ToString("yyyy-MM-dd");
|
|
emailparams[3] = endDate.ToString("yyyy-MM-dd");
|
|
userEmail = email;
|
|
|
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
}
|
|
}
|
|
|
|
public static void DelegateDocumentApproval(AppSettings appSettings, int issueID, string ecnTypeString, string title, string email) {
|
|
string subject;
|
|
string userEmail = string.Empty;
|
|
string senderName = ecnTypeString;
|
|
string emailTemplate = "DelegateApproval.txt";
|
|
|
|
subject = ecnTypeString + " Delegation" + " - Email would be sent to " + email + " for Number " + issueID + ", - " + title;
|
|
EmailNotification en = new(appSettings, subject);
|
|
string[] emailparams = new string[4];
|
|
emailparams[0] = issueID.ToString();
|
|
emailparams[1] = issueID.ToString();
|
|
emailparams[2] = GlobalVars.hostURL;
|
|
emailparams[3] = ecnTypeString;
|
|
|
|
userEmail = email;
|
|
|
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
}
|
|
|
|
} |