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