Training report excludes OOO users

This commit is contained in:
Chase Tucker 2023-08-24 15:16:09 -07:00
parent 33599e51e8
commit 6ea927045f
4 changed files with 56 additions and 13 deletions

View File

@ -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;

View File

@ -426,6 +426,8 @@
<Content Include="Models\FabApproval.edmx.diagram">
<DependentUpon>FabApproval.edmx</DependentUpon>
</Content>
<None Include="Properties\PublishProfiles\ChaseDesktopDebug.pubxml" />
<None Include="Properties\PublishProfiles\ChaseDesktopRelease.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<None Include="Properties\PublishProfiles\MesaDeploy.pubxml" />
<Content Include="Scripts\excel-bootstrap-table-filter-bundle.js.map" />

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>C:\Users\tuckerc\Desktop\FabApprovalDeployments-Debug</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
</PropertyGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>C:\Users\tuckerc\Desktop\FabApprovalDeployments-Release</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
</PropertyGroup>
</Project>