Clean up training assignments through report
This commit is contained in:
parent
c97ce37238
commit
603052d7e5
@ -23,7 +23,6 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public AccountController(UserManager<ApplicationUser> userManager)
|
||||
{
|
||||
UserManager = userManager;
|
||||
@ -78,7 +77,6 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
isLoginValid = Functions.IFX_ADAuthenticate(model.LoginID, model.Password);
|
||||
isIFX = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -102,7 +100,6 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
{
|
||||
ModelState.AddModelError("", "The user name does not exist in the DB. Please contact the System Admin");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -202,7 +199,9 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
|
||||
//
|
||||
// GET: /Account/Manage
|
||||
#pragma warning disable IDE0060 // Remove unused parameter
|
||||
public ActionResult Manage(ManageMessageId? message)
|
||||
#pragma warning restore IDE0060 // Remove unused parameter
|
||||
{
|
||||
//ViewBag.StatusMessage =
|
||||
// message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
|
||||
|
@ -15,8 +15,6 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Fab2ApprovalSystem.Controllers
|
||||
{
|
||||
|
||||
|
||||
[Authorize]
|
||||
[SessionExpireFilter]
|
||||
public class TrainingController : Controller
|
||||
@ -44,7 +42,6 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
trainingDMO.DeleteTraining(oldTrainingId);
|
||||
}
|
||||
|
||||
|
||||
int trainingId = trainingDMO.Create(ecnId);
|
||||
List<int> TrainingGroups = new List<int>();
|
||||
TrainingGroups = trainingDMO.GetECNAssignedTrainingGroups(ecnId);
|
||||
@ -61,8 +58,6 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
int assignmentId = trainingDMO.CreateAssignment(trainingId, trainee);
|
||||
NotifyTrainee(trainee, assignmentId, ecnId, ECNTitle);
|
||||
}
|
||||
|
||||
|
||||
return trainingId;
|
||||
}
|
||||
public ActionResult AddUserToTrainingAdHoc(int trainingId, int traineeId, int ecnId)
|
||||
@ -114,7 +109,6 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
{
|
||||
return Content("User already has an open or completed assignment for this training.");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -135,9 +129,8 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
{
|
||||
return Content("Not Authorized");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ActionResult AddGroupToTrainingAdHoc(int trainingId, int groupId, int ecnId)
|
||||
{
|
||||
if ((bool)Session[GlobalVars.IS_ADMIN])
|
||||
@ -166,13 +159,11 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
int assignmentId = trainingDMO.CreateAssignment(trainingId, id);
|
||||
NotifyTrainee(id, assignmentId, ecnId, ecn.Title);
|
||||
}
|
||||
|
||||
}
|
||||
if (usersAdded > 0)
|
||||
{
|
||||
trainingDMO.reOpenTraining(trainingId);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -220,8 +211,6 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
{
|
||||
return Content("Not Authorized");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public ActionResult DeleteTrainingByECN(int ECNNumber)
|
||||
{
|
||||
@ -285,9 +274,8 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
detailedException = e.Message;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ActionResult ViewTrainingPartial(int trainingID, int userID)
|
||||
{
|
||||
List<TrainingAssignment> TrainingData = trainingDMO.GetTrainingAssignmentsByUser(trainingID, userID);
|
||||
@ -329,9 +317,6 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
string exception = e.ToString();
|
||||
return Content(exception);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -418,9 +403,6 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
{
|
||||
return PartialView(trainingList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
public ActionResult ViewTrainingAssignmentsReportView(int trainingID, string statusFilter, string groupFilter)
|
||||
{
|
||||
@ -445,7 +427,9 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
totalCompleted++;
|
||||
}
|
||||
}
|
||||
#pragma warning disable IDE0047 // Remove unnecessary parentheses
|
||||
percentComplete = (totalCompleted / assignmentCount) * 100;
|
||||
#pragma warning restore IDE0047 // Remove unnecessary parentheses
|
||||
ViewBag.PercentComplete = percentComplete.ToString("0.00") + "%";
|
||||
|
||||
if (groupFilter != "" && groupFilter != null)
|
||||
@ -530,11 +514,8 @@ namespace Fab2ApprovalSystem.Controllers
|
||||
DateAssigned = assignment.DateAssigned,
|
||||
DateCompleted = assignment.DateCompleted,
|
||||
Status = assignment.status
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return View(ViewData);
|
||||
|
@ -154,6 +154,21 @@ namespace Fab2ApprovalSystem.DMO
|
||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||
var TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID select a;
|
||||
|
||||
bool assignmentIsIncomplete = false;
|
||||
UserAccountDMO userAccountDMO = new UserAccountDMO();
|
||||
foreach (TrainingAssignment assignment in TrainingData)
|
||||
{
|
||||
LoginModel userModel = userAccountDMO.GetUserByID(assignment.UserID);
|
||||
if (!userModel.IsActive) UpdateAssignmentStatus(assignment.ID);
|
||||
if (assignment.Deleted != true && (assignment.DateCompleted is null || assignment.DateCompleted > DateTime.Now))
|
||||
assignmentIsIncomplete = true;
|
||||
}
|
||||
|
||||
if (!assignmentIsIncomplete)
|
||||
UpdateTrainingStatus(TrainingID);
|
||||
|
||||
TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID select a;
|
||||
|
||||
return TrainingData.ToList();
|
||||
}
|
||||
public List<TrainingAssignment> GetTrainingAssignments(int TrainingID)
|
||||
@ -161,6 +176,21 @@ namespace Fab2ApprovalSystem.DMO
|
||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||
var TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID && a.Deleted != true select a;
|
||||
|
||||
bool assignmentIsIncomplete = false;
|
||||
UserAccountDMO userAccountDMO = new UserAccountDMO();
|
||||
foreach (TrainingAssignment assignment in TrainingData)
|
||||
{
|
||||
LoginModel userModel = userAccountDMO.GetUserByID(assignment.UserID);
|
||||
if (!userModel.IsActive) UpdateAssignmentStatus(assignment.ID);
|
||||
if (assignment.Deleted != true && (assignment.DateCompleted is null || assignment.DateCompleted > DateTime.Now))
|
||||
assignmentIsIncomplete = true;
|
||||
}
|
||||
|
||||
if (!assignmentIsIncomplete)
|
||||
UpdateTrainingStatus(TrainingID);
|
||||
|
||||
TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID select a;
|
||||
|
||||
return TrainingData.ToList();
|
||||
}
|
||||
public List<TrainingAssignment> GetTrainingAssignmentsByUser(int TrainingID, int userID)
|
||||
|
@ -20,10 +20,14 @@
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<UseGlobalApplicationHostFile />
|
||||
<Use64BitIISExpress>true</Use64BitIISExpress>
|
||||
<TargetFrameworkProfile />
|
||||
|
Loading…
x
Reference in New Issue
Block a user