Training report excludes OOO users
This commit is contained in:
@ -15,6 +15,8 @@ using System.Configuration;
|
||||
|
||||
namespace Fab2ApprovalSystem.Controllers
|
||||
{
|
||||
|
||||
|
||||
[Authorize]
|
||||
[SessionExpireFilter]
|
||||
public class TrainingController : Controller
|
||||
@ -716,35 +718,38 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
string userEmail = userDMO.GetUserByID(user.UserId).Email;
|
||||
emailList.Add(userEmail);
|
||||
}
|
||||
//emailList.Add("Jonathan.Ouellette@infineon.com");
|
||||
//emailList.Add("Chase.Tucker@infineon.com");
|
||||
//Get a list of open trainings
|
||||
List<Training> openTrainings = trainingDMO.GetAllOpenTrainings();
|
||||
|
||||
foreach (Training training in openTrainings)
|
||||
{
|
||||
string trainingSection = "";
|
||||
int trainingSectionUserCount = 0;
|
||||
string ecnTitle = ecnDMO.GetECN(training.ECN).Title;
|
||||
emailBody += "<h3>" + training.ECN + " - " + ecnTitle + "</h3>";
|
||||
trainingSection += "<h3>" + training.ECN + " - " + ecnTitle + "</h3>";
|
||||
|
||||
emailBody += "<table>";
|
||||
emailBody += "<tr><th>Name</th><th>Date Assigned</th><th>Out of Office</th></tr>";
|
||||
trainingSection += "<table>";
|
||||
trainingSection += "<tr><th>Name</th><th>Date Assigned</th></tr>";
|
||||
List<TrainingAssignment> openAssignments = trainingDMO.GetOpenAssignmentsByTrainingID(training.TrainingID);
|
||||
foreach (TrainingAssignment assignment in openAssignments)
|
||||
{
|
||||
DateTime? assignmentDate = assignment.DateAssigned;
|
||||
|
||||
string DateAssigned = assignmentDate.HasValue ? assignmentDate.Value.ToString("MM/dd/yyyy") : "<not available>";
|
||||
if (!userDMO.GetUserByID(assignment.UserID).OOO)
|
||||
{
|
||||
trainingSectionUserCount++;
|
||||
|
||||
emailBody += "<tr><td>" + assignment.FullName + "</td><td>" + DateAssigned + "</td>";
|
||||
DateTime? assignmentDate = assignment.DateAssigned;
|
||||
|
||||
if (userDMO.GetUserByID(assignment.UserID).OOO)
|
||||
emailBody += "<td style=\"text-align:center;\">X</td>";
|
||||
else
|
||||
emailBody += "<td></td>";
|
||||
string DateAssigned = assignmentDate.HasValue ? assignmentDate.Value.ToString("MM/dd/yyyy") : "<not available>";
|
||||
|
||||
emailBody += "</tr>";
|
||||
trainingSection += "<tr><td>" + assignment.FullName + "</td><td>" + DateAssigned + "</td>";
|
||||
|
||||
trainingSection += "</tr>";
|
||||
}
|
||||
}
|
||||
emailBody += "</table>";
|
||||
trainingSection += "</table>";
|
||||
if (trainingSectionUserCount > 0) emailBody += trainingSection;
|
||||
}
|
||||
string recipientEmail = "";
|
||||
List<string> ccRecipients = emailList;
|
||||
|
Reference in New Issue
Block a user