NET8
This commit is contained in:
@ -1,36 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#if !NET8
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Services;
|
||||
#endif
|
||||
|
||||
#if NET8
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
#endif
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Misc;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
|
||||
#if !NET8
|
||||
using Kendo.Mvc.Extensions;
|
||||
using Kendo.Mvc.UI;
|
||||
#endif
|
||||
|
||||
namespace Fab2ApprovalSystem.Controllers;
|
||||
|
||||
[Authorize]
|
||||
#if !NET8
|
||||
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
||||
[SessionExpireFilter]
|
||||
#endif
|
||||
#if NET8
|
||||
[Route("[controller]")]
|
||||
#endif
|
||||
public class ChangeControlController : Controller {
|
||||
|
||||
ChangeControlDMO ccDMO = new ChangeControlDMO();
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
private readonly ChangeControlDMO ccDMO = new();
|
||||
private readonly AppSettings? _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
public ActionResult Index() {
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Create() {
|
||||
ChangeControlViewModel cc = new ChangeControlViewModel();
|
||||
ChangeControlViewModel cc = new();
|
||||
try {
|
||||
cc.OwnerID = (int)Session[GlobalVars.SESSION_USERID];
|
||||
cc.OwnerID = GlobalVars.GetUserId(GetSession());
|
||||
ccDMO.InsertChangeControl(cc);
|
||||
return RedirectToAction("Edit", new { issueID = cc.PlanNumber });
|
||||
} catch (Exception e) {
|
||||
@ -41,16 +55,16 @@ public class ChangeControlController : Controller {
|
||||
detailedException = e.Message;
|
||||
}
|
||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + cc.PlanNumber.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n Create - Change Control\r\n" + cc.PlanNumber.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = cc.PlanNumber, UserID = @User.Identity.Name, DocumentType = "Change Control", OperationType = "Error", Comments = "Create - " + exceptionString });
|
||||
Functions.WriteEvent(_AppSettings, GetUserIdentityName() + "\r\n Create - Change Control\r\n" + cc.PlanNumber.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = cc.PlanNumber, UserID = GetUserIdentityName(), DocumentType = "Change Control", OperationType = "Error", Comments = "Create - " + exceptionString });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult Edit(int issueID) {
|
||||
string jwt = Session["JWT"].ToString();
|
||||
string jwt = GlobalVars.GetJWT(GetSession());
|
||||
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
||||
string refreshToken = Session["RefreshToken"].ToString();
|
||||
string refreshToken = GlobalVars.GetRefreshToken(GetSession());
|
||||
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
||||
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=pcrb/{issueID}";
|
||||
|
||||
@ -58,9 +72,9 @@ public class ChangeControlController : Controller {
|
||||
}
|
||||
|
||||
public ActionResult ReadOnlyCC(int issueID) {
|
||||
string jwt = Session["JWT"].ToString();
|
||||
string jwt = GlobalVars.GetJWT(GetSession());
|
||||
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
||||
string refreshToken = Session["RefreshToken"].ToString();
|
||||
string refreshToken = GlobalVars.GetRefreshToken(GetSession());
|
||||
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
||||
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=pcrb/{issueID}";
|
||||
|
||||
@ -71,7 +85,7 @@ public class ChangeControlController : Controller {
|
||||
public ActionResult Edit(ChangeControlViewModel model) {
|
||||
try {
|
||||
var data = model;
|
||||
ccDMO.UpdateChangeControl(model, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
ccDMO.UpdateChangeControl(model, GlobalVars.GetUserId(GetSession()));
|
||||
ViewBag.AIResponsibles = ccDMO.GetActionItemResponsible();
|
||||
} catch (Exception ex) {
|
||||
return Content(ex.Message);
|
||||
@ -93,10 +107,12 @@ public class ChangeControlController : Controller {
|
||||
}
|
||||
|
||||
public JsonResult SearchParts(string searchText) {
|
||||
List<String> partList = MiscDMO.SearchLTParts(searchText.Trim()).Select(x => x.WIPPartData).ToList<String>();
|
||||
return Json(partList, JsonRequestBehavior.AllowGet);
|
||||
List<string> partList = MiscDMO.SearchLTParts(searchText.Trim()).Select(x => x.WIPPartData).ToList();
|
||||
return GetJsonResult(partList);
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
public ActionResult GetCCAttachments([DataSourceRequest] DataSourceRequest request, int planNumber) {
|
||||
return Json(ccDMO.GetCCAttachment(planNumber).ToDataSourceResult(request));
|
||||
}
|
||||
@ -130,7 +146,7 @@ public class ChangeControlController : Controller {
|
||||
public ActionResult AttachSaveCC(IEnumerable<HttpPostedFileBase> files, int planNumber, int attachID) {
|
||||
// The Name of the Upload component is "files"
|
||||
if (files != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
int userId = GlobalVars.GetUserId(GetSession());
|
||||
foreach (var file in files) {
|
||||
ChangeControlHelper.AttachSaveCC(_AppSettings, ccDMO, planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
}
|
||||
@ -145,6 +161,7 @@ public class ChangeControlController : Controller {
|
||||
public ActionResult GetMeetingAttachments([DataSourceRequest] DataSourceRequest request, int meetingID) {
|
||||
return Json(ccDMO.GetMeetingAttachments(meetingID).ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
public ActionResult GetPCRB([DataSourceRequest] DataSourceRequest request, int PlanNumber, string PCRB) {
|
||||
return Json(ccDMO.GetPCRB(PlanNumber, PCRB).ToDataSourceResult(request));
|
||||
}
|
||||
@ -177,7 +194,7 @@ public class ChangeControlController : Controller {
|
||||
public ActionResult AttachSaveMeeting(IEnumerable<HttpPostedFileBase> files, int planNumber, int meetingID, int attachID) {
|
||||
// The Name of the Upload component is "files"
|
||||
if (files != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
int userId = GlobalVars.GetUserId(GetSession());
|
||||
foreach (var file in files) {
|
||||
ChangeControlHelper.AttachSaveMeeting(_AppSettings, ccDMO, planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
}
|
||||
@ -185,6 +202,8 @@ public class ChangeControlController : Controller {
|
||||
return Content("");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public FileResult DownloadCCFile(string fileGuid, int planNumber) {
|
||||
string fileName = ccDMO.GetCCFileName(fileGuid);
|
||||
|
||||
@ -219,20 +238,20 @@ public class ChangeControlController : Controller {
|
||||
detailedException = e.Message;
|
||||
}
|
||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + planNumber.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n Create - Meeting\r\n" + planNumber.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = planNumber, UserID = @User.Identity.Name, DocumentType = "Meeting", OperationType = "Error", Comments = "Create - " + exceptionString });
|
||||
Functions.WriteEvent(_AppSettings, GetUserIdentityName() + "\r\n Create - Meeting\r\n" + planNumber.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = planNumber, UserID = GetUserIdentityName(), DocumentType = "Meeting", OperationType = "Error", Comments = "Create - " + exceptionString });
|
||||
throw new Exception("Error: " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult EditMeeting(int meetingID) {
|
||||
int isITARCompliant = 1;
|
||||
CCMeeting meeting = new CCMeeting();
|
||||
meeting = ccDMO.GetMeetingRead(meetingID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
CCMeeting meeting = new();
|
||||
meeting = ccDMO.GetMeetingRead(meetingID, out isITARCompliant, GlobalVars.GetUserId(GetSession()));
|
||||
ViewBag.MeetingList = ccDMO.GetMeetingList(meeting.PlanNumber);
|
||||
// TODO locked functionality
|
||||
List<ApproversListViewModel> userList = MiscDMO.GetApproversListByDocument(meeting.PlanNumber, meeting.CurrentStep, (int)GlobalVars.DocumentType.ChangeControl);
|
||||
ApproversListViewModel appUser = userList.Find(delegate (ApproversListViewModel al) { return al.UserID == (int)Session[GlobalVars.SESSION_USERID]; });
|
||||
ApproversListViewModel appUser = userList.Find(delegate (ApproversListViewModel al) { return al.UserID == GlobalVars.GetUserId(GetSession()); });
|
||||
if (appUser != null) {
|
||||
ViewBag.IsApprover = "true";
|
||||
}
|
||||
@ -241,7 +260,7 @@ public class ChangeControlController : Controller {
|
||||
{
|
||||
return View("UnAuthorizedAccess");
|
||||
} else {
|
||||
if ((meeting.RecordLockIndicator && meeting.RecordLockedBy != (int)Session[GlobalVars.SESSION_USERID])
|
||||
if ((meeting.RecordLockIndicator && meeting.RecordLockedBy != GlobalVars.GetUserId(GetSession()))
|
||||
|| (meeting.PCRBClosed)) {
|
||||
return RedirectToAction("ReadOnlyMeeting", new { meetingID = meetingID });
|
||||
} else if (meeting.Decision != -1) {
|
||||
@ -251,7 +270,7 @@ public class ChangeControlController : Controller {
|
||||
ViewBag.Attendees = ccDMO.GetUsers();
|
||||
ViewBag.Sites = ccDMO.GetSites();
|
||||
ViewBag.PCRValues = ccDMO.GetPCRValues();
|
||||
meeting = ccDMO.GetMeeting(meetingID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
meeting = ccDMO.GetMeeting(meetingID, out isITARCompliant, GlobalVars.GetUserId(GetSession()));
|
||||
|
||||
return View(meeting);
|
||||
}
|
||||
@ -260,8 +279,8 @@ public class ChangeControlController : Controller {
|
||||
|
||||
public ActionResult ReadOnlyMeeting(int meetingID) {
|
||||
int isITARCompliant = 1;
|
||||
CCMeeting meeting = new CCMeeting();
|
||||
meeting = ccDMO.GetMeetingRead(meetingID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
CCMeeting meeting = new();
|
||||
meeting = ccDMO.GetMeetingRead(meetingID, out isITARCompliant, GlobalVars.GetUserId(GetSession()));
|
||||
ViewBag.MeetingList = ccDMO.GetMeetingList(meeting.PlanNumber);
|
||||
ViewBag.PCRValues = ccDMO.GetPCRValues();
|
||||
|
||||
@ -286,13 +305,13 @@ public class ChangeControlController : Controller {
|
||||
|
||||
public ActionResult EditMeetingUpdate(int meetingID) {
|
||||
int isITARCompliant = 1;
|
||||
CCMeeting meeting = new CCMeeting();
|
||||
meeting = ccDMO.GetMeetingRead(meetingID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
CCMeeting meeting = new();
|
||||
meeting = ccDMO.GetMeetingRead(meetingID, out isITARCompliant, GlobalVars.GetUserId(GetSession()));
|
||||
ViewBag.MeetingList = ccDMO.GetMeetingList(meeting.PlanNumber);
|
||||
ViewBag.PCRValues = ccDMO.GetPCRValues();
|
||||
// TODO locked functionality
|
||||
List<ApproversListViewModel> userList = MiscDMO.GetApproversListByDocument(meeting.PlanNumber, meeting.CurrentStep, (int)GlobalVars.DocumentType.ChangeControl);
|
||||
ApproversListViewModel appUser = userList.Find(delegate (ApproversListViewModel al) { return al.UserID == (int)Session[GlobalVars.SESSION_USERID]; });
|
||||
ApproversListViewModel appUser = userList.Find(delegate (ApproversListViewModel al) { return al.UserID == GlobalVars.GetUserId(GetSession()); });
|
||||
if (appUser != null) {
|
||||
ViewBag.IsApprover = "true";
|
||||
}
|
||||
@ -301,11 +320,11 @@ public class ChangeControlController : Controller {
|
||||
{
|
||||
return View("UnAuthorizedAccess");
|
||||
} else {
|
||||
if ((meeting.RecordLockIndicator && meeting.RecordLockedBy != (int)Session[GlobalVars.SESSION_USERID])
|
||||
if ((meeting.RecordLockIndicator && meeting.RecordLockedBy != GlobalVars.GetUserId(GetSession()))
|
||||
|| (meeting.PCRBClosed)) {
|
||||
return RedirectToAction("ReadOnlyMeeting", new { meetingID = meetingID });
|
||||
} else {
|
||||
meeting = ccDMO.GetMeeting(meetingID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
meeting = ccDMO.GetMeeting(meetingID, out isITARCompliant, GlobalVars.GetUserId(GetSession()));
|
||||
|
||||
ViewBag.AIResponsibles = ccDMO.GetActionItemResponsible();
|
||||
|
||||
@ -336,10 +355,14 @@ public class ChangeControlController : Controller {
|
||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
public ActionResult GetDecisionsSummaryList([DataSourceRequest] DataSourceRequest request, int meetingID) {
|
||||
return Json(ccDMO.GetDecisionsSummaryList(meetingID).ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public ActionResult UpdateMeetingDecisionNotes(CCDecisionSummary model) {
|
||||
try {
|
||||
ccDMO.UpdateDecisionSummary(model);
|
||||
@ -349,6 +372,8 @@ public class ChangeControlController : Controller {
|
||||
return Content("Saved Succesfully");
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
public ActionResult DeleteDecisionsSummary([DataSourceRequest] DataSourceRequest request, CCDecisionSummary model) {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
@ -357,6 +382,8 @@ public class ChangeControlController : Controller {
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public ActionResult InsertDecisionsSummary(CCDecisionSummary model) {
|
||||
try {
|
||||
ccDMO.InsertDecisionSummary(model);
|
||||
@ -375,19 +402,23 @@ public class ChangeControlController : Controller {
|
||||
return Content("Saved Succesfully", "application/json");
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
public ActionResult GetMeetingList([DataSourceRequest] DataSourceRequest request, int planNumber) {
|
||||
var meetingList = ccDMO.GetMeetingList(planNumber);
|
||||
return Json(meetingList.ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
///
|
||||
public ActionResult GetMeetingAttendees([DataSourceRequest] DataSourceRequest request, int meetingID) {
|
||||
return Json(ccDMO.GetMeetingAttendees(meetingID).ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
public ActionResult GetPCRBAttendees([DataSourceRequest] DataSourceRequest request, int PCRBID) {
|
||||
return Json(ccDMO.GetPCRBAttendees(PCRBID).ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public void InsertNewMeetingAttendee(string attendeeName, string jobTitle, string siteName) {
|
||||
try {
|
||||
} catch (Exception e) {
|
||||
@ -412,8 +443,8 @@ public class ChangeControlController : Controller {
|
||||
detailedException = e.Message;
|
||||
}
|
||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + docid.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n UpdateMeetingAttendee - Change Control\r\n" + docid.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = @User.Identity.Name, DocumentType = "Change Control", OperationType = "Error", Comments = "UpdateMeetingAttendee - " + exceptionString });
|
||||
Functions.WriteEvent(_AppSettings, GetUserIdentityName() + "\r\n UpdateMeetingAttendee - Change Control\r\n" + docid.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = GetUserIdentityName(), DocumentType = "Change Control", OperationType = "Error", Comments = "UpdateMeetingAttendee - " + exceptionString });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
}
|
||||
@ -432,12 +463,14 @@ public class ChangeControlController : Controller {
|
||||
detailedException = e.Message;
|
||||
}
|
||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + docid.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n UpdateMeetingAttendee - Change Control\r\n" + docid.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = @User.Identity.Name, DocumentType = "Change Control", OperationType = "Error", Comments = "UpdateMeetingAttendee - " + exceptionString });
|
||||
Functions.WriteEvent(_AppSettings, GetUserIdentityName() + "\r\n UpdateMeetingAttendee - Change Control\r\n" + docid.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = GetUserIdentityName(), DocumentType = "Change Control", OperationType = "Error", Comments = "UpdateMeetingAttendee - " + exceptionString });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
public ActionResult DeleteMeetingAttendee([DataSourceRequest] DataSourceRequest request, CCMeetingAttendee model) {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
@ -475,6 +508,8 @@ public class ChangeControlController : Controller {
|
||||
return Json(ccDMO.GetMeetingActionItems_All(planNumber).ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public ActionResult InsertPCRBActionItem(CCPCRBActionItem model) {
|
||||
try {
|
||||
if (model != null) {
|
||||
@ -501,6 +536,8 @@ public class ChangeControlController : Controller {
|
||||
return Content("1");
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
public ActionResult InsertPCRBAttendee([DataSourceRequest] DataSourceRequest request, int pcrId, int attendeeId, string jobTitle, string siteName) {
|
||||
CCPCRBAttendee newAttendee = new CCPCRBAttendee();
|
||||
newAttendee.AttendeeID = attendeeId;
|
||||
@ -517,6 +554,8 @@ public class ChangeControlController : Controller {
|
||||
return Content("1");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public ActionResult UpdatePCRBActionItem(CCPCRBActionItem model) {
|
||||
try {
|
||||
if (model != null) {
|
||||
@ -529,10 +568,12 @@ public class ChangeControlController : Controller {
|
||||
return Content("1");
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
public ActionResult UpdateMeetingActionItemAll([DataSourceRequest] DataSourceRequest request, CCMeetingActionItemAll model) {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
model.ClosedBy = (int)Session[GlobalVars.SESSION_USERID];
|
||||
model.ClosedBy = GlobalVars.GetUserId(GetSession());
|
||||
ccDMO.UpdateMeetingActionItem_All(model);
|
||||
}
|
||||
if (model.ClosedStatus)
|
||||
@ -543,6 +584,8 @@ public class ChangeControlController : Controller {
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public ActionResult UpdateMeetingActionItem(CCMeetingActionItem model) {
|
||||
try {
|
||||
if (model != null) {
|
||||
@ -557,11 +600,11 @@ public class ChangeControlController : Controller {
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult ReassignMeetingActionItemResponsiblePersons(int meetingActionItemId, string newResponsiblePersonIDs, string comments) {
|
||||
if (Session[GlobalVars.IS_ADMIN] == null)
|
||||
if (GlobalVars.IsAdminValueNull(GetSession()))
|
||||
throw new Exception("Permission denied");
|
||||
|
||||
try {
|
||||
ccDMO.ReassignMeetingActionItemResponsiblePersons(meetingActionItemId, newResponsiblePersonIDs, comments, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
ccDMO.ReassignMeetingActionItemResponsiblePersons(meetingActionItemId, newResponsiblePersonIDs, comments, GlobalVars.GetUserId(GetSession()));
|
||||
} catch (Exception ex) {
|
||||
return Content(ex.Message.ToString());
|
||||
}
|
||||
@ -569,6 +612,8 @@ public class ChangeControlController : Controller {
|
||||
return Content("1");
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
public ActionResult DeleteMeetingActionItem([DataSourceRequest] DataSourceRequest request, CCMeetingActionItem model) {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
@ -584,6 +629,8 @@ public class ChangeControlController : Controller {
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public void CompleteCC(int planNumber) {
|
||||
int docid = planNumber;
|
||||
try {
|
||||
@ -596,8 +643,8 @@ public class ChangeControlController : Controller {
|
||||
detailedException = e.Message;
|
||||
}
|
||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + docid.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n CompleteCC - Change Control\r\n" + docid.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = @User.Identity.Name, DocumentType = "Change Control", OperationType = "Error", Comments = "CompleteCC - " + exceptionString });
|
||||
Functions.WriteEvent(_AppSettings, GetUserIdentityName() + "\r\n CompleteCC - Change Control\r\n" + docid.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = GetUserIdentityName(), DocumentType = "Change Control", OperationType = "Error", Comments = "CompleteCC - " + exceptionString });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
}
|
||||
@ -614,16 +661,18 @@ public class ChangeControlController : Controller {
|
||||
detailedException = e.Message;
|
||||
}
|
||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + docid.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n CompleteCC - Change Control\r\n" + docid.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = @User.Identity.Name, DocumentType = "Change Control", OperationType = "Error", Comments = "CancelCC - " + exceptionString });
|
||||
Functions.WriteEvent(_AppSettings, GetUserIdentityName() + "\r\n CompleteCC - Change Control\r\n" + docid.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = GetUserIdentityName(), DocumentType = "Change Control", OperationType = "Error", Comments = "CancelCC - " + exceptionString });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
|
||||
public ActionResult AttachSaveActionItem(IEnumerable<HttpPostedFileBase> AIfiles, int planNumber, int attachID) {
|
||||
// The Name of the Upload component is "files"
|
||||
if (AIfiles != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
int userId = GlobalVars.GetUserId(GetSession());
|
||||
foreach (var file in AIfiles) {
|
||||
ChangeControlHelper.AttachSaveActionItem(_AppSettings, ccDMO, planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
}
|
||||
@ -631,6 +680,8 @@ public class ChangeControlController : Controller {
|
||||
return Content("");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public FileResult DownloadActionItemFile(string fileGuid, int planNumber) {
|
||||
string fileName = ccDMO.GetActionItemFileName(fileGuid);
|
||||
|
||||
@ -658,36 +709,36 @@ public class ChangeControlController : Controller {
|
||||
}
|
||||
|
||||
public void ReleaseLockOnDocument(int planNumber) {
|
||||
ccDMO.ReleaseLockOnDocument((int)Session[GlobalVars.SESSION_USERID], planNumber);
|
||||
ccDMO.ReleaseLockOnDocument(GlobalVars.GetUserId(GetSession()), planNumber);
|
||||
|
||||
try {
|
||||
ccDMO.ReleaseLockOnDocument((int)Session[GlobalVars.SESSION_USERID], planNumber);
|
||||
ccDMO.ReleaseLockOnDocument(GlobalVars.GetUserId(GetSession()), planNumber);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n ReleaseLockOnDocument LD\r\n" + planNumber.ToString() + "\r\n" + e.Message, System.Diagnostics.EventLogEntryType.Error);
|
||||
Functions.WriteEvent(_AppSettings, GetUserIdentityName() + "\r\n ReleaseLockOnDocument LD\r\n" + planNumber.ToString() + "\r\n" + e.Message, System.Diagnostics.EventLogEntryType.Error);
|
||||
} catch { }
|
||||
ccDMO.ReleaseLockOnDocument(-1, planNumber);
|
||||
}
|
||||
}
|
||||
|
||||
public JsonResult GetAllUsersList() {
|
||||
UserAccountDMO userDMO = new UserAccountDMO();
|
||||
UserAccountDMO userDMO = new();
|
||||
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||
return GetJsonResult(userlist);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void ReAssignOwnerByAdmin(string planNumber, string comments, int newOwnerId) {
|
||||
if (Session[GlobalVars.IS_ADMIN] == null)
|
||||
if (GlobalVars.IsAdminValueNull(GetSession()))
|
||||
throw new Exception("Permission denied");
|
||||
|
||||
int planNumberInt = 0;
|
||||
|
||||
try {
|
||||
// remove non-numeric characters from Plan # then convert to int
|
||||
planNumberInt = Int32.Parse(new String(planNumber.Where<char>(c => char.IsNumber(c)).ToArray()));
|
||||
planNumberInt = int.Parse(new string(planNumber.Where(char.IsNumber).ToArray()));
|
||||
|
||||
ccDMO.ReassignOwner(planNumberInt, newOwnerId, comments, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
ccDMO.ReassignOwner(planNumberInt, newOwnerId, comments, GlobalVars.GetUserId(GetSession()));
|
||||
} catch (Exception e) {
|
||||
string detailedException = "";
|
||||
try {
|
||||
@ -698,17 +749,46 @@ public class ChangeControlController : Controller {
|
||||
string exceptionString = e.Message.ToString().Trim();
|
||||
if (exceptionString.Length > 450)
|
||||
exceptionString = exceptionString.Substring(0, 450);
|
||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n ReAssignOwnerByAdmin\r\n" + planNumber.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = planNumberInt, UserID = @User.Identity.Name, DocumentType = "ChangeControl", OperationType = "Error", Comments = "ReAssignOwnerByAdmin - " + exceptionString });
|
||||
Functions.WriteEvent(_AppSettings, GetUserIdentityName() + "\r\n ReAssignOwnerByAdmin\r\n" + planNumber.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = planNumberInt, UserID = GetUserIdentityName(), DocumentType = "ChangeControl", OperationType = "Error", Comments = "ReAssignOwnerByAdmin - " + exceptionString });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult GetPCRBMesaTitle(int issueID) {
|
||||
int isItarCompliant = 1;
|
||||
ChangeControlViewModel cc = ccDMO.GetChangeControlRead(issueID, out isItarCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
ChangeControlViewModel cc = ccDMO.GetChangeControlRead(issueID, out isItarCompliant, GlobalVars.GetUserId(GetSession()));
|
||||
string content = cc.PlanTitle;
|
||||
return Content(content);
|
||||
}
|
||||
|
||||
#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