Compare commits
9 Commits
f110fba4cd
...
fix-core-t
| Author | SHA1 | Date | |
|---|---|---|---|
| 54799f54ec | |||
| 65a433e9ab | |||
| 8bae94de96 | |||
| 032c971472 | |||
| 704df4fa8c | |||
| e452047dfb | |||
| bf3e46a784 | |||
| 909f358356 | |||
| b3fb328b98 |
@ -58,6 +58,7 @@ public class AuditController : Controller {
|
|||||||
try {
|
try {
|
||||||
bool isAdmin = (bool)Session[GlobalVars.IS_ADMIN];
|
bool isAdmin = (bool)Session[GlobalVars.IS_ADMIN];
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
|
audit = auditDMO.GetAuditItem(issueID, userId);
|
||||||
AuditEdit auditEdit = auditDMO.GetAuditEdit(issueID, audit, isAdmin, userId);
|
AuditEdit auditEdit = auditDMO.GetAuditEdit(issueID, audit, isAdmin, userId);
|
||||||
if (auditEdit.RedirectToAction)
|
if (auditEdit.RedirectToAction)
|
||||||
return RedirectToAction("ReadOnlyAudit", new { auditNo = audit.AuditNo });
|
return RedirectToAction("ReadOnlyAudit", new { auditNo = audit.AuditNo });
|
||||||
|
|||||||
@ -52,7 +52,7 @@ public class ChangeControlController : Controller {
|
|||||||
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
||||||
string refreshToken = Session["RefreshToken"].ToString();
|
string refreshToken = Session["RefreshToken"].ToString();
|
||||||
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
||||||
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/pcrb/{issueID}";
|
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=pcrb/{issueID}";
|
||||||
|
|
||||||
return Redirect(mrbUrl);
|
return Redirect(mrbUrl);
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ public class ChangeControlController : Controller {
|
|||||||
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
||||||
string refreshToken = Session["RefreshToken"].ToString();
|
string refreshToken = Session["RefreshToken"].ToString();
|
||||||
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
||||||
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/pcrb/{issueID}";
|
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=pcrb/{issueID}";
|
||||||
|
|
||||||
return Redirect(mrbUrl);
|
return Redirect(mrbUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
@ -21,7 +22,7 @@ namespace Fab2ApprovalSystem.Controllers;
|
|||||||
[Authorize]
|
[Authorize]
|
||||||
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class ECNController : PdfViewController {
|
public class ECNController : Controller {
|
||||||
|
|
||||||
private const string ECN_PREFIX = "ECN_";
|
private const string ECN_PREFIX = "ECN_";
|
||||||
private const string TECN_PREFIX = "TECN_";
|
private const string TECN_PREFIX = "TECN_";
|
||||||
@ -669,9 +670,6 @@ public class ECNController : PdfViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get a list of Approvers and the status
|
|
||||||
/// </summary>
|
|
||||||
public ActionResult GetApproversList([DataSourceRequest] DataSourceRequest request, int issueID, byte step, bool isTECN, bool isEmergrncyTECN) {
|
public ActionResult GetApproversList([DataSourceRequest] DataSourceRequest request, int issueID, byte step, bool isTECN, bool isEmergrncyTECN) {
|
||||||
int isITARCompliant = 0;
|
int isITARCompliant = 0;
|
||||||
ECN ecn = new ECN();
|
ECN ecn = new ECN();
|
||||||
@ -883,6 +881,8 @@ public class ECNController : PdfViewController {
|
|||||||
|
|
||||||
string outputFileName = "";
|
string outputFileName = "";
|
||||||
ecn = ecnDMO.GetECNPdf(ecnNumber);
|
ecn = ecnDMO.GetECNPdf(ecnNumber);
|
||||||
|
ViewBag.Category = ecnDMO.GetCategoryID(ecn);
|
||||||
|
ViewBag.TrainingNotificationTo = ecnDMO.GetTrainingNotificationTo(ecn, trainingDMO);
|
||||||
outputFileName = ecnNumber.ToString() + ".pdf";
|
outputFileName = ecnNumber.ToString() + ".pdf";
|
||||||
|
|
||||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString();
|
string ecnFolderPath = _AppSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString();
|
||||||
@ -891,10 +891,12 @@ public class ECNController : PdfViewController {
|
|||||||
if (!di.Exists)
|
if (!di.Exists)
|
||||||
di.Create();
|
di.Create();
|
||||||
|
|
||||||
// To render a PDF instead of an HTML, all we need to do is call ViewPdf instead of View. This
|
string htmlText;
|
||||||
// requires the controller to be inherited from MyController instead of MVC's Controller.
|
string pageTitle = string.Empty;
|
||||||
SavePdf(ecnFolderPath + "\\ECNForm_" + outputFileName, "ECNPdf", ecn);
|
htmlText = RenderViewToString("ECNPdf", ecn);
|
||||||
SavePdf(ecnFolderPath + "\\ECNApprovalLog_" + outputFileName, "ECNApprovalPdf", ecn);
|
StandardPdfRenderer.WritePortableDocumentFormatToFile(pageTitle, htmlText, $"{ecnFolderPath}\\ECNForm_{outputFileName}");
|
||||||
|
htmlText = RenderViewToString("ECNApprovalPdf", ecn);
|
||||||
|
StandardPdfRenderer.WritePortableDocumentFormatToFile(pageTitle, htmlText, $"{ecnFolderPath}\\ECNApprovalLog_{outputFileName}");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "ECN", OperationType = "Generate PDF", Comments = ex.Message });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "ECN", OperationType = "Generate PDF", Comments = ex.Message });
|
||||||
ecn = null;
|
ecn = null;
|
||||||
@ -904,12 +906,32 @@ public class ECNController : PdfViewController {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string RenderViewToString(string viewName, ECNPdf ecnPdf) {
|
||||||
|
string result;
|
||||||
|
ViewData.Model = ecnPdf;
|
||||||
|
using (StringWriter writer = new()) {
|
||||||
|
try {
|
||||||
|
ViewEngineResult viewResult = ViewEngines.Engines.FindView(ControllerContext, viewName, string.Empty);
|
||||||
|
if (viewResult is null)
|
||||||
|
return $"A view with the name '{viewName}' could not be found";
|
||||||
|
ViewContext viewContext = new(ControllerContext, viewResult.View, ViewData, TempData, writer);
|
||||||
|
viewResult.View.Render(viewContext, writer);
|
||||||
|
result = writer.GetStringBuilder().ToString();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
result = $"Failed - {ex.Message}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public bool GenerateECNPdfDifferentLocation(int ecnNumber, int folderName) {
|
public bool GenerateECNPdfDifferentLocation(int ecnNumber, int folderName) {
|
||||||
ECNPdf ecn = new ECNPdf();
|
ECNPdf ecn = new ECNPdf();
|
||||||
try {
|
try {
|
||||||
string outputFileName = "";
|
string outputFileName = "";
|
||||||
|
|
||||||
ecn = ecnDMO.GetECNPdf(ecnNumber);
|
ecn = ecnDMO.GetECNPdf(ecnNumber);
|
||||||
|
ViewBag.Category = ecnDMO.GetCategoryID(ecn);
|
||||||
|
ViewBag.TrainingNotificationTo = ecnDMO.GetTrainingNotificationTo(ecn, trainingDMO);
|
||||||
outputFileName = ecnNumber.ToString() + ".pdf";
|
outputFileName = ecnNumber.ToString() + ".pdf";
|
||||||
|
|
||||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "ECN\\" + folderName.ToString();
|
string ecnFolderPath = _AppSettings.AttachmentFolder + "ECN\\" + folderName.ToString();
|
||||||
@ -919,9 +941,9 @@ public class ECNController : PdfViewController {
|
|||||||
if (!di.Exists)
|
if (!di.Exists)
|
||||||
di.Create();
|
di.Create();
|
||||||
|
|
||||||
// To render a PDF instead of an HTML, all we need to do is call ViewPdf instead of View. This
|
string pageTitle = string.Empty;
|
||||||
// requires the controller to be inherited from MyController instead of MVC's Controller.
|
string htmlText = RenderViewToString("ECNPdf", ecn);
|
||||||
SavePdf(ecnFolderPath + "\\ECNForm_" + outputFileName, "ECNPdf", ecn);
|
StandardPdfRenderer.WritePortableDocumentFormatToFile(pageTitle, htmlText, $"{ecnFolderPath}\\ECNForm_{outputFileName}");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "ECN", OperationType = "Generate PDF", Comments = ex.Message });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "ECN", OperationType = "Generate PDF", Comments = ex.Message });
|
||||||
ecn = null;
|
ecn = null;
|
||||||
@ -935,13 +957,20 @@ public class ECNController : PdfViewController {
|
|||||||
ECNPdf ecn;
|
ECNPdf ecn;
|
||||||
try {
|
try {
|
||||||
ecn = ecnDMO.GetECNPdf(ecnNumber);
|
ecn = ecnDMO.GetECNPdf(ecnNumber);
|
||||||
// To render a PDF instead of an HTML, all we need to do is call ViewPdf instead of View. This
|
ViewBag.Category = ecnDMO.GetCategoryID(ecn);
|
||||||
// requires the controller to be inherited from MyController instead of MVC's Controller.
|
ViewBag.TrainingNotificationTo = ecnDMO.GetTrainingNotificationTo(ecn, trainingDMO);
|
||||||
return this.ViewPdf("", "ECNPdf", ecn);
|
string pageTitle = string.Empty;
|
||||||
|
string htmlText = RenderViewToString("ECNPdf", ecn);
|
||||||
|
if (System.Diagnostics.Debugger.IsAttached) {
|
||||||
|
return Content(htmlText, "text/html");
|
||||||
|
} else {
|
||||||
|
byte[] buffer = StandardPdfRenderer.GetPortableDocumentFormatBytes(pageTitle, htmlText);
|
||||||
|
return new BinaryContentResult(buffer, "application/pdf");
|
||||||
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "ECN", OperationType = "Print PDF", Comments = ex.Message });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "ECN", OperationType = "Print PDF", Comments = ex.Message });
|
||||||
ecn = null;
|
ecn = null;
|
||||||
return Content("");
|
return Content("An unexpected error has occurred!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1221,6 +1250,12 @@ public class ECNController : PdfViewController {
|
|||||||
try {
|
try {
|
||||||
lastApproverAndLastStep = true;
|
lastApproverAndLastStep = true;
|
||||||
|
|
||||||
|
ecn.CancellationDate = DateTime.Now;
|
||||||
|
ecn.CancellationApprovalDate = DateTime.Now;
|
||||||
|
ecn.CancellationApproved = true;
|
||||||
|
ecn.Cancelled = true;
|
||||||
|
ecnDMO.UpdateECN(ecn);
|
||||||
|
|
||||||
ECNPdf ecnPDF = new ECNPdf();
|
ECNPdf ecnPDF = new ECNPdf();
|
||||||
GenerateECNPdf(ecnNumber, out ecnPDF);
|
GenerateECNPdf(ecnNumber, out ecnPDF);
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
@ -20,7 +21,7 @@ namespace Fab2ApprovalSystem.Controllers;
|
|||||||
[Authorize]
|
[Authorize]
|
||||||
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class LotTravelerController : PdfViewController {
|
public class LotTravelerController : Controller {
|
||||||
|
|
||||||
LotTravelerDMO LotTravDMO = new LotTravelerDMO();
|
LotTravelerDMO LotTravDMO = new LotTravelerDMO();
|
||||||
string docTypeString = "LotTraveler";
|
string docTypeString = "LotTraveler";
|
||||||
@ -199,9 +200,14 @@ public class LotTravelerController : PdfViewController {
|
|||||||
try {
|
try {
|
||||||
workRequest = LotTravDMO.GetLTWorkRequestItemPDF(workRequestID);
|
workRequest = LotTravDMO.GetLTWorkRequestItemPDF(workRequestID);
|
||||||
|
|
||||||
// To render a PDF instead of an HTML, all we need to do is call ViewPdf instead of View. This
|
string pageTitle = string.Empty;
|
||||||
// requires the controller to be inherited from MyController instead of MVC's Controller.
|
string htmlText = RenderViewToString("WorkRequestPDF", workRequest);
|
||||||
return this.ViewPdf("", "WorkRequestPDF", workRequest);
|
if (System.Diagnostics.Debugger.IsAttached) {
|
||||||
|
return Content(htmlText, "text/html");
|
||||||
|
} else {
|
||||||
|
byte[] buffer = StandardPdfRenderer.GetPortableDocumentFormatBytes(pageTitle, htmlText);
|
||||||
|
return new BinaryContentResult(buffer, "application/pdf");
|
||||||
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n DisplayWorkRequestPDF - LotTraveler\r\n" + ex.InnerException.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n DisplayWorkRequestPDF - LotTraveler\r\n" + ex.InnerException.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = workRequest.SWRNumber, UserID = @User.Identity.Name, DocumentType = "LotTravler", OperationType = "Generate PDF", Comments = ex.Message });
|
EventLogDMO.Add(new WinEventLog() { IssueID = workRequest.SWRNumber, UserID = @User.Identity.Name, DocumentType = "LotTravler", OperationType = "Generate PDF", Comments = ex.Message });
|
||||||
@ -210,6 +216,24 @@ public class LotTravelerController : PdfViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string RenderViewToString(string viewName, object model) {
|
||||||
|
string result;
|
||||||
|
ViewData.Model = model;
|
||||||
|
using (StringWriter writer = new()) {
|
||||||
|
try {
|
||||||
|
ViewEngineResult viewResult = ViewEngines.Engines.FindView(ControllerContext, viewName, string.Empty);
|
||||||
|
if (viewResult is null)
|
||||||
|
return $"A view with the name '{viewName}' could not be found";
|
||||||
|
ViewContext viewContext = new(ControllerContext, viewResult.View, ViewData, TempData, writer);
|
||||||
|
viewResult.View.Render(viewContext, writer);
|
||||||
|
result = writer.GetStringBuilder().ToString();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
result = $"Failed - {ex.Message}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public ActionResult WorkRequestRevision(int workRequestID) {
|
public ActionResult WorkRequestRevision(int workRequestID) {
|
||||||
int isITARCompliant = 1;
|
int isITARCompliant = 1;
|
||||||
LTWorkRequest workRequest = new LTWorkRequest();
|
LTWorkRequest workRequest = new LTWorkRequest();
|
||||||
@ -251,9 +275,7 @@ public class LotTravelerController : PdfViewController {
|
|||||||
|
|
||||||
return Content("Successfully Saved");
|
return Content("Successfully Saved");
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public JsonResult GetBaseFlowLocations(string baseFlow) {
|
public JsonResult GetBaseFlowLocations(string baseFlow) {
|
||||||
List<BaseFlowLocation> loclist = LotTravDMO.GetBaseFlowLocations(baseFlow);
|
List<BaseFlowLocation> loclist = LotTravDMO.GetBaseFlowLocations(baseFlow);
|
||||||
return Json(loclist, JsonRequestBehavior.AllowGet);
|
return Json(loclist, JsonRequestBehavior.AllowGet);
|
||||||
@ -332,9 +354,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
return Content(newWorkRequestID.ToString());
|
return Content(newWorkRequestID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// For the Revison
|
|
||||||
/// </summary>
|
|
||||||
public ActionResult UpdateMaterialDetailRevision(LTWorkRequest model) {
|
public ActionResult UpdateMaterialDetailRevision(LTWorkRequest model) {
|
||||||
var modelMaterialDetail = model.LTMaterial;
|
var modelMaterialDetail = model.LTMaterial;
|
||||||
int previousMaterialID = model.LTMaterial.ID;
|
int previousMaterialID = model.LTMaterial.ID;
|
||||||
@ -1232,15 +1251,19 @@ public class LotTravelerController : PdfViewController {
|
|||||||
LotTravDMO.DeleteLot(ltLotID);
|
LotTravDMO.DeleteLot(ltLotID);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
public ActionResult DisplayLotTravlerPdf(int ltLotID, int revisionNumber) {
|
public ActionResult DisplayLotTravlerPdf(int ltLotID, int revisionNumber) {
|
||||||
LotTravelerPdf traveler = new LotTravelerPdf();
|
LotTravelerPdf traveler = new LotTravelerPdf();
|
||||||
try {
|
try {
|
||||||
traveler = LotTravDMO.GetLotTravlerPdf(ltLotID, revisionNumber);
|
traveler = LotTravDMO.GetLotTravlerPdf(ltLotID, revisionNumber);
|
||||||
|
|
||||||
// To render a PDF instead of an HTML, all we need to do is call ViewPdf instead of View. This
|
string pageTitle = string.Empty;
|
||||||
// requires the controller to be inherited from MyController instead of MVC's Controller.
|
string htmlText = RenderViewToString("LotTravelerPDF", traveler);
|
||||||
return this.ViewPdf("", "LotTravelerPDF", traveler);
|
if (System.Diagnostics.Debugger.IsAttached) {
|
||||||
|
return Content(htmlText, "text/html");
|
||||||
|
} else {
|
||||||
|
byte[] buffer = StandardPdfRenderer.GetPortableDocumentFormatBytes(pageTitle, htmlText);
|
||||||
|
return new BinaryContentResult(buffer, "application/pdf");
|
||||||
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = traveler.SWRNumber, UserID = @User.Identity.Name, DocumentType = "LotTraveler", OperationType = "Generate PDF", Comments = ex.Message });
|
EventLogDMO.Add(new WinEventLog() { IssueID = traveler.SWRNumber, UserID = @User.Identity.Name, DocumentType = "LotTraveler", OperationType = "Generate PDF", Comments = ex.Message });
|
||||||
traveler = null;
|
traveler = null;
|
||||||
|
|||||||
@ -79,7 +79,7 @@ public class MRBController : Controller {
|
|||||||
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
||||||
string refreshToken = Session["RefreshToken"].ToString();
|
string refreshToken = Session["RefreshToken"].ToString();
|
||||||
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
||||||
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/mrb/{issueID}";
|
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=mrb/{issueID}";
|
||||||
|
|
||||||
return Redirect(mrbUrl);
|
return Redirect(mrbUrl);
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ public class MRBController : Controller {
|
|||||||
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
||||||
string refreshToken = Session["RefreshToken"].ToString();
|
string refreshToken = Session["RefreshToken"].ToString();
|
||||||
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
||||||
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/mrb/{issueID}";
|
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=mrb/{issueID}";
|
||||||
|
|
||||||
return Redirect(mrbUrl);
|
return Redirect(mrbUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -401,7 +401,6 @@ public class AuditDMO {
|
|||||||
result.Is8DQA = "true";
|
result.Is8DQA = "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
audit = GetAuditItem(issueID, userId);
|
|
||||||
// transform audit users from string to list, delimited by a comma.
|
// transform audit users from string to list, delimited by a comma.
|
||||||
if (audit.Auditees == null) {
|
if (audit.Auditees == null) {
|
||||||
result.AuditeeNames = new List<string>();
|
result.AuditeeNames = new List<string>();
|
||||||
|
|||||||
@ -42,6 +42,9 @@ public class ECN_DMO {
|
|||||||
parameters.Add("@ExpirationDate", ecn.ExpirationDate);
|
parameters.Add("@ExpirationDate", ecn.ExpirationDate);
|
||||||
parameters.Add("@ExtensionDate", ecn.ExtensionDate);
|
parameters.Add("@ExtensionDate", ecn.ExtensionDate);
|
||||||
parameters.Add("@CancellationDate", ecn.CancellationDate);
|
parameters.Add("@CancellationDate", ecn.CancellationDate);
|
||||||
|
parameters.Add("@CancellationApprovalDate", ecn.CancellationApprovalDate);
|
||||||
|
parameters.Add("@CancellationApproved", ecn.CancellationApproved);
|
||||||
|
parameters.Add("@Cancelled", ecn.Cancelled);
|
||||||
parameters.Add("@AcknowledgementRequired", ecn.AcknowledgementRequired);
|
parameters.Add("@AcknowledgementRequired", ecn.AcknowledgementRequired);
|
||||||
parameters.Add("@TrainingRequired", ecn.TrainingRequired);
|
parameters.Add("@TrainingRequired", ecn.TrainingRequired);
|
||||||
parameters.Add("@AreaID", ecn.AreaID);
|
parameters.Add("@AreaID", ecn.AreaID);
|
||||||
@ -353,14 +356,17 @@ public class ECN_DMO {
|
|||||||
List<string> affectedAreas = multipleResultItems.Read<string>().ToList();
|
List<string> affectedAreas = multipleResultItems.Read<string>().ToList();
|
||||||
List<string> affectedTechnologies = multipleResultItems.Read<string>().ToList();
|
List<string> affectedTechnologies = multipleResultItems.Read<string>().ToList();
|
||||||
List<string> acknowledgementBy = multipleResultItems.Read<string>().ToList();
|
List<string> acknowledgementBy = multipleResultItems.Read<string>().ToList();
|
||||||
List<string> trainingBy = multipleResultItems.Read<string>().ToList();
|
List<int> trainingby = multipleResultItems.Read<int>().ToList();
|
||||||
|
if (ecnItem != null && trainingby != null) {
|
||||||
|
if (trainingby.Count > 0)
|
||||||
|
ecnItem.TrainingByIDs.AddRange(trainingby);
|
||||||
|
}
|
||||||
List<string> productfamilies = multipleResultItems.Read<string>().ToList();
|
List<string> productfamilies = multipleResultItems.Read<string>().ToList();
|
||||||
|
|
||||||
ecnItem.AffectedModules = string.Join(", ", modules);
|
ecnItem.AffectedModules = string.Join(", ", modules);
|
||||||
ecnItem.AffectedDepartments = string.Join(", ", departments);
|
ecnItem.AffectedDepartments = string.Join(", ", departments);
|
||||||
ecnItem.AffectedAreas = string.Join(",", affectedAreas);
|
ecnItem.AffectedAreas = string.Join(",", affectedAreas);
|
||||||
ecnItem.AffectedTechnologies = string.Join(",", affectedTechnologies);
|
ecnItem.AffectedTechnologies = string.Join(",", affectedTechnologies);
|
||||||
ecnItem.TrainingBy = string.Join(",", trainingBy);
|
|
||||||
ecnItem.AcknowledgementBy = string.Join(",", acknowledgementBy);
|
ecnItem.AcknowledgementBy = string.Join(",", acknowledgementBy);
|
||||||
ecnItem.AffectedProductFamilies = string.Join(",", productfamilies);
|
ecnItem.AffectedProductFamilies = string.Join(",", productfamilies);
|
||||||
|
|
||||||
@ -711,4 +717,26 @@ public class ECN_DMO {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal string GetCategoryID(ECNPdf ecn) {
|
||||||
|
string result;
|
||||||
|
if (ecn.CategoryID is null) {
|
||||||
|
result = string.Empty;
|
||||||
|
} else {
|
||||||
|
List<ECNCategory> categories = GetCategories();
|
||||||
|
result = (from l in categories where l.CategoryID == ecn.CategoryID.Value select l.CategoryName).FirstOrDefault();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal string GetTrainingNotificationTo(ECNPdf ecn, TrainingDMO trainingDMO) {
|
||||||
|
string result;
|
||||||
|
if (ecn.TrainingByIDs is null) {
|
||||||
|
result = string.Empty;
|
||||||
|
} else {
|
||||||
|
List<TrainingGroup> trainingGroups = trainingDMO.GetTrainingGroups();
|
||||||
|
result = string.Join(", ", (from l in trainingGroups where ecn.TrainingByIDs.Contains(l.TrainingGroupID) select l.TrainingGroupName).ToArray());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -325,9 +325,6 @@
|
|||||||
<Compile Include="Models\WinEventLogModel.cs" />
|
<Compile Include="Models\WinEventLogModel.cs" />
|
||||||
<Compile Include="Models\WorkFlowModels.cs" />
|
<Compile Include="Models\WorkFlowModels.cs" />
|
||||||
<Compile Include="PdfGenerator\BinaryContentResult.cs" />
|
<Compile Include="PdfGenerator\BinaryContentResult.cs" />
|
||||||
<Compile Include="PdfGenerator\FakeView.cs" />
|
|
||||||
<Compile Include="PdfGenerator\HtmlViewRenderer.cs" />
|
|
||||||
<Compile Include="PdfGenerator\PdfViewController.cs" />
|
|
||||||
<Compile Include="PdfGenerator\PrintHeaderFooter.cs" />
|
<Compile Include="PdfGenerator\PrintHeaderFooter.cs" />
|
||||||
<Compile Include="PdfGenerator\StandardPdfRenderer.cs" />
|
<Compile Include="PdfGenerator\StandardPdfRenderer.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|||||||
@ -1,28 +0,0 @@
|
|||||||
#if !NET8
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="FakeView.cs" company="SemanticArchitecture">
|
|
||||||
// http://www.SemanticArchitecture.net pkalkie@gmail.com
|
|
||||||
// </copyright>
|
|
||||||
// <summary>
|
|
||||||
// Defines the FakeView type.
|
|
||||||
// </summary>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.PdfGenerator {
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Web.Mvc;
|
|
||||||
|
|
||||||
public class FakeView : IView {
|
|
||||||
#region IView Members
|
|
||||||
|
|
||||||
public void Render(ViewContext viewContext, TextWriter writer) {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
#if !NET8
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="HtmlViewRenderer.cs" company="SemanticArchitecture">
|
|
||||||
// http://www.SemanticArchitecture.net pkalkie@gmail.com
|
|
||||||
// </copyright>
|
|
||||||
// <summary>
|
|
||||||
// This class is responsible for rendering a HTML view to a string.
|
|
||||||
// </summary>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.PdfGenerator {
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
using System.Web;
|
|
||||||
using System.Web.Mvc;
|
|
||||||
using System.Web.Mvc.Html;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This class is responsible for rendering a HTML view into a string.
|
|
||||||
/// </summary>
|
|
||||||
public class HtmlViewRenderer {
|
|
||||||
public string RenderViewToString(Controller controller, string viewName, object viewData) {
|
|
||||||
var renderedView = new StringBuilder();
|
|
||||||
using (var responseWriter = new StringWriter(renderedView)) {
|
|
||||||
var fakeResponse = new HttpResponse(responseWriter);
|
|
||||||
var fakeContext = new HttpContext(HttpContext.Current.Request, fakeResponse);
|
|
||||||
var fakeControllerContext = new ControllerContext(new HttpContextWrapper(fakeContext), controller.ControllerContext.RouteData, controller.ControllerContext.Controller);
|
|
||||||
|
|
||||||
var oldContext = HttpContext.Current;
|
|
||||||
HttpContext.Current = fakeContext;
|
|
||||||
|
|
||||||
using (var viewPage = new ViewPage()) {
|
|
||||||
var html = new HtmlHelper(CreateViewContext(responseWriter, fakeControllerContext), viewPage);
|
|
||||||
html.RenderPartial(viewName, viewData);
|
|
||||||
HttpContext.Current = oldContext;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return renderedView.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ViewContext CreateViewContext(TextWriter responseWriter, ControllerContext fakeControllerContext) {
|
|
||||||
return new ViewContext(fakeControllerContext, new FakeView(), new ViewDataDictionary(), new TempDataDictionary(), responseWriter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
#if !NET8
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
// <copyright file="PdfViewController.cs" company="SemanticArchitecture">
|
|
||||||
// http://www.SemanticArchitecture.net pkalkie@gmail.com
|
|
||||||
// </copyright>
|
|
||||||
// <summary>
|
|
||||||
// Extends the controller with functionality for rendering PDF views
|
|
||||||
// </summary>
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.PdfGenerator {
|
|
||||||
using System.Web.Mvc;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Extends the controller with functionality for rendering PDF views
|
|
||||||
/// </summary>
|
|
||||||
public class PdfViewController : Controller {
|
|
||||||
private readonly HtmlViewRenderer htmlViewRenderer;
|
|
||||||
private readonly StandardPdfRenderer standardPdfRenderer;
|
|
||||||
|
|
||||||
public PdfViewController() {
|
|
||||||
this.htmlViewRenderer = new HtmlViewRenderer();
|
|
||||||
this.standardPdfRenderer = new StandardPdfRenderer();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ActionResult ViewPdf(string pageTitle, string viewName, object model) {
|
|
||||||
// Render the view html to a string.
|
|
||||||
string htmlText = this.htmlViewRenderer.RenderViewToString(this, viewName, model);
|
|
||||||
|
|
||||||
// Let the html be rendered into a PDF document through iTextSharp.
|
|
||||||
byte[] buffer = standardPdfRenderer.Render(htmlText, pageTitle);
|
|
||||||
|
|
||||||
// Return the PDF as a binary stream to the client.
|
|
||||||
return new BinaryContentResult(buffer, "application/pdf");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void SavePdf(string fileName, string viewName, object model) {
|
|
||||||
// Render the view html to a string.
|
|
||||||
string htmlText = this.htmlViewRenderer.RenderViewToString(this, viewName, model);
|
|
||||||
|
|
||||||
// Let the html be rendered into a PDF document through iTextSharp.
|
|
||||||
byte[] buffer = standardPdfRenderer.Render(htmlText, "");
|
|
||||||
|
|
||||||
using (FileStream fs = new FileStream(fileName, FileMode.Create)) {
|
|
||||||
fs.Write(buffer, 0, buffer.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -8,20 +8,34 @@ using System.IO;
|
|||||||
|
|
||||||
namespace Fab2ApprovalSystem.PdfGenerator;
|
namespace Fab2ApprovalSystem.PdfGenerator;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This class is responsible for rendering a html text string to a PDF document using the html renderer of iTextSharp.
|
|
||||||
/// </summary>
|
|
||||||
public class StandardPdfRenderer {
|
public class StandardPdfRenderer {
|
||||||
|
|
||||||
private const int HorizontalMargin = 40;
|
private const int HorizontalMargin = 40;
|
||||||
private const int VerticalMargin = 40;
|
private const int VerticalMargin = 40;
|
||||||
|
|
||||||
public byte[] Render(string htmlText, string pageTitle) {
|
public static byte[] GetPortableDocumentFormatBytes(string pageTitle, string htmlText) {
|
||||||
byte[] renderedBuffer;
|
byte[] results;
|
||||||
|
using (MemoryStream memoryStream = GetPortableDocumentFormat(pageTitle, htmlText)) {
|
||||||
|
results = new byte[memoryStream.Position];
|
||||||
|
memoryStream.Position = 0;
|
||||||
|
memoryStream.Read(results, 0, results.Length);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
using (MemoryStream outputMemoryStream = new()) {
|
public static void WritePortableDocumentFormatToFile(string pageTitle, string htmlText, string path) {
|
||||||
|
using (MemoryStream memoryStream = GetPortableDocumentFormat(pageTitle, htmlText)) {
|
||||||
|
using (FileStream fileStream = new(path, FileMode.Create)) {
|
||||||
|
memoryStream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MemoryStream GetPortableDocumentFormat(string pageTitle, string htmlText) {
|
||||||
|
MemoryStream result = new();
|
||||||
#if !NET8
|
#if !NET8
|
||||||
using (Document pdfDocument = new Document(PageSize.A4, HorizontalMargin, HorizontalMargin, VerticalMargin, VerticalMargin)) {
|
using (Document pdfDocument = new Document(PageSize.A4, HorizontalMargin, HorizontalMargin, VerticalMargin, VerticalMargin)) {
|
||||||
PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDocument, outputMemoryStream);
|
using (PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDocument, result)) {
|
||||||
pdfWriter.CloseStream = false;
|
pdfWriter.CloseStream = false;
|
||||||
pdfWriter.PageEvent = new PrintHeaderFooter { Title = pageTitle };
|
pdfWriter.PageEvent = new PrintHeaderFooter { Title = pageTitle };
|
||||||
pdfDocument.Open();
|
pdfDocument.Open();
|
||||||
@ -30,15 +44,10 @@ public class StandardPdfRenderer {
|
|||||||
htmlWorker.Parse(htmlViewReader);
|
htmlWorker.Parse(htmlViewReader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
renderedBuffer = new byte[outputMemoryStream.Position];
|
|
||||||
outputMemoryStream.Position = 0;
|
|
||||||
outputMemoryStream.Read(renderedBuffer, 0, renderedBuffer.Length);
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return renderedBuffer;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ public class ECNPdf {
|
|||||||
public string AffectedDepartments { get; set; }
|
public string AffectedDepartments { get; set; }
|
||||||
public string AffectedAreas { get; set; }
|
public string AffectedAreas { get; set; }
|
||||||
public string AffectedTechnologies { get; set; }
|
public string AffectedTechnologies { get; set; }
|
||||||
public string TrainingBy { get; set; }
|
public List<int> TrainingByIDs { get; set; }
|
||||||
public string AcknowledgementBy { get; set; }
|
public string AcknowledgementBy { get; set; }
|
||||||
public bool IsECN { get; set; }
|
public bool IsECN { get; set; }
|
||||||
public bool IsTECN { get; set; }
|
public bool IsTECN { get; set; }
|
||||||
@ -79,6 +79,7 @@ public class ECNPdf {
|
|||||||
public int? ConvertedToNumber { get; set; }
|
public int? ConvertedToNumber { get; set; }
|
||||||
public int? ConvertedFromNumber { get; set; }
|
public int? ConvertedFromNumber { get; set; }
|
||||||
public int WorkFlowNumber { get; set; }
|
public int WorkFlowNumber { get; set; }
|
||||||
|
public int? CategoryID { get; set; }
|
||||||
public bool FIChangeRequired { get; set; }
|
public bool FIChangeRequired { get; set; }
|
||||||
public string NumberOfLotsAffected { get; set; }
|
public string NumberOfLotsAffected { get; set; }
|
||||||
public string RecipeChange { get; set; }
|
public string RecipeChange { get; set; }
|
||||||
@ -87,6 +88,7 @@ public class ECNPdf {
|
|||||||
public ECNPdf() {
|
public ECNPdf() {
|
||||||
Approvalog = new List<ECNApprovalLog>();
|
Approvalog = new List<ECNApprovalLog>();
|
||||||
Attachments = new List<string>();
|
Attachments = new List<string>();
|
||||||
|
TrainingByIDs = new List<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,497 +1,506 @@
|
|||||||
@model Fab2ApprovalSystem.ViewModels.ECNPdf
|
@model Fab2ApprovalSystem.ViewModels.ECNPdf
|
||||||
<table style="width:100%;">
|
@{
|
||||||
<tr>
|
Layout = null;
|
||||||
<td>
|
}
|
||||||
<table cellpadding="3" cellspacing="3" border="1">
|
|
||||||
<tr bgcolor="#c4baba" color="#000000">
|
|
||||||
<td colspan="2">
|
|
||||||
@Model.Title
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
<!DOCTYPE html>
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<table border="0">
|
|
||||||
@if (@Model.ConvertedFromNumber != null)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
ECN# @Model.ECNNumber (Converted from TECN#:@Model.ConvertedFromNumber)
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
@if (@Model.ConvertedToNumber != null)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
ECN# @Model.ECNNumber (Converted to ECN#:@Model.ConvertedToNumber)
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
@if (@Model.ConvertedFromNumber == null && @Model.ConvertedToNumber == null)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
ECN# @Model.ECNNumber
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
|
|
||||||
<tr>
|
<head>
|
||||||
<td>
|
<meta charset="utf-8" />
|
||||||
<font size="2">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
Submit Date#:
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
</font>
|
<title></title>
|
||||||
<font size="1">
|
</head>
|
||||||
@Model.SubmitedDate
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
Originator Name:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@Model.OriginatorName
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</table>
|
<body class="navbar-inner">
|
||||||
</td>
|
<table style="width:100%;">
|
||||||
<td>
|
<tr>
|
||||||
<table border="0">
|
<td>
|
||||||
@*<tr>
|
<table cellpadding="3" cellspacing="3" border="1">
|
||||||
<td>
|
<tr bgcolor="#c4baba" color="#000000">
|
||||||
<font size="2">
|
<td colspan="2">
|
||||||
Affected Department:
|
@Model.Title
|
||||||
</font>
|
</td>
|
||||||
<font size="1">
|
|
||||||
@Model.AffectedDepartments
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>*@
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<font size="2">
|
<table border="0">
|
||||||
Affected Area:
|
@if (@Model.ConvertedFromNumber != null)
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@Model.AffectedModules
|
|
||||||
@*@Model.AffectedAreas*@
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
ITAR/EC:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@(Model.IsDocEC ? "Yes" : "No")
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<table border="1">
|
|
||||||
<tr bgcolor="#c4baba" color="#000000">
|
|
||||||
<td> ECN - TECN Details</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<table border="0">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
ECN:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@(Model.IsECN ? "Yes" : "No")
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
TECN:
|
|
||||||
@(Model.IsTECN ? "Yes" : "No")
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
Emergency:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@(Model.IsEmergencyTECN ? "Yes" : "No")
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
Expiration Date:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
|
|
||||||
@Convert.ToString(string.Format("{0:MM/dd/yyyy}", Model.ExpirationDate))
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
Extension Date:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
|
|
||||||
@Convert.ToString(string.Format("{0:MM/dd/yyyy}", @Model.ExtensionDate))
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
Cancellation Date:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@Model.CancellationApprovalDate
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
# lots affected:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@Model.NumberOfLotsAffected
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
Recipe Or/And Flow Change:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@Model.RecipeChange
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
Affected product families:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@Model.AffectedProductFamilies
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<table border="0">
|
|
||||||
<tr>
|
|
||||||
<td colspan="3" style="background-color:ActiveCaption">
|
|
||||||
<font size="2">
|
|
||||||
Affected Documents:
|
|
||||||
</font>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
@foreach (string attachmentName in Model.Attachments)
|
|
||||||
{
|
{
|
||||||
<td colspan="3">
|
<tr>
|
||||||
|
<td>
|
||||||
|
ECN# @Model.ECNNumber (Converted from TECN#:@Model.ConvertedFromNumber)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
@if (@Model.ConvertedToNumber != null)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
ECN# @Model.ECNNumber (Converted to ECN#:@Model.ConvertedToNumber)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
@if (@Model.ConvertedFromNumber == null && @Model.ConvertedToNumber == null)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
ECN# @Model.ECNNumber
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Submit Date#:
|
||||||
|
</font>
|
||||||
<font size="1">
|
<font size="1">
|
||||||
@attachmentName
|
@Model.SubmitedDate
|
||||||
</font>
|
</font>
|
||||||
</td>
|
</td>
|
||||||
}
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
</table>
|
<td>
|
||||||
</td>
|
<font size="2">
|
||||||
</tr>
|
Originator Name:
|
||||||
|
|
||||||
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<table border="1" >
|
|
||||||
<tr bgcolor="#c4baba" color="#000000">
|
|
||||||
<td> Description of Change</td>
|
|
||||||
<td> Reason for Change</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="1">
|
|
||||||
@Html.Raw(@Model.DescriptionOfChange)
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<font size="1">
|
|
||||||
@Html.Raw(@Model.ReasonForChange)
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@*<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
<table border="1">
|
|
||||||
<tr bgcolor="#c4baba" color="#000000">
|
|
||||||
<td colspan="3">Training Notification</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<table border="0">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="1">
|
|
||||||
Training:
|
|
||||||
@(Model.TrainingRequired ? "Yes" : "No")
|
|
||||||
</font>
|
|
||||||
|
|
||||||
<font size="1">
|
|
||||||
@(Model.TrainingBy.Length > 0 ? "(" + Model.TrainingBy + ")" : Model.TrainingBy)
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>*@
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
<table border="1">
|
|
||||||
<tr bgcolor="#c4baba" color="#000000">
|
|
||||||
<td colspan="5">Systems</td>
|
|
||||||
</tr>
|
|
||||||
<tr style="display:block;">
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
PCRB:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@(Model.PCRBRequired ? "Yes": "No")
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
PCRB#:
|
|
||||||
@Model.PCRBNumber
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
Metrology Change:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@(Model.MetrologyChangeRequired ? "Yes": "No")
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
SPC Change:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@(Model.SPCChangeRequired ? "Yes": "No")
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
FI Change:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@(Model.FIChangeRequired ? "Yes" : "No")
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
OI Change:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@(Model.SPNChangeRequired ? "Yes" : "No")
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<table border="1">
|
|
||||||
<tr bgcolor="#c4baba" color="#000000">
|
|
||||||
<td colspan="4"> Change Impact</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<table border="0">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
Impact On ESH:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@if (Model.ImpactOnEnvironment == 1)
|
|
||||||
{
|
|
||||||
@: Positive
|
|
||||||
}
|
|
||||||
else if (Model.ImpactOnEnvironment == 2)
|
|
||||||
{
|
|
||||||
@: Negative
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@: N/A
|
|
||||||
}
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="1">
|
|
||||||
@Html.Raw(@Model.ImpactOnEnvironmentDescription)
|
|
||||||
</font>
|
</font>
|
||||||
</td>
|
<font size="1">
|
||||||
</tr>
|
@Model.OriginatorName
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<table border="0">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
Impact On Capacity:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@(Model.ImpactOnCapacity == 1 ? "Yes" : "No")
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="1">
|
|
||||||
@Html.Raw(@Model.ImpactOnCapacityDescription)
|
|
||||||
</font>
|
</font>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@*<table border="0">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
RH(ITAR):
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@(Model.IsRH ? "Yes" : "No")
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>*@
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<table border="0">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="2">
|
|
||||||
Material Consumption Change:
|
|
||||||
</font>
|
|
||||||
<font size="1">
|
|
||||||
@(Model.MaterialConsumptionChangeRequired == 1 ? "Yes" : "No")
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<font size="1">
|
|
||||||
@Html.Raw(@Model.MaterialConsumptionChangeDescription)
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<table border="1">
|
|
||||||
<tr bgcolor="#c4baba" color="#ffffff">
|
|
||||||
<td>
|
|
||||||
Full Name
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Role
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Approved/Denied
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Date Time
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
@foreach (Fab2ApprovalSystem.ViewModels.ECNApprovalLog ecnApp in Model.Approvalog)
|
</table>
|
||||||
{
|
</td>
|
||||||
|
<td>
|
||||||
|
<table border="0">
|
||||||
|
@*<tr>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Affected Department:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@Model.AffectedDepartments
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>*@
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Affected Area:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@Model.AffectedModules
|
||||||
|
@*@Model.AffectedAreas*@
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Category:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@(ViewBag.Category)
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
ITAR/EC:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@(Model.IsDocEC ? "Yes" : "No")
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table border="1">
|
||||||
|
<tr bgcolor="#c4baba" color="#000000">
|
||||||
|
<td> ECN - TECN Details</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
ECN:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@(Model.IsECN ? "Yes" : "No")
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
TECN:
|
||||||
|
@(Model.IsTECN ? "Yes" : "No")
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Emergency:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@(Model.IsEmergencyTECN ? "Yes" : "No")
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Expiration Date:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
|
||||||
|
@Convert.ToString(string.Format("{0:MM/dd/yyyy}", Model.ExpirationDate))
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Extension Date:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
|
||||||
|
@Convert.ToString(string.Format("{0:MM/dd/yyyy}", @Model.ExtensionDate))
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Cancellation Date:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@Model.CancellationApprovalDate
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
# lots affected:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@Model.NumberOfLotsAffected
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Recipe Or/And Flow Change:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@Model.RecipeChange
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Affected product families:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@Model.AffectedProductFamilies
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table border="0">
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="background-color:ActiveCaption">
|
||||||
|
<font size="2">
|
||||||
|
Affected Documents:
|
||||||
|
</font>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
@foreach (string attachmentName in Model.Attachments)
|
||||||
|
{
|
||||||
|
<td colspan="3">
|
||||||
|
<font size="1">
|
||||||
|
@attachmentName
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
}
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table border="1">
|
||||||
|
<tr bgcolor="#c4baba" color="#000000">
|
||||||
|
<td> Description of Change</td>
|
||||||
|
<td> Reason for Change</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<font size="1">
|
<font size="1">
|
||||||
@ecnApp.FullName
|
@Html.Raw(@Model.DescriptionOfChange)
|
||||||
</font>
|
</font>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<font size="1">
|
<font size="1">
|
||||||
@ecnApp.SubRole
|
@Html.Raw(@Model.ReasonForChange)
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<font size="1">
|
|
||||||
@ecnApp.Operation
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<font size="1">
|
|
||||||
@ecnApp.OperationTime
|
|
||||||
</font>
|
</font>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
<tr>
|
||||||
</td>
|
<td>
|
||||||
</tr>
|
|
||||||
|
|
||||||
|
|
||||||
</table> <!--main table -->
|
|
||||||
|
|
||||||
|
<table border="1">
|
||||||
|
<tr bgcolor="#c4baba" color="#000000">
|
||||||
|
<td colspan="5">Systems</td>
|
||||||
|
</tr>
|
||||||
|
<tr style="display:block;">
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
PCRB:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@(Model.PCRBRequired ? "Yes" : "No")
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
PCRB#:
|
||||||
|
@Model.PCRBNumber
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Metrology Change:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@(Model.MetrologyChangeRequired ? "Yes" : "No")
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
SPC Change:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@(Model.SPCChangeRequired ? "Yes" : "No")
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
FI Change:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@(Model.FIChangeRequired ? "Yes" : "No")
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
OI Change:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@(Model.SPNChangeRequired ? "Yes" : "No")
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<table border="1">
|
||||||
|
<tr bgcolor="#c4baba" color="#000000">
|
||||||
|
<td colspan="1">Training Notification</td>
|
||||||
|
</tr>
|
||||||
|
<tr style="display:block;">
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Training:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@(Model.TrainingRequired ? "Yes" : "No")
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Training Notification to:
|
||||||
|
@(ViewBag.TrainingNotificationTo)
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table border="1">
|
||||||
|
<tr bgcolor="#c4baba" color="#000000">
|
||||||
|
<td colspan="4"> Change Impact</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Impact On ESH:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@if (Model.ImpactOnEnvironment == 1)
|
||||||
|
{
|
||||||
|
@: Positive
|
||||||
|
}
|
||||||
|
else if (Model.ImpactOnEnvironment == 2)
|
||||||
|
{
|
||||||
|
@: Negative
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@: N/A
|
||||||
|
}
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="1">
|
||||||
|
@Html.Raw(@Model.ImpactOnEnvironmentDescription)
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<table border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Impact On Capacity:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@(Model.ImpactOnCapacity == 1 ? "Yes" : "No")
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="1">
|
||||||
|
@Html.Raw(@Model.ImpactOnCapacityDescription)
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@*<table border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
RH(ITAR):
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@(Model.IsRH ? "Yes" : "No")
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>*@
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<table border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="2">
|
||||||
|
Material Consumption Change:
|
||||||
|
</font>
|
||||||
|
<font size="1">
|
||||||
|
@(Model.MaterialConsumptionChangeRequired == 1 ? "Yes" : "No")
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="1">
|
||||||
|
@Html.Raw(@Model.MaterialConsumptionChangeDescription)
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table border="1">
|
||||||
|
<tr bgcolor="#c4baba" color="#ffffff">
|
||||||
|
<td>
|
||||||
|
Full Name
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
Role
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
Approved/Denied
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
Date Time
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@foreach (Fab2ApprovalSystem.ViewModels.ECNApprovalLog ecnApp in Model.Approvalog)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<font size="1">
|
||||||
|
@ecnApp.FullName
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="1">
|
||||||
|
@ecnApp.SubRole
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<font size="1">
|
||||||
|
@ecnApp.Operation
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<font size="1">
|
||||||
|
@ecnApp.OperationTime
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@ -90,16 +90,16 @@
|
|||||||
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
||||||
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
||||||
"https://localhost:7255";
|
"https://localhost:7255";
|
||||||
string mrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=/mrb/new";
|
string mrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=mrb/new";
|
||||||
<li><a href="@mrbUrl">Create MRB</a></li>
|
<li><a href="@mrbUrl">Create MRB</a></li>
|
||||||
string pcrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=/pcrb/new";
|
string pcrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=pcrb/new";
|
||||||
<li><a href="@pcrbUrl">Create PCRB</a></li>
|
<li><a href="@pcrbUrl">Create PCRB</a></li>
|
||||||
} else {
|
} else {
|
||||||
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
||||||
"https://localhost:7255";
|
"https://localhost:7255";
|
||||||
string mrbUrl = wasmClientUrl + "/redirect?redirectPath=/mrb/new";
|
string mrbUrl = wasmClientUrl + "/redirect?redirectPath=mrb/new";
|
||||||
<li><a href="@mrbUrl">Create MRB</a></li>
|
<li><a href="@mrbUrl">Create MRB</a></li>
|
||||||
string pcrbUrl = wasmClientUrl + "/redirect?redirectPath=/pcrb/new";
|
string pcrbUrl = wasmClientUrl + "/redirect?redirectPath=pcrb/new";
|
||||||
<li><a href="@pcrbUrl">Create PCRB</a></li>
|
<li><a href="@pcrbUrl">Create PCRB</a></li>
|
||||||
}
|
}
|
||||||
@*<li><a href=@Url.Action("CreateWorkRequest", "LotTraveler")>Create Special Work Request</a></li>*@
|
@*<li><a href=@Url.Action("CreateWorkRequest", "LotTraveler")>Create Special Work Request</a></li>*@
|
||||||
@ -150,9 +150,9 @@
|
|||||||
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
||||||
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
||||||
"https://localhost:7255";
|
"https://localhost:7255";
|
||||||
string mrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=/mrb/all";
|
string mrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=mrb/all";
|
||||||
menu.Add().Text("MRB").Url(mrbUrl);
|
menu.Add().Text("MRB").Url(mrbUrl);
|
||||||
string pcrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=/pcrb/all";
|
string pcrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=pcrb/all";
|
||||||
menu.Add().Text("PCRB").Url(pcrbUrl);
|
menu.Add().Text("PCRB").Url(pcrbUrl);
|
||||||
//menu.Add().Text("Special Work Requests").Action("SpecialWorkRequestList", "Home");
|
//menu.Add().Text("Special Work Requests").Action("SpecialWorkRequestList", "Home");
|
||||||
//menu.Add().Text("PCRB").Action("ChangeControlList", "Home");
|
//menu.Add().Text("PCRB").Action("ChangeControlList", "Home");
|
||||||
|
|||||||
@ -1,3 +1,11 @@
|
|||||||
|
trigger:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- master
|
||||||
|
paths:
|
||||||
|
include:
|
||||||
|
- Fab2ApprovalSystem
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
coreVersion: "net8.0"
|
coreVersion: "net8.0"
|
||||||
targetFrameworkVersion: "v4.8"
|
targetFrameworkVersion: "v4.8"
|
||||||
|
|||||||
@ -51,7 +51,7 @@ public class AuditDMOTests {
|
|||||||
try { throw new Exception(); } catch (Exception) { }
|
try { throw new Exception(); } catch (Exception) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AuditDMO(ILogger? logger, AppSettings appSettings) {
|
private static void AuditDMO(ILogger? logger, AppSettings appSettings, int auditNo, bool isAdmin) {
|
||||||
#pragma warning disable IDE0059
|
#pragma warning disable IDE0059
|
||||||
SetGlobalVars(logger, appSettings);
|
SetGlobalVars(logger, appSettings);
|
||||||
AuditDMO auditDMO = new(appSettings);
|
AuditDMO auditDMO = new(appSettings);
|
||||||
@ -61,25 +61,25 @@ public class AuditDMOTests {
|
|||||||
AuditedArea[] auditedAreas = auditDMO.GetAuditAreaList().ToArray();
|
AuditedArea[] auditedAreas = auditDMO.GetAuditAreaList().ToArray();
|
||||||
// IEnumerable<int> GetAuditFindingCategoryIdsByFindingId(int auditFindingsID);
|
// IEnumerable<int> GetAuditFindingCategoryIdsByFindingId(int auditFindingsID);
|
||||||
// AuditFindings GetAuditFindingsByID(int auditFindingsID);
|
// AuditFindings GetAuditFindingsByID(int auditFindingsID);
|
||||||
// IEnumerable<AuditFindings> GetAuditFindingsList(int auditNo);
|
AuditFindings[] auditFindings = auditDMO.GetAuditFindingsList(auditNo).ToArray();
|
||||||
// Audit GetAuditItem(int auditNo, appSettings.UserId);
|
Audit auditB = auditDMO.GetAuditItem(auditNo, appSettings.UserId);
|
||||||
// Audit GetAuditItemReadOnly(int auditNo, appSettings.UserId);
|
Audit auditC = new();
|
||||||
|
AuditEdit auditEdit = auditDMO.GetAuditEdit(auditNo, auditC, isAdmin, appSettings.UserId);
|
||||||
|
Audit auditD = auditDMO.GetAuditItemReadOnly(auditNo, appSettings.UserId);
|
||||||
Auditor[] auditors = auditDMO.GetAuditorList().ToArray();
|
Auditor[] auditors = auditDMO.GetAuditorList().ToArray();
|
||||||
// IEnumerable<AuditReportAttachment> GetAuditReportAttachments(int auditNo);
|
AuditReportAttachment[] auditReportAttachments = auditDMO.GetAuditReportAttachments(auditNo).ToArray();
|
||||||
// C_8DAuditedStandard[] c_8DAuditedStandards = auditDMO.GetAuditStandardList().ToArray();
|
// C_8DAuditedStandard[] c_8DAuditedStandards = auditDMO.GetAuditStandardList().ToArray();
|
||||||
AuditType[] auditTypes = auditDMO.GetAuditTypeList().ToArray();
|
AuditType[] auditTypes = auditDMO.GetAuditTypeList().ToArray();
|
||||||
// CAFindings GetCAFindingsItem(int caFindingsID);
|
// CAFindings GetCAFindingsItem(int caFindingsID);
|
||||||
// IEnumerable<AuditReportAttachment> GetCAFindingsItemAttachments(int caFindingsID);
|
// IEnumerable<AuditReportAttachment> GetCAFindingsItemAttachments(int caFindingsID);
|
||||||
// IEnumerable<CAFindings> GetCAFindingsList(int auditNo);
|
CAFindings[] caFindings = auditDMO.GetCAFindingsList(auditNo).ToArray();
|
||||||
CANoList[] cANoLists = auditDMO.GetCorrectiveActionNoList().ToArray();
|
CANoList[] cANoLists = auditDMO.GetCorrectiveActionNoList().ToArray();
|
||||||
// int GetOpenCACountByAuditNo(int auditNo);
|
int openCACountByAuditNo = auditDMO.GetOpenCACountByAuditNo(auditNo);
|
||||||
CAUserList[] cAUserLists = auditDMO.GetUserList().ToArray();
|
CAUserList[] cAUserLists = auditDMO.GetUserList().ToArray();
|
||||||
// Audit InsertAudit(Audit audit);
|
|
||||||
// void InsertAuditReportAttachment(AuditReportAttachment attach);
|
// void InsertAuditReportAttachment(AuditReportAttachment attach);
|
||||||
// void InsertCAFindings(CAFindings model);
|
// void InsertCAFindings(CAFindings model);
|
||||||
// int IsCAAssignedToAudit(int CANo, int auditNo);
|
// int IsCAAssignedToAudit(int CANo, int auditNo);
|
||||||
// void ReleaseLockOnDocument(appSettings.UserId, int issueID);
|
// void ReleaseLockOnDocument(appSettings.UserId, int issueID);
|
||||||
// void UpdateAudit(Audit audit, appSettings.UserId);
|
|
||||||
// void UpdateCAFindings(CAFindings model);
|
// void UpdateCAFindings(CAFindings model);
|
||||||
if (auditDMO is null) { }
|
if (auditDMO is null) { }
|
||||||
#pragma warning restore IDE0059
|
#pragma warning restore IDE0059
|
||||||
@ -89,13 +89,14 @@ public class AuditDMOTests {
|
|||||||
[Ignore]
|
[Ignore]
|
||||||
#endif
|
#endif
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void AuditDMOIsAttachedOnly() {
|
[DataRow(250, true)]
|
||||||
|
public void AuditDMOIsAttachedOnly(int auditNo, bool isAdmin) {
|
||||||
_Logger?.LogInformation("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
|
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
|
||||||
Assert.IsTrue(appSettings is not null);
|
Assert.IsTrue(appSettings is not null);
|
||||||
if (System.Diagnostics.Debugger.IsAttached)
|
if (System.Diagnostics.Debugger.IsAttached)
|
||||||
AuditDMO(_Logger, appSettings);
|
AuditDMO(_Logger, appSettings, auditNo, isAdmin);
|
||||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,25 +25,33 @@ public static class MockMemoryCacheService {
|
|||||||
public class PCRBServiceTests {
|
public class PCRBServiceTests {
|
||||||
private readonly Mock<ILogger<PCRBService>> _loggerMock;
|
private readonly Mock<ILogger<PCRBService>> _loggerMock;
|
||||||
private readonly Mock<IDalService> _dalServiceMock;
|
private readonly Mock<IDalService> _dalServiceMock;
|
||||||
private readonly Mock<IMemoryCache> _cacheMock;
|
private Mock<IMemoryCache> _cacheMock;
|
||||||
private readonly Mock<IUserService> _userServiceMock;
|
private readonly Mock<IUserService> _userServiceMock;
|
||||||
private readonly Mock<IApprovalService> _approvalServiceMock;
|
private readonly Mock<IApprovalService> _approvalServiceMock;
|
||||||
private readonly Mock<ISmtpService> _smtpServiceMock;
|
private readonly Mock<ISmtpService> _smtpServiceMock;
|
||||||
private readonly PCRBService _pcrbService;
|
private PCRBService _pcrbService;
|
||||||
|
|
||||||
|
private static IEnumerable<PCRB> PCRBS = new List<PCRB>() {
|
||||||
|
new PCRB {
|
||||||
|
PlanNumber = 1,
|
||||||
|
OwnerID = 1,
|
||||||
|
Title = "Test Title",
|
||||||
|
ChangeLevel = "Level 1",
|
||||||
|
ReasonForChange = "Test Reason",
|
||||||
|
ChangeDescription = "Test Description",
|
||||||
|
IsITAR = false,
|
||||||
|
CurrentStep = 1,
|
||||||
|
InsertTimeStamp = DateTime.Now,
|
||||||
|
LastUpdateDate = DateTime.Now,
|
||||||
|
Type = "Type 1"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private static IEnumerable<PCRBFollowUp> FOLLOW_UPS = new List<PCRBFollowUp>() {
|
private static IEnumerable<PCRBFollowUp> FOLLOW_UPS = new List<PCRBFollowUp>() {
|
||||||
new PCRBFollowUp { ID = 1, PlanNumber = 1, Step = 1, FollowUpDate = DateTime.Now }
|
new PCRBFollowUp { ID = 1, PlanNumber = 1, Step = 1, FollowUpDate = DateTime.Now }
|
||||||
};
|
};
|
||||||
|
|
||||||
public PCRBServiceTests() {
|
private static AppSettings appSettings = new AppSettings(
|
||||||
_loggerMock = new Mock<ILogger<PCRBService>>();
|
|
||||||
_dalServiceMock = new Mock<IDalService>();
|
|
||||||
_userServiceMock = new Mock<IUserService>();
|
|
||||||
_approvalServiceMock = new Mock<IApprovalService>();
|
|
||||||
_smtpServiceMock = new Mock<ISmtpService>();
|
|
||||||
_cacheMock = MockMemoryCacheService.GetMemoryCache(FOLLOW_UPS);
|
|
||||||
|
|
||||||
var appSettings = new AppSettings(
|
|
||||||
Company: "Infineon",
|
Company: "Infineon",
|
||||||
DbConnectionString: "connectionString",
|
DbConnectionString: "connectionString",
|
||||||
JwtAudience: "audience",
|
JwtAudience: "audience",
|
||||||
@ -56,6 +64,14 @@ public class PCRBServiceTests {
|
|||||||
WorkingDirectoryName: "workingDirectoryName"
|
WorkingDirectoryName: "workingDirectoryName"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public PCRBServiceTests() {
|
||||||
|
_loggerMock = new Mock<ILogger<PCRBService>>();
|
||||||
|
_dalServiceMock = new Mock<IDalService>();
|
||||||
|
_userServiceMock = new Mock<IUserService>();
|
||||||
|
_approvalServiceMock = new Mock<IApprovalService>();
|
||||||
|
_smtpServiceMock = new Mock<ISmtpService>();
|
||||||
|
_cacheMock = MockMemoryCacheService.GetMemoryCache(FOLLOW_UPS);
|
||||||
|
|
||||||
_pcrbService = new PCRBService(
|
_pcrbService = new PCRBService(
|
||||||
_loggerMock.Object,
|
_loggerMock.Object,
|
||||||
_dalServiceMock.Object,
|
_dalServiceMock.Object,
|
||||||
@ -67,6 +83,161 @@ public class PCRBServiceTests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task CreateNewPCRB_WithValidParam_ShouldCreatePCRB() {
|
||||||
|
var pcrb = new PCRB {
|
||||||
|
OwnerID = 1,
|
||||||
|
Title = "Test Title",
|
||||||
|
ChangeLevel = "Level 1",
|
||||||
|
ReasonForChange = "Test Reason",
|
||||||
|
ChangeDescription = "Test Description",
|
||||||
|
IsITAR = false,
|
||||||
|
CurrentStep = 1,
|
||||||
|
InsertTimeStamp = DateTime.Now,
|
||||||
|
LastUpdateDate = DateTime.Now,
|
||||||
|
Type = "Type 1"
|
||||||
|
};
|
||||||
|
|
||||||
|
_dalServiceMock.Setup(d => d.ExecuteAsync(It.IsAny<string>(), pcrb))
|
||||||
|
.ReturnsAsync(1);
|
||||||
|
|
||||||
|
await _pcrbService.CreateNewPCRB(pcrb);
|
||||||
|
|
||||||
|
_dalServiceMock.Verify(d => d.ExecuteAsync(It.IsAny<string>(), pcrb), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task CreateNewPCRB_WithNullParam_ShouldThrowException() {
|
||||||
|
await Assert.ThrowsAsync<ArgumentNullException>(() => _pcrbService.CreateNewPCRB(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task CreateNewPCRB_WithDatabaseFailure_ShouldThrowException() {
|
||||||
|
var pcrb = new PCRB {
|
||||||
|
OwnerID = 1,
|
||||||
|
Title = "Test Title",
|
||||||
|
ChangeLevel = "Level 1",
|
||||||
|
ReasonForChange = "Test Reason",
|
||||||
|
ChangeDescription = "Test Description",
|
||||||
|
IsITAR = false,
|
||||||
|
CurrentStep = 1,
|
||||||
|
InsertTimeStamp = DateTime.Now,
|
||||||
|
LastUpdateDate = DateTime.Now,
|
||||||
|
Type = "Type 1"
|
||||||
|
};
|
||||||
|
|
||||||
|
_dalServiceMock.Setup(d => d.ExecuteAsync(It.IsAny<string>(), pcrb))
|
||||||
|
.ReturnsAsync(0);
|
||||||
|
|
||||||
|
await Assert.ThrowsAsync<Exception>(() => _pcrbService.CreateNewPCRB(pcrb));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task CreateNewPCRB_WithDatabaseException_ShouldThrowException() {
|
||||||
|
var pcrb = new PCRB {
|
||||||
|
OwnerID = 1,
|
||||||
|
Title = "Test Title",
|
||||||
|
ChangeLevel = "Level 1",
|
||||||
|
ReasonForChange = "Test Reason",
|
||||||
|
ChangeDescription = "Test Description",
|
||||||
|
IsITAR = false,
|
||||||
|
CurrentStep = 1,
|
||||||
|
InsertTimeStamp = DateTime.Now,
|
||||||
|
LastUpdateDate = DateTime.Now,
|
||||||
|
Type = "Type 1"
|
||||||
|
};
|
||||||
|
|
||||||
|
_dalServiceMock.Setup(d => d.ExecuteAsync(It.IsAny<string>(), pcrb))
|
||||||
|
.Throws<Exception>();
|
||||||
|
|
||||||
|
await Assert.ThrowsAsync<Exception>(() => _pcrbService.CreateNewPCRB(pcrb));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task UpdatePCRB_WithValidParam_ShouldUpdatePCRB() {
|
||||||
|
_cacheMock = MockMemoryCacheService.GetMemoryCache(PCRBS);
|
||||||
|
|
||||||
|
_pcrbService = new PCRBService(
|
||||||
|
_loggerMock.Object,
|
||||||
|
_dalServiceMock.Object,
|
||||||
|
_cacheMock.Object,
|
||||||
|
_userServiceMock.Object,
|
||||||
|
_approvalServiceMock.Object,
|
||||||
|
_smtpServiceMock.Object,
|
||||||
|
appSettings
|
||||||
|
);
|
||||||
|
|
||||||
|
var pcrb = new PCRB {
|
||||||
|
PlanNumber = 1,
|
||||||
|
OwnerID = 1,
|
||||||
|
Title = "Test Title",
|
||||||
|
ChangeLevel = "Level 1",
|
||||||
|
ReasonForChange = "Test Reason",
|
||||||
|
ChangeDescription = "Test Description",
|
||||||
|
IsITAR = false,
|
||||||
|
CurrentStep = 1,
|
||||||
|
LastUpdateDate = DateTime.Now,
|
||||||
|
ClosedDate = DateTime.Now,
|
||||||
|
Type = "Type 1"
|
||||||
|
};
|
||||||
|
|
||||||
|
_dalServiceMock.Setup(d => d.ExecuteAsync(It.IsAny<string>(), pcrb))
|
||||||
|
.ReturnsAsync(1);
|
||||||
|
|
||||||
|
await _pcrbService.UpdatePCRB(pcrb);
|
||||||
|
|
||||||
|
_dalServiceMock.Verify(d => d.ExecuteAsync(It.IsAny<string>(), pcrb), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task UpdatePCRB_WithNullParam_ShouldThrowException() {
|
||||||
|
await Assert.ThrowsAsync<ArgumentNullException>(() => _pcrbService.UpdatePCRB(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task UpdatePCRB_WithDatabaseFailure_ShouldThrowException() {
|
||||||
|
var pcrb = new PCRB {
|
||||||
|
PlanNumber = 1,
|
||||||
|
OwnerID = 1,
|
||||||
|
Title = "Test Title",
|
||||||
|
ChangeLevel = "Level 1",
|
||||||
|
ReasonForChange = "Test Reason",
|
||||||
|
ChangeDescription = "Test Description",
|
||||||
|
IsITAR = false,
|
||||||
|
CurrentStep = 1,
|
||||||
|
LastUpdateDate = DateTime.Now,
|
||||||
|
ClosedDate = DateTime.Now,
|
||||||
|
Type = "Type 1"
|
||||||
|
};
|
||||||
|
|
||||||
|
_dalServiceMock.Setup(d => d.ExecuteAsync(It.IsAny<string>(), pcrb))
|
||||||
|
.ReturnsAsync(0);
|
||||||
|
|
||||||
|
await Assert.ThrowsAsync<Exception>(() => _pcrbService.UpdatePCRB(pcrb));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task UpdatePCRB_WithDatabaseException_ShouldThrowException() {
|
||||||
|
var pcrb = new PCRB {
|
||||||
|
PlanNumber = 1,
|
||||||
|
OwnerID = 1,
|
||||||
|
Title = "Test Title",
|
||||||
|
ChangeLevel = "Level 1",
|
||||||
|
ReasonForChange = "Test Reason",
|
||||||
|
ChangeDescription = "Test Description",
|
||||||
|
IsITAR = false,
|
||||||
|
CurrentStep = 1,
|
||||||
|
LastUpdateDate = DateTime.Now,
|
||||||
|
ClosedDate = DateTime.Now,
|
||||||
|
Type = "Type 1"
|
||||||
|
};
|
||||||
|
|
||||||
|
_dalServiceMock.Setup(d => d.ExecuteAsync(It.IsAny<string>(), pcrb))
|
||||||
|
.Throws<Exception>();
|
||||||
|
|
||||||
|
await Assert.ThrowsAsync<Exception>(() => _pcrbService.UpdatePCRB(pcrb));
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task CreateFollowUp_WithValidParam_ShouldCreateFollowUp() {
|
public async Task CreateFollowUp_WithValidParam_ShouldCreateFollowUp() {
|
||||||
var followUp = new PCRBFollowUp {
|
var followUp = new PCRBFollowUp {
|
||||||
|
|||||||
@ -15,6 +15,8 @@ public class SmtpClientWrapper : ISmtpClientWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Send(MailMessage message) {
|
public void Send(MailMessage message) {
|
||||||
|
message.Subject = message.Subject.Replace('\r', ' ').Replace('\n', ' ');
|
||||||
|
|
||||||
_client.Send(message);
|
_client.Send(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,16 +78,15 @@ public class PCRBService : IPCRBService {
|
|||||||
|
|
||||||
if (pcrb is null) throw new ArgumentNullException("PCRB cannot be null");
|
if (pcrb is null) throw new ArgumentNullException("PCRB cannot be null");
|
||||||
|
|
||||||
|
pcrb.LastUpdateDate = DateTime.Now;
|
||||||
|
|
||||||
StringBuilder queryBuilder = new();
|
StringBuilder queryBuilder = new();
|
||||||
queryBuilder.Append("insert into CCChangeControl (OwnerID, Title, ChangeLevel, ReasonForChange, ");
|
queryBuilder.Append("insert into CCChangeControl (OwnerID, Title, ChangeLevel, ReasonForChange, ");
|
||||||
queryBuilder.Append("ChangeDescription, IsITAR, CurrentStep, InsertTimeStamp, LastUpdateDate) ");
|
queryBuilder.Append("ChangeDescription, IsITAR, CurrentStep, InsertTimeStamp, LastUpdateDate, Type) ");
|
||||||
queryBuilder.Append($"values ({pcrb.OwnerID}, '{pcrb.Title}', '{pcrb.ChangeLevel}', ");
|
queryBuilder.Append("values (@OwnerID, @Title, @ChangeLevel, @ReasonForChange, @ChangeDescription, ");
|
||||||
queryBuilder.Append($"'{pcrb.ReasonForChange}', '{pcrb.ChangeDescription}', ");
|
queryBuilder.Append("@IsITAR, @CurrentStep, @InsertTimeStamp, @LastUpdateDate, @Type)");
|
||||||
queryBuilder.Append($"{Convert.ToInt32(pcrb.IsITAR)}, {pcrb.CurrentStep}, ");
|
|
||||||
queryBuilder.Append($"'{pcrb.InsertTimeStamp.ToString("yyyy-MM-dd HH:mm:ss")}', ");
|
|
||||||
queryBuilder.Append($"'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}')");
|
|
||||||
|
|
||||||
int rowsCreated = await _dalService.ExecuteAsync(queryBuilder.ToString());
|
int rowsCreated = await _dalService.ExecuteAsync(queryBuilder.ToString(), pcrb);
|
||||||
|
|
||||||
if (rowsCreated <= 0) throw new Exception("unable to insert new PCRB in the database");
|
if (rowsCreated <= 0) throw new Exception("unable to insert new PCRB in the database");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@ -198,18 +197,16 @@ public class PCRBService : IPCRBService {
|
|||||||
|
|
||||||
if (pcrb is null) throw new ArgumentNullException("PCRB cannot be null");
|
if (pcrb is null) throw new ArgumentNullException("PCRB cannot be null");
|
||||||
|
|
||||||
StringBuilder queryBuilder = new();
|
pcrb.LastUpdateDate = DateTime.Now;
|
||||||
queryBuilder.Append($"update CCChangeControl set OwnerID={pcrb.OwnerID}, ");
|
|
||||||
queryBuilder.Append($"Title='{pcrb.Title.Replace("'", "''")}', ChangeLevel='{pcrb.ChangeLevel}', ");
|
|
||||||
queryBuilder.Append($"CurrentStep={pcrb.CurrentStep}, ReasonForChange='{pcrb.ReasonForChange.Replace("'", "''")}', ");
|
|
||||||
queryBuilder.Append($"ChangeDescription='{pcrb.ChangeDescription.Replace("'", "''")}', ");
|
|
||||||
queryBuilder.Append($"IsITAR={Convert.ToInt32(pcrb.IsITAR)}, ");
|
|
||||||
queryBuilder.Append($"InsertTimeStamp='{pcrb.InsertTimeStamp.ToString("yyyy-MM-dd HH:mm:ss")}', ");
|
|
||||||
queryBuilder.Append($"ClosedDate='{pcrb.ClosedDate.ToString("yyyy-MM-dd HH:mm:ss")}', ");
|
|
||||||
queryBuilder.Append($"LastUpdateDate='{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}' ");
|
|
||||||
queryBuilder.Append($"where PlanNumber={pcrb.PlanNumber}");
|
|
||||||
|
|
||||||
int rowsAffected = await _dalService.ExecuteAsync(queryBuilder.ToString());
|
StringBuilder queryBuilder = new();
|
||||||
|
queryBuilder.Append("update CCChangeControl set OwnerID=@OwnerID, Title=@Title, ChangeLevel=@ChangeLevel, ");
|
||||||
|
queryBuilder.Append("Type=@Type, CurrentStep=@CurrentStep, ReasonForChange=@ReasonForChange, ");
|
||||||
|
queryBuilder.Append("ChangeDescription=@ChangeDescription, IsITAR=@IsITAR, ClosedDate=@ClosedDate, ");
|
||||||
|
queryBuilder.Append("LastUpdateDate=@LastUpdateDate ");
|
||||||
|
queryBuilder.Append($"where PlanNumber=@PlanNumber");
|
||||||
|
|
||||||
|
int rowsAffected = await _dalService.ExecuteAsync(queryBuilder.ToString(), pcrb);
|
||||||
|
|
||||||
if (rowsAffected <= 0) throw new Exception("unable to perform update in database");
|
if (rowsAffected <= 0) throw new Exception("unable to perform update in database");
|
||||||
|
|
||||||
|
|||||||
@ -137,6 +137,20 @@
|
|||||||
<MudSelectItem Value="@("Other Site + Mesa - Class 2")" />
|
<MudSelectItem Value="@("Other Site + Mesa - Class 2")" />
|
||||||
<MudSelectItem Value="@("Mesa - Class 3")" />
|
<MudSelectItem Value="@("Mesa - Class 3")" />
|
||||||
</MudSelect>
|
</MudSelect>
|
||||||
|
<MudSelect T="string"
|
||||||
|
Variant="Variant.Outlined"
|
||||||
|
Required
|
||||||
|
Clearable
|
||||||
|
AnchorOrigin="Origin.BottomCenter"
|
||||||
|
Disabled="@pcrbIsSubmitted"
|
||||||
|
@bind-Value="@pcrb.Type"
|
||||||
|
Text="@pcrb.Type"
|
||||||
|
Label="Change Type">
|
||||||
|
<MudSelectItem Value="@("Cost Savings")" />
|
||||||
|
<MudSelectItem Value="@("Process Efficiency")" />
|
||||||
|
<MudSelectItem Value="@("Process Improvement")" />
|
||||||
|
<MudSelectItem Value="@("Business Continuity")" />
|
||||||
|
</MudSelect>
|
||||||
<MudCheckBox Disabled="@pcrbIsSubmitted"
|
<MudCheckBox Disabled="@pcrbIsSubmitted"
|
||||||
Color="Color.Tertiary"
|
Color="Color.Tertiary"
|
||||||
@bind-Value=pcrb.IsITAR
|
@bind-Value=pcrb.IsITAR
|
||||||
@ -152,6 +166,11 @@
|
|||||||
Value="@DateTimeUtilities.GetDateAsStringMinDefault(pcrb.LastUpdateDate)"
|
Value="@DateTimeUtilities.GetDateAsStringMinDefault(pcrb.LastUpdateDate)"
|
||||||
Label="Last Update"
|
Label="Last Update"
|
||||||
Variant="Variant.Outlined" />
|
Variant="Variant.Outlined" />
|
||||||
|
<MudTextField Disabled="true"
|
||||||
|
T="string"
|
||||||
|
Value="@DateTimeUtilities.GetDateAsStringMaxDefault(pcrb.ClosedDate)"
|
||||||
|
Label="Complete Date"
|
||||||
|
Variant="Variant.Outlined" />
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
|
|
||||||
<MudPaper Outlined="true"
|
<MudPaper Outlined="true"
|
||||||
|
|||||||
@ -23,4 +23,5 @@ public class PCRB {
|
|||||||
public DateTime InsertTimeStamp { get; set; } = DateTimeUtilities.MIN_DT;
|
public DateTime InsertTimeStamp { get; set; } = DateTimeUtilities.MIN_DT;
|
||||||
public DateTime LastUpdateDate { get; set; } = DateTimeUtilities.MIN_DT;
|
public DateTime LastUpdateDate { get; set; } = DateTimeUtilities.MIN_DT;
|
||||||
public DateTime ClosedDate { get; set; } = DateTimeUtilities.MAX_DT;
|
public DateTime ClosedDate { get; set; } = DateTimeUtilities.MAX_DT;
|
||||||
|
public string Type { get; set; } = "";
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user