NET8
This commit is contained in:
@ -1,35 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
#if !NET8
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
#endif
|
||||
|
||||
#if NET8
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
#endif
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Misc;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
using Fab2ApprovalSystem.Utilities;
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
|
||||
#if !NET8
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
#endif
|
||||
|
||||
#if !NET8
|
||||
using Kendo.Mvc.Extensions;
|
||||
using Kendo.Mvc.UI;
|
||||
#endif
|
||||
|
||||
namespace Fab2ApprovalSystem.Controllers;
|
||||
|
||||
#if !NET8
|
||||
[Authorize]
|
||||
#if !NET8
|
||||
[SessionExpireFilter]
|
||||
#endif
|
||||
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
||||
#endif
|
||||
#if NET8
|
||||
[Route("[controller]")]
|
||||
#endif
|
||||
public class HomeController : Controller {
|
||||
|
||||
MRB_DMO mrbDMO = new MRB_DMO(GlobalVars.AppSettings);
|
||||
PartsRequestDMO prDMO = new PartsRequestDMO();
|
||||
LotDispositionDMO ldDMO = new LotDispositionDMO();
|
||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||
ECN_DMO ecnDMO = new ECN_DMO();
|
||||
UserUtilities userDMO = new UserUtilities();
|
||||
UserAccountDMO originalUserDMO = new UserAccountDMO();
|
||||
TrainingDMO trainingDMO = new TrainingDMO();
|
||||
MiscDMO miscDMO = new MiscDMO();
|
||||
private readonly MRB_DMO mrbDMO = new(GlobalVars.AppSettings);
|
||||
private readonly PartsRequestDMO prDMO = new();
|
||||
private readonly LotDispositionDMO ldDMO = new();
|
||||
private readonly WorkflowDMO wfDMO = new();
|
||||
private readonly ECN_DMO ecnDMO = new();
|
||||
private readonly UserUtilities userDMO = new();
|
||||
private readonly UserAccountDMO originalUserDMO = new();
|
||||
private readonly TrainingDMO trainingDMO = new();
|
||||
private readonly MiscDMO miscDMO = new();
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
public ActionResult Index(string tabName) {
|
||||
@ -57,6 +75,7 @@ public class HomeController : Controller {
|
||||
public ActionResult ECNList() {
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult TrainingList() {
|
||||
return View();
|
||||
}
|
||||
@ -82,25 +101,25 @@ public class HomeController : Controller {
|
||||
return View();
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
public ActionResult GetTaskList([DataSourceRequest] DataSourceRequest request, string tabName) {
|
||||
try {
|
||||
ViewBag.ActiveTabName = tabName;
|
||||
List<IssuesViewModel> data = ldDMO.GetTaskList((int)Session[GlobalVars.SESSION_USERID]).Distinct().ToList();
|
||||
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
||||
List<IssuesViewModel> data = ldDMO.GetTaskList(GlobalVars.GetUserId(GetSession())).Distinct().ToList();
|
||||
return GetJsonResult(data.ToDataSourceResult(request));
|
||||
} catch (Exception ex) {
|
||||
// TODO record the error
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult GetMyOpenActionItems([DataSourceRequest] DataSourceRequest request, string tabName) {
|
||||
try {
|
||||
ViewBag.ActiveTabName = tabName;
|
||||
List<OpenActionItemViewModel> data = ldDMO.GetMyOpenActionItems((int)Session[GlobalVars.SESSION_USERID]).Distinct().ToList();
|
||||
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
||||
List<OpenActionItemViewModel> data = ldDMO.GetMyOpenActionItems(GlobalVars.GetUserId(GetSession())).Distinct().ToList();
|
||||
return GetJsonResult(data.ToDataSourceResult(request));
|
||||
} catch (Exception ex) {
|
||||
// TODO record the error
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,76 +135,82 @@ public class HomeController : Controller {
|
||||
}
|
||||
|
||||
public ActionResult GetChangeControlList([DataSourceRequest] DataSourceRequest request) {
|
||||
IEnumerable<ChangeControlList> data = ldDMO.GetChangeControls(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||
IEnumerable<ChangeControlList> data = ldDMO.GetChangeControls(GlobalVars.GetUserId(GetSession()));
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
public ActionResult GetAuditList([DataSourceRequest] DataSourceRequest request) {
|
||||
IEnumerable<AuditList> data = ldDMO.GetAuditList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||
IEnumerable<AuditList> data = ldDMO.GetAuditList(GlobalVars.GetUserId(GetSession()));
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
public ActionResult GetCorrectiveActionList([DataSourceRequest] DataSourceRequest request) {
|
||||
IEnumerable<CorrectiveAction> data = ldDMO.GetCorrectiveActionList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||
IEnumerable<CorrectiveAction> data = ldDMO.GetCorrectiveActionList(GlobalVars.GetUserId(GetSession()));
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
public ActionResult GetMRBList([DataSourceRequest] DataSourceRequest request) {
|
||||
IEnumerable<IssuesViewModel> data = ldDMO.GetMRBList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||
IEnumerable<IssuesViewModel> data = ldDMO.GetMRBList(GlobalVars.GetUserId(GetSession()));
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
public ActionResult GetLotDispositionList([DataSourceRequest] DataSourceRequest request) {
|
||||
IEnumerable<IssuesViewModel> data = ldDMO.GetLotDispositionList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||
IEnumerable<IssuesViewModel> data = ldDMO.GetLotDispositionList(GlobalVars.GetUserId(GetSession()));
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
public ActionResult GetECNList([DataSourceRequest] DataSourceRequest request) {
|
||||
IEnumerable<IssuesViewModel> data = ldDMO.GetECNList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||
IEnumerable<IssuesViewModel> data = ldDMO.GetECNList(GlobalVars.GetUserId(GetSession()));
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
public ActionResult GetTrainingList([DataSourceRequest] DataSourceRequest request) {
|
||||
IEnumerable<Training> data = trainingDMO.GetAllTrainings();
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public ActionResult MyECNsTECNs(string dataType) {
|
||||
ViewBag.ActiveTabName = dataType;
|
||||
return View();
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
public ActionResult GetECN_TECNsPendingApproval([DataSourceRequest] DataSourceRequest request) {
|
||||
IEnumerable<IssuesViewModel> data = ecnDMO.GetECN_TECNPendingApprovals(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||
IEnumerable<IssuesViewModel> data = ecnDMO.GetECN_TECNPendingApprovals(GlobalVars.GetUserId(GetSession()));
|
||||
ViewBag.ViewOption = "Pending Approvals";
|
||||
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
||||
GlobalVars.SetECNViewOption(GetSession(), ViewBag.ViewOption);
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
public ActionResult GetMyExpiredTECNs([DataSourceRequest] DataSourceRequest request) {
|
||||
|
||||
IEnumerable<IssuesViewModel> data = ecnDMO.GetMyExpiredTECNs(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), 7);
|
||||
IEnumerable<IssuesViewModel> data = ecnDMO.GetMyExpiredTECNs(GlobalVars.GetUserId(GetSession()), 7);
|
||||
ViewBag.ViewOption = "Expired TECNs";
|
||||
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
||||
GlobalVars.SetECNViewOption(GetSession(), ViewBag.ViewOption);
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
public ActionResult GetAllTECNs([DataSourceRequest] DataSourceRequest request) {
|
||||
IEnumerable<IssuesViewModel> data = ecnDMO.GetAllTECNs();
|
||||
ViewBag.ViewOption = "All TECNs";
|
||||
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
||||
GlobalVars.SetECNViewOption(GetSession(), ViewBag.ViewOption);
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
public ActionResult GetMyConvertedTECNsToECNs([DataSourceRequest] DataSourceRequest request) {
|
||||
IEnumerable<IssuesViewModel> data = ecnDMO.GetMyConvertedTECNsToECNs(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), 7);
|
||||
IEnumerable<IssuesViewModel> data = ecnDMO.GetMyConvertedTECNsToECNs(GlobalVars.GetUserId(GetSession()), 7);
|
||||
ViewBag.ViewOption = "Converted TECNs";
|
||||
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
||||
GlobalVars.SetECNViewOption(GetSession(), ViewBag.ViewOption);
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
public ActionResult GetMyExpiringTECNs([DataSourceRequest] DataSourceRequest request) {
|
||||
IEnumerable<IssuesViewModel> data = ecnDMO.GetMyExpiringTECNs(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), 7);
|
||||
IEnumerable<IssuesViewModel> data = ecnDMO.GetMyExpiringTECNs(GlobalVars.GetUserId(GetSession()), 7);
|
||||
ViewBag.ViewOption = "Expiring TECNs";
|
||||
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
||||
GlobalVars.SetECNViewOption(GetSession(), ViewBag.ViewOption);
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
@ -194,17 +219,17 @@ public class HomeController : Controller {
|
||||
return Json(LotTravDMO.GetLotListBasedOnSWRNumber(workRequestID).ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
/// <returns></returns>
|
||||
#endif
|
||||
|
||||
public ActionResult SetOOOStatus(int delegatedTo, DateTime startDate, DateTime endDate, string tab) {
|
||||
if (Session[GlobalVars.SESSION_USERID] != null) {
|
||||
int returnValue = MiscDMO.EnableOOOStatus(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), delegatedTo, startDate, endDate);
|
||||
if (GlobalVars.IsUserIdValueNotNull(GetSession())) {
|
||||
int returnValue = MiscDMO.EnableOOOStatus(GlobalVars.GetUserId(GetSession()), delegatedTo, startDate, endDate);
|
||||
if (returnValue == 3) // the delegator is already a delegator to someone else
|
||||
{
|
||||
return Content("3");
|
||||
}
|
||||
if (startDate <= DateTime.Today)
|
||||
Session[GlobalVars.OOO] = true;
|
||||
GlobalVars.SetOOO(GetSession(), true);
|
||||
|
||||
NotifyDelegation(delegatedTo, startDate, endDate);
|
||||
}
|
||||
@ -213,12 +238,14 @@ public class HomeController : Controller {
|
||||
}
|
||||
|
||||
public void ExpireOOOStatus(string tab) {
|
||||
if (Session[GlobalVars.SESSION_USERID] != null) {
|
||||
MiscDMO.ExpireOOOStatus(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||
Session[GlobalVars.OOO] = false;
|
||||
if (GlobalVars.IsUserIdValueNotNull(GetSession())) {
|
||||
MiscDMO.ExpireOOOStatus(GlobalVars.GetUserId(GetSession()));
|
||||
GlobalVars.SetOOO(GetSession(), false);
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
public ActionResult DeleteItem([DataSourceRequest] DataSourceRequest request, IssuesViewModel issue) {
|
||||
GlobalVars.DocumentType dType;
|
||||
@ -228,20 +255,22 @@ public class HomeController : Controller {
|
||||
else if (dType == GlobalVars.DocumentType.LotDisposition)
|
||||
ldDMO.DeleteLotDisposition(issue.IssueID);
|
||||
else if (dType == GlobalVars.DocumentType.ECN)
|
||||
ecnDMO.DeleteDocument(issue.IssueID, int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), "ECN");
|
||||
ecnDMO.DeleteDocument(issue.IssueID, GlobalVars.GetUserId(GetSession()), "ECN");
|
||||
else if (dType == GlobalVars.DocumentType.CorrectiveAction)
|
||||
ldDMO.DeleteCADocument(issue.IssueID, int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), "Corrective Action");
|
||||
ldDMO.DeleteCADocument(issue.IssueID, GlobalVars.GetUserId(GetSession()), "Corrective Action");
|
||||
|
||||
return Json(new[] { issue }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
public ActionResult DeleteCAItem([DataSourceRequest] DataSourceRequest request, CorrectiveAction ca) {
|
||||
ldDMO.DeleteCADocument(ca.CANo, int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), "Corrective Action");
|
||||
ldDMO.DeleteCADocument(ca.CANo, GlobalVars.GetUserId(GetSession()), "Corrective Action");
|
||||
|
||||
return Json(new[] { ca }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public ActionResult About() {
|
||||
ViewBag.Message = "Your application description page.";
|
||||
|
||||
@ -283,61 +312,63 @@ public class HomeController : Controller {
|
||||
|
||||
public void DelegateDocumentApproval(int issueID, int delegateTo, string ecnTypeString, string title) {
|
||||
var email = "";
|
||||
int delegateFrom = (int)Session[GlobalVars.SESSION_USERID];
|
||||
int delegateFrom = GlobalVars.GetUserId(GetSession());
|
||||
try {
|
||||
email = wfDMO.DelegateDocumentApproval(issueID, delegateFrom, delegateTo);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Delegation", Comments = "Delegated from - " + delegateFrom + " to " + delegateTo });
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = GetUserIdentityName(), DocumentType = ecnTypeString, OperationType = "Delegation", Comments = "Delegated from - " + delegateFrom + " to " + delegateTo });
|
||||
} catch (Exception e) {
|
||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n DelegateApproval\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = " + ecnTypeString + ", OperationType = "Error", Comments = "DelegateApproval - " + exceptionString });
|
||||
Functions.WriteEvent(_AppSettings, GetUserIdentityName() + "\r\n DelegateApproval\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = GetUserIdentityName(), DocumentType = " + ecnTypeString + ", OperationType = "Error", Comments = "DelegateApproval - " + exceptionString });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
HomeHelper.DelegateDocumentApproval(_AppSettings, issueID, ecnTypeString, title, email);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Delegated to Approver: " + email });
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = GetUserIdentityName(), DocumentType = ecnTypeString, OperationType = "Email", Comments = "Delegated to Approver: " + email });
|
||||
} catch { }
|
||||
}
|
||||
|
||||
public JsonResult GetAllUsersList() {
|
||||
|
||||
UserAccountDMO userDMO = new UserAccountDMO();
|
||||
UserAccountDMO userDMO = new();
|
||||
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||
return GetJsonResult(userlist);
|
||||
}
|
||||
|
||||
public ActionResult SaveAllDocumentsFilter(string data) {
|
||||
Session["AllDocumentsFilterData"] = data;
|
||||
GlobalVars.SetAllDocumentsFilterData(GetSession(), data);
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
||||
public ActionResult LoadAllDocumentsFilter() {
|
||||
return Json(Session["AllDocumentsFilterData"], JsonRequestBehavior.AllowGet);
|
||||
return GetJsonResult(GlobalVars.GetAllDocumentsFilterData(GetSession()));
|
||||
}
|
||||
|
||||
public ActionResult SaveSWRFilter(string data) {
|
||||
Session["SWRFilterData"] = data;
|
||||
GlobalVars.SetSWRFilterData(GetSession(), data);
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
||||
public ActionResult LoadSWRFilter() {
|
||||
return Json(Session["SWRFilterData"], JsonRequestBehavior.AllowGet);
|
||||
return GetJsonResult(GlobalVars.GetSWRFilterData(GetSession()));
|
||||
}
|
||||
|
||||
public ActionResult SavePCRBFilter(string data) {
|
||||
Session["PCRBFilterData"] = data;
|
||||
GlobalVars.SetPCRBFilterData(GetSession(), data);
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
||||
public ActionResult LoadPCRBFilter() {
|
||||
return Json(Session["PCRBFilterData"], JsonRequestBehavior.AllowGet);
|
||||
return GetJsonResult(GlobalVars.GetPCRBFilterData(GetSession()));
|
||||
}
|
||||
|
||||
public ActionResult PartsRequestList() {
|
||||
ViewBag.CanDeletePR = Session[GlobalVars.CAN_CREATE_PARTS_REQUEST];
|
||||
ViewBag.CanDeletePR = GlobalVars.GetCanCreatePartsRequest(GetSession());
|
||||
return View();
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
public ActionResult GetPartsRequestList([DataSourceRequest] DataSourceRequest request) {
|
||||
IEnumerable<PartsRequestList> data = prDMO.GetPartsRequestList();
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
@ -346,31 +377,32 @@ public class HomeController : Controller {
|
||||
public ActionResult GetMyPartsRequestsList([DataSourceRequest] DataSourceRequest request, string tabName) {
|
||||
try {
|
||||
ViewBag.ActiveTabName = tabName;
|
||||
var data = prDMO.GetMyPartsRequests((int)Session[GlobalVars.SESSION_USERID]);
|
||||
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
||||
var data = prDMO.GetMyPartsRequests(GlobalVars.GetUserId(GetSession()));
|
||||
return GetJsonResult(data.ToDataSourceResult(request));
|
||||
} catch (Exception ex) {
|
||||
// TODO record the error
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
public ActionResult DeletePR([DataSourceRequest] DataSourceRequest request, MyPartsRequestList pr) {
|
||||
try {
|
||||
if (Convert.ToBoolean(Session[GlobalVars.CAN_CREATE_PARTS_REQUEST]) == false)
|
||||
if (!GlobalVars.GetCanCreatePartsRequest(GetSession()))
|
||||
throw new Exception("Permission denied");
|
||||
|
||||
prDMO.DeleteDocument(pr.PRNumber, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
prDMO.DeleteDocument(pr.PRNumber, GlobalVars.GetUserId(GetSession()));
|
||||
return Json(new[] { pr }.ToDataSourceResult(request, ModelState));
|
||||
} catch (Exception ex) {
|
||||
return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public void NotifyDelegation(int delegatedUser, DateTime startDate, DateTime endDate) {
|
||||
LoginModel delegateFrom = originalUserDMO.GetUserByID((int)Session[GlobalVars.SESSION_USERID]);
|
||||
LoginModel delegateFrom = originalUserDMO.GetUserByID(GlobalVars.GetUserId(GetSession()));
|
||||
LoginModel delegateTo = originalUserDMO.GetUserByID(delegatedUser);
|
||||
List<string> emailList = new List<string>();
|
||||
List<string> emailList = new();
|
||||
emailList.Add(delegateFrom.Email);
|
||||
emailList.Add(delegateTo.Email);
|
||||
HomeHelper.NotifyDelegation(_AppSettings, startDate, endDate, delegateFrom, delegateTo, emailList);
|
||||
@ -381,22 +413,24 @@ public class HomeController : Controller {
|
||||
public bool ProcessOoO() {
|
||||
|
||||
try {
|
||||
UserAccountDMO userDMO = new UserAccountDMO();
|
||||
UserAccountDMO userDMO = new();
|
||||
userDMO.ProcessOoO();
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ExpireOoO() {
|
||||
try {
|
||||
UserAccountDMO userDMO = new UserAccountDMO();
|
||||
UserAccountDMO userDMO = new();
|
||||
userDMO.ExpireOoO();
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ApprovalsReminderNotifications() {
|
||||
try {
|
||||
// Get list of approvals
|
||||
@ -417,12 +451,13 @@ public class HomeController : Controller {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyApprover(string toEmail, string title, int issueId, string docType) {
|
||||
try {
|
||||
HomeHelper.NotifyApprover(_AppSettings, toEmail, title, issueId, docType);
|
||||
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueId, UserID = @User.Identity.Name, DocumentType = docType, OperationType = "Email", Comments = "Approval reminders" });
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueId, UserID = GetUserIdentityName(), DocumentType = docType, OperationType = "Email", Comments = "Approval reminders" });
|
||||
} catch { }
|
||||
|
||||
} catch (Exception e) {
|
||||
@ -432,9 +467,38 @@ public class HomeController : Controller {
|
||||
} catch {
|
||||
detailedException = e.Message;
|
||||
}
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueId, UserID = @User.Identity.Name, DocumentType = docType, OperationType = "Email", Comments = "Approval reminders" });
|
||||
throw e;
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueId, UserID = GetUserIdentityName(), DocumentType = docType, OperationType = "Email", Comments = "Approval reminders" });
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
private System.Web.HttpSessionStateBase GetSession() =>
|
||||
Session;
|
||||
|
||||
private JsonResult GetJsonResult(object? data) =>
|
||||
Json(data, JsonRequestBehavior.AllowGet);
|
||||
|
||||
private bool IsAjaxRequest() =>
|
||||
Request.IsAjaxRequest();
|
||||
|
||||
#endif
|
||||
|
||||
#if NET8
|
||||
|
||||
private Microsoft.AspNetCore.Http.ISession GetSession() =>
|
||||
HttpContext.Session;
|
||||
|
||||
private JsonResult GetJsonResult(object? data) =>
|
||||
Json(data);
|
||||
|
||||
private bool IsAjaxRequest() =>
|
||||
Request.Headers.TryGetValue("X-Requested-With", out Microsoft.Extensions.Primitives.StringValues strings) && strings[0] == "XMLHttpRequest";
|
||||
|
||||
#endif
|
||||
|
||||
private string GetUserIdentityName() =>
|
||||
@User.Identity.Name;
|
||||
|
||||
}
|
Reference in New Issue
Block a user