PCRB webassembly

This commit is contained in:
Chase Tucker
2024-05-13 14:33:27 -07:00
parent 9b7e3ef897
commit 89790f4fc1
50 changed files with 5466 additions and 677 deletions

View File

@ -102,53 +102,15 @@ namespace Fab2ApprovalSystem.Controllers
// GET: /MRB/Edit/5
public ActionResult Edit(int issueID)
{
MRB mrb = new MRB();
int isITARCompliant = 1;
ViewBag.Status = "Pending";
ViewBag.IsApprover = "false";
ViewBag.IsCloser = "false";
string jwt = Session["JWT"].ToString();
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
string refreshToken = Session["RefreshToken"].ToString();
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
"https://localhost:7255";
string mrbUrl = $"{wasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/mrb/{issueID}";
//ViewBag.IsApproved = "false";
//ViewBag.IsClosed = "false";
PopulateCloseToQDB();
mrb = mrbDMO.GetMRBItem(issueID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
ViewBag.UserList = mrbDMO.GetUserList();
if (isITARCompliant == 0) // not ITAR Compliant
{
return View("UnAuthorizedAccess");
}
else
{
if (mrb.ApprovalStatus == (int)GlobalVars.ApprovalOption.Approved)
{
//ViewBag.IsApproved = "true";
ViewBag.Status = "Approved";
}
else if (mrb.ApprovalStatus == (int)GlobalVars.ApprovalOption.Closed)
{
ViewBag.Status = "Closed";
//ViewBag.IsClosed = "true";
}
List<ApproversListViewModel> userList = MiscDMO.GetApproversListByDocument(issueID, mrb.CurrentStep, (int)GlobalVars.DocumentType.MRB);
ApproversListViewModel appUser = userList.Find(delegate (ApproversListViewModel al) { return al.UserID == (int)Session[GlobalVars.SESSION_USERID]; });
if (appUser != null)
{
ViewBag.IsApprover = "true";
}
}
// can edit
ViewBag.Owners = MiscDMO.GetUserList();
ViewBag.Modules = mrbDMO.GetModules();
//ViewBag.Dispositions = mrbDMO.GetDispositions();
ViewBag.RiskAssessments = mrbDMO.GetRiskAssessments();
ViewBag.PartGroups = mrbDMO.GetPartGroups();
ViewBag.DispoTypes = mrbDMO.GetDispositions(issueID).Select(d => new { d.DispositionType });
return View(mrb);
return Redirect(mrbUrl);
}
//
@ -178,39 +140,15 @@ namespace Fab2ApprovalSystem.Controllers
/// <returns></returns>
public ActionResult ReadOnly(int issueID)
{
MRB mrb = new MRB();
int isITARCompliant = 1;
string jwt = Session["JWT"].ToString();
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
string refreshToken = Session["RefreshToken"].ToString();
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
"https://localhost:7255";
string mrbUrl = $"{wasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/mrb/{issueID}";
try
{
if (isITARCompliant == 0) // not ITAR Compliant
{
return View("UnAuthorizedAccess");
}
else
{
mrb = mrbDMO.GetMRBItem(issueID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
ViewBag.Owners = MiscDMO.GetUserList();
ViewBag.Modules = mrbDMO.GetModules();
//ViewBag.Dispositions = mrbDMO.GetDispositions();
ViewBag.RiskAssessments = mrbDMO.GetRiskAssessments();
ViewBag.PartGroups = mrbDMO.GetPartGroups();
ViewBag.DispoTypes = mrbDMO.GetDispositions(issueID).Select(d => new { d.DispositionType });
}
return View(mrb);
}
catch (Exception e)
{
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "IssueID=" + issueID.ToString() + " " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
Functions.WriteEvent(@User.Identity.Name + "\r\n ReadOnly Disposition\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Error", Comments = exceptionString });
throw new Exception(e.Message);
}
return Redirect(mrbUrl);
}
//