Moved System.IO references from DMO classes to Static Helpers

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
This commit is contained in:
2024-12-11 09:29:01 -07:00
parent b1c6903c1c
commit b99b721458
86 changed files with 2961 additions and 4432 deletions

View File

@ -1,3 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
@ -6,12 +12,6 @@ using Fab2ApprovalSystem.ViewModels;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Fab2ApprovalSystem.Controllers;
[Authorize]
@ -21,13 +21,8 @@ public class AdminController : Controller {
UserAccountDMO userDMO = new UserAccountDMO();
AdminDMO adminDMO = new AdminDMO();
TrainingDMO trainingDMO = new TrainingDMO();
LotDispositionDMO ldDMO;
private readonly AppSettings _AppSettings;
public AdminController(AppSettings appSettings) {
_AppSettings = appSettings;
ldDMO = new LotDispositionDMO(appSettings);
}
LotDispositionDMO ldDMO = new LotDispositionDMO();
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
public ActionResult Index() {
if ((bool)Session[GlobalVars.IS_ADMIN]) {
@ -76,7 +71,7 @@ public class AdminController : Controller {
}
/// <summary>
///OBSOLETE FUNCTION BELOW FOR THE KENDO TREEVIEW
/// OBSOLETE FUNCTION BELOW FOR THE KENDO TREEVIEW
/// </summary>
private IEnumerable<TreeViewItemModel> GetRoles_SubRolesList() {
List<Role> roles = adminDMO.GetSubRoles();
@ -188,7 +183,6 @@ public class AdminController : Controller {
return Content("");
// TODO - Send an email to the OOO person and to the Delegated person
//return View();
}
public void ExpireOOOStatus(int oooUserID) {
@ -197,8 +191,6 @@ public class AdminController : Controller {
}
public ActionResult ManageTrainingGroups() {
//List<TrainingGroup> allGroups = GetTrainingGroups();
//return View(allGroups);
if ((bool)Session[GlobalVars.IS_ADMIN]) {
ViewBag.AllGroups = GetTrainingGroups();
return View();
@ -314,19 +306,18 @@ public class AdminController : Controller {
public ActionResult AddToTrainingReport(int userId) {
if ((bool)Session[GlobalVars.IS_ADMIN]) {
//Check to make sure user is not apart of the group already
// Check to make sure user is not apart of the group already
bool userExists = false;
//bool userValid = true;
List<TrainingReportUser> existingUsers = adminDMO.GetTrainingReportUsers();
foreach (var item in existingUsers) {
if (item.UserId == userId) {
userExists = true;
}
}
//Check if user is valid
// Check if user is valid
var validUser = userDMO.GetUserByID(userId);
//Add to group
// Add to group
if (!userExists && validUser != null) {
adminDMO.TrainingReportAddUser(userId);
return Json("Success Added");
@ -340,19 +331,18 @@ public class AdminController : Controller {
public ActionResult AddToTECNNotification(int userId) {
if ((bool)Session[GlobalVars.IS_ADMIN]) {
//Check to make sure user is not apart of the group already
// Check to make sure user is not apart of the group already
bool userExists = false;
//bool userValid = true;
List<TECNNotificationsUser> existingUsers = adminDMO.GetTECNNotificationUsers();
foreach (var item in existingUsers) {
if (item.UserId == userId) {
userExists = true;
}
}
//Check if user is valid
// Check if user is valid
var validUser = userDMO.GetUserByID(userId);
//Add to group
// Add to group
if (!userExists && validUser != null) {
try {
adminDMO.TECNExpirationAddUser(userId);