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:
@ -1,3 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Services;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Misc;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
@ -6,14 +13,6 @@ using Fab2ApprovalSystem.ViewModels;
|
||||
using Kendo.Mvc.Extensions;
|
||||
using Kendo.Mvc.UI;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Services;
|
||||
|
||||
namespace Fab2ApprovalSystem.Controllers;
|
||||
|
||||
[Authorize]
|
||||
@ -21,13 +20,8 @@ namespace Fab2ApprovalSystem.Controllers;
|
||||
[SessionExpireFilter]
|
||||
public class ChangeControlController : Controller {
|
||||
|
||||
ChangeControlDMO ccDMO;
|
||||
private readonly AppSettings _AppSettings;
|
||||
|
||||
public ChangeControlController(AppSettings appSettings) {
|
||||
_AppSettings = appSettings;
|
||||
ccDMO = new ChangeControlDMO(appSettings);
|
||||
}
|
||||
ChangeControlDMO ccDMO = new ChangeControlDMO();
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
public ActionResult Index() {
|
||||
return View();
|
||||
@ -63,7 +57,7 @@ public class ChangeControlController : Controller {
|
||||
if (appUser != null) {
|
||||
ViewBag.IsApprover = "true";
|
||||
}
|
||||
//TODO locked functionality
|
||||
// TODO locked functionality
|
||||
|
||||
if (isITARCompliant == 0) // not ITAR Compliant
|
||||
{
|
||||
@ -82,8 +76,6 @@ public class ChangeControlController : Controller {
|
||||
ViewBag.Attendees = ccDMO.GetUsers();
|
||||
ViewBag.Generations = ccDMO.GetGenerations();
|
||||
ViewBag.PartNumbers = ccDMO.GetPartNumbers();
|
||||
//ViewBag.ToolTypes = ccDMO.GetToolTypes();
|
||||
//ViewBag.MeetingList = ccDMO.GetMeetingList(issueID);
|
||||
ViewBag.Processes = ccDMO.GetProcesses();
|
||||
ViewBag.Logistics = ccDMO.GetLogistics();
|
||||
ViewBag.AIResponsibles = ccDMO.GetActionItemResponsible();
|
||||
@ -97,7 +89,7 @@ public class ChangeControlController : Controller {
|
||||
int isITARCompliant = 1;
|
||||
ChangeControlViewModel cc = new ChangeControlViewModel();
|
||||
cc = ccDMO.GetChangeControlRead(issueID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
//TODO locked functionality
|
||||
// TODO locked functionality
|
||||
|
||||
if (isITARCompliant == 0) // not ITAR Compliant
|
||||
{
|
||||
@ -106,7 +98,6 @@ public class ChangeControlController : Controller {
|
||||
ViewBag.MeetingList = ccDMO.GetMeetingList(issueID);
|
||||
ViewBag.Generations = ccDMO.GetGenerations();
|
||||
ViewBag.PartNumbers = ccDMO.GetPartNumbers();
|
||||
//ViewBag.ToolTypes = ccDMO.GetToolTypes();
|
||||
ViewBag.Processes = ccDMO.GetProcesses();
|
||||
ViewBag.Logistics = ccDMO.GetLogistics();
|
||||
return View(cc);
|
||||
@ -153,7 +144,6 @@ public class ChangeControlController : Controller {
|
||||
ccDMO.UpdateCCAttachemnt(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -163,7 +153,6 @@ public class ChangeControlController : Controller {
|
||||
ccDMO.DeleteCCAttachemnt(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -180,7 +169,7 @@ public class ChangeControlController : Controller {
|
||||
if (files != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
foreach (var file in files) {
|
||||
ccDMO.AttachSaveCC(planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
ChangeControlHelper.AttachSaveCC(_AppSettings, ccDMO, planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
}
|
||||
}
|
||||
return Content("");
|
||||
@ -202,8 +191,6 @@ public class ChangeControlController : Controller {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
ccDMO.UpdateMeetingAttachmentAttrib(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -212,8 +199,6 @@ public class ChangeControlController : Controller {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
ccDMO.DeleteMeetingAttachemnt(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -231,7 +216,7 @@ public class ChangeControlController : Controller {
|
||||
if (files != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
foreach (var file in files) {
|
||||
ccDMO.AttachSaveMeeting(planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
ChangeControlHelper.AttachSaveMeeting(_AppSettings, ccDMO, planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
}
|
||||
}
|
||||
return Content("");
|
||||
@ -243,7 +228,7 @@ public class ChangeControlController : Controller {
|
||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||
|
||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "ChangeControl\\" + planNumber.ToString();
|
||||
var sDocument = Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||
var sDocument = System.IO.Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||
|
||||
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||
@ -254,7 +239,6 @@ public class ChangeControlController : Controller {
|
||||
|
||||
if (!System.IO.File.Exists(sDocument)) {
|
||||
return null;
|
||||
//throw new Exception("File not found");
|
||||
}
|
||||
|
||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||
@ -263,9 +247,7 @@ public class ChangeControlController : Controller {
|
||||
public ActionResult CreateMeeting(int planNumber) {
|
||||
try {
|
||||
int meetingID = ccDMO.InsertMeeting(planNumber);
|
||||
//return RedirectToAction("EditMeeting", new { meetingID = meetingID });
|
||||
return Content(meetingID.ToString());
|
||||
//return null;
|
||||
} catch (Exception e) {
|
||||
string detailedException = "";
|
||||
try {
|
||||
@ -285,7 +267,7 @@ public class ChangeControlController : Controller {
|
||||
CCMeeting meeting = new CCMeeting();
|
||||
meeting = ccDMO.GetMeetingRead(meetingID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
ViewBag.MeetingList = ccDMO.GetMeetingList(meeting.PlanNumber);
|
||||
//TODO locked functionality
|
||||
// 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]; });
|
||||
if (appUser != null) {
|
||||
@ -345,7 +327,7 @@ public class ChangeControlController : Controller {
|
||||
meeting = ccDMO.GetMeetingRead(meetingID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
ViewBag.MeetingList = ccDMO.GetMeetingList(meeting.PlanNumber);
|
||||
ViewBag.PCRValues = ccDMO.GetPCRValues();
|
||||
//TODO locked functionality
|
||||
// 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]; });
|
||||
if (appUser != null) {
|
||||
@ -375,7 +357,7 @@ public class ChangeControlController : Controller {
|
||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||
|
||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "ChangeControl\\" + planNumber.ToString();
|
||||
var sDocument = Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||
var sDocument = System.IO.Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||
|
||||
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||
@ -386,7 +368,6 @@ public class ChangeControlController : Controller {
|
||||
|
||||
if (!System.IO.File.Exists(sDocument)) {
|
||||
return null;
|
||||
//throw new Exception("File not found");
|
||||
}
|
||||
|
||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||
@ -410,8 +391,6 @@ public class ChangeControlController : Controller {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
ccDMO.DeleteDecisionSummary(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -448,7 +427,6 @@ public class ChangeControlController : Controller {
|
||||
|
||||
public void InsertNewMeetingAttendee(string attendeeName, string jobTitle, string siteName) {
|
||||
try {
|
||||
//ccDMO.InsertNewMeetingAttendee(meetingId, attendeeName, jobTitle, siteName);
|
||||
} catch (Exception e) {
|
||||
string detailedException = "";
|
||||
try {
|
||||
@ -456,10 +434,6 @@ public class ChangeControlController : Controller {
|
||||
} catch {
|
||||
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 });
|
||||
//throw new Exception(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -479,8 +453,6 @@ public class ChangeControlController : Controller {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = @User.Identity.Name, DocumentType = "Change Control", OperationType = "Error", Comments = "UpdateMeetingAttendee - " + exceptionString });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
//return Content("");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@ -501,8 +473,6 @@ public class ChangeControlController : Controller {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = @User.Identity.Name, DocumentType = "Change Control", OperationType = "Error", Comments = "UpdateMeetingAttendee - " + exceptionString });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
//return Content("");
|
||||
}
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
@ -510,8 +480,6 @@ public class ChangeControlController : Controller {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
ccDMO.DeleteMeetingAttendee(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -530,8 +498,6 @@ public class ChangeControlController : Controller {
|
||||
}
|
||||
|
||||
return Content("1");
|
||||
|
||||
//return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
public ActionResult GetMeetingActionItems([DataSourceRequest] DataSourceRequest request, int meetingID) {
|
||||
@ -546,17 +512,6 @@ public class ChangeControlController : Controller {
|
||||
return Json(ccDMO.GetMeetingActionItems_All(planNumber).ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
//public ActionResult InsertMeetingActionItem([DataSourceRequest] DataSourceRequest request, CCMeetingActionItem model)
|
||||
//{
|
||||
// if (model != null && ModelState.IsValid)
|
||||
// {
|
||||
// ccDMO.InsertMeetingActionItem(model);
|
||||
// }
|
||||
|
||||
// return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
//}
|
||||
|
||||
public ActionResult InsertPCRBActionItem(CCPCRBActionItem model) {
|
||||
try {
|
||||
if (model != null) {
|
||||
@ -597,8 +552,6 @@ public class ChangeControlController : Controller {
|
||||
}
|
||||
|
||||
return Content("1");
|
||||
|
||||
//return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
public ActionResult UpdatePCRBActionItem(CCPCRBActionItem model) {
|
||||
@ -658,8 +611,6 @@ public class ChangeControlController : Controller {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
ccDMO.DeleteMeetingActionItem(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -667,8 +618,6 @@ public class ChangeControlController : Controller {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
ccDMO.DeletePCRBActionItem(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -713,7 +662,7 @@ public class ChangeControlController : Controller {
|
||||
if (AIfiles != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
foreach (var file in AIfiles) {
|
||||
ccDMO.AttachSaveActionItem(planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
ChangeControlHelper.AttachSaveActionItem(_AppSettings, ccDMO, planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
}
|
||||
}
|
||||
return Content("");
|
||||
@ -725,7 +674,7 @@ public class ChangeControlController : Controller {
|
||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||
|
||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "ChangeControl\\" + planNumber.ToString();
|
||||
var sDocument = Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||
var sDocument = System.IO.Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||
|
||||
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||
@ -736,7 +685,6 @@ public class ChangeControlController : Controller {
|
||||
|
||||
if (!System.IO.File.Exists(sDocument)) {
|
||||
return null;
|
||||
//throw new Exception("File not found");
|
||||
}
|
||||
|
||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||
@ -760,9 +708,6 @@ public class ChangeControlController : Controller {
|
||||
}
|
||||
|
||||
public JsonResult GetAllUsersList() {
|
||||
//var userList = ldDMO.GetApprovedApproversList(issueID, currentStep);
|
||||
//return Json(userList, JsonRequestBehavior.AllowGet);
|
||||
|
||||
UserAccountDMO userDMO = new UserAccountDMO();
|
||||
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||
|
Reference in New Issue
Block a user