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:
parent
b1c6903c1c
commit
b99b721458
@ -20,10 +20,5 @@ public class RouteConfig {
|
|||||||
// otherwise MVC generates the wrong form action url
|
// otherwise MVC generates the wrong form action url
|
||||||
defaults: new { controller = "Home", action = "MyTasks", id = UrlParameter.Optional }
|
defaults: new { controller = "Home", action = "MyTasks", id = UrlParameter.Optional }
|
||||||
);
|
);
|
||||||
//routes.MapHttpRoute(
|
|
||||||
// name: "ApiRoute",
|
|
||||||
// routeTemplate: "api/{controller}/{id}",
|
|
||||||
// defaults: new { id = RouteParameter.Optional }
|
|
||||||
//);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,20 +16,5 @@ public partial class Startup {
|
|||||||
});
|
});
|
||||||
// Use a cookie to temporarily store information about a user logging in with a third party login provider
|
// Use a cookie to temporarily store information about a user logging in with a third party login provider
|
||||||
// app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
|
// app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
|
||||||
|
|
||||||
// Uncomment the following lines to enable logging in with third party login providers
|
|
||||||
//app.UseMicrosoftAccountAuthentication(
|
|
||||||
// clientId: "",
|
|
||||||
// clientSecret: "");
|
|
||||||
|
|
||||||
//app.UseTwitterAuthentication(
|
|
||||||
// consumerKey: "",
|
|
||||||
// consumerSecret: "");
|
|
||||||
|
|
||||||
//app.UseFacebookAuthentication(
|
|
||||||
// appId: "",
|
|
||||||
// appSecret: "");
|
|
||||||
|
|
||||||
//app.UseGoogleAuthentication();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -38,7 +38,6 @@ public class AccountController : Controller {
|
|||||||
|
|
||||||
public UserManager<ApplicationUser> UserManager { get; private set; }
|
public UserManager<ApplicationUser> UserManager { get; private set; }
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Account/Login
|
// GET: /Account/Login
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
// try to make the browser refresh the login page every time, to prevent issues with changing usernames and the anti-forgery token validation
|
// try to make the browser refresh the login page every time, to prevent issues with changing usernames and the anti-forgery token validation
|
||||||
@ -81,9 +80,6 @@ public class AccountController : Controller {
|
|||||||
#if (!DEBUG)
|
#if (!DEBUG)
|
||||||
|
|
||||||
bool isIFX = false;
|
bool isIFX = false;
|
||||||
//domainProvider = Membership.Providers["NA_ADMembershipProvider"];
|
|
||||||
//isLoginValid = domainProvider.ValidateUser(model.LoginID, model.Password);
|
|
||||||
|
|
||||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||||
isLoginValid = true;
|
isLoginValid = true;
|
||||||
} else {
|
} else {
|
||||||
@ -136,9 +132,6 @@ public class AccountController : Controller {
|
|||||||
#if (!DEBUG)
|
#if (!DEBUG)
|
||||||
|
|
||||||
bool isIFX = false;
|
bool isIFX = false;
|
||||||
//domainProvider = Membership.Providers["NA_ADMembershipProvider"];
|
|
||||||
//isLoginValid = domainProvider.ValidateUser(model.LoginID, model.Password);
|
|
||||||
|
|
||||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||||
isLoginValid = true;
|
isLoginValid = true;
|
||||||
} else {
|
} else {
|
||||||
@ -220,7 +213,6 @@ public class AccountController : Controller {
|
|||||||
return new ChallengeResult(provider, Url.Action("LinkLoginCallback", "Account"), User.Identity.GetUserId());
|
return new ChallengeResult(provider, Url.Action("LinkLoginCallback", "Account"), User.Identity.GetUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Account/LinkLoginCallback
|
// GET: /Account/LinkLoginCallback
|
||||||
public async Task<ActionResult> LinkLoginCallback() {
|
public async Task<ActionResult> LinkLoginCallback() {
|
||||||
ExternalLoginInfo loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(XsrfKey, User.Identity.GetUserId());
|
ExternalLoginInfo loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(XsrfKey, User.Identity.GetUserId());
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
@ -6,12 +12,6 @@ using Fab2ApprovalSystem.ViewModels;
|
|||||||
using Kendo.Mvc.Extensions;
|
using Kendo.Mvc.Extensions;
|
||||||
using Kendo.Mvc.UI;
|
using Kendo.Mvc.UI;
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using System.Web.Mvc;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers;
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
@ -21,13 +21,8 @@ public class AdminController : Controller {
|
|||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
AdminDMO adminDMO = new AdminDMO();
|
AdminDMO adminDMO = new AdminDMO();
|
||||||
TrainingDMO trainingDMO = new TrainingDMO();
|
TrainingDMO trainingDMO = new TrainingDMO();
|
||||||
LotDispositionDMO ldDMO;
|
LotDispositionDMO ldDMO = new LotDispositionDMO();
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||||
|
|
||||||
public AdminController(AppSettings appSettings) {
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
ldDMO = new LotDispositionDMO(appSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||||
@ -188,7 +183,6 @@ public class AdminController : Controller {
|
|||||||
return Content("");
|
return Content("");
|
||||||
|
|
||||||
// TODO - Send an email to the OOO person and to the Delegated person
|
// TODO - Send an email to the OOO person and to the Delegated person
|
||||||
//return View();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExpireOOOStatus(int oooUserID) {
|
public void ExpireOOOStatus(int oooUserID) {
|
||||||
@ -197,8 +191,6 @@ public class AdminController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult ManageTrainingGroups() {
|
public ActionResult ManageTrainingGroups() {
|
||||||
//List<TrainingGroup> allGroups = GetTrainingGroups();
|
|
||||||
//return View(allGroups);
|
|
||||||
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||||
ViewBag.AllGroups = GetTrainingGroups();
|
ViewBag.AllGroups = GetTrainingGroups();
|
||||||
return View();
|
return View();
|
||||||
@ -316,7 +308,6 @@ public class AdminController : Controller {
|
|||||||
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||||
// Check to make sure user is not apart of the group already
|
// Check to make sure user is not apart of the group already
|
||||||
bool userExists = false;
|
bool userExists = false;
|
||||||
//bool userValid = true;
|
|
||||||
List<TrainingReportUser> existingUsers = adminDMO.GetTrainingReportUsers();
|
List<TrainingReportUser> existingUsers = adminDMO.GetTrainingReportUsers();
|
||||||
foreach (var item in existingUsers) {
|
foreach (var item in existingUsers) {
|
||||||
if (item.UserId == userId) {
|
if (item.UserId == userId) {
|
||||||
@ -342,7 +333,6 @@ public class AdminController : Controller {
|
|||||||
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||||
// Check to make sure user is not apart of the group already
|
// Check to make sure user is not apart of the group already
|
||||||
bool userExists = false;
|
bool userExists = false;
|
||||||
//bool userValid = true;
|
|
||||||
List<TECNNotificationsUser> existingUsers = adminDMO.GetTECNNotificationUsers();
|
List<TECNNotificationsUser> existingUsers = adminDMO.GetTECNNotificationUsers();
|
||||||
foreach (var item in existingUsers) {
|
foreach (var item in existingUsers) {
|
||||||
if (item.UserId == userId) {
|
if (item.UserId == userId) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
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,15 +20,9 @@ namespace Fab2ApprovalSystem.Controllers;
|
|||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class AuditController : Controller {
|
public class AuditController : Controller {
|
||||||
|
|
||||||
AuditDMO auditDMO;
|
AuditDMO auditDMO = new AuditDMO(GlobalVars.AppSettings);
|
||||||
CorrectiveActionDMO caDMO;
|
CorrectiveActionDMO caDMO = new CorrectiveActionDMO();
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||||
|
|
||||||
public AuditController(AppSettings appSettings) {
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
auditDMO = new AuditDMO(appSettings);
|
|
||||||
caDMO = new CorrectiveActionDMO(appSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: Audit
|
// GET: Audit
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
@ -136,7 +129,7 @@ public class AuditController : Controller {
|
|||||||
if (AuditReportFiles != null) {
|
if (AuditReportFiles != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in AuditReportFiles) {
|
foreach (var file in AuditReportFiles) {
|
||||||
auditDMO.AuditReportAttachSave(auditNo, userId, file.FileName, file.InputStream);
|
AuditHelper.AuditReportAttachSave(_AppSettings, auditDMO, auditNo, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@ -159,7 +152,7 @@ public class AuditController : Controller {
|
|||||||
public FileResult DownloadAuditReportAttachment(string fileGuid, int auditNo) {
|
public FileResult DownloadAuditReportAttachment(string fileGuid, int auditNo) {
|
||||||
try {
|
try {
|
||||||
string fileName, sDocument;
|
string fileName, sDocument;
|
||||||
List<string> results = auditDMO.GetFileNameAndDocument(fileGuid, auditNo);
|
List<string> results = AuditHelper.GetFileNameAndDocument(_AppSettings, auditDMO, fileGuid, auditNo);
|
||||||
fileName = results[0];
|
fileName = results[0];
|
||||||
sDocument = results[1];
|
sDocument = results[1];
|
||||||
if (string.IsNullOrEmpty(sDocument)) {
|
if (string.IsNullOrEmpty(sDocument)) {
|
||||||
@ -170,7 +163,6 @@ public class AuditController : Controller {
|
|||||||
|
|
||||||
if (!System.IO.File.Exists(sDocument)) {
|
if (!System.IO.File.Exists(sDocument)) {
|
||||||
return null;
|
return null;
|
||||||
//throw new Exception("File not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||||
@ -270,7 +262,7 @@ public class AuditController : Controller {
|
|||||||
if (CAFindings_Attachemnt != null) {
|
if (CAFindings_Attachemnt != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in CAFindings_Attachemnt) {
|
foreach (var file in CAFindings_Attachemnt) {
|
||||||
auditDMO.SaveAndInsert(caFindingsID, auditNo, userId, file.FileName, file.InputStream);
|
AuditHelper.SaveAndInsert(_AppSettings, auditDMO, caFindingsID, auditNo, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@ -282,8 +274,7 @@ public class AuditController : Controller {
|
|||||||
|
|
||||||
public void NotifyActionItemOwner(int issueID, DateTime? dueDate, int? responsibleOwnerID) {
|
public void NotifyActionItemOwner(int issueID, DateTime? dueDate, int? responsibleOwnerID) {
|
||||||
try {
|
try {
|
||||||
string emailTemplatesPath = ConfigurationManager.AppSettings["EmailTemplatesPath"];
|
string email = auditDMO.NotifyActionItemOwner(issueID, dueDate, responsibleOwnerID, _AppSettings.EmailTemplatesPath);
|
||||||
string email = auditDMO.NotifyActionItemOwner(issueID, dueDate, responsibleOwnerID, emailTemplatesPath);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 5S/CA Findings" + ":" + email });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 5S/CA Findings" + ":" + email });
|
||||||
@ -299,7 +290,6 @@ public class AuditController : Controller {
|
|||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " 5s/CAFindings:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " 5s/CAFindings:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n 5s/CAFindings - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n 5s/CAFindings - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "5s/CAFindings Notification - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "5s/CAFindings Notification - " + exceptionString });
|
||||||
//throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.DMO;
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
@ -6,14 +13,6 @@ using Fab2ApprovalSystem.ViewModels;
|
|||||||
using Kendo.Mvc.Extensions;
|
using Kendo.Mvc.Extensions;
|
||||||
using Kendo.Mvc.UI;
|
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;
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
@ -21,13 +20,8 @@ namespace Fab2ApprovalSystem.Controllers;
|
|||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class ChangeControlController : Controller {
|
public class ChangeControlController : Controller {
|
||||||
|
|
||||||
ChangeControlDMO ccDMO;
|
ChangeControlDMO ccDMO = new ChangeControlDMO();
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||||
|
|
||||||
public ChangeControlController(AppSettings appSettings) {
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
ccDMO = new ChangeControlDMO(appSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
return View();
|
return View();
|
||||||
@ -82,8 +76,6 @@ public class ChangeControlController : Controller {
|
|||||||
ViewBag.Attendees = ccDMO.GetUsers();
|
ViewBag.Attendees = ccDMO.GetUsers();
|
||||||
ViewBag.Generations = ccDMO.GetGenerations();
|
ViewBag.Generations = ccDMO.GetGenerations();
|
||||||
ViewBag.PartNumbers = ccDMO.GetPartNumbers();
|
ViewBag.PartNumbers = ccDMO.GetPartNumbers();
|
||||||
//ViewBag.ToolTypes = ccDMO.GetToolTypes();
|
|
||||||
//ViewBag.MeetingList = ccDMO.GetMeetingList(issueID);
|
|
||||||
ViewBag.Processes = ccDMO.GetProcesses();
|
ViewBag.Processes = ccDMO.GetProcesses();
|
||||||
ViewBag.Logistics = ccDMO.GetLogistics();
|
ViewBag.Logistics = ccDMO.GetLogistics();
|
||||||
ViewBag.AIResponsibles = ccDMO.GetActionItemResponsible();
|
ViewBag.AIResponsibles = ccDMO.GetActionItemResponsible();
|
||||||
@ -106,7 +98,6 @@ public class ChangeControlController : Controller {
|
|||||||
ViewBag.MeetingList = ccDMO.GetMeetingList(issueID);
|
ViewBag.MeetingList = ccDMO.GetMeetingList(issueID);
|
||||||
ViewBag.Generations = ccDMO.GetGenerations();
|
ViewBag.Generations = ccDMO.GetGenerations();
|
||||||
ViewBag.PartNumbers = ccDMO.GetPartNumbers();
|
ViewBag.PartNumbers = ccDMO.GetPartNumbers();
|
||||||
//ViewBag.ToolTypes = ccDMO.GetToolTypes();
|
|
||||||
ViewBag.Processes = ccDMO.GetProcesses();
|
ViewBag.Processes = ccDMO.GetProcesses();
|
||||||
ViewBag.Logistics = ccDMO.GetLogistics();
|
ViewBag.Logistics = ccDMO.GetLogistics();
|
||||||
return View(cc);
|
return View(cc);
|
||||||
@ -153,7 +144,6 @@ public class ChangeControlController : Controller {
|
|||||||
ccDMO.UpdateCCAttachemnt(model);
|
ccDMO.UpdateCCAttachemnt(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +153,6 @@ public class ChangeControlController : Controller {
|
|||||||
ccDMO.DeleteCCAttachemnt(model);
|
ccDMO.DeleteCCAttachemnt(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +169,7 @@ public class ChangeControlController : Controller {
|
|||||||
if (files != null) {
|
if (files != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in files) {
|
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("");
|
return Content("");
|
||||||
@ -202,8 +191,6 @@ public class ChangeControlController : Controller {
|
|||||||
if (model != null && ModelState.IsValid) {
|
if (model != null && ModelState.IsValid) {
|
||||||
ccDMO.UpdateMeetingAttachmentAttrib(model);
|
ccDMO.UpdateMeetingAttachmentAttrib(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,8 +199,6 @@ public class ChangeControlController : Controller {
|
|||||||
if (model != null && ModelState.IsValid) {
|
if (model != null && ModelState.IsValid) {
|
||||||
ccDMO.DeleteMeetingAttachemnt(model);
|
ccDMO.DeleteMeetingAttachemnt(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +216,7 @@ public class ChangeControlController : Controller {
|
|||||||
if (files != null) {
|
if (files != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in files) {
|
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("");
|
return Content("");
|
||||||
@ -243,7 +228,7 @@ public class ChangeControlController : Controller {
|
|||||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||||
|
|
||||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "ChangeControl\\" + planNumber.ToString();
|
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;
|
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||||
@ -254,7 +239,6 @@ public class ChangeControlController : Controller {
|
|||||||
|
|
||||||
if (!System.IO.File.Exists(sDocument)) {
|
if (!System.IO.File.Exists(sDocument)) {
|
||||||
return null;
|
return null;
|
||||||
//throw new Exception("File not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||||
@ -263,9 +247,7 @@ public class ChangeControlController : Controller {
|
|||||||
public ActionResult CreateMeeting(int planNumber) {
|
public ActionResult CreateMeeting(int planNumber) {
|
||||||
try {
|
try {
|
||||||
int meetingID = ccDMO.InsertMeeting(planNumber);
|
int meetingID = ccDMO.InsertMeeting(planNumber);
|
||||||
//return RedirectToAction("EditMeeting", new { meetingID = meetingID });
|
|
||||||
return Content(meetingID.ToString());
|
return Content(meetingID.ToString());
|
||||||
//return null;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
string detailedException = "";
|
string detailedException = "";
|
||||||
try {
|
try {
|
||||||
@ -375,7 +357,7 @@ public class ChangeControlController : Controller {
|
|||||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||||
|
|
||||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "ChangeControl\\" + planNumber.ToString();
|
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;
|
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||||
@ -386,7 +368,6 @@ public class ChangeControlController : Controller {
|
|||||||
|
|
||||||
if (!System.IO.File.Exists(sDocument)) {
|
if (!System.IO.File.Exists(sDocument)) {
|
||||||
return null;
|
return null;
|
||||||
//throw new Exception("File not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||||
@ -410,8 +391,6 @@ public class ChangeControlController : Controller {
|
|||||||
if (model != null && ModelState.IsValid) {
|
if (model != null && ModelState.IsValid) {
|
||||||
ccDMO.DeleteDecisionSummary(model);
|
ccDMO.DeleteDecisionSummary(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +427,6 @@ public class ChangeControlController : Controller {
|
|||||||
|
|
||||||
public void InsertNewMeetingAttendee(string attendeeName, string jobTitle, string siteName) {
|
public void InsertNewMeetingAttendee(string attendeeName, string jobTitle, string siteName) {
|
||||||
try {
|
try {
|
||||||
//ccDMO.InsertNewMeetingAttendee(meetingId, attendeeName, jobTitle, siteName);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
string detailedException = "";
|
string detailedException = "";
|
||||||
try {
|
try {
|
||||||
@ -456,10 +434,6 @@ public class ChangeControlController : Controller {
|
|||||||
} catch {
|
} catch {
|
||||||
detailedException = e.Message;
|
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 });
|
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = @User.Identity.Name, DocumentType = "Change Control", OperationType = "Error", Comments = "UpdateMeetingAttendee - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//return Content("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[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 });
|
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = @User.Identity.Name, DocumentType = "Change Control", OperationType = "Error", Comments = "UpdateMeetingAttendee - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//return Content("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AcceptVerbs(HttpVerbs.Post)]
|
[AcceptVerbs(HttpVerbs.Post)]
|
||||||
@ -510,8 +480,6 @@ public class ChangeControlController : Controller {
|
|||||||
if (model != null && ModelState.IsValid) {
|
if (model != null && ModelState.IsValid) {
|
||||||
ccDMO.DeleteMeetingAttendee(model);
|
ccDMO.DeleteMeetingAttendee(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,8 +498,6 @@ public class ChangeControlController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Content("1");
|
return Content("1");
|
||||||
|
|
||||||
//return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetMeetingActionItems([DataSourceRequest] DataSourceRequest request, int meetingID) {
|
public ActionResult GetMeetingActionItems([DataSourceRequest] DataSourceRequest request, int meetingID) {
|
||||||
@ -546,17 +512,6 @@ public class ChangeControlController : Controller {
|
|||||||
return Json(ccDMO.GetMeetingActionItems_All(planNumber).ToDataSourceResult(request));
|
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) {
|
public ActionResult InsertPCRBActionItem(CCPCRBActionItem model) {
|
||||||
try {
|
try {
|
||||||
if (model != null) {
|
if (model != null) {
|
||||||
@ -597,8 +552,6 @@ public class ChangeControlController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Content("1");
|
return Content("1");
|
||||||
|
|
||||||
//return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult UpdatePCRBActionItem(CCPCRBActionItem model) {
|
public ActionResult UpdatePCRBActionItem(CCPCRBActionItem model) {
|
||||||
@ -658,8 +611,6 @@ public class ChangeControlController : Controller {
|
|||||||
if (model != null && ModelState.IsValid) {
|
if (model != null && ModelState.IsValid) {
|
||||||
ccDMO.DeleteMeetingActionItem(model);
|
ccDMO.DeleteMeetingActionItem(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -667,8 +618,6 @@ public class ChangeControlController : Controller {
|
|||||||
if (model != null && ModelState.IsValid) {
|
if (model != null && ModelState.IsValid) {
|
||||||
ccDMO.DeletePCRBActionItem(model);
|
ccDMO.DeletePCRBActionItem(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -713,7 +662,7 @@ public class ChangeControlController : Controller {
|
|||||||
if (AIfiles != null) {
|
if (AIfiles != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in AIfiles) {
|
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("");
|
return Content("");
|
||||||
@ -725,7 +674,7 @@ public class ChangeControlController : Controller {
|
|||||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||||
|
|
||||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "ChangeControl\\" + planNumber.ToString();
|
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;
|
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||||
@ -736,7 +685,6 @@ public class ChangeControlController : Controller {
|
|||||||
|
|
||||||
if (!System.IO.File.Exists(sDocument)) {
|
if (!System.IO.File.Exists(sDocument)) {
|
||||||
return null;
|
return null;
|
||||||
//throw new Exception("File not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||||
@ -760,9 +708,6 @@ public class ChangeControlController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public JsonResult GetAllUsersList() {
|
public JsonResult GetAllUsersList() {
|
||||||
//var userList = ldDMO.GetApprovedApproversList(issueID, currentStep);
|
|
||||||
//return Json(userList, JsonRequestBehavior.AllowGet);
|
|
||||||
|
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
||||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
@ -7,14 +14,6 @@ using Fab2ApprovalSystem.ViewModels;
|
|||||||
using Kendo.Mvc.Extensions;
|
using Kendo.Mvc.Extensions;
|
||||||
using Kendo.Mvc.UI;
|
using Kendo.Mvc.UI;
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using System.Web.Mvc;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers;
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
@ -22,19 +21,13 @@ namespace Fab2ApprovalSystem.Controllers;
|
|||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class CorrectiveActionController : Controller {
|
public class CorrectiveActionController : Controller {
|
||||||
|
|
||||||
AuditDMO auditDMO;
|
AuditDMO auditDMO = new AuditDMO(GlobalVars.AppSettings);
|
||||||
CorrectiveActionDMO caDMO;
|
CorrectiveActionDMO caDMO = new CorrectiveActionDMO();
|
||||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
FileUtilities<System.Web.Mvc.FileContentResult> fileUtilities = new FileUtilities<System.Web.Mvc.FileContentResult>();
|
FileUtilities<System.Web.Mvc.FileContentResult> fileUtilities = new FileUtilities<System.Web.Mvc.FileContentResult>();
|
||||||
|
|
||||||
public CorrectiveActionController(AppSettings appSettings) {
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
auditDMO = new AuditDMO(appSettings);
|
|
||||||
caDMO = new CorrectiveActionDMO(appSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
@ -177,9 +170,6 @@ public class CorrectiveActionController : Controller {
|
|||||||
return Content("User is not authorized to save the CA.");
|
return Content("User is not authorized to save the CA.");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (model.TriggerApproval) {
|
|
||||||
//model.FollowUpDate = DateTime.Now.AddMonths(6);
|
|
||||||
}
|
|
||||||
caDMO.UpdateCorrectiveAction(model);
|
caDMO.UpdateCorrectiveAction(model);
|
||||||
|
|
||||||
if ((model.D1AssigneeID != model.CurrentD1AssigneeID && model.CASubmitted) || (model.CASubmitted && !caPrevious.CASubmitted)) {
|
if ((model.D1AssigneeID != model.CurrentD1AssigneeID && model.CASubmitted) || (model.CASubmitted && !caPrevious.CASubmitted)) {
|
||||||
@ -208,7 +198,6 @@ public class CorrectiveActionController : Controller {
|
|||||||
NotifySectionApprover(model.CANo, model.QAID, model.SectionApproval);
|
NotifySectionApprover(model.CANo, model.QAID, model.SectionApproval);
|
||||||
|
|
||||||
NotifySectionApprover(model.CANo, model.RequestorID, model.SectionApproval);
|
NotifySectionApprover(model.CANo, model.RequestorID, model.SectionApproval);
|
||||||
//NotifyApprovers(model.CANo, 1);
|
|
||||||
return Content("Successfully Saved...Approval initiated!");
|
return Content("Successfully Saved...Approval initiated!");
|
||||||
}
|
}
|
||||||
if (model.TriggerApproval) {
|
if (model.TriggerApproval) {
|
||||||
@ -292,7 +281,7 @@ public class CorrectiveActionController : Controller {
|
|||||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||||
|
|
||||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "CorrectiveAction\\" + caNo.ToString();
|
string ecnFolderPath = _AppSettings.AttachmentFolder + "CorrectiveAction\\" + caNo.ToString();
|
||||||
var sDocument = Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
var sDocument = System.IO.Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||||
|
|
||||||
var FDir_AppData = _AppSettings.AttachmentFolder;
|
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||||
@ -303,7 +292,6 @@ public class CorrectiveActionController : Controller {
|
|||||||
|
|
||||||
if (!System.IO.File.Exists(sDocument)) {
|
if (!System.IO.File.Exists(sDocument)) {
|
||||||
return null;
|
return null;
|
||||||
//throw new Exception("File not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||||
@ -314,8 +302,6 @@ public class CorrectiveActionController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult DownloadTemplatesFiles() {
|
public ActionResult DownloadTemplatesFiles() {
|
||||||
//string templatesPath = GlobalVars.CA_BlankFormsLocation;
|
|
||||||
//string fullName = Server.MapPath("~" + filePath);
|
|
||||||
string fileName = "5Why_Is_Is_Not_Fishbone.pptx";
|
string fileName = "5Why_Is_Is_Not_Fishbone.pptx";
|
||||||
string pathToFile = GlobalVars.MesaTemplateFiles + "\\5Why_Is_Is_Not_Fishbone.pptx";
|
string pathToFile = GlobalVars.MesaTemplateFiles + "\\5Why_Is_Is_Not_Fishbone.pptx";
|
||||||
byte[] fileBytes = fileUtilities.GetFile(pathToFile);
|
byte[] fileBytes = fileUtilities.GetFile(pathToFile);
|
||||||
@ -328,7 +314,7 @@ public class CorrectiveActionController : Controller {
|
|||||||
if (files != null) {
|
if (files != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in files) {
|
foreach (var file in files) {
|
||||||
caDMO.AttachSave(caNo, userId, file.FileName, file.InputStream);
|
CorrectiveActionHelper.AttachSave(_AppSettings, caDMO, caNo, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@ -374,7 +360,7 @@ public class CorrectiveActionController : Controller {
|
|||||||
if (D4Files != null) {
|
if (D4Files != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in D4Files) {
|
foreach (var file in D4Files) {
|
||||||
caDMO.D4FilesAttachSave(caNo, userId, file.FileName, file.InputStream);
|
CorrectiveActionHelper.D4FilesAttachSave(_AppSettings, caDMO, caNo, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@ -394,10 +380,6 @@ public class CorrectiveActionController : Controller {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Content(e.Message + " Please try again...");
|
return Content(e.Message + " Please try again...");
|
||||||
}
|
}
|
||||||
if (data.ResponsibilityOwnerID != null && data.ResponsibilityOwnerID != 0) {
|
|
||||||
//NotifyActionItemOwner(data.CANo, data.ECD, data.ResponsibilityOwnerID, "CorrectiveActionAIAssigned.txt");
|
|
||||||
//NotifyRequestor(data.CANo, data.ECD, data.ResponsibilityOwnerID, "CorrectiveActionAIAssigned.txt");
|
|
||||||
}
|
|
||||||
return Content("");
|
return Content("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,7 +425,7 @@ public class CorrectiveActionController : Controller {
|
|||||||
if (D5D6CA_Attachemnt != null) {
|
if (D5D6CA_Attachemnt != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in D5D6CA_Attachemnt) {
|
foreach (var file in D5D6CA_Attachemnt) {
|
||||||
caDMO.SaveD5D6CA_Attachemnt(d5d6CAID, caNo, userId, file.FileName, file.InputStream);
|
CorrectiveActionHelper.SaveD5D6CA_Attachemnt(_AppSettings, caDMO, d5d6CAID, caNo, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@ -498,7 +480,7 @@ public class CorrectiveActionController : Controller {
|
|||||||
if (D7PA_Attachemnt != null) {
|
if (D7PA_Attachemnt != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in D7PA_Attachemnt) {
|
foreach (var file in D7PA_Attachemnt) {
|
||||||
caDMO.SaveD7PA_Attachemnt(d7PAID, caNo, userId, file.FileName, file.InputStream);
|
CorrectiveActionHelper.SaveD7PA_Attachemnt(_AppSettings, caDMO, d7PAID, caNo, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@ -520,9 +502,6 @@ public class CorrectiveActionController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public JsonResult GetAllUsersList() {
|
public JsonResult GetAllUsersList() {
|
||||||
//var userList = ldDMO.GetApprovedApproversList(issueID, currentStep);
|
|
||||||
//return Json(userList, JsonRequestBehavior.AllowGet);
|
|
||||||
|
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
||||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||||
@ -544,24 +523,7 @@ public class CorrectiveActionController : Controller {
|
|||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "CA", OperationType = "Error", Comments = "ReAssignApproval - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "CA", OperationType = "Error", Comments = "ReAssignApproval - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
CorrectiveActionHelper.ReAssignApproverByAdmin(_AppSettings, issueID, email);
|
||||||
string emailTemplate = "CorrectiveActionReAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Corrective Action Re-Assignment";
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
subject = "Corrective Action Re-Assignment" + " - Email would be sent to " + email;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[3];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -583,24 +545,7 @@ public class CorrectiveActionController : Controller {
|
|||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "ReAssignApproval - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "ReAssignApproval - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
CorrectiveActionHelper.ReAssignApproval(_AppSettings, issueID, email);
|
||||||
string emailTemplate = "CorrectiveActionReAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Corrective Action Re-Assignment";
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
subject = "Corrective Action Re-Assignment" + " - Email would be sent to " + email;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[3];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -629,30 +574,9 @@ public class CorrectiveActionController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyRejectionToAssignee(int issueID, string comments) {
|
public void NotifyRejectionToAssignee(int issueID, string comments) {
|
||||||
|
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
|
||||||
List<string> emailIst = caDMO.GetRejectionAssigneeEmailList(@issueID).Distinct().ToList();
|
List<string> emailIst = caDMO.GetRejectionAssigneeEmailList(@issueID).Distinct().ToList();
|
||||||
|
string userEmail = CorrectiveActionHelper.NotifyRejectionToAssignee(_AppSettings, issueID, comments, username, emailIst);
|
||||||
string emailTemplate = "CorrectiveActionReject.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Corrective Action Rejection";
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
subject = "Corrective Action Rejection";
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[5];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = Session[GlobalVars.SESSION_USERNAME].ToString();
|
|
||||||
emailparams[4] = comments;
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Rejection: " + userEmail });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Rejection: " + userEmail });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -666,12 +590,6 @@ public class CorrectiveActionController : Controller {
|
|||||||
|
|
||||||
bool lastApprover = wfDMO.Approve(_AppSettings, issueID, currentStep, comments, out lastStep, (int)Session[GlobalVars.SESSION_USERID], (int)GlobalVars.DocumentType.CorrectiveAction, ca.WorkFlowNumber);
|
bool lastApprover = wfDMO.Approve(_AppSettings, issueID, currentStep, comments, out lastStep, (int)Session[GlobalVars.SESSION_USERID], (int)GlobalVars.DocumentType.CorrectiveAction, ca.WorkFlowNumber);
|
||||||
|
|
||||||
//while (lastApprover && !lastStep)
|
|
||||||
//{
|
|
||||||
// currentStep++;
|
|
||||||
// //lastApprover = wfDMO.Approve(issueID, currentStep, comments, out lastStep, (int)Session[GlobalVars.SESSION_USERID], (int)GlobalVars.DocumentType.CorrectiveAction, ca.WorkFlowNumber);
|
|
||||||
// NotifyApprovers(issueID, currentStep);
|
|
||||||
//}
|
|
||||||
if (lastApprover && !lastStep) {
|
if (lastApprover && !lastStep) {
|
||||||
// Set to complete
|
// Set to complete
|
||||||
DateTime followUpDate = caDMO.SetCAComplete(issueID);
|
DateTime followUpDate = caDMO.SetCAComplete(issueID);
|
||||||
@ -701,25 +619,7 @@ public class CorrectiveActionController : Controller {
|
|||||||
public void NotifySectionApprover(int issueID, int userId, string section) {
|
public void NotifySectionApprover(int issueID, int userId, string section) {
|
||||||
try {
|
try {
|
||||||
string userEmail = userDMO.GetUserEmailByID(userId);
|
string userEmail = userDMO.GetUserEmailByID(userId);
|
||||||
|
CorrectiveActionHelper.NotifySectionApprover(_AppSettings, issueID, section, userEmail);
|
||||||
string emailTemplate = "CorrectiveActionSectionAssignee.txt";
|
|
||||||
//string userEmail = string.Empty;
|
|
||||||
string subject = "Corrective Action Assignment";
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
subject = "Corrective Action Assignment - Section Approval";
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = section;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -736,34 +636,11 @@ public class CorrectiveActionController : Controller {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyApprovers(int issueID, byte currentStep) {
|
public void NotifyApprovers(int issueID, byte currentStep) {
|
||||||
try {
|
try {
|
||||||
string emailSentList = "";
|
|
||||||
|
|
||||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
|
||||||
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@issueID, currentStep, (int)GlobalVars.DocumentType.CorrectiveAction).Distinct().ToList();
|
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@issueID, currentStep, (int)GlobalVars.DocumentType.CorrectiveAction).Distinct().ToList();
|
||||||
|
string emailSentList = CorrectiveActionHelper.NotifyApprovers(_AppSettings, issueID, emailIst);
|
||||||
string emailTemplate = "CorrectiveActionAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Corrective Action Assignment";
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
subject = "Corrective Action Assignment - Final Approval";
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[3];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
emailSentList += email + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -780,6 +657,7 @@ public class CorrectiveActionController : Controller {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Additional Approvers
|
#region Additional Approvers
|
||||||
|
|
||||||
public void AddAdditionalApproval(int issueID, byte step, string userIDs) {
|
public void AddAdditionalApproval(int issueID, byte step, string userIDs) {
|
||||||
@ -799,33 +677,7 @@ public class CorrectiveActionController : Controller {
|
|||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "AddAdditionalApproval - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "AddAdditionalApproval - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
emailSentList = CorrectiveActionHelper.AddAdditionalApproval(_AppSettings, issueID, emailSentList, emailArray);
|
||||||
string emailTemplate = "CorrectiveActionAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Corrective Action Assignment - Final Approval";
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
string[] emailIst = emailArray.Split(new char[] { '~' });
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
if (email.Length > 0) {
|
|
||||||
//subject = "Lot Disposition Assignment" + " - Email would be sent to " + email;
|
|
||||||
subject = "Corrective Action Assignment";
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[3];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
emailSentList += email + ",";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Additonal Approver: " + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Additonal Approver: " + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -834,38 +686,17 @@ public class CorrectiveActionController : Controller {
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public ActionResult GetApproversList([DataSourceRequest] DataSourceRequest request, int issueID, byte step) {
|
public ActionResult GetApproversList([DataSourceRequest] DataSourceRequest request, int issueID, byte step) {
|
||||||
//return Json(ldDMO.GetApproversList(issueID, step).ToDataSourceResult(request));
|
|
||||||
return Json(MiscDMO.GetApproversListByDocument(issueID, step, (int)GlobalVars.DocumentType.CorrectiveAction).ToDataSourceResult(request));
|
return Json(MiscDMO.GetApproversListByDocument(issueID, step, (int)GlobalVars.DocumentType.CorrectiveAction).ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetSectionApprovalLog([DataSourceRequest] DataSourceRequest request, int caNo) {
|
public ActionResult GetSectionApprovalLog([DataSourceRequest] DataSourceRequest request, int caNo) {
|
||||||
//return Json(ldDMO.GetApproversList(issueID, step).ToDataSourceResult(request));
|
|
||||||
return Json(caDMO.GetCASectionApprovalLog(caNo).ToDataSourceResult(request));
|
return Json(caDMO.GetCASectionApprovalLog(caNo).ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyRequestor(int issueID, DateTime? dueDate, int? responsibleOwnerID, string template) {
|
public void NotifyRequestor(int issueID, DateTime? dueDate, int? responsibleOwnerID, string template) {
|
||||||
try {
|
try {
|
||||||
string emailSentList = "";
|
|
||||||
|
|
||||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
|
||||||
string email = MiscDMO.GetEmail(responsibleOwnerID);
|
string email = MiscDMO.GetEmail(responsibleOwnerID);
|
||||||
|
CorrectiveActionHelper.NotifyRequestor(_AppSettings, issueID, dueDate, template, email);
|
||||||
string emailTemplate = template;
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Corrective Action Assignment - " + Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[5];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = dueDate.ToString();
|
|
||||||
emailparams[2] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.CorrectiveAction);
|
|
||||||
emailparams[3] = GlobalVars.hostURL;
|
|
||||||
emailparams[4] = issueID.ToString();
|
|
||||||
//userEmail = email;
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
|
|
||||||
emailSentList += email + ",";
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 8D Item" + ":" + email });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 8D Item" + ":" + email });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -880,37 +711,13 @@ public class CorrectiveActionController : Controller {
|
|||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " 8D Action Item:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " 8D Action Item:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n 8D Action Item - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n 8D Action Item - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "8D Action Item Notification - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "8D Action Item Notification - " + exceptionString });
|
||||||
//throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyAssignee(int issueID, int? responsibleOwnerID, string template, DateTime? D3DueDate, DateTime? D5D7DueDate) {
|
public void NotifyAssignee(int issueID, int? responsibleOwnerID, string template, DateTime? D3DueDate, DateTime? D5D7DueDate) {
|
||||||
try {
|
try {
|
||||||
string emailSentList = "";
|
|
||||||
|
|
||||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
|
||||||
string email = MiscDMO.GetEmail(responsibleOwnerID);
|
string email = MiscDMO.GetEmail(responsibleOwnerID);
|
||||||
|
CorrectiveActionHelper.NotifyAssignee(_AppSettings, issueID, template, D3DueDate, D5D7DueDate, email);
|
||||||
string emailTemplate = template;
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "CAR Assigned - " + Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
string D3DueDateString = D3DueDate != null ? D3DueDate.ToString() : "N/A";
|
|
||||||
string D5D7DueDateString = D5D7DueDate != null ? D5D7DueDate.ToString() : "N/A";
|
|
||||||
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[6];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.CorrectiveAction);
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = issueID.ToString();
|
|
||||||
emailparams[4] = D3DueDateString;
|
|
||||||
emailparams[5] = D5D7DueDateString;
|
|
||||||
//userEmail = email;
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
|
|
||||||
emailSentList += email + ",";
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 8D Item" + ":" + email });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 8D Item" + ":" + email });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -925,34 +732,12 @@ public class CorrectiveActionController : Controller {
|
|||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " 8D Action Item:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " 8D Action Item:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n 8D Action Item - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n 8D Action Item - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "8D Action Item Notification - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "8D Action Item Notification - " + exceptionString });
|
||||||
//throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyActionItemOwner(int issueID, DateTime? dueDate, int? responsibleOwnerID, string template) {
|
public void NotifyActionItemOwner(int issueID, DateTime? dueDate, int? responsibleOwnerID, string template) {
|
||||||
try {
|
try {
|
||||||
string emailSentList = "";
|
string email = CorrectiveActionHelper.NotifyActionItemOwner(_AppSettings, issueID, dueDate, responsibleOwnerID, template);
|
||||||
|
|
||||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
|
||||||
string email = MiscDMO.GetEmail(responsibleOwnerID);
|
|
||||||
|
|
||||||
string emailTemplate = template;
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Action Item in " + Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[5];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = dueDate.ToString();
|
|
||||||
emailparams[2] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.CorrectiveAction);
|
|
||||||
emailparams[3] = GlobalVars.hostURL;
|
|
||||||
emailparams[4] = issueID.ToString();
|
|
||||||
//userEmail = email;
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
|
|
||||||
emailSentList += email + ",";
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 8D Item" + ":" + email });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 8D Item" + ":" + email });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -967,33 +752,12 @@ public class CorrectiveActionController : Controller {
|
|||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " 8D Action Item:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " 8D Action Item:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n 8D Action Item - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n 8D Action Item - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "8D Action Item Notification - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "8D Action Item Notification - " + exceptionString });
|
||||||
//throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyActionItemCompletion(int issueID, DateTime? dueDate, int? recipientId, string template) {
|
public void NotifyActionItemCompletion(int issueID, DateTime? dueDate, int? recipientId, string template) {
|
||||||
try {
|
try {
|
||||||
string emailSentList = "";
|
string email = CorrectiveActionHelper.NotifyActionItemCompletion(_AppSettings, issueID, dueDate, recipientId, template);
|
||||||
|
|
||||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
|
||||||
string email = MiscDMO.GetEmail(recipientId);
|
|
||||||
|
|
||||||
string emailTemplate = template;
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "8D Action Item Completion - " + Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[5];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = dueDate.ToString();
|
|
||||||
emailparams[2] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.CorrectiveAction);
|
|
||||||
emailparams[3] = GlobalVars.hostURL;
|
|
||||||
emailparams[4] = issueID.ToString();
|
|
||||||
//userEmail = email;
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
|
|
||||||
emailSentList += email + ",";
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 8D Item" + ":" + email });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 8D Item" + ":" + email });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -1008,34 +772,12 @@ public class CorrectiveActionController : Controller {
|
|||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " 8D Action Item:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " 8D Action Item:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n 8D Action Item - NotifyActionItemCompletion\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n 8D Action Item - NotifyActionItemCompletion\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "8D Action Item Notification - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "8D Action Item Notification - " + exceptionString });
|
||||||
//throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyClosureOf8D(int issueID) {
|
public void NotifyClosureOf8D(int issueID) {
|
||||||
try {
|
try {
|
||||||
string emailSentList = "";
|
string emailSentList = CorrectiveActionHelper.NotifyClosureOf8D(_AppSettings, issueID);
|
||||||
|
|
||||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
|
||||||
List<string> emailIst = MiscDMO.Get8DEmailListForClosureNotification(issueID);
|
|
||||||
|
|
||||||
string emailTemplate = "CorrectiveActionClosed.txt";
|
|
||||||
//string userEmail = string.Empty;
|
|
||||||
string subject = "Corrective Action Follow Up Closure - " + Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[3];
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = GlobalVars.hostURL;
|
|
||||||
emailparams[2] = issueID.ToString();
|
|
||||||
//userEmail = email;
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
|
|
||||||
emailSentList += email + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Closure of 8D Item" + ":" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Closure of 8D Item" + ":" + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -1050,34 +792,12 @@ public class CorrectiveActionController : Controller {
|
|||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " Closure of 8D:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " Closure of 8D:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n Closure of 8D - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n Closure of 8D - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "Closure of 8D Notification - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "Closure of 8D Notification - " + exceptionString });
|
||||||
//throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyCompletionOf8D(int issueID, DateTime? followUpDate) {
|
public void NotifyCompletionOf8D(int issueID, DateTime? followUpDate) {
|
||||||
try {
|
try {
|
||||||
string emailSentList = "";
|
string emailSentList = CorrectiveActionHelper.NotifyCompletionOf8D(_AppSettings, issueID, followUpDate);
|
||||||
|
|
||||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
|
||||||
List<string> emailIst = MiscDMO.Get8DEmailListForClosureNotification(issueID);
|
|
||||||
|
|
||||||
string emailTemplate = "CorrectiveActionCompleted.txt";
|
|
||||||
//string userEmail = string.Empty;
|
|
||||||
string subject = "Corrective Action Completion - " + Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = GlobalVars.hostURL;
|
|
||||||
emailparams[2] = issueID.ToString();
|
|
||||||
emailparams[3] = followUpDate.ToString();
|
|
||||||
//userEmail = email;
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
|
|
||||||
emailSentList += email + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Closure of 8D Item" + ":" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Closure of 8D Item" + ":" + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -1092,16 +812,15 @@ public class CorrectiveActionController : Controller {
|
|||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " Closure of 8D:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " Closure of 8D:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n Closure of 8D - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n Closure of 8D - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "Closure of 8D Notification - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "Closure of 8D Notification - " + exceptionString });
|
||||||
//throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartSectionApproval(int issueID, string dSection) {
|
public void StartSectionApproval(int issueID, string dSection) {
|
||||||
try {
|
try {
|
||||||
CorrectiveAction ca = caDMO.GetCAItem(issueID, (int)Session[GlobalVars.SESSION_USERID]);
|
CorrectiveAction ca = caDMO.GetCAItem(issueID, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
|
|
||||||
int requestorId = ca.RequestorID;
|
int requestorId = ca.RequestorID;
|
||||||
int qaId = ca.QAID;
|
int qaId = ca.QAID;
|
||||||
//int userID = (int)Session[GlobalVars.SESSION_USERID];
|
|
||||||
|
|
||||||
caDMO.StartSectionApproval(issueID, requestorId, dSection);
|
caDMO.StartSectionApproval(issueID, requestorId, dSection);
|
||||||
NotifySectionApprover(issueID, requestorId, dSection);
|
NotifySectionApprover(issueID, requestorId, dSection);
|
||||||
@ -1160,7 +879,6 @@ public class CorrectiveActionController : Controller {
|
|||||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n " + "Approve\r\n" + issueID.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n " + "Approve\r\n" + issueID.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "Approve - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "Approve - " + exceptionString });
|
||||||
return Content(e.Message);
|
return Content(e.Message);
|
||||||
//return Content(ex.Message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@ -1195,30 +913,8 @@ public class CorrectiveActionController : Controller {
|
|||||||
public void NotifySectionRejection(int issueID, int recipientUserId, int loggedInUserId, string section, string comment) {
|
public void NotifySectionRejection(int issueID, int recipientUserId, int loggedInUserId, string section, string comment) {
|
||||||
try {
|
try {
|
||||||
LoginModel recipient = userDMO.GetUserByID(recipientUserId);
|
LoginModel recipient = userDMO.GetUserByID(recipientUserId);
|
||||||
string recipientEmail = recipient.Email;
|
|
||||||
|
|
||||||
LoginModel loggedInUser = userDMO.GetUserByID(loggedInUserId);
|
LoginModel loggedInUser = userDMO.GetUserByID(loggedInUserId);
|
||||||
|
CorrectiveActionHelper.NotifySectionRejection(_AppSettings, issueID, section, comment, recipient, loggedInUser);
|
||||||
string emailTemplate = "CorrectiveActionSectionRejection.txt";
|
|
||||||
//string userEmail = string.Empty;
|
|
||||||
string subject = "Corrective Action Rejection - " + Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
//subject = "Corrective Action Assignment";
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[6];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = section;
|
|
||||||
emailparams[4] = loggedInUser.FirstName + " " + loggedInUser.LastName;
|
|
||||||
emailparams[5] = comment;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, recipientEmail, null, subject, emailparams);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -1235,28 +931,11 @@ public class CorrectiveActionController : Controller {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyForD5D6D7Validation(int issueID, int userId, string dSection) {
|
public void NotifyForD5D6D7Validation(int issueID, int userId, string dSection) {
|
||||||
try {
|
try {
|
||||||
string userEmail = userDMO.GetUserEmailByID(userId);
|
string userEmail = userDMO.GetUserEmailByID(userId);
|
||||||
|
CorrectiveActionHelper.NotifyForD5D6D7Validation(_AppSettings, issueID, dSection, userEmail);
|
||||||
string emailTemplate = "CorrectiveActionSectionApproved.txt";
|
|
||||||
//string userEmail = string.Empty;
|
|
||||||
string subject = "Corrective Action Section Approval - " + Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
//subject = "Corrective Action Assignment";
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = dSection;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -1277,25 +956,7 @@ public class CorrectiveActionController : Controller {
|
|||||||
public void NotifyUsersDSectionApproved(int issueID, int userId, string dSection) {
|
public void NotifyUsersDSectionApproved(int issueID, int userId, string dSection) {
|
||||||
try {
|
try {
|
||||||
string userEmail = userDMO.GetUserEmailByID(userId);
|
string userEmail = userDMO.GetUserEmailByID(userId);
|
||||||
|
CorrectiveActionHelper.NotifyUsersDSectionApproved(_AppSettings, issueID, dSection, userEmail);
|
||||||
string emailTemplate = "CorrectiveActionSectionApproved.txt";
|
|
||||||
//string userEmail = string.Empty;
|
|
||||||
string subject = "Corrective Action Section Approval - " + Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
|
|
||||||
//subject = "Corrective Action Assignment";
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = dSection;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -1312,6 +973,7 @@ public class CorrectiveActionController : Controller {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime SetD3DueDate(int caNo) {
|
public DateTime SetD3DueDate(int caNo) {
|
||||||
DateTime d3DueDate = caDMO.SetCAD3DueDate(caNo);
|
DateTime d3DueDate = caDMO.SetCAD3DueDate(caNo);
|
||||||
|
|
||||||
@ -1331,30 +993,7 @@ public class CorrectiveActionController : Controller {
|
|||||||
LoginModel user = userDMO.GetUserByID(assigneeID);
|
LoginModel user = userDMO.GetUserByID(assigneeID);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
string emailTemplate = "D3D5D7Due.txt";
|
CorrectiveActionHelper.ProcessCARDueDates(_AppSettings, dueCA, ca, user);
|
||||||
//string userEmail = string.Empty;
|
|
||||||
string subject = "Corrective Action " + dueCA.ItemDue + " " + dueCA.ExpiryType + " - " + Functions.ReturnCANoStringFormat(dueCA.CANo);
|
|
||||||
string senderName = "CorrectiveAction";
|
|
||||||
string[] emailparams = new string[7];
|
|
||||||
emailparams[0] = Functions.ReturnCANoStringFormat(dueCA.CANo);
|
|
||||||
emailparams[1] = dueCA.CANo.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = dueCA.ExpiryType;
|
|
||||||
emailparams[4] = dueCA.ItemDue;
|
|
||||||
if (ca.D3DueDate != null) {
|
|
||||||
emailparams[5] = ca.D3DueDate.ToString();
|
|
||||||
} else {
|
|
||||||
emailparams[5] = "N/A";
|
|
||||||
}
|
|
||||||
if (ca.D5D7DueDate != null) {
|
|
||||||
emailparams[6] = ca.D5D7DueDate.ToString();
|
|
||||||
} else {
|
|
||||||
emailparams[6] = "N/A";
|
|
||||||
}
|
|
||||||
|
|
||||||
//subject = "Corrective Action Assignment";
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, user.Email, "jonathan.ouellette@infineon.com", subject, emailparams);
|
|
||||||
caDMO.SetD3D5D7NotificationDate(dueCA.CANo, dueCA.ItemDue);
|
caDMO.SetD3D5D7NotificationDate(dueCA.CANo, dueCA.ItemDue);
|
||||||
isSuccess = true;
|
isSuccess = true;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -21,23 +21,16 @@ namespace Fab2ApprovalSystem.Controllers;
|
|||||||
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
||||||
public class HomeController : Controller {
|
public class HomeController : Controller {
|
||||||
|
|
||||||
MRB_DMO mrbDMO;
|
MRB_DMO mrbDMO = new MRB_DMO(GlobalVars.AppSettings);
|
||||||
PartsRequestDMO prDMO;
|
PartsRequestDMO prDMO = new PartsRequestDMO();
|
||||||
LotDispositionDMO ldDMO;
|
LotDispositionDMO ldDMO = new LotDispositionDMO();
|
||||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||||
ECN_DMO ecnDMO = new ECN_DMO();
|
ECN_DMO ecnDMO = new ECN_DMO();
|
||||||
UserUtilities userDMO = new UserUtilities();
|
UserUtilities userDMO = new UserUtilities();
|
||||||
UserAccountDMO originalUserDMO = new UserAccountDMO();
|
UserAccountDMO originalUserDMO = new UserAccountDMO();
|
||||||
TrainingDMO trainingDMO = new TrainingDMO();
|
TrainingDMO trainingDMO = new TrainingDMO();
|
||||||
MiscDMO miscDMO = new MiscDMO();
|
MiscDMO miscDMO = new MiscDMO();
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||||
|
|
||||||
public HomeController(AppSettings appSettings) {
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
ldDMO = new LotDispositionDMO(appSettings);
|
|
||||||
mrbDMO = new MRB_DMO(appSettings);
|
|
||||||
prDMO = new PartsRequestDMO(appSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActionResult Index(string tabName) {
|
public ActionResult Index(string tabName) {
|
||||||
ViewBag.ActiveTabName = tabName;
|
ViewBag.ActiveTabName = tabName;
|
||||||
@ -113,7 +106,6 @@ public class HomeController : Controller {
|
|||||||
|
|
||||||
public ActionResult GetDocuments([DataSourceRequest] DataSourceRequest request, string tabName) {
|
public ActionResult GetDocuments([DataSourceRequest] DataSourceRequest request, string tabName) {
|
||||||
ViewBag.ActiveTabName = tabName;
|
ViewBag.ActiveTabName = tabName;
|
||||||
//IEnumerable<IssuesViewModel> data = ldDMO.GetLotDispositions();
|
|
||||||
IEnumerable<IssuesViewModel> data = ldDMO.GetDocuments();
|
IEnumerable<IssuesViewModel> data = ldDMO.GetDocuments();
|
||||||
return Json(data.ToDataSourceResult(request));
|
return Json(data.ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
@ -198,7 +190,7 @@ public class HomeController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetLotList([DataSourceRequest] DataSourceRequest request, int workRequestID) {
|
public ActionResult GetLotList([DataSourceRequest] DataSourceRequest request, int workRequestID) {
|
||||||
LotTravelerDMO LotTravDMO = new LotTravelerDMO(_AppSettings);
|
LotTravelerDMO LotTravDMO = new LotTravelerDMO();
|
||||||
return Json(LotTravDMO.GetLotListBasedOnSWRNumber(workRequestID).ToDataSourceResult(request));
|
return Json(LotTravDMO.GetLotListBasedOnSWRNumber(workRequestID).ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,24 +293,7 @@ public class HomeController : Controller {
|
|||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = " + ecnTypeString + ", OperationType = "Error", Comments = "DelegateApproval - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = " + ecnTypeString + ", OperationType = "Error", Comments = "DelegateApproval - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
HomeHelper.DelegateDocumentApproval(_AppSettings, issueID, ecnTypeString, title, email);
|
||||||
string emailTemplate = "DelegateApproval.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject;
|
|
||||||
string senderName = ecnTypeString;
|
|
||||||
|
|
||||||
subject = ecnTypeString + " Delegation" + " - Email would be sent to " + email + " for Number " + issueID + ", - " + title;
|
|
||||||
;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = issueID.ToString();
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = ecnTypeString;
|
|
||||||
|
|
||||||
userEmail = email;
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Delegated to Approver: " + email });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Delegated to Approver: " + email });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -398,31 +373,11 @@ public class HomeController : Controller {
|
|||||||
List<string> emailList = new List<string>();
|
List<string> emailList = new List<string>();
|
||||||
emailList.Add(delegateFrom.Email);
|
emailList.Add(delegateFrom.Email);
|
||||||
emailList.Add(delegateTo.Email);
|
emailList.Add(delegateTo.Email);
|
||||||
|
HomeHelper.NotifyDelegation(_AppSettings, startDate, endDate, delegateFrom, delegateTo, emailList);
|
||||||
string emailTemplate = "DelegationOn.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Mesa Approval Delegation Notification";
|
|
||||||
string senderName = "Mesa Approval";
|
|
||||||
|
|
||||||
foreach (string email in emailList) {
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[5];
|
|
||||||
emailparams[0] = delegateFrom.FullName;
|
|
||||||
emailparams[1] = delegateTo.FullName;
|
|
||||||
emailparams[2] = startDate.ToString("yyyy-MM-dd");
|
|
||||||
emailparams[3] = endDate.ToString("yyyy-MM-dd");
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = GlobalVars.SENDER_EMAIL;
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Rejection: " + userEmail });
|
|
||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ProcessOoO() {
|
public bool ProcessOoO() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -464,45 +419,12 @@ public class HomeController : Controller {
|
|||||||
}
|
}
|
||||||
public void NotifyApprover(string toEmail, string title, int issueId, string docType) {
|
public void NotifyApprover(string toEmail, string title, int issueId, string docType) {
|
||||||
try {
|
try {
|
||||||
string emailSentList = "";
|
HomeHelper.NotifyApprover(_AppSettings, toEmail, title, issueId, docType);
|
||||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
|
||||||
//List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@ecnNumber, currentStep, documentType).Distinct().ToList();
|
|
||||||
//string ecnCreatedByEmail = MiscDMO.GetEmail(ecnCreatedById);
|
|
||||||
|
|
||||||
string emailTemplate = "ApprovalReminders.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = string.Empty;
|
|
||||||
string senderName = docType;
|
|
||||||
|
|
||||||
subject = docType + " Approval Reminder: " + title;
|
|
||||||
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = docType;
|
|
||||||
emailparams[1] = title;
|
|
||||||
emailparams[2] = issueId.ToString();
|
|
||||||
userEmail = toEmail;
|
|
||||||
|
|
||||||
//#if(DEBUG)
|
|
||||||
//string SenderEmail = "MesaFabApproval@infineon.com";
|
|
||||||
//userEmail = "jonathan.ouellette@infineon.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, "jonathan.ouellette@infineon.com", subject, emailparams);
|
|
||||||
//en.SendNotificationEmail(emailTemplate, SenderEmail, senderName, userEmail, null, subject, emailparams);
|
|
||||||
//emailSentList = ecnCreatedByEmail;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueId, UserID = @User.Identity.Name, DocumentType = docType, OperationType = "Email", Comments = "Approval reminders" });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueId, UserID = @User.Identity.Name, DocumentType = docType, OperationType = "Email", Comments = "Approval reminders" });
|
||||||
} catch { }
|
} catch { }
|
||||||
|
|
||||||
//EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
//string[] emailparams = new string[4];
|
|
||||||
//emailparams[0] = issueID.ToString();
|
|
||||||
//emailparams[1] = issueID.ToString();
|
|
||||||
//emailparams[2] = GlobalVars.hostURL;
|
|
||||||
//emailparams[3] =Session[GlobalVars.SESSION_USERNAME].ToString();
|
|
||||||
//en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, emailparams);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
string detailedException = "";
|
string detailedException = "";
|
||||||
try {
|
try {
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
using Fab2ApprovalSystem.DMO;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
@ -6,17 +16,6 @@ using Fab2ApprovalSystem.ViewModels;
|
|||||||
using Kendo.Mvc.Extensions;
|
using Kendo.Mvc.Extensions;
|
||||||
using Kendo.Mvc.UI;
|
using Kendo.Mvc.UI;
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Web;
|
|
||||||
using System.Web.Mvc;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers;
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
@ -24,19 +23,12 @@ namespace Fab2ApprovalSystem.Controllers;
|
|||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class LotDispositionController : Controller {
|
public class LotDispositionController : Controller {
|
||||||
|
|
||||||
LotDispositionDMO ldDMO;
|
LotDispositionDMO ldDMO = new LotDispositionDMO();
|
||||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||||
|
|
||||||
public LotDispositionController(AppSettings appSettings) {
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
ldDMO = new LotDispositionDMO(appSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: /LotDisposition/Create
|
// GET: /LotDisposition/Create
|
||||||
public ActionResult Create() {
|
public ActionResult Create() {
|
||||||
//excel.FileName = "";
|
|
||||||
//var lot =
|
|
||||||
LotDisposition lotDispo = new LotDisposition();
|
LotDisposition lotDispo = new LotDisposition();
|
||||||
try {
|
try {
|
||||||
// insert a records to get the issueID
|
// insert a records to get the issueID
|
||||||
@ -67,14 +59,6 @@ public class LotDispositionController : Controller {
|
|||||||
lot.LotStatusOption.LotStatusOptionID = l.LotStatusOptionID;
|
lot.LotStatusOption.LotStatusOptionID = l.LotStatusOptionID;
|
||||||
lot.LotStatusOption.LotStatusOption = l.LotStatusOptionName;
|
lot.LotStatusOption.LotStatusOption = l.LotStatusOptionName;
|
||||||
ldDMO.InsertLot(lot, false);
|
ldDMO.InsertLot(lot, false);
|
||||||
|
|
||||||
//if (!mrbDMO.DoesMRBLotExist(lot.LotNumber))
|
|
||||||
//{
|
|
||||||
//get All the MRBs associated to the Parent lot
|
|
||||||
//insert the lot into the MRBChildLotNotInMRB table and NOT in the MRB Lot table for each MRB
|
|
||||||
//ldDMO.InsertChildLot_NotInTheMRB(lot.LotNumber);
|
|
||||||
|
|
||||||
//}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
string detailedException = "";
|
string detailedException = "";
|
||||||
try {
|
try {
|
||||||
@ -110,23 +94,6 @@ public class LotDispositionController : Controller {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//foreach (string lotNumber in tempLots)
|
|
||||||
//{
|
|
||||||
//===================================================================
|
|
||||||
// ONLY DO THIS PART IF THE LOT DOES NOT EXIST IN THE
|
|
||||||
//"MRBLot" TABLE AND THE "MRBChildLotNotInMRB" TABLE
|
|
||||||
//===================================================================
|
|
||||||
|
|
||||||
//if (!mrbDMO.DoesMRBLotExist(lotNumber))
|
|
||||||
//{
|
|
||||||
// //get All the MRBs associated to the Parent lot
|
|
||||||
// //insert the lot into the MRBChildLotNotInMRB table and NOT in the MRB Lot table for each MRB
|
|
||||||
// ldDMO.InsertChildLot_NotInTheMRB(lotNumber);
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -145,7 +112,6 @@ public class LotDispositionController : Controller {
|
|||||||
return Json(issueWEL, JsonRequestBehavior.AllowGet);
|
return Json(issueWEL, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /LotDisposition/Edit/5
|
// GET: /LotDisposition/Edit/5
|
||||||
public ActionResult Edit(int issueID) {
|
public ActionResult Edit(int issueID) {
|
||||||
int isITARCompliant = 1;
|
int isITARCompliant = 1;
|
||||||
@ -162,7 +128,6 @@ public class LotDispositionController : Controller {
|
|||||||
}
|
}
|
||||||
if (lotDispo.CurrentStep == 1) {
|
if (lotDispo.CurrentStep == 1) {
|
||||||
List<ApproversListViewModel> userList = MiscDMO.GetPendingApproversListByDocument(issueID, lotDispo.CurrentStep, (int)GlobalVars.DocumentType.LotDisposition);
|
List<ApproversListViewModel> userList = MiscDMO.GetPendingApproversListByDocument(issueID, lotDispo.CurrentStep, (int)GlobalVars.DocumentType.LotDisposition);
|
||||||
//ApproversListViewModel approver = userList.Find(delegate(ApproversListViewModel al) { return al.UserID == GlobalVars.USER_ID; });
|
|
||||||
ApproversListViewModel approver = userList.Find(delegate (ApproversListViewModel al) { return al.UserID == (int)Session[GlobalVars.SESSION_USERID]; });
|
ApproversListViewModel approver = userList.Find(delegate (ApproversListViewModel al) { return al.UserID == (int)Session[GlobalVars.SESSION_USERID]; });
|
||||||
if (approver == null)
|
if (approver == null)
|
||||||
ViewBag.IsApprover = "false";
|
ViewBag.IsApprover = "false";
|
||||||
@ -170,7 +135,6 @@ public class LotDispositionController : Controller {
|
|||||||
ViewBag.IsApprover = "true";
|
ViewBag.IsApprover = "true";
|
||||||
|
|
||||||
if (approver == null && (!(bool)Session[GlobalVars.IS_ADMIN]) && (int)Session[GlobalVars.SESSION_USERID] != lotDispo.OriginatorID) {
|
if (approver == null && (!(bool)Session[GlobalVars.IS_ADMIN]) && (int)Session[GlobalVars.SESSION_USERID] != lotDispo.OriginatorID) {
|
||||||
//return RedirectToAction("ReadOnly", lotDispo);
|
|
||||||
return RedirectToAction("ReadOnly", new { issueID = issueID });
|
return RedirectToAction("ReadOnly", new { issueID = issueID });
|
||||||
} else {
|
} else {
|
||||||
if ((ViewBag.IsApprover == "true" || (bool)Session[GlobalVars.IS_ADMIN])
|
if ((ViewBag.IsApprover == "true" || (bool)Session[GlobalVars.IS_ADMIN])
|
||||||
@ -194,7 +158,7 @@ public class LotDispositionController : Controller {
|
|||||||
}
|
}
|
||||||
} else if (lotDispo.CurrentStep > 1) {
|
} else if (lotDispo.CurrentStep > 1) {
|
||||||
List<ApproversListViewModel> userList = MiscDMO.GetPendingApproversListByDocument(issueID, lotDispo.CurrentStep, (int)GlobalVars.DocumentType.LotDisposition);
|
List<ApproversListViewModel> userList = MiscDMO.GetPendingApproversListByDocument(issueID, lotDispo.CurrentStep, (int)GlobalVars.DocumentType.LotDisposition);
|
||||||
//ApproversListViewModel approver = userList.Find(delegate(ApproversListViewModel al) { return al.UserID == GlobalVars.USER_ID; });
|
|
||||||
ApproversListViewModel approver = userList.Find(delegate (ApproversListViewModel al) { return al.UserID == (int)Session[GlobalVars.SESSION_USERID]; });
|
ApproversListViewModel approver = userList.Find(delegate (ApproversListViewModel al) { return al.UserID == (int)Session[GlobalVars.SESSION_USERID]; });
|
||||||
if (approver == null) {
|
if (approver == null) {
|
||||||
ViewBag.IsApprover = "false";
|
ViewBag.IsApprover = "false";
|
||||||
@ -208,14 +172,6 @@ public class LotDispositionController : Controller {
|
|||||||
return RedirectToAction("ReadOnly", new { issueID = issueID });
|
return RedirectToAction("ReadOnly", new { issueID = issueID });
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//// Check the record Lock indicator
|
|
||||||
//if ((lotDispo.RecordLockIndicator && lotDispo.RecordLockedBy != (int)Session[GlobalVars.SESSION_USERID]) || (ViewBag.IsApprover == "false"))
|
|
||||||
//{
|
|
||||||
// return RedirectToAction("ReadOnly", new { issueID = issueID });
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
// return RedirectToAction("EditStep", new { issueID = issueID });
|
|
||||||
|
|
||||||
if ((ViewBag.IsApprover == "true" || (bool)Session[GlobalVars.IS_ADMIN])
|
if ((ViewBag.IsApprover == "true" || (bool)Session[GlobalVars.IS_ADMIN])
|
||||||
|| (int)Session[GlobalVars.SESSION_USERID] == lotDispo.OriginatorID) {
|
|| (int)Session[GlobalVars.SESSION_USERID] == lotDispo.OriginatorID) {
|
||||||
return RedirectToAction("EditStep", new { issueID = issueID });
|
return RedirectToAction("EditStep", new { issueID = issueID });
|
||||||
@ -257,7 +213,6 @@ public class LotDispositionController : Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /LotDisposition/Edit/5
|
// POST: /LotDisposition/Edit/5
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@ -320,19 +275,6 @@ public class LotDispositionController : Controller {
|
|||||||
|
|
||||||
// Check the recordlock indicator
|
// Check the recordlock indicator
|
||||||
|
|
||||||
//if ((lotDispo.RecordLockIndicator && lotDispo.RecordLockedBy != (int)Session[GlobalVars.SESSION_USERID]))
|
|
||||||
//{
|
|
||||||
// return RedirectToAction("ReadOnly", new { issueID = issueID });
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// PopulateLotStatusOptions();
|
|
||||||
// ViewBag.OriginatorList = ldDMO.GetUserList();
|
|
||||||
// ViewBag.deps = ldDMO.GetDepartments();
|
|
||||||
// ViewBag.ResponsibilityList = ldDMO.GetResponsibilityList();
|
|
||||||
// ViewBag.ResponsibilityIssueList = ldDMO.GetResponsibilityIssueList(lotDispo.ResponsibilityID);
|
|
||||||
//}
|
|
||||||
|
|
||||||
if ((ViewBag.IsApprover == "true" || (bool)Session[GlobalVars.IS_ADMIN])) {
|
if ((ViewBag.IsApprover == "true" || (bool)Session[GlobalVars.IS_ADMIN])) {
|
||||||
lotDispo = ldDMO.GetLotDispositionItem(issueID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
lotDispo = ldDMO.GetLotDispositionItem(issueID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
|
|
||||||
@ -351,7 +293,6 @@ public class LotDispositionController : Controller {
|
|||||||
return RedirectToAction("ReadOnly", new { issueID = issueID });
|
return RedirectToAction("ReadOnly", new { issueID = issueID });
|
||||||
}
|
}
|
||||||
|
|
||||||
//return View(lotDispo);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
string detailedException = "";
|
string detailedException = "";
|
||||||
try {
|
try {
|
||||||
@ -366,7 +307,6 @@ public class LotDispositionController : Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /LotDisposition/Delete/5
|
// GET: /LotDisposition/Delete/5
|
||||||
public ActionResult Delete(int id) {
|
public ActionResult Delete(int id) {
|
||||||
return View();
|
return View();
|
||||||
@ -387,7 +327,6 @@ public class LotDispositionController : Controller {
|
|||||||
public void PopulateLotStatusOptions() {
|
public void PopulateLotStatusOptions() {
|
||||||
var lotStatusOptions = ldDMO.GetLotStatusOptions();
|
var lotStatusOptions = ldDMO.GetLotStatusOptions();
|
||||||
ViewData["LotStatusOptions"] = lotStatusOptions;
|
ViewData["LotStatusOptions"] = lotStatusOptions;
|
||||||
//ViewData["DefaultLotStatusOptions"] = lotStatusOptions.First();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult EditingCustom_Read([DataSourceRequest] DataSourceRequest request, int issueID) {
|
public ActionResult EditingCustom_Read([DataSourceRequest] DataSourceRequest request, int issueID) {
|
||||||
@ -397,7 +336,6 @@ public class LotDispositionController : Controller {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the lot tables
|
/// Updates the lot tables
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
[AcceptVerbs(HttpVerbs.Post)]
|
[AcceptVerbs(HttpVerbs.Post)]
|
||||||
public ActionResult EditingCustom_Update([DataSourceRequest] DataSourceRequest request, Lot lot) {
|
public ActionResult EditingCustom_Update([DataSourceRequest] DataSourceRequest request, Lot lot) {
|
||||||
|
|
||||||
@ -442,26 +380,19 @@ public class LotDispositionController : Controller {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Delete =" + attachmentID.ToString() + " " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
|
||||||
//Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n AttachmentID Disposition\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
|
||||||
//EventLogDMO.Add(new WinEventLog() { UserID = @User.Identity.Name, OperationType = "Error", Comments = exceptionString });
|
|
||||||
//throw new Exception(e.Message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Json(new[] { attachment }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { attachment }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
//[AcceptVerbs(HttpVerbs.Post)]
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void DeleteAttachment(int attachmentID, string fileName) {
|
public void DeleteAttachment(int attachmentID, string fileName) {
|
||||||
try {
|
try {
|
||||||
if (ModelState.IsValid) {
|
if (ModelState.IsValid) {
|
||||||
ldDMO.DeleteLotDispoAttachment(attachmentID);
|
ldDMO.DeleteLotDispoAttachment(attachmentID);
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
var physicalPath = System.IO.Path.Combine(_AppSettings.AttachmentFolder + "LotDisposition", fileName);
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + "LotDisposition", fileName);
|
|
||||||
|
|
||||||
FileInfo f = new FileInfo(physicalPath);
|
System.IO.FileInfo f = new System.IO.FileInfo(physicalPath);
|
||||||
|
|
||||||
if (f.Exists)
|
if (f.Exists)
|
||||||
f.Delete();
|
f.Delete();
|
||||||
@ -491,20 +422,16 @@ public class LotDispositionController : Controller {
|
|||||||
if (files != null) {
|
if (files != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in files) {
|
foreach (var file in files) {
|
||||||
ldDMO.AttachSave(issueID, userId, file.FileName, file.InputStream);
|
LotDispositionHelper.AttachSave(_AppSettings, ldDMO, issueID, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//var model = ldDMO.GetLotDispoAttachments(issueID);
|
|
||||||
|
|
||||||
return Content("");
|
return Content("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonResult SearchLots(string searchText, string searchBy) {
|
public JsonResult SearchLots(string searchText, string searchBy) {
|
||||||
List<String> lotlist = MiscDMO.SearchLots(searchText, searchBy).Select(x => x.LotNumber).ToList<String>();
|
List<String> lotlist = MiscDMO.SearchLots(searchText, searchBy).Select(x => x.LotNumber).ToList<String>();
|
||||||
|
|
||||||
//IEnumerable<Lot> lotlist = MiscDMO.SearchLots(searchText, searchBy);
|
|
||||||
|
|
||||||
return Json(lotlist, JsonRequestBehavior.AllowGet);
|
return Json(lotlist, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,8 +513,6 @@ public class LotDispositionController : Controller {
|
|||||||
sl.IssueID = issueID;
|
sl.IssueID = issueID;
|
||||||
foreach (PropertyInfo pi in sl.GetType().GetProperties()) {
|
foreach (PropertyInfo pi in sl.GetType().GetProperties()) {
|
||||||
if (pi.Name.ToLower().StartsWith("lot") && pi.Name.ToLower().EndsWith("state")) {
|
if (pi.Name.ToLower().StartsWith("lot") && pi.Name.ToLower().EndsWith("state")) {
|
||||||
//byte currentValue = (byte)pi.GetValue(sl, null);
|
|
||||||
//if (currentValue != 2)
|
|
||||||
pi.SetValue(sl, (byte)1, null);
|
pi.SetValue(sl, (byte)1, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -616,8 +541,6 @@ public class LotDispositionController : Controller {
|
|||||||
sl.IssueID = issueID;
|
sl.IssueID = issueID;
|
||||||
foreach (PropertyInfo pi in sl.GetType().GetProperties()) {
|
foreach (PropertyInfo pi in sl.GetType().GetProperties()) {
|
||||||
if (pi.Name.ToLower().StartsWith("lot") && pi.Name.ToLower().EndsWith("state")) {
|
if (pi.Name.ToLower().StartsWith("lot") && pi.Name.ToLower().EndsWith("state")) {
|
||||||
//byte currentValue = (byte)pi.GetValue(sl, null);
|
|
||||||
//if (currentValue != 2)
|
|
||||||
pi.SetValue(sl, (byte)2, null);
|
pi.SetValue(sl, (byte)2, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -727,14 +650,10 @@ public class LotDispositionController : Controller {
|
|||||||
/// Get a list of Approvers and the status
|
/// Get a list of Approvers and the status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ActionResult GetApproversList([DataSourceRequest] DataSourceRequest request, int issueID, byte step) {
|
public ActionResult GetApproversList([DataSourceRequest] DataSourceRequest request, int issueID, byte step) {
|
||||||
//return Json(ldDMO.GetApproversList(issueID, step).ToDataSourceResult(request));
|
|
||||||
return Json(MiscDMO.GetApproversListByDocument(issueID, step, (int)GlobalVars.DocumentType.LotDisposition).ToDataSourceResult(request));
|
return Json(MiscDMO.GetApproversListByDocument(issueID, step, (int)GlobalVars.DocumentType.LotDisposition).ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonResult GetAllUsersList() {
|
public JsonResult GetAllUsersList() {
|
||||||
//var userList = ldDMO.GetApprovedApproversList(issueID, currentStep);
|
|
||||||
//return Json(userList, JsonRequestBehavior.AllowGet);
|
|
||||||
|
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
||||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||||
@ -756,24 +675,7 @@ public class LotDispositionController : Controller {
|
|||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Error", Comments = "ReAssignApproval - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Error", Comments = "ReAssignApproval - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
LotDispositionHelper.ReAssignApproval(_AppSettings, issueID, email);
|
||||||
string emailTemplate = "LotDispositionReAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Lot Disposition Re-Assignment";
|
|
||||||
string senderName = "LotDisposition";
|
|
||||||
|
|
||||||
subject = "Lot Disposition Re-Assignment" + " - Email would be sent to " + email;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[3];
|
|
||||||
emailparams[0] = issueID.ToString();
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -795,24 +697,7 @@ public class LotDispositionController : Controller {
|
|||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Error", Comments = "ReAssignApproval - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Error", Comments = "ReAssignApproval - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
LotDispositionHelper.ReAssignApproverByAdmin(_AppSettings, issueID, email);
|
||||||
string emailTemplate = "LotDispositionReAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Lot Disposition Re-Assignment";
|
|
||||||
string senderName = "LotDisposition";
|
|
||||||
|
|
||||||
subject = "Lot Disposition Re-Assignment" + " - Email would be sent to " + email;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[3];
|
|
||||||
emailparams[0] = issueID.ToString();
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -843,33 +728,7 @@ public class LotDispositionController : Controller {
|
|||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Error", Comments = "AddAdditionalApproval - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Error", Comments = "AddAdditionalApproval - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
emailSentList = LotDispositionHelper.AddAdditionalApproval(_AppSettings, issueID, emailSentList, emailArray);
|
||||||
string emailTemplate = "LotDispositionAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Lot Disposition Assignment";
|
|
||||||
string senderName = "LotDisposition";
|
|
||||||
|
|
||||||
string[] emailIst = emailArray.Split(new char[] { '~' });
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
if (email.Length > 0) {
|
|
||||||
//subject = "Lot Disposition Assignment" + " - Email would be sent to " + email;
|
|
||||||
subject = "Lot Disposition Assignment";
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[3];
|
|
||||||
emailparams[0] = issueID.ToString();
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
emailSentList += email + ",";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "Additonal Approver: " + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "Additonal Approver: " + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -879,32 +738,8 @@ public class LotDispositionController : Controller {
|
|||||||
|
|
||||||
public void NotifyApprovers(int issueID, byte currentStep) {
|
public void NotifyApprovers(int issueID, byte currentStep) {
|
||||||
try {
|
try {
|
||||||
string emailSentList = "";
|
|
||||||
|
|
||||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
|
||||||
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@issueID, currentStep, (int)GlobalVars.DocumentType.LotDisposition).Distinct().ToList();
|
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@issueID, currentStep, (int)GlobalVars.DocumentType.LotDisposition).Distinct().ToList();
|
||||||
|
string emailSentList = LotDispositionHelper.NotifyApprovers(_AppSettings, issueID, emailIst);
|
||||||
string emailTemplate = "LotDispositionAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Lot Disposition Assignment";
|
|
||||||
string senderName = "LotDisposition";
|
|
||||||
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
subject = "Lot Disposition Assignment";
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[3];
|
|
||||||
emailparams[0] = issueID.ToString();
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
emailSentList += email + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -924,29 +759,9 @@ public class LotDispositionController : Controller {
|
|||||||
|
|
||||||
public void NotifyRejectionToOrginator(int issueID) {
|
public void NotifyRejectionToOrginator(int issueID) {
|
||||||
|
|
||||||
|
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
|
||||||
List<string> emailIst = ldDMO.GetRejectionOrginatorEmailList(@issueID).Distinct().ToList();
|
List<string> emailIst = ldDMO.GetRejectionOrginatorEmailList(@issueID).Distinct().ToList();
|
||||||
|
string userEmail = LotDispositionHelper.NotifyRejectionToOrginator(_AppSettings, issueID, username, emailIst);
|
||||||
string emailTemplate = "LotDispositionReject.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Lot Disposition Rejection";
|
|
||||||
string senderName = "LotDisposition";
|
|
||||||
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
subject = "Lot Disposition Rejection";
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = issueID.ToString();
|
|
||||||
emailparams[1] = issueID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = Session[GlobalVars.SESSION_USERNAME].ToString();
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "Rejection: " + userEmail });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "Rejection: " + userEmail });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -970,7 +785,6 @@ public class LotDispositionController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetComments([DataSourceRequest] DataSourceRequest request, int issueID) {
|
public ActionResult GetComments([DataSourceRequest] DataSourceRequest request, int issueID) {
|
||||||
//return Json(ldDMO.GetApproversList(issueID, step).ToDataSourceResult(request));
|
|
||||||
return Json(ldDMO.GetComments(issueID).ToDataSourceResult(request));
|
return Json(ldDMO.GetComments(issueID).ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -996,14 +810,13 @@ public class LotDispositionController : Controller {
|
|||||||
var physicalPath = "";
|
var physicalPath = "";
|
||||||
try {
|
try {
|
||||||
string userIdentityName = @User.Identity.Name;
|
string userIdentityName = @User.Identity.Name;
|
||||||
string lotTempPipeLine = ConfigurationManager.AppSettings["LotTempPipeLine"].ToString();
|
|
||||||
foreach (var file in Lotfile) {
|
foreach (var file in Lotfile) {
|
||||||
physicalPath = ldDMO.ExcelLotOpen(issueID, userIdentityName, lotTempPipeLine, file.FileName, file.InputStream);
|
physicalPath = LotDispositionHelper.ExcelLotOpen(ldDMO, issueID, userIdentityName, _AppSettings.LotTempPipeLine, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content("");
|
return Content("");
|
||||||
} catch {
|
} catch {
|
||||||
FileInfo f = new FileInfo(physicalPath);
|
System.IO.FileInfo f = new System.IO.FileInfo(physicalPath);
|
||||||
if (f.Exists)
|
if (f.Exists)
|
||||||
f.Delete();
|
f.Delete();
|
||||||
|
|
||||||
@ -1027,11 +840,10 @@ public class LotDispositionController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FileResult DownloadFile(string attachmentID) {
|
public FileResult DownloadFile(string attachmentID) {
|
||||||
//fileName = "ECNForm_71132.pdf";
|
|
||||||
|
|
||||||
string fileName = ldDMO.GetFileName(attachmentID);
|
string fileName = ldDMO.GetFileName(attachmentID);
|
||||||
|
|
||||||
var sDocument = Path.Combine(_AppSettings.AttachmentFolder + "LotDisposition", fileName);
|
var sDocument = System.IO.Path.Combine(_AppSettings.AttachmentFolder + "LotDisposition", fileName);
|
||||||
var FDir_AppData = _AppSettings.AttachmentFolder;
|
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||||
// Ensure that we are serving file only inside the Fab2ApprovalAttachments folder
|
// Ensure that we are serving file only inside the Fab2ApprovalAttachments folder
|
||||||
@ -1041,7 +853,6 @@ public class LotDispositionController : Controller {
|
|||||||
|
|
||||||
if (!System.IO.File.Exists(sDocument)) {
|
if (!System.IO.File.Exists(sDocument)) {
|
||||||
return null;
|
return null;
|
||||||
//throw new Exception("File not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
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;
|
||||||
@ -23,15 +22,10 @@ namespace Fab2ApprovalSystem.Controllers;
|
|||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class LotTravelerController : PdfViewController {
|
public class LotTravelerController : PdfViewController {
|
||||||
|
|
||||||
LotTravelerDMO LotTravDMO;
|
LotTravelerDMO LotTravDMO = new LotTravelerDMO();
|
||||||
string docTypeString = "LotTraveler";
|
string docTypeString = "LotTraveler";
|
||||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||||
|
|
||||||
public LotTravelerController(AppSettings appSettings) {
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
LotTravDMO = new LotTravelerDMO(appSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActionResult CreateWorkRequest() {
|
public ActionResult CreateWorkRequest() {
|
||||||
LTWorkRequest workRequest = new LTWorkRequest();
|
LTWorkRequest workRequest = new LTWorkRequest();
|
||||||
@ -122,7 +116,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
if (Session["CreateNewRevision"].ToString() == "true") {
|
if (Session["CreateNewRevision"].ToString() == "true") {
|
||||||
ViewBag.NewRevision = "false";
|
ViewBag.NewRevision = "false";
|
||||||
Session["CreateNewRevision"] = "false";
|
Session["CreateNewRevision"] = "false";
|
||||||
//Session["CurrentlyOnSamePage"] = "true";
|
|
||||||
model.OriginatorID = (int)Session[GlobalVars.SESSION_USERID];
|
model.OriginatorID = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
int newRequestID = LotTravDMO.CreateWorkRequestRevision(model, (int)Session[GlobalVars.SESSION_USERID]);
|
int newRequestID = LotTravDMO.CreateWorkRequestRevision(model, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
// TODO
|
// TODO
|
||||||
@ -131,7 +124,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
|
|
||||||
return Content(newRequestID.ToString());
|
return Content(newRequestID.ToString());
|
||||||
} else {
|
} else {
|
||||||
// model.OriginatorID = (int)Session[GlobalVars.SESSION_USERID];
|
|
||||||
LotTravDMO.UpdateWorkRequest(model, (int)Session[GlobalVars.SESSION_USERID]);
|
LotTravDMO.UpdateWorkRequest(model, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
return Content("");
|
return Content("");
|
||||||
}
|
}
|
||||||
@ -176,7 +168,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
else
|
else
|
||||||
ViewBag.IsApprover = "true";
|
ViewBag.IsApprover = "true";
|
||||||
|
|
||||||
//if ((workRequest.RecordLockIndicator && workRequest.RecordLockedBy != (int)Session[GlobalVars.SESSION_USERID]) || (!((bool)Session[GlobalVars.IS_ADMIN]) && (ViewBag.IsApprover == "false")) )
|
|
||||||
if (workRequest.RecordLockIndicator && workRequest.RecordLockedBy != (int)Session[GlobalVars.SESSION_USERID]) {
|
if (workRequest.RecordLockIndicator && workRequest.RecordLockedBy != (int)Session[GlobalVars.SESSION_USERID]) {
|
||||||
return RedirectToAction("WorkRequestReadOnly", new { issueID = issueID });
|
return RedirectToAction("WorkRequestReadOnly", new { issueID = issueID });
|
||||||
}
|
}
|
||||||
@ -200,10 +191,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
LTWorkRequest workRequest = new LTWorkRequest();
|
LTWorkRequest workRequest = new LTWorkRequest();
|
||||||
workRequest = LotTravDMO.GetLTWorkRequestItemForRead(workRequestID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
workRequest = LotTravDMO.GetLTWorkRequestItemForRead(workRequestID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
|
|
||||||
//if (workRequest.IsCurrentRevision)
|
|
||||||
//{
|
|
||||||
// return RedirectToAction("Edit", new { issueID = workRequestID });
|
|
||||||
//}
|
|
||||||
return Content("");
|
return Content("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +288,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
//throw new Exception(ex.Message);
|
|
||||||
return this.Json(new DataSourceResult {
|
return this.Json(new DataSourceResult {
|
||||||
Errors = ex.Message
|
Errors = ex.Message
|
||||||
});
|
});
|
||||||
@ -315,10 +301,8 @@ public class LotTravelerController : PdfViewController {
|
|||||||
LotTravDMO.UpdateMaterialDetail(model, (int)Session[GlobalVars.SESSION_USERID]);
|
LotTravDMO.UpdateMaterialDetail(model, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
//throw new Exception(ex.Message);
|
|
||||||
return this.Json(new DataSourceResult {
|
return this.Json(new DataSourceResult {
|
||||||
Errors = ex.Message
|
Errors = ex.Message
|
||||||
});
|
});
|
||||||
@ -373,8 +357,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
//return Json(new[] { modelMaterialDetail }.ToDataSourceResult(request, ModelState));
|
|
||||||
return Content(newWorkRequestID.ToString());
|
return Content(newWorkRequestID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,10 +367,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Delete =" + attachmentID.ToString() + " " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
|
||||||
//Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n AttachmentID Disposition\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
|
||||||
//EventLogDMO.Add(new WinEventLog() { UserID = @User.Identity.Name, OperationType = "Error", Comments = exceptionString });
|
|
||||||
//throw new Exception(e.Message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
@ -415,8 +393,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
//return Json(new[] { modelMaterialDetail }.ToDataSourceResult(request, ModelState));
|
|
||||||
return Content(newWorkRequestID.ToString());
|
return Content(newWorkRequestID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,8 +431,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
//return Json(new[] { modelMaterialDetail }.ToDataSourceResult(request, ModelState));
|
|
||||||
return Content(newWorkRequestID.ToString());
|
return Content(newWorkRequestID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,8 +456,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
//return Json(new[] { modelMaterialDetail }.ToDataSourceResult(request, ModelState));
|
|
||||||
return Content(newWorkRequestID.ToString());
|
return Content(newWorkRequestID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,8 +481,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
//return Json(new[] { modelMaterialDetail }.ToDataSourceResult(request, ModelState));
|
|
||||||
return Content(newWorkRequestID.ToString());
|
return Content(newWorkRequestID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,7 +498,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
//throw new Exception(ex.Message);
|
|
||||||
return this.Json(new DataSourceResult {
|
return this.Json(new DataSourceResult {
|
||||||
Errors = ex.Message
|
Errors = ex.Message
|
||||||
});
|
});
|
||||||
@ -558,16 +527,10 @@ public class LotTravelerController : PdfViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetHoldStepAttachments([DataSourceRequest] DataSourceRequest request, int holdStepID) {
|
public ActionResult GetHoldStepAttachments([DataSourceRequest] DataSourceRequest request, int holdStepID) {
|
||||||
//var model = LotTravDMO.GetHoldStepAttachemnts(holdStepID);
|
|
||||||
//return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
|
||||||
|
|
||||||
return Json(LotTravDMO.GetHoldStepAttachemnts(holdStepID).ToDataSourceResult(request));
|
return Json(LotTravDMO.GetHoldStepAttachemnts(holdStepID).ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetLTHoldStepAttachments([DataSourceRequest] DataSourceRequest request, int ltHoldStepID) {
|
public ActionResult GetLTHoldStepAttachments([DataSourceRequest] DataSourceRequest request, int ltHoldStepID) {
|
||||||
//var model = LotTravDMO.GetHoldStepAttachemnts(holdStepID);
|
|
||||||
//return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
|
||||||
|
|
||||||
return Json(LotTravDMO.GetLotTravHoldStepAttachemnts(ltHoldStepID).ToDataSourceResult(request));
|
return Json(LotTravDMO.GetLotTravHoldStepAttachemnts(ltHoldStepID).ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,13 +561,9 @@ public class LotTravelerController : PdfViewController {
|
|||||||
LotTravDMO.UpdateWorkRequestAttachment(model);
|
LotTravDMO.UpdateWorkRequestAttachment(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public ActionResult UpdateWorkRequestAttachmentRevision(LTWorkRequest model) {
|
public ActionResult UpdateWorkRequestAttachmentRevision(LTWorkRequest model) {
|
||||||
var wrAttachmentDetail = model.WorkRequestAttachment;
|
var wrAttachmentDetail = model.WorkRequestAttachment;
|
||||||
int previousWorkRequestAttachmentID = model.WorkRequestAttachment.ID;
|
int previousWorkRequestAttachmentID = model.WorkRequestAttachment.ID;
|
||||||
@ -627,8 +586,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
//return Json(new[] { modelMaterialDetail }.ToDataSourceResult(request, ModelState));
|
|
||||||
return Content(newWorkRequestID.ToString());
|
return Content(newWorkRequestID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,8 +628,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
|
||||||
//return Json(new[] { modelMaterialDetail }.ToDataSourceResult(request, ModelState));
|
|
||||||
return Content(newWorkRequestID.ToString());
|
return Content(newWorkRequestID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -681,7 +636,7 @@ public class LotTravelerController : PdfViewController {
|
|||||||
if (files != null) {
|
if (files != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in files) {
|
foreach (var file in files) {
|
||||||
LotTravDMO.AttachSaveWorkRequest(workRequestID, swrNo, comments, docType, userId, file.FileName, file.InputStream);
|
LotTravelerHelper.AttachSaveWorkRequest(_AppSettings, LotTravDMO, workRequestID, swrNo, comments, docType, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Content("");
|
return Content("");
|
||||||
@ -707,7 +662,7 @@ public class LotTravelerController : PdfViewController {
|
|||||||
if (files != null) {
|
if (files != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in files) {
|
foreach (var file in files) {
|
||||||
LotTravDMO.AttachSaveWorkRequestRevision(workRequestID, swrNo, docType, attachComments, newRevision, userId, file.FileName, file.InputStream);
|
LotTravelerHelper.AttachSaveWorkRequestRevision(_AppSettings, LotTravDMO, workRequestID, swrNo, docType, attachComments, newRevision, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Content("");
|
return Content("");
|
||||||
@ -719,7 +674,7 @@ public class LotTravelerController : PdfViewController {
|
|||||||
if (HoldStepAttachment != null) {
|
if (HoldStepAttachment != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in HoldStepAttachment) {
|
foreach (var file in HoldStepAttachment) {
|
||||||
LotTravDMO.HoldStepAttachSave(holdStepID, swrNo, docType, comments, userId, file.FileName, file.InputStream);
|
LotTravelerHelper.HoldStepAttachSave(_AppSettings, LotTravDMO, holdStepID, swrNo, docType, comments, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -728,9 +683,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
EventLogDMO.Add(new WinEventLog() { IssueID = holdStepID, UserID = @User.Identity.Name, DocumentType = docTypeString, OperationType = "Error", Comments = "HoldStep Attachment - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = holdStepID, UserID = @User.Identity.Name, DocumentType = docTypeString, OperationType = "Error", Comments = "HoldStep Attachment - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//var model = ldDMO.GetLotDispoAttachments(issueID);
|
|
||||||
|
|
||||||
return Content("");
|
return Content("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,7 +706,7 @@ public class LotTravelerController : PdfViewController {
|
|||||||
if (HoldStepAttachment != null) {
|
if (HoldStepAttachment != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in HoldStepAttachment) {
|
foreach (var file in HoldStepAttachment) {
|
||||||
LotTravDMO.HoldStepAttachSaveRev(holdStepID, swrNo, docType, comments, newRevision, userId, file.FileName, file.InputStream);
|
LotTravelerHelper.HoldStepAttachSaveRev(_AppSettings, LotTravDMO, holdStepID, swrNo, docType, comments, newRevision, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -763,9 +715,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
EventLogDMO.Add(new WinEventLog() { IssueID = holdStepID, UserID = @User.Identity.Name, DocumentType = docTypeString, OperationType = "Error", Comments = "HoldStep Attachment - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = holdStepID, UserID = @User.Identity.Name, DocumentType = docTypeString, OperationType = "Error", Comments = "HoldStep Attachment - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//var model = ldDMO.GetLotDispoAttachments(issueID);
|
|
||||||
|
|
||||||
return Content("");
|
return Content("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -819,7 +768,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
} else
|
} else
|
||||||
return Content("Invalid");
|
return Content("Invalid");
|
||||||
|
|
||||||
//return View(ltWR);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + workRequestID.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + workRequestID.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
@ -840,14 +788,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
while (lastApprover && !lastStep) {
|
while (lastApprover && !lastStep) {
|
||||||
currentStep++;
|
currentStep++;
|
||||||
lastApprover = wfDMO.Approve(_AppSettings, workRequestID, currentStep, comments, out lastStep, (int)Session[GlobalVars.SESSION_USERID], documentType, ltWR.WorkFlowNumber);
|
lastApprover = wfDMO.Approve(_AppSettings, workRequestID, currentStep, comments, out lastStep, (int)Session[GlobalVars.SESSION_USERID], documentType, ltWR.WorkFlowNumber);
|
||||||
|
|
||||||
//if (currentStep == 3 && (!lastStep)) // add orginator to the last step
|
|
||||||
//{
|
|
||||||
// int isITARCompliant = 1;
|
|
||||||
// ltWR = LotTravDMO.GetLTWorkRequestItemForRead(workRequestID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
|
||||||
// wfDMO.AddAdditionalApproval(workRequestID, ltWR.OriginatorID.ToString(), currentStep, documentType);
|
|
||||||
//}
|
|
||||||
|
|
||||||
NotifyApprovers(workRequestID, currentStep, documentType);
|
NotifyApprovers(workRequestID, currentStep, documentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -883,42 +823,12 @@ public class LotTravelerController : PdfViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO ======================================
|
|
||||||
|
|
||||||
public void NotifyRejectionToOrginator(int workRequestID) {
|
public void NotifyRejectionToOrginator(int workRequestID) {
|
||||||
List<string> emailIst = LotTravDMO.GetRejectionOrginatorEmailList(workRequestID).Distinct().ToList();
|
|
||||||
int isITARCompliant = 0;
|
int isITARCompliant = 0;
|
||||||
|
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
|
||||||
|
List<string> emailIst = LotTravDMO.GetRejectionOrginatorEmailList(workRequestID).Distinct().ToList();
|
||||||
LTWorkRequest ltWR = LotTravDMO.GetLTWorkRequestItemForRead(workRequestID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
LTWorkRequest ltWR = LotTravDMO.GetLTWorkRequestItemForRead(workRequestID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
|
string userEmail = LotTravelerHelper.NotifyRejectionToOrginator(_AppSettings, @User.Identity.Name, workRequestID, username, emailIst, ltWR);
|
||||||
string emailTemplate = "WorkRequestReject.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Work Request Rejection";
|
|
||||||
string senderName = "Work Request";
|
|
||||||
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
subject = "Work Request Rejection notice for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[5];
|
|
||||||
emailparams[0] = ltWR.SWRNumber.ToString();
|
|
||||||
emailparams[1] = workRequestID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = Session[GlobalVars.SESSION_USERNAME].ToString();
|
|
||||||
emailparams[4] = "Work Request";
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
// en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
try {
|
|
||||||
//emailSentList += email + ",";
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
|
|
||||||
} catch {
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Lot Traveler Notify Rejection:" + email });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Rejection: " + userEmail });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Rejection: " + userEmail });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -930,36 +840,7 @@ public class LotTravelerController : PdfViewController {
|
|||||||
LTWorkRequest ltWR = LotTravDMO.GetLTWorkRequestItemForRead(workRequestID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
LTWorkRequest ltWR = LotTravDMO.GetLTWorkRequestItemForRead(workRequestID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
|
|
||||||
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(workRequestID, currentStep, documentType).Distinct().ToList();
|
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(workRequestID, currentStep, documentType).Distinct().ToList();
|
||||||
|
emailSentList = LotTravelerHelper.NotifyApprovers(_AppSettings, @User.Identity.Name, workRequestID, emailSentList, ltWR, emailIst);
|
||||||
string emailTemplate = "WorkRequestAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Work Request Assignment";
|
|
||||||
var senderName = "";
|
|
||||||
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
subject = "Work Request Assignment notice for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = ltWR.SWRNumber.ToString();
|
|
||||||
emailparams[1] = workRequestID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = "Work Request";
|
|
||||||
userEmail = email;
|
|
||||||
#if (DEBUG)
|
|
||||||
userEmail = "rkotian1@irf.com";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
//emailSentList += email + ",";
|
|
||||||
try {
|
|
||||||
emailSentList += email + ",";
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
|
|
||||||
} catch {
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "WR Notify Approvers:" + email });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -971,35 +852,7 @@ public class LotTravelerController : PdfViewController {
|
|||||||
LTWorkRequest ltWR = LotTravDMO.GetLTWorkRequestItemForRead(workRequestID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
LTWorkRequest ltWR = LotTravDMO.GetLTWorkRequestItemForRead(workRequestID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
|
|
||||||
List<string> emailIst = MiscDMO.GetWorkRequestApprovedNotifyList((int)GlobalVars.NotificationType.WorkRequest, workRequestID, (int)Session[GlobalVars.SESSION_USERID]).Distinct().ToList();
|
List<string> emailIst = MiscDMO.GetWorkRequestApprovedNotifyList((int)GlobalVars.NotificationType.WorkRequest, workRequestID, (int)Session[GlobalVars.SESSION_USERID]).Distinct().ToList();
|
||||||
|
emailSentList = LotTravelerHelper.NotifyApprovalOfWorkRequest(_AppSettings, @User.Identity.Name, workRequestID, emailSentList, ltWR, emailIst);
|
||||||
string emailTemplate = "WorkRequestApproval.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Work Request Approval";
|
|
||||||
var senderName = "";
|
|
||||||
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
subject = "Work Request Approval notice for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = ltWR.SWRNumber.ToString();
|
|
||||||
emailparams[1] = workRequestID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = "Work Request";
|
|
||||||
userEmail = email;
|
|
||||||
#if (DEBUG)
|
|
||||||
userEmail = "rkotian1@irf.com";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
//emailSentList += email + ",";
|
|
||||||
try {
|
|
||||||
emailSentList += email + ",";
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
|
|
||||||
} catch {
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Lot Traveler Approval Notification:" + email });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Approvers for WorkRequest: " + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Approvers for WorkRequest: " + emailSentList });
|
||||||
@ -1013,36 +866,7 @@ public class LotTravelerController : PdfViewController {
|
|||||||
LTWorkRequest ltWR = LotTravDMO.GetLTWorkRequestItemForRead(workRequestID, out isITARCompliant, currentUserID);
|
LTWorkRequest ltWR = LotTravDMO.GetLTWorkRequestItemForRead(workRequestID, out isITARCompliant, currentUserID);
|
||||||
|
|
||||||
List<string> emailIst = MiscDMO.GetWorkRequestRevisionNotifyList((int)GlobalVars.NotificationType.WorkRequest, workRequestID, currentUserID).Distinct().ToList();
|
List<string> emailIst = MiscDMO.GetWorkRequestRevisionNotifyList((int)GlobalVars.NotificationType.WorkRequest, workRequestID, currentUserID).Distinct().ToList();
|
||||||
|
emailSentList = LotTravelerHelper.NotifyfWorkRequestRevisionChange(_AppSettings, @User.Identity.Name, workRequestID, emailSentList, ltWR, emailIst);
|
||||||
string emailTemplate = "WorkRequestRevisionChange.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Work Request Revision Change";
|
|
||||||
var senderName = "";
|
|
||||||
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
subject = "Work Request Revision Change notice for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = ltWR.SWRNumber.ToString();
|
|
||||||
emailparams[1] = workRequestID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = "Work Request";
|
|
||||||
userEmail = email;
|
|
||||||
#if (DEBUG)
|
|
||||||
userEmail = "rkotian1@irf.com";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
//emailSentList += email + ",";
|
|
||||||
try {
|
|
||||||
emailSentList += email + ",";
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
|
|
||||||
} catch {
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "WR Revision Change Notification:" + email });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Work Request Revision Change for :" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Work Request Revision Change for :" + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -1050,39 +874,10 @@ public class LotTravelerController : PdfViewController {
|
|||||||
|
|
||||||
public void NotifyLotTravelerRevisionChange(int ltLotID, int revisionNumber) {
|
public void NotifyLotTravelerRevisionChange(int ltLotID, int revisionNumber) {
|
||||||
string emailSentList = "";
|
string emailSentList = "";
|
||||||
var data = LotTravDMO.GetLotTravelerHeaderForReadOnly(ltLotID, revisionNumber);
|
LTLotTravelerHeaderViewModel data = LotTravDMO.GetLotTravelerHeaderForReadOnly(ltLotID, revisionNumber);
|
||||||
int currentUserID = (int)Session[GlobalVars.SESSION_USERID];
|
int currentUserID = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
List<string> emailIst = MiscDMO.GetLotTravelerCreationAndRevisionNotifyList(ltLotID, data.LTWorkRequestID, currentUserID).Distinct().ToList();
|
List<string> emailIst = MiscDMO.GetLotTravelerCreationAndRevisionNotifyList(ltLotID, data.LTWorkRequestID, currentUserID).Distinct().ToList();
|
||||||
|
emailSentList = LotTravelerHelper.NotifyLotTravelerRevisionChange(_AppSettings, @User.Identity.Name, emailSentList, data, emailIst);
|
||||||
string emailTemplate = "LotTravelerRevisionChange.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Lot Traveler Revision Change";
|
|
||||||
var senderName = "";
|
|
||||||
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
subject = "Lot Traveler Revision for SWR# " + data.SWRNumber + ", Lot# " + data.LotNumber + " - " + data.Title;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = data.SWRNumber.ToString();
|
|
||||||
emailparams[1] = data.LTWorkRequestID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = data.LotNumber;
|
|
||||||
userEmail = email;
|
|
||||||
#if (DEBUG)
|
|
||||||
userEmail = "rkotian1@irf.com";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
//emailSentList += email + ",";
|
|
||||||
try {
|
|
||||||
emailSentList += email + ",";
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
|
|
||||||
} catch {
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = data.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Lot Traveler Revision Notification:" + email });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = data.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Email", Comments = "Lot Traveler Revision Change Notification:" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = data.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Email", Comments = "Lot Traveler Revision Change Notification:" + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -1090,36 +885,10 @@ public class LotTravelerController : PdfViewController {
|
|||||||
|
|
||||||
public void NotifyLotTravelerCreation(int ltLotID, int revisionNumber) {
|
public void NotifyLotTravelerCreation(int ltLotID, int revisionNumber) {
|
||||||
string emailSentList = "";
|
string emailSentList = "";
|
||||||
var data = LotTravDMO.GetLotTravelerHeaderForReadOnly(ltLotID, revisionNumber);
|
LTLotTravelerHeaderViewModel data = LotTravDMO.GetLotTravelerHeaderForReadOnly(ltLotID, revisionNumber);
|
||||||
int currentUserID = (int)Session[GlobalVars.SESSION_USERID];
|
int currentUserID = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
List<string> emailIst = MiscDMO.GetLotTravelerCreationAndRevisionNotifyList(ltLotID, data.LTWorkRequestID, currentUserID).Distinct().ToList();
|
List<string> emailIst = MiscDMO.GetLotTravelerCreationAndRevisionNotifyList(ltLotID, data.LTWorkRequestID, currentUserID).Distinct().ToList();
|
||||||
|
emailSentList = LotTravelerHelper.NotifyLotTravelerCreation(_AppSettings, @User.Identity.Name, emailSentList, data, emailIst);
|
||||||
string emailTemplate = "LotTravelerCreation.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Lot Traveler Revision Change";
|
|
||||||
var senderName = "";
|
|
||||||
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
subject = "Lot Traveler created for SWR# " + data.SWRNumber + ", Lot# " + data.LotNumber + " - " + data.Title;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = data.SWRNumber.ToString();
|
|
||||||
emailparams[1] = data.LTWorkRequestID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = data.LotNumber;
|
|
||||||
userEmail = email;
|
|
||||||
#if (DEBUG)
|
|
||||||
userEmail = "rkotian1@irf.com";
|
|
||||||
#endif
|
|
||||||
try {
|
|
||||||
emailSentList += email + ",";
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
|
|
||||||
} catch {
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = data.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Lot Traveler Creation Email Notification:" + email });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = data.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Email", Comments = "Lot Traveler Revision Change Notification:" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = data.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Email", Comments = "Lot Traveler Revision Change Notification:" + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -1144,9 +913,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public JsonResult GetAllUsersList() {
|
public JsonResult GetAllUsersList() {
|
||||||
//var userList = ldDMO.GetApprovedApproversList(issueID, currentStep);
|
|
||||||
//return Json(userList, JsonRequestBehavior.AllowGet);
|
|
||||||
|
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
||||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||||
@ -1164,35 +930,7 @@ public class LotTravelerController : PdfViewController {
|
|||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Error", Comments = "ReAssignApproval - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Error", Comments = "ReAssignApproval - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
LotTravelerHelper.ReAssignApproverByAdmin(_AppSettings, @User.Identity.Name, workRequestID, email, ltWR);
|
||||||
string emailTemplate = "WorkRequestReAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject;
|
|
||||||
string senderName = "Work Request";
|
|
||||||
|
|
||||||
subject = "Work Request Re-Assignment" + " - Email would be sent to " + email + " for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
|
|
||||||
;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = ltWR.SWRNumber.ToString();
|
|
||||||
emailparams[1] = workRequestID.ToString(); // goes into the link
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = "Work Request";
|
|
||||||
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
//en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
|
|
||||||
try {
|
|
||||||
//emailSentList += email + ",";
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
} catch {
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "ReAssign Approver Notification:" + email });
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -1210,32 +948,7 @@ public class LotTravelerController : PdfViewController {
|
|||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Error", Comments = "ReAssignApproval - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Error", Comments = "ReAssignApproval - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
LotTravelerHelper.ReAssignApproval(_AppSettings, @User.Identity.Name, workRequestID, email, ltWR);
|
||||||
string emailTemplate = "WorkRequestReAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Work Request Re-Assignment";
|
|
||||||
string senderName = "Work Request";
|
|
||||||
|
|
||||||
subject = "Work Request Re-Assignment" + " - Email would be sent to " + email + " for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
|
|
||||||
;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = ltWR.SWRNumber.ToString();
|
|
||||||
emailparams[1] = workRequestID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = "Work Request";
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
//en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
try {
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
} catch {
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "ReAssign Approval Notification:" + email });
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -1254,42 +967,7 @@ public class LotTravelerController : PdfViewController {
|
|||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Error", Comments = "AddAdditionalApproval - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Error", Comments = "AddAdditionalApproval - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
emailSentList = LotTravelerHelper.AddAdditionalApproval(_AppSettings, @User.Identity.Name, workRequestID, emailSentList, emailArray, ltWR);
|
||||||
string emailTemplate = "WorkRequestAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "Work Request Assignment";
|
|
||||||
string senderName = "Work Request";
|
|
||||||
|
|
||||||
string[] emailIst = emailArray.Split(new char[] { '~' });
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
if (email.Length > 0) {
|
|
||||||
//subject = "Lot Disposition Assignment" + " - Email would be sent to " + email;
|
|
||||||
subject = "Work Request Assignment notice for Number " + workRequestID + ", - " + ltWR.Title;
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = ltWR.SWRNumber.ToString();
|
|
||||||
emailparams[1] = workRequestID.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = "Work Request";
|
|
||||||
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
//en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
//emailSentList += email + ",";
|
|
||||||
try {
|
|
||||||
emailSentList += email + ",";
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
|
|
||||||
} catch {
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Addtional Approver Notification:" + email });
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Additonal Approver: " + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Additonal Approver: " + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -1325,9 +1003,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
|
|
||||||
public JsonResult SearchLots(string searchText, string searchBy) {
|
public JsonResult SearchLots(string searchText, string searchBy) {
|
||||||
List<String> lotlist = MiscDMO.SearchLTLots(searchText, searchBy).Select(x => x.LotNumber).ToList<String>();
|
List<String> lotlist = MiscDMO.SearchLTLots(searchText, searchBy).Select(x => x.LotNumber).ToList<String>();
|
||||||
|
|
||||||
//IEnumerable<Lot> lotlist = MiscDMO.SearchLots(searchText, searchBy);
|
|
||||||
|
|
||||||
return Json(lotlist, JsonRequestBehavior.AllowGet);
|
return Json(lotlist, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1355,12 +1030,10 @@ public class LotTravelerController : PdfViewController {
|
|||||||
public JsonResult GetLotTravelerHeader(int ltLotID) {
|
public JsonResult GetLotTravelerHeader(int ltLotID) {
|
||||||
LTLotTravelerHeaderViewModel data = new LTLotTravelerHeaderViewModel();
|
LTLotTravelerHeaderViewModel data = new LTLotTravelerHeaderViewModel();
|
||||||
data = LotTravDMO.GetLotTravelerHeaderForUpdate(ltLotID, (int)Session[GlobalVars.SESSION_USERID]);
|
data = LotTravDMO.GetLotTravelerHeaderForUpdate(ltLotID, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
//data.Revisions = LotTravDMO.GetLotTravRevisions(ltLotID).Select(s => new SelectListItem { Value = s.ID.ToString(), Text = s.RevisionNumber.ToString() }).ToList();
|
|
||||||
return Json(data, JsonRequestBehavior.AllowGet);
|
return Json(data, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetLotTravRevisions(int ltLotID) {
|
public ActionResult GetLotTravRevisions(int ltLotID) {
|
||||||
//return Json(LotTravDMO.GetLotTravRevisions(ltLotID).ToDataSourceResult(request));
|
|
||||||
return Json(LotTravDMO.GetLotTravRevisions(ltLotID), JsonRequestBehavior.AllowGet);
|
return Json(LotTravDMO.GetLotTravRevisions(ltLotID), JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1394,9 +1067,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
return View(data);
|
return View(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// /
|
|
||||||
/// </summary>
|
|
||||||
public ActionResult LotTravelerReadonly(int ltLotID, int revisionNumber) {
|
public ActionResult LotTravelerReadonly(int ltLotID, int revisionNumber) {
|
||||||
LTLotTravelerHeaderViewModel data = new LTLotTravelerHeaderViewModel();
|
LTLotTravelerHeaderViewModel data = new LTLotTravelerHeaderViewModel();
|
||||||
data = LotTravDMO.GetLotTravelerHeaderForReadOnly(ltLotID, revisionNumber);
|
data = LotTravDMO.GetLotTravelerHeaderForReadOnly(ltLotID, revisionNumber);
|
||||||
@ -1459,14 +1129,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
if (Session["CreateLotTravNewRevision"].ToString() == "true") {
|
if (Session["CreateLotTravNewRevision"].ToString() == "true") {
|
||||||
// Create a new Revision
|
// Create a new Revision
|
||||||
Session["CreateLotTravNewRevision"] = "false";
|
Session["CreateLotTravNewRevision"] = "false";
|
||||||
|
|
||||||
//int result = LotTravDMO.CanAddLocationOperation(ltHoldStepObj);
|
|
||||||
//if (result == -1)
|
|
||||||
//{
|
|
||||||
// Session["CreateLotTravNewRevision"] = "true";
|
|
||||||
// throw new Exception("Cannot set to this Hold Step as the step has already been passed in the Mfg Process.");
|
|
||||||
//}
|
|
||||||
|
|
||||||
newLotTravRevID = LotTravDMO.CreateLotTravelerRevision(ltHoldStepObj, (int)Session[GlobalVars.SESSION_USERID]);
|
newLotTravRevID = LotTravDMO.CreateLotTravelerRevision(ltHoldStepObj, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -1540,7 +1202,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
int prevLotTravRevID = ltHoldStepObj.LotTravelerRevisionID;
|
int prevLotTravRevID = ltHoldStepObj.LotTravelerRevisionID;
|
||||||
int newLotTravRevID = -1;
|
int newLotTravRevID = -1;
|
||||||
try {
|
try {
|
||||||
//int newLotTravRevisionAttribID = 0;
|
|
||||||
if (Session["CreateLotTravNewRevision"].ToString() == "true") {
|
if (Session["CreateLotTravNewRevision"].ToString() == "true") {
|
||||||
// Create a new Revision
|
// Create a new Revision
|
||||||
Session["CreateLotTravNewRevision"] = "false";
|
Session["CreateLotTravNewRevision"] = "false";
|
||||||
@ -1573,7 +1234,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
|
|
||||||
///
|
///
|
||||||
public ActionResult DisplayLotTravlerPdf(int ltLotID, int revisionNumber) {
|
public ActionResult DisplayLotTravlerPdf(int ltLotID, int revisionNumber) {
|
||||||
//DateTime? expDt;
|
|
||||||
LotTravelerPdf traveler = new LotTravelerPdf();
|
LotTravelerPdf traveler = new LotTravelerPdf();
|
||||||
try {
|
try {
|
||||||
traveler = LotTravDMO.GetLotTravlerPdf(ltLotID, revisionNumber);
|
traveler = LotTravDMO.GetLotTravlerPdf(ltLotID, revisionNumber);
|
||||||
@ -1624,7 +1284,7 @@ public class LotTravelerController : PdfViewController {
|
|||||||
if (LotTravHoldStepAttachment != null) {
|
if (LotTravHoldStepAttachment != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in LotTravHoldStepAttachment) {
|
foreach (var file in LotTravHoldStepAttachment) {
|
||||||
LotTravDMO.LotTravHoldStepAttachSaveRev(ltHoldStepID, swrNo, docType, prevLotTravRevID, newLotTravRevID, newRevision, userId, file.FileName, file.InputStream);
|
LotTravelerHelper.LotTravHoldStepAttachSaveRev(_AppSettings, LotTravDMO, ltHoldStepID, swrNo, docType, prevLotTravRevID, newLotTravRevID, newRevision, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
// send a notification
|
// send a notification
|
||||||
@ -1639,9 +1299,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltHoldStepID, UserID = @User.Identity.Name, DocumentType = docTypeString, OperationType = "Error", Comments = "Lot Traveler HoldStep Attachment - " + exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltHoldStepID, UserID = @User.Identity.Name, DocumentType = docTypeString, OperationType = "Error", Comments = "Lot Traveler HoldStep Attachment - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//var model = ldDMO.GetLotDispoAttachments(issueID);
|
|
||||||
|
|
||||||
return Content("");
|
return Content("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1668,7 +1325,7 @@ public class LotTravelerController : PdfViewController {
|
|||||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||||
|
|
||||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "LotTraveler\\" + swrNumber.ToString();
|
string ecnFolderPath = _AppSettings.AttachmentFolder + "LotTraveler\\" + swrNumber.ToString();
|
||||||
var sDocument = Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
var sDocument = System.IO.Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||||
|
|
||||||
var FDir_AppData = _AppSettings.AttachmentFolder;
|
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||||
@ -1679,7 +1336,6 @@ public class LotTravelerController : PdfViewController {
|
|||||||
|
|
||||||
if (!System.IO.File.Exists(sDocument)) {
|
if (!System.IO.File.Exists(sDocument)) {
|
||||||
return null;
|
return null;
|
||||||
//throw new Exception("File not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||||
|
@ -1,17 +1,8 @@
|
|||||||
using Fab2ApprovalSystem.DMO;
|
using System;
|
||||||
using Fab2ApprovalSystem.Misc;
|
|
||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
|
||||||
|
|
||||||
using Kendo.Mvc.Extensions;
|
|
||||||
using Kendo.Mvc.UI;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -19,6 +10,14 @@ using System.Web;
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Script.Serialization;
|
using System.Web.Script.Serialization;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
|
|
||||||
|
using Kendo.Mvc.Extensions;
|
||||||
|
using Kendo.Mvc.UI;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers;
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
@ -26,29 +25,21 @@ namespace Fab2ApprovalSystem.Controllers;
|
|||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class MRBController : Controller {
|
public class MRBController : Controller {
|
||||||
|
|
||||||
MRB_DMO mrbDMO;
|
MRB_DMO mrbDMO = new MRB_DMO(GlobalVars.AppSettings);
|
||||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||||
CredentialsStorage credentialsStorage = new CredentialsStorage();
|
CredentialsStorage credentialsStorage = new CredentialsStorage();
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||||
|
|
||||||
public MRBController(AppSettings appSettings) {
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
mrbDMO = new MRB_DMO(appSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /MRB/
|
// GET: /MRB/
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /MRB/Details/5
|
// GET: /MRB/Details/5
|
||||||
public ActionResult Details(int id) {
|
public ActionResult Details(int id) {
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /MRB/Create
|
// GET: /MRB/Create
|
||||||
public ActionResult Create() {
|
public ActionResult Create() {
|
||||||
MRB mrb = new MRB();
|
MRB mrb = new MRB();
|
||||||
@ -60,15 +51,6 @@ public class MRBController : Controller {
|
|||||||
try {
|
try {
|
||||||
PopulateCloseToQDB();
|
PopulateCloseToQDB();
|
||||||
mrbDMO.SubmitDocument(mrb.MRBNumber, (int)Session[GlobalVars.SESSION_USERID]);
|
mrbDMO.SubmitDocument(mrb.MRBNumber, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
//if (appoverCount > 0)
|
|
||||||
// NotifyApprovers(mrb.MRBNumber, (byte)GlobalVars.WorkFLowStepNumber.Step1);
|
|
||||||
|
|
||||||
//if (Request.IsAjaxRequest())
|
|
||||||
//{
|
|
||||||
// return Content("Redirect");
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
// return Content("Invalid");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + mrb.MRBNumber.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + mrb.MRBNumber.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n SubmitDocument - MRB\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n SubmitDocument - MRB\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
||||||
@ -79,7 +61,6 @@ public class MRBController : Controller {
|
|||||||
return RedirectToAction("Edit", new { IssueID = mrb.MRBNumber });
|
return RedirectToAction("Edit", new { IssueID = mrb.MRBNumber });
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /MRB/Create
|
// POST: /MRB/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Create(FormCollection collection) {
|
public ActionResult Create(FormCollection collection) {
|
||||||
@ -92,7 +73,6 @@ public class MRBController : Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /MRB/Edit/5
|
// GET: /MRB/Edit/5
|
||||||
public ActionResult Edit(int issueID) {
|
public ActionResult Edit(int issueID) {
|
||||||
string jwt = Session["JWT"].ToString();
|
string jwt = Session["JWT"].ToString();
|
||||||
@ -106,7 +86,6 @@ public class MRBController : Controller {
|
|||||||
return Redirect(mrbUrl);
|
return Redirect(mrbUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /MRB/Edit/5
|
// POST: /MRB/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void Edit(MRB mrb) {
|
public void Edit(MRB mrb) {
|
||||||
@ -132,13 +111,11 @@ public class MRBController : Controller {
|
|||||||
return Redirect(mrbUrl);
|
return Redirect(mrbUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /MRB/Delete/5
|
// GET: /MRB/Delete/5
|
||||||
public ActionResult Delete(int id) {
|
public ActionResult Delete(int id) {
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /MRB/Delete/5
|
// POST: /MRB/Delete/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Delete(int id, FormCollection collection) {
|
public ActionResult Delete(int id, FormCollection collection) {
|
||||||
@ -152,7 +129,6 @@ public class MRBController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public JsonResult SearchLots(string searchText, string searchBy) {
|
public JsonResult SearchLots(string searchText, string searchBy) {
|
||||||
//IEnumerable<Lot> lotlist = MiscDMO.SearchLots(searchText, searchBy);
|
|
||||||
List<String> lotlist = MiscDMO.SearchLots(searchText, searchBy).Select(x => x.LotNumber).ToList<String>();
|
List<String> lotlist = MiscDMO.SearchLots(searchText, searchBy).Select(x => x.LotNumber).ToList<String>();
|
||||||
return Json(lotlist, JsonRequestBehavior.AllowGet);
|
return Json(lotlist, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
@ -169,46 +145,8 @@ public class MRBController : Controller {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the lot tables
|
/// Updates the lot tables
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
[AcceptVerbs(HttpVerbs.Post)]
|
[AcceptVerbs(HttpVerbs.Post)]
|
||||||
public ActionResult UpdateMRBLot([DataSourceRequest] DataSourceRequest request, Lot lot) {
|
public ActionResult UpdateMRBLot([DataSourceRequest] DataSourceRequest request, Lot lot) {
|
||||||
//try
|
|
||||||
//{
|
|
||||||
// // RJK
|
|
||||||
// //routine to cascade the "dispo type" to all the child lots in SPN
|
|
||||||
|
|
||||||
// MRB mrbInfo = mrbDMO.GetToolIssueStartEndDateData(lot.MRBNumber);
|
|
||||||
|
|
||||||
// if (!mrbInfo.ToolCSV.ToUpper().Equals("NA"))
|
|
||||||
// {
|
|
||||||
// bool existingLotUpdated;
|
|
||||||
// Lot l = new Lot();
|
|
||||||
// l.LotNumber = lot.LotNumber;
|
|
||||||
// if (lot.DispoType.ToString().Trim().Length == 1)
|
|
||||||
// {
|
|
||||||
// l.DispoType = lot.DispoType;
|
|
||||||
// }
|
|
||||||
// l.MRBNumber = lot.MRBNumber;
|
|
||||||
// // check if the lot was sent to SPN
|
|
||||||
// bool lotSentToSPN = mrbDMO.IsLotSentToSPN(l.LotNumber, l.MRBNumber);
|
|
||||||
// //only get the child lots if it has been sent to SPN to set the MRB Flag
|
|
||||||
// if (lotSentToSPN)
|
|
||||||
// {
|
|
||||||
// if (!mrbDMO.GetChildLotsFromSPNForDispoTypeUpdate(l.MRBNumber, l.LotNumber, mrbInfo.ToolCSV, mrbInfo.IssueStartDate, mrbInfo.IssueEndDate, lot.DispoType))
|
|
||||||
// {
|
|
||||||
// //warnings.AppendFormat("Lot number {0} is not affected by these tools and issue start/end time.\n", l.LotNumber);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
//}
|
|
||||||
//catch(Exception e)
|
|
||||||
//{
|
|
||||||
// // ignore the error
|
|
||||||
// string s = e.InnerException.ToString();
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (lot != null && ModelState.IsValid) {
|
if (lot != null && ModelState.IsValid) {
|
||||||
mrbDMO.UpdateMRBLot(lot);
|
mrbDMO.UpdateMRBLot(lot);
|
||||||
}
|
}
|
||||||
@ -219,7 +157,6 @@ public class MRBController : Controller {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes record from the lot table
|
/// Deletes record from the lot table
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
[AcceptVerbs(HttpVerbs.Post)]
|
[AcceptVerbs(HttpVerbs.Post)]
|
||||||
public ActionResult DeleteMRBLot([DataSourceRequest] DataSourceRequest request, Lot lot) {
|
public ActionResult DeleteMRBLot([DataSourceRequest] DataSourceRequest request, Lot lot) {
|
||||||
try {
|
try {
|
||||||
@ -271,17 +208,7 @@ public class MRBController : Controller {
|
|||||||
l.LotNumber = lotNumber;
|
l.LotNumber = lotNumber;
|
||||||
l.MRBNumber = mrbNumber;
|
l.MRBNumber = mrbNumber;
|
||||||
mrbDMO.InsertLot(l, true, out existingRowUpdated);
|
mrbDMO.InsertLot(l, true, out existingRowUpdated);
|
||||||
|
|
||||||
//if (!existingRowUpdated)
|
|
||||||
//{
|
|
||||||
// if (!mrbDMO.InsertLotSplitsAffectedByIncident(mrbNumber, l.LotNumber))
|
|
||||||
// {
|
|
||||||
// warnings.AppendFormat("Lot number {0} is not affected by these tools and issue start/end time.\n", l.LotNumber);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//warnings.Append("No tool info, split lots will NOT be automatically searched and uploaded \n please make sure to include all the child lots in the MRB");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content(warnings.ToString());
|
return Content(warnings.ToString());
|
||||||
@ -317,9 +244,9 @@ public class MRBController : Controller {
|
|||||||
mrbDMO.DeleteMRBAttachment(attachmentID);
|
mrbDMO.DeleteMRBAttachment(attachmentID);
|
||||||
|
|
||||||
if (!String.IsNullOrWhiteSpace(fileName)) {
|
if (!String.IsNullOrWhiteSpace(fileName)) {
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + "MRB", fileName);
|
var physicalPath = System.IO.Path.Combine(_AppSettings.AttachmentFolder + "MRB", fileName);
|
||||||
|
|
||||||
FileInfo f = new FileInfo(physicalPath);
|
System.IO.FileInfo f = new System.IO.FileInfo(physicalPath);
|
||||||
|
|
||||||
if (f.Exists)
|
if (f.Exists)
|
||||||
f.Delete();
|
f.Delete();
|
||||||
@ -340,12 +267,9 @@ public class MRBController : Controller {
|
|||||||
if (files != null) {
|
if (files != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in files) {
|
foreach (var file in files) {
|
||||||
mrbDMO.AttachSave(mrbNumber, userId, file.FileName, file.InputStream);
|
MRBHelper.AttachSave(_AppSettings, mrbDMO, mrbNumber, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//var model = mrbDMO.GetMRBAttachments(mrbNumber);
|
|
||||||
|
|
||||||
return Json(new { errors = errorList });
|
return Json(new { errors = errorList });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,10 +281,8 @@ public class MRBController : Controller {
|
|||||||
try {
|
try {
|
||||||
string userIdentityName = @User.Identity.Name;
|
string userIdentityName = @User.Identity.Name;
|
||||||
var dispos = mrbDMO.GetDispositions(mrbNumber);
|
var dispos = mrbDMO.GetDispositions(mrbNumber);
|
||||||
string lotTempPipeLine = ConfigurationManager.AppSettings["LotTempPipeLine"].ToString();
|
|
||||||
|
|
||||||
foreach (var file in Lotfile) {
|
foreach (var file in Lotfile) {
|
||||||
physicalPath = mrbDMO.ExcelLotOpen(mrbNumber, warnings, dispos, userIdentityName, lotTempPipeLine, file.FileName, file.InputStream);
|
physicalPath = MRBHelper.ExcelLotOpen(mrbDMO, mrbNumber, warnings, dispos, userIdentityName, _AppSettings.LotTempPipeLine, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content(warnings.ToString());
|
return Content(warnings.ToString());
|
||||||
@ -375,7 +297,7 @@ public class MRBController : Controller {
|
|||||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n MRB Excel\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n MRB Excel\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = mrbNumber, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Error", Comments = exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = mrbNumber, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Error", Comments = exceptionString });
|
||||||
|
|
||||||
FileInfo f = new FileInfo(physicalPath);
|
System.IO.FileInfo f = new System.IO.FileInfo(physicalPath);
|
||||||
if (f.Exists)
|
if (f.Exists)
|
||||||
f.Delete();
|
f.Delete();
|
||||||
|
|
||||||
@ -385,16 +307,15 @@ public class MRBController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult ImportAddQDBFlag(IEnumerable<HttpPostedFileBase> AddQDBFlag, string operation) {
|
public ActionResult ImportAddQDBFlag(IEnumerable<HttpPostedFileBase> AddQDBFlag, string operation) {
|
||||||
//string path = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName"]);
|
|
||||||
var physicalPath = "";
|
var physicalPath = "";
|
||||||
try {
|
try {
|
||||||
string message;
|
string message;
|
||||||
string c = Server.MapPath("/FTPBatch/");
|
string c = Server.MapPath("/FTPBatch/");
|
||||||
string userIdentityName = @User.Identity.Name;
|
string userIdentityName = @User.Identity.Name;
|
||||||
string b = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName"]);
|
string b = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName);
|
||||||
string a = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName_Test"]);
|
string a = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName_Test);
|
||||||
foreach (var file in AddQDBFlag) {
|
foreach (var file in AddQDBFlag) {
|
||||||
message = mrbDMO.ImportAddQDBFlag(operation, out physicalPath, userIdentityName, a, b, c, file.FileName, file.InputStream);
|
message = MRBHelper.ImportAddQDBFlag(_AppSettings, mrbDMO, operation, out physicalPath, userIdentityName, a, b, c, file.FileName, file.InputStream);
|
||||||
if (string.IsNullOrEmpty(message))
|
if (string.IsNullOrEmpty(message))
|
||||||
continue;
|
continue;
|
||||||
return Content(message);
|
return Content(message);
|
||||||
@ -402,7 +323,7 @@ public class MRBController : Controller {
|
|||||||
|
|
||||||
return Content("");
|
return Content("");
|
||||||
} catch {
|
} catch {
|
||||||
FileInfo f = new FileInfo(physicalPath);
|
System.IO.FileInfo f = new System.IO.FileInfo(physicalPath);
|
||||||
if (f.Exists)
|
if (f.Exists)
|
||||||
f.Delete();
|
f.Delete();
|
||||||
|
|
||||||
@ -416,10 +337,10 @@ public class MRBController : Controller {
|
|||||||
string message;
|
string message;
|
||||||
string c = Server.MapPath("/FTPBatch/");
|
string c = Server.MapPath("/FTPBatch/");
|
||||||
string userIdentityName = @User.Identity.Name;
|
string userIdentityName = @User.Identity.Name;
|
||||||
string b = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName"]);
|
string b = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName);
|
||||||
string a = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName_Test"]);
|
string a = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName_Test);
|
||||||
foreach (var file in RemoveQDBFlag) {
|
foreach (var file in RemoveQDBFlag) {
|
||||||
message = mrbDMO.ImportRemoveQDBFlag(operation, out physicalPath, userIdentityName, a, b, c, file.FileName, file.InputStream);
|
message = MRBHelper.ImportRemoveQDBFlag(_AppSettings, mrbDMO, operation, out physicalPath, userIdentityName, a, b, c, file.FileName, file.InputStream);
|
||||||
if (string.IsNullOrEmpty(message))
|
if (string.IsNullOrEmpty(message))
|
||||||
continue;
|
continue;
|
||||||
return Content(message);
|
return Content(message);
|
||||||
@ -427,7 +348,7 @@ public class MRBController : Controller {
|
|||||||
|
|
||||||
return Content("");
|
return Content("");
|
||||||
} catch {
|
} catch {
|
||||||
FileInfo f = new FileInfo(physicalPath);
|
System.IO.FileInfo f = new System.IO.FileInfo(physicalPath);
|
||||||
if (f.Exists)
|
if (f.Exists)
|
||||||
f.Delete();
|
f.Delete();
|
||||||
|
|
||||||
@ -503,38 +424,13 @@ public class MRBController : Controller {
|
|||||||
List<CloseToQDBOptionViewModel> options = new List<CloseToQDBOptionViewModel>();
|
List<CloseToQDBOptionViewModel> options = new List<CloseToQDBOptionViewModel>();
|
||||||
options.Add(new CloseToQDBOptionViewModel { CloseToQDBOptionID = 0, CloseToQDBOption = "No" });
|
options.Add(new CloseToQDBOptionViewModel { CloseToQDBOptionID = 0, CloseToQDBOption = "No" });
|
||||||
options.Add(new CloseToQDBOptionViewModel { CloseToQDBOptionID = 1, CloseToQDBOption = "Yes" });
|
options.Add(new CloseToQDBOptionViewModel { CloseToQDBOptionID = 1, CloseToQDBOption = "Yes" });
|
||||||
//options.Add(new CloseToQDBOptionViewModel{CloseToQDBOption= "No"});
|
|
||||||
//options.Add(new CloseToQDBOptionViewModel {CloseToQDBOption = "Yes" });
|
|
||||||
|
|
||||||
ViewData["CloseToQDBOptions"] = options;
|
ViewData["CloseToQDBOptions"] = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyApprovers(int mrbNumber, byte currentStep) {
|
public void NotifyApprovers(int mrbNumber, byte currentStep) {
|
||||||
string emailSentList = "";
|
|
||||||
|
|
||||||
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(mrbNumber, currentStep, (int)GlobalVars.DocumentType.MRB).Distinct().ToList();
|
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(mrbNumber, currentStep, (int)GlobalVars.DocumentType.MRB).Distinct().ToList();
|
||||||
|
string emailSentList = MRBHelper.NotifyApprovers(_AppSettings, mrbNumber, emailIst);
|
||||||
string emailTemplate = "MRBAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = "MRB Assignment";
|
|
||||||
string senderName = "MRB";
|
|
||||||
|
|
||||||
foreach (string email in emailIst) {
|
|
||||||
subject = "MRB Assignment";
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[3];
|
|
||||||
emailparams[0] = mrbNumber.ToString();
|
|
||||||
emailparams[1] = mrbNumber.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
userEmail = email;
|
|
||||||
//#if(DEBUG)
|
|
||||||
// userEmail = "rkotian1@irf.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
emailSentList += email + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = mrbNumber, UserID = @User.Identity.Name, DocumentType = "MRB", OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = mrbNumber, UserID = @User.Identity.Name, DocumentType = "MRB", OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -575,15 +471,6 @@ public class MRBController : Controller {
|
|||||||
int waferCount = 0;
|
int waferCount = 0;
|
||||||
int dieCount = 0;
|
int dieCount = 0;
|
||||||
mrbDMO.GetLotWaferDieCount(mrbNumber, out lotCount, out waferCount, out dieCount);
|
mrbDMO.GetLotWaferDieCount(mrbNumber, out lotCount, out waferCount, out dieCount);
|
||||||
|
|
||||||
//dynamic data = new ExpandoObject();
|
|
||||||
//data.LotCount = lotCount;
|
|
||||||
//data.WaferCount = waferCount;
|
|
||||||
//data.DieCount = dieCount;
|
|
||||||
|
|
||||||
//string json = Newtonsoft.Json.JsonConvert.SerializeObject(data);
|
|
||||||
|
|
||||||
//return Json(json, JsonRequestBehavior.AllowGet);
|
|
||||||
return Json(lotCount.ToString() + "~" + waferCount.ToString() + "~" + dieCount, JsonRequestBehavior.AllowGet);
|
return Json(lotCount.ToString() + "~" + waferCount.ToString() + "~" + dieCount, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -614,11 +501,10 @@ public class MRBController : Controller {
|
|||||||
try {
|
try {
|
||||||
string c = Server.MapPath("/FTPBatch/");
|
string c = Server.MapPath("/FTPBatch/");
|
||||||
string userIdentityName = @User.Identity.Name;
|
string userIdentityName = @User.Identity.Name;
|
||||||
string b = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName"]);
|
string b = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName);
|
||||||
string a = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName_Test"]);
|
string a = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName_Test);
|
||||||
IEnumerable<string> data = mrbDMO.GetMRBHoldLots(mrbNumber);
|
IEnumerable<string> data = mrbDMO.GetMRBHoldLots(mrbNumber);
|
||||||
foreach (string tempData in data) {
|
foreach (string tempData in data) {
|
||||||
//output = new StringBuilder();
|
|
||||||
if (tempData != null)
|
if (tempData != null)
|
||||||
output.Append(tempData.Trim() + Environment.NewLine);
|
output.Append(tempData.Trim() + Environment.NewLine);
|
||||||
|
|
||||||
@ -630,9 +516,7 @@ public class MRBController : Controller {
|
|||||||
string newsourceFileName = mrbNumber.ToString() + "_S" + dt.Day.ToString("00") + dt.Month.ToString("00") + dt.Year.ToString("00") + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00") + ".mrb";
|
string newsourceFileName = mrbNumber.ToString() + "_S" + dt.Day.ToString("00") + dt.Month.ToString("00") + dt.Year.ToString("00") + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00") + ".mrb";
|
||||||
string newDestFileName = "S" + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00");
|
string newDestFileName = "S" + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00");
|
||||||
|
|
||||||
//string outputFile = @"C:\Websites\SPNLotHoldFlag\" + newsourceFileName;
|
string outputFile = _AppSettings.SPNMRBHoldFlagDirectory + newsourceFileName;
|
||||||
string ftpLogDirectory = ConfigurationManager.AppSettings["SPNMRBHoldFlagFTPLogDirectory"].ToString();
|
|
||||||
string outputFile = ConfigurationManager.AppSettings["SPNMRBHoldFlagDirectory"].ToString() + newsourceFileName;
|
|
||||||
|
|
||||||
System.IO.File.WriteAllText(outputFile, output.ToString());
|
System.IO.File.WriteAllText(outputFile, output.ToString());
|
||||||
|
|
||||||
@ -640,26 +524,17 @@ public class MRBController : Controller {
|
|||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
#endif
|
#endif
|
||||||
try {
|
try {
|
||||||
//#if (!DEBUG)
|
if (MRBHelper.BatchFTP(_AppSettings, outputFile, newDestFileName, _AppSettings.SPNMRBHoldFlagFTPLogDirectory, userIdentityName, a, b, c)) {
|
||||||
//FTPWrapper spfSPN = new FTPWrapper(outputFile, newDestFileName);
|
|
||||||
//spfSPN.FTPToSPN();
|
|
||||||
|
|
||||||
if (mrbDMO.BatchFTP(outputFile, newDestFileName, ftpLogDirectory, userIdentityName, a, b, c)) {
|
|
||||||
// TODO
|
// TODO
|
||||||
mrbDMO.LogHoldFlagSentToSPNHistory(mrbNumber);
|
mrbDMO.LogHoldFlagSentToSPNHistory(mrbNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
//#endif
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "MRB =" + mrbNumber.ToString() + " FTPToSPN(): SendMRBHoldFlagToSPN(mrbNumber) - FTP Upload Error " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "MRB =" + mrbNumber.ToString() + " FTPToSPN(): SendMRBHoldFlagToSPN(mrbNumber) - FTP Upload Error " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = -1, UserID = @User.Identity.Name, DocumentType = "MRB", OperationType = "Error", Comments = exceptionString });
|
EventLogDMO.Add(new WinEventLog() { IssueID = -1, UserID = @User.Identity.Name, DocumentType = "MRB", OperationType = "Error", Comments = exceptionString });
|
||||||
return Json(new { Error = true, Message = e.Message }, JsonRequestBehavior.AllowGet);
|
return Json(new { Error = true, Message = e.Message }, JsonRequestBehavior.AllowGet);
|
||||||
//return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//return true;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "MRB =" + mrbNumber.ToString() + " SendMRBHoldFlagToSPN(mrbNumber) " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "MRB =" + mrbNumber.ToString() + " SendMRBHoldFlagToSPN(mrbNumber) " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n Approve\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n Approve\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
||||||
@ -678,18 +553,14 @@ public class MRBController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool BatchFTP_Old(string sourceFile, string destFile) {
|
public bool BatchFTP_Old(string sourceFile, string destFile) {
|
||||||
FileInfo sourcefile = new FileInfo(sourceFile);
|
System.IO.FileInfo sourcefile = new System.IO.FileInfo(sourceFile);
|
||||||
//FileInfo sourcefile = new FileInfo(@"C:\Websites\ECNViewerAckResultToSPN\S15122017102017.ecn");
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//Functions.WriteEvent("HR Emp", "SPNData - Start Send(): FTPing " + sourceFile + " to SPN server.", System.Diagnostics.EventLogEntryType.Information);
|
|
||||||
|
|
||||||
ProcessStartInfo psiFab1 = new ProcessStartInfo();
|
ProcessStartInfo psiFab1 = new ProcessStartInfo();
|
||||||
//psiFab1.FileName = ConfigurationManager.AppSettings["FTPSPNBatchFileName"];
|
|
||||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||||
psiFab1.FileName = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName_Test"]);
|
psiFab1.FileName = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName_Test);
|
||||||
} else {
|
} else {
|
||||||
psiFab1.FileName = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName"]);
|
psiFab1.FileName = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
psiFab1.Arguments = sourcefile.FullName + " " + destFile;
|
psiFab1.Arguments = sourcefile.FullName + " " + destFile;
|
||||||
@ -697,8 +568,6 @@ public class MRBController : Controller {
|
|||||||
Process procFab1 = new Process();
|
Process procFab1 = new Process();
|
||||||
procFab1.StartInfo = psiFab1;
|
procFab1.StartInfo = psiFab1;
|
||||||
procFab1.Start();
|
procFab1.Start();
|
||||||
//Functions.WriteEvent("HR Emp", "SPNData - Finish FTPing to SPN server.", System.Diagnostics.EventLogEntryType.Information);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n Approve\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n Approve\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
||||||
@ -707,8 +576,6 @@ public class MRBController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FileResult DownloadFile(string attachmentID) {
|
public FileResult DownloadFile(string attachmentID) {
|
||||||
//fileName = "ECNForm_71132.pdf";
|
|
||||||
|
|
||||||
var attachment = mrbDMO.GetMRBAttachment(Convert.ToInt32(attachmentID));
|
var attachment = mrbDMO.GetMRBAttachment(Convert.ToInt32(attachmentID));
|
||||||
|
|
||||||
if (attachment == null)
|
if (attachment == null)
|
||||||
@ -718,7 +585,7 @@ public class MRBController : Controller {
|
|||||||
if (String.IsNullOrEmpty(fileName))
|
if (String.IsNullOrEmpty(fileName))
|
||||||
fileName = attachment.FileName;
|
fileName = attachment.FileName;
|
||||||
|
|
||||||
var sDocument = Path.Combine(_AppSettings.AttachmentFolder + "MRB", fileName);
|
var sDocument = System.IO.Path.Combine(_AppSettings.AttachmentFolder + "MRB", fileName);
|
||||||
var FDir_AppData = _AppSettings.AttachmentFolder;
|
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||||
// Ensure that we are serving file only inside the Fab2ApprovalAttachments folder
|
// Ensure that we are serving file only inside the Fab2ApprovalAttachments folder
|
||||||
@ -728,7 +595,6 @@ public class MRBController : Controller {
|
|||||||
|
|
||||||
if (!System.IO.File.Exists(sDocument)) {
|
if (!System.IO.File.Exists(sDocument)) {
|
||||||
return null;
|
return null;
|
||||||
//throw new Exception("File not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, attachment.FileName);
|
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, attachment.FileName);
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
using Fab2ApprovalSystem.DMO;
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
|
||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers;
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
@ -17,13 +17,8 @@ public class ManagerController : Controller {
|
|||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
AdminDMO adminDMO = new AdminDMO();
|
AdminDMO adminDMO = new AdminDMO();
|
||||||
TrainingDMO trainingDMO = new TrainingDMO();
|
TrainingDMO trainingDMO = new TrainingDMO();
|
||||||
LotDispositionDMO ldDMO;
|
LotDispositionDMO ldDMO = new LotDispositionDMO();
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||||
|
|
||||||
public ManagerController(AppSettings appSettings) {
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
ldDMO = new LotDispositionDMO(appSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
if ((bool)Session[GlobalVars.IS_MANAGER]) {
|
if ((bool)Session[GlobalVars.IS_MANAGER]) {
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
using Fab2ApprovalSystem.DMO;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
using Kendo.Mvc.Extensions;
|
using Kendo.Mvc.Extensions;
|
||||||
using Kendo.Mvc.UI;
|
using Kendo.Mvc.UI;
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using System.Web.Mvc;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers;
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
@ -20,15 +20,13 @@ public class PartsRequestController : Controller {
|
|||||||
|
|
||||||
|
|
||||||
const int WorkflowNumber = 1;
|
const int WorkflowNumber = 1;
|
||||||
PartsRequestDMO prDMO;
|
PartsRequestDMO prDMO = new PartsRequestDMO();
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||||
|
|
||||||
public PartsRequestController(AppSettings appSettings) {
|
public PartsRequestController() {
|
||||||
_AppSettings = appSettings;
|
|
||||||
ViewBag.ShowReAssignApprovers = false;
|
ViewBag.ShowReAssignApprovers = false;
|
||||||
prDMO = new PartsRequestDMO(appSettings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ActionResult HandleValidationError(string msg) {
|
protected ActionResult HandleValidationError(string msg) {
|
||||||
@ -248,7 +246,7 @@ public class PartsRequestController : Controller {
|
|||||||
if (files != null) {
|
if (files != null) {
|
||||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in files) {
|
foreach (var file in files) {
|
||||||
prDMO.AttachSave(prNumber, userId, file.FileName, file.InputStream);
|
PartsRequestHelper.AttachSave(_AppSettings, prDMO, prNumber, userId, file.FileName, file.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,28 +417,14 @@ public class PartsRequestController : Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SendEmailNotification(string subject, int prNumber, string toEmail, string emailTemplate) {
|
|
||||||
string senderName = "Parts Request";
|
|
||||||
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, System.Configuration.ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[5];
|
|
||||||
emailparams[0] = prNumber.ToString();
|
|
||||||
emailparams[1] = prNumber.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
emailparams[3] = "Parts Request";
|
|
||||||
emailparams[4] = Session[GlobalVars.SESSION_USERNAME].ToString();
|
|
||||||
String userEmail = toEmail;
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void NotifyReAssignment(int prNumber, string email) {
|
protected void NotifyReAssignment(int prNumber, string email) {
|
||||||
var pr = prDMO.Get(prNumber);
|
var pr = prDMO.Get(prNumber);
|
||||||
|
|
||||||
if (pr == null)
|
if (pr == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SendEmailNotification(
|
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
|
||||||
|
PartsRequestHelper.SendEmailNotification(_AppSettings, username,
|
||||||
subject: String.Format("Parts Request Re-Assignment notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
subject: String.Format("Parts Request Re-Assignment notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
||||||
prNumber: prNumber,
|
prNumber: prNumber,
|
||||||
toEmail: email,
|
toEmail: email,
|
||||||
@ -463,7 +447,8 @@ public class PartsRequestController : Controller {
|
|||||||
|
|
||||||
var u = userDMO.GetUserByID(pr.RequestorID);
|
var u = userDMO.GetUserByID(pr.RequestorID);
|
||||||
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email))) {
|
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email))) {
|
||||||
SendEmailNotification(
|
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
|
||||||
|
PartsRequestHelper.SendEmailNotification(_AppSettings, username,
|
||||||
subject: String.Format("Parts Request Completion notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
subject: String.Format("Parts Request Completion notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
||||||
prNumber: prNumber,
|
prNumber: prNumber,
|
||||||
toEmail: u.Email,
|
toEmail: u.Email,
|
||||||
@ -487,7 +472,8 @@ public class PartsRequestController : Controller {
|
|||||||
|
|
||||||
var u = userDMO.GetUserByID(pr.OriginatorID);
|
var u = userDMO.GetUserByID(pr.OriginatorID);
|
||||||
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email))) {
|
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email))) {
|
||||||
SendEmailNotification(
|
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
|
||||||
|
PartsRequestHelper.SendEmailNotification(_AppSettings, username,
|
||||||
subject: String.Format("Parts Request Rejection notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
subject: String.Format("Parts Request Rejection notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
||||||
prNumber: prNumber,
|
prNumber: prNumber,
|
||||||
toEmail: u.Email,
|
toEmail: u.Email,
|
||||||
@ -517,7 +503,8 @@ public class PartsRequestController : Controller {
|
|||||||
|
|
||||||
foreach (string email in emailList) {
|
foreach (string email in emailList) {
|
||||||
try {
|
try {
|
||||||
SendEmailNotification(
|
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
|
||||||
|
PartsRequestHelper.SendEmailNotification(_AppSettings, username,
|
||||||
subject: String.Format("Parts Request Assignment notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
subject: String.Format("Parts Request Assignment notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
||||||
prNumber: prNumber,
|
prNumber: prNumber,
|
||||||
toEmail: email,
|
toEmail: email,
|
||||||
@ -569,7 +556,8 @@ public class PartsRequestController : Controller {
|
|||||||
if (pr == null)
|
if (pr == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SendEmailNotification(
|
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
|
||||||
|
PartsRequestHelper.SendEmailNotification(_AppSettings, username,
|
||||||
subject: String.Format("Parts Request Assignment notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
subject: String.Format("Parts Request Assignment notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
||||||
prNumber: prNumber,
|
prNumber: prNumber,
|
||||||
toEmail: email,
|
toEmail: email,
|
||||||
|
@ -1,19 +1,22 @@
|
|||||||
using Fab2ApprovalSystem.DMO;
|
using System;
|
||||||
using Fab2ApprovalSystem.Misc;
|
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers;
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class ReportsController : Controller {
|
public class ReportsController : Controller {
|
||||||
|
|
||||||
public const String specialNullString = "~NULL~";
|
public const String specialNullString = "~NULL~";
|
||||||
|
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||||
|
|
||||||
// GET: Export
|
// GET: Export
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
@ -84,14 +87,14 @@ public class ReportsController : Controller {
|
|||||||
|
|
||||||
public SSRSHelper.SSRSClient SetupSSRSHelperClient() {
|
public SSRSHelper.SSRSClient SetupSSRSHelperClient() {
|
||||||
var useCfgForBindings = false;
|
var useCfgForBindings = false;
|
||||||
if (String.Equals(System.Configuration.ConfigurationManager.AppSettings["SSRSBindingsByConfiguration"], "true", StringComparison.OrdinalIgnoreCase))
|
if (String.Equals(_AppSettings.SSRSBindingsByConfiguration, "true", StringComparison.OrdinalIgnoreCase))
|
||||||
useCfgForBindings = true;
|
useCfgForBindings = true;
|
||||||
|
|
||||||
var c = new SSRSHelper.SSRSClient(
|
var c = new SSRSHelper.SSRSClient(
|
||||||
Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSBaseURL"]),
|
Convert.ToString(_AppSettings.SSRSBaseURL),
|
||||||
Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSDomain"]),
|
Convert.ToString(_AppSettings.SSRSDomain),
|
||||||
Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSUsername"]),
|
Convert.ToString(_AppSettings.SSRSUsername),
|
||||||
Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSPassword"]),
|
Convert.ToString(_AppSettings.SSRSPassword),
|
||||||
useCfgForBindings);
|
useCfgForBindings);
|
||||||
c.Initialize();
|
c.Initialize();
|
||||||
|
|
||||||
@ -99,7 +102,7 @@ public class ReportsController : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<SSRSHelper.ReportInfo> GetReportList(String docType) {
|
private IEnumerable<SSRSHelper.ReportInfo> GetReportList(String docType) {
|
||||||
String folderName = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSFolder"]);
|
String folderName = Convert.ToString(_AppSettings.SSRSFolder);
|
||||||
if (folderName.EndsWith("/"))
|
if (folderName.EndsWith("/"))
|
||||||
folderName = folderName.TrimEnd('/');
|
folderName = folderName.TrimEnd('/');
|
||||||
if (!String.IsNullOrWhiteSpace(docType))
|
if (!String.IsNullOrWhiteSpace(docType))
|
||||||
@ -181,7 +184,7 @@ public class ReportsController : Controller {
|
|||||||
|
|
||||||
protected String MakeFilename(String reportName) {
|
protected String MakeFilename(String reportName) {
|
||||||
String r = "";
|
String r = "";
|
||||||
var invalidChars = System.IO.Path.GetInvalidFileNameChars();
|
char[] invalidChars = System.IO.Path.GetInvalidFileNameChars();
|
||||||
foreach (char c in reportName) {
|
foreach (char c in reportName) {
|
||||||
if (invalidChars.Contains(c))
|
if (invalidChars.Contains(c))
|
||||||
r += '_';
|
r += '_';
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
@ -6,12 +12,6 @@ using Fab2ApprovalSystem.ViewModels;
|
|||||||
|
|
||||||
using Kendo.Mvc.Extensions;
|
using Kendo.Mvc.Extensions;
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web.Mvc;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers;
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
@ -22,7 +22,7 @@ public class TrainingController : Controller {
|
|||||||
AdminDMO adminDMO = new AdminDMO();
|
AdminDMO adminDMO = new AdminDMO();
|
||||||
TrainingDMO trainingDMO = new TrainingDMO();
|
TrainingDMO trainingDMO = new TrainingDMO();
|
||||||
ECN_DMO ecnDMO = new ECN_DMO();
|
ECN_DMO ecnDMO = new ECN_DMO();
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||||
|
|
||||||
// GET: Training
|
// GET: Training
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
@ -178,28 +178,8 @@ public class TrainingController : Controller {
|
|||||||
|
|
||||||
public void NotifyTrainee(int userId, int assignmentId, int ecnId, string title) {
|
public void NotifyTrainee(int userId, int assignmentId, int ecnId, string title) {
|
||||||
try {
|
try {
|
||||||
string emailSentList = "";
|
|
||||||
string recipient = userDMO.GetUserEmailByID(userId);
|
string recipient = userDMO.GetUserEmailByID(userId);
|
||||||
|
TrainingHelper.NotifyTrainee(_AppSettings, userId, assignmentId, ecnId, title, recipient);
|
||||||
string emailTemplate = "ECNTrainingAssigned.txt";
|
|
||||||
string userEmail = string.Empty;
|
|
||||||
string subject = string.Empty;
|
|
||||||
string senderName = "ECN Training";
|
|
||||||
|
|
||||||
subject = "ECN# " + ecnId + " - Training Assignment Notice - " + title;
|
|
||||||
|
|
||||||
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
userEmail = recipient;
|
|
||||||
string[] emailparams = new string[4];
|
|
||||||
emailparams[0] = assignmentId.ToString();
|
|
||||||
emailparams[1] = ecnId.ToString();
|
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
|
||||||
//#if(DEBUG)
|
|
||||||
//string SenderEmail = "MesaFabApproval@infineon.com";
|
|
||||||
//userEmail = "jonathan.ouellette@infineon.com";
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
string detailedException = "";
|
string detailedException = "";
|
||||||
try {
|
try {
|
||||||
@ -220,7 +200,6 @@ public class TrainingController : Controller {
|
|||||||
|
|
||||||
public ActionResult ViewTrainingDocsPartial(int trainingAssignmentId) {
|
public ActionResult ViewTrainingDocsPartial(int trainingAssignmentId) {
|
||||||
ViewBag.trainingAssignmentId = trainingAssignmentId;
|
ViewBag.trainingAssignmentId = trainingAssignmentId;
|
||||||
//IEnumerable<TrainingDocAck> attachments = ecnDMO.GetECNAttachments(ecnNumber);
|
|
||||||
IEnumerable<TrainingDocAck> attachments = trainingDMO.GetAssignedDocs(trainingAssignmentId);
|
IEnumerable<TrainingDocAck> attachments = trainingDMO.GetAssignedDocs(trainingAssignmentId);
|
||||||
return PartialView(attachments);
|
return PartialView(attachments);
|
||||||
}
|
}
|
||||||
@ -325,7 +304,6 @@ public class TrainingController : Controller {
|
|||||||
IEnumerable<TrainingAssignment> trainingAssignments = trainingDMO.GetAllTrainingAssignments(trainingID);
|
IEnumerable<TrainingAssignment> trainingAssignments = trainingDMO.GetAllTrainingAssignments(trainingID);
|
||||||
// Calculate Percent Complete:
|
// Calculate Percent Complete:
|
||||||
float percentComplete = 0;
|
float percentComplete = 0;
|
||||||
//float assignmentCount = trainingAssignments.Count();
|
|
||||||
float assignmentCount = (from a in trainingAssignments where a.Deleted != true select a).Count();
|
float assignmentCount = (from a in trainingAssignments where a.Deleted != true select a).Count();
|
||||||
float totalCompleted = 0;
|
float totalCompleted = 0;
|
||||||
foreach (TrainingAssignment assignment in trainingAssignments) {
|
foreach (TrainingAssignment assignment in trainingAssignments) {
|
||||||
@ -367,7 +345,6 @@ public class TrainingController : Controller {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
trainingAssignments = filteredTraining;
|
trainingAssignments = filteredTraining;
|
||||||
//return PartialView(trainingList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PartialView(trainingAssignments);
|
return PartialView(trainingAssignments);
|
||||||
@ -479,7 +456,6 @@ public class TrainingController : Controller {
|
|||||||
public ActionResult ManuallyExecuteECNTraining(int ecnId, int[] trainingGroupsIn) {
|
public ActionResult ManuallyExecuteECNTraining(int ecnId, int[] trainingGroupsIn) {
|
||||||
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||||
List<int> newTrainingGroupIds = new List<int>(trainingGroupsIn);
|
List<int> newTrainingGroupIds = new List<int>(trainingGroupsIn);
|
||||||
//Get ECN
|
|
||||||
ECN ecn = ecnDMO.GetECN(ecnId);
|
ECN ecn = ecnDMO.GetECN(ecnId);
|
||||||
if (ecn != null) {
|
if (ecn != null) {
|
||||||
if (ecn.CloseDate != null) {
|
if (ecn.CloseDate != null) {
|
||||||
@ -546,7 +522,6 @@ public class TrainingController : Controller {
|
|||||||
string userEmail = userDMO.GetUserByID(user.UserId).Email;
|
string userEmail = userDMO.GetUserByID(user.UserId).Email;
|
||||||
emailList.Add(userEmail);
|
emailList.Add(userEmail);
|
||||||
}
|
}
|
||||||
//emailList.Add("Chase.Tucker@infineon.com");
|
|
||||||
// Get a list of open trainings
|
// Get a list of open trainings
|
||||||
List<Training> openTrainings = trainingDMO.GetAllOpenTrainings();
|
List<Training> openTrainings = trainingDMO.GetAllOpenTrainings();
|
||||||
|
|
||||||
|
@ -5,22 +5,17 @@ using System.Net;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Web.Http;
|
using System.Web.Http;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.Misc;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers;
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
public class WebAPIController : ApiController {
|
public class WebAPIController : ApiController {
|
||||||
public TrainingController trainingFunctions = new TrainingController();
|
public TrainingController trainingFunctions = new TrainingController();
|
||||||
public CorrectiveActionController carFunctions;
|
public CorrectiveActionController carFunctions = new CorrectiveActionController();
|
||||||
public AccountController accountFunctions = new AccountController();
|
public AccountController accountFunctions = new AccountController();
|
||||||
public HomeController homeFunctions;
|
public HomeController homeFunctions = new HomeController();
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||||
|
|
||||||
public WebAPIController(AppSettings appSettings) {
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
carFunctions = new CorrectiveActionController(appSettings);
|
|
||||||
homeFunctions = new HomeController(appSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Get() {
|
public string Get() {
|
||||||
return "Welcome To Web API";
|
return "Welcome To Web API";
|
||||||
|
@ -1,33 +1,29 @@
|
|||||||
using Fab2ApprovalSystem.DMO;
|
using System;
|
||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
|
|
||||||
using Kendo.Mvc.Extensions;
|
|
||||||
using Kendo.Mvc.UI;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
using Kendo.Mvc.Extensions;
|
||||||
|
using Kendo.Mvc.UI;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers;
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
public class WorkflowController : Controller {
|
public class WorkflowController : Controller {
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Workflow/Details/5
|
// GET: /Workflow/Details/5
|
||||||
public ActionResult Details(int id) {
|
public ActionResult Details(int id) {
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Workflow/Create
|
// GET: /Workflow/Create
|
||||||
public ActionResult Create() {
|
public ActionResult Create() {
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Workflow/Create
|
// POST: /Workflow/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Create(FormCollection collection) {
|
public ActionResult Create(FormCollection collection) {
|
||||||
@ -40,13 +36,11 @@ public class WorkflowController : Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Workflow/Edit/5
|
// GET: /Workflow/Edit/5
|
||||||
public ActionResult Edit(int id) {
|
public ActionResult Edit(int id) {
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Workflow/Edit/5
|
// POST: /Workflow/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Edit(int id, FormCollection collection) {
|
public ActionResult Edit(int id, FormCollection collection) {
|
||||||
@ -59,13 +53,11 @@ public class WorkflowController : Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Workflow/Delete/5
|
// GET: /Workflow/Delete/5
|
||||||
public ActionResult Delete(int id) {
|
public ActionResult Delete(int id) {
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Workflow/Delete/5
|
// POST: /Workflow/Delete/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Delete(int id, FormCollection collection) {
|
public ActionResult Delete(int id, FormCollection collection) {
|
||||||
|
@ -71,8 +71,6 @@ public class AdminDMO {
|
|||||||
if (!lookup.TryGetValue(parent.RoleID, out role)) {
|
if (!lookup.TryGetValue(parent.RoleID, out role)) {
|
||||||
lookup.Add(parent.RoleID, role = parent);
|
lookup.Add(parent.RoleID, role = parent);
|
||||||
}
|
}
|
||||||
//if (role.RoleID == null)
|
|
||||||
// role.SubRoles = new List<SubRole>();
|
|
||||||
role.SubRoles.Add(child);
|
role.SubRoles.Add(child);
|
||||||
return role;
|
return role;
|
||||||
},
|
},
|
||||||
@ -80,7 +78,7 @@ public class AdminDMO {
|
|||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
///
|
|
||||||
public List<UserSubRoles> GetUserSubRoles(int userId) {
|
public List<UserSubRoles> GetUserSubRoles(int userId) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@UserId", userId);
|
parameters.Add("@UserId", userId);
|
||||||
@ -130,14 +128,17 @@ public class AdminDMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !NET8
|
#if !NET8
|
||||||
public List<TrainingReportUser> GetTrainingReportUsers() {
|
public List<TrainingReportUser> GetTrainingReportUsers() {
|
||||||
List<TrainingReportUser> CurrentReportUsers = (from a in FabApprovalDB.TrainingReportUsers select a).ToList();
|
List<TrainingReportUser> CurrentReportUsers = (from a in FabApprovalDB.TrainingReportUsers select a).ToList();
|
||||||
return CurrentReportUsers;
|
return CurrentReportUsers;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public List<TrainingReportUser> GetTrainingReportUsers() => throw new NotImplementedException();
|
public List<TrainingReportUser> GetTrainingReportUsers() =>
|
||||||
|
throw new NotImplementedException();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !NET8
|
#if !NET8
|
||||||
public List<TECNNotificationsUser> GetTECNNotificationUsers() {
|
public List<TECNNotificationsUser> GetTECNNotificationUsers() {
|
||||||
List<TECNNotificationsUser> currentTECNNotificationUsers = (from a in FabApprovalDB.TECNNotificationsUsers select a).ToList();
|
List<TECNNotificationsUser> currentTECNNotificationUsers = (from a in FabApprovalDB.TECNNotificationsUsers select a).ToList();
|
||||||
@ -164,8 +165,6 @@ public class AdminDMO {
|
|||||||
|
|
||||||
public void TrainingReportDeleteUser(int userId) {
|
public void TrainingReportDeleteUser(int userId) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@UserID", userId);
|
parameters.Add("@UserID", userId);
|
||||||
|
|
||||||
db.Execute("DeleteUserFromTrainingReport", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("DeleteUserFromTrainingReport", parameters, commandType: CommandType.StoredProcedure);
|
||||||
@ -174,25 +173,14 @@ public class AdminDMO {
|
|||||||
|
|
||||||
public void TECNExpirationDeleteUser(int userId) {
|
public void TECNExpirationDeleteUser(int userId) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@UserID", userId);
|
parameters.Add("@UserID", userId);
|
||||||
|
|
||||||
db.Execute("DeleteUserFromTECNReport", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("DeleteUserFromTECNReport", parameters, commandType: CommandType.StoredProcedure);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !NET8
|
#if !NET8
|
||||||
public List<TrainingGroup> GetTrainingGroups() {
|
public List<TrainingGroup> GetTrainingGroups() {
|
||||||
//StringBuilder sql = new StringBuilder();
|
|
||||||
//sql.Append(
|
|
||||||
// "SELECT 'TrainingGroupID', TrainingGroupName " +
|
|
||||||
// "FROM TrainingGroups " +
|
|
||||||
// "ORDER BY TrainingGroupID ");
|
|
||||||
|
|
||||||
//db.Open();
|
|
||||||
//var lookup = new Dictionary<int, TrainingGroup>();
|
|
||||||
////List<TrainingGroup> data = this.db.Query<TrainingGroup>(sql.ToString()
|
|
||||||
//return this.db.Query<TrainingGroup>(sql.ToString()).ToList();
|
|
||||||
var TrainingGroups = from a in FabApprovalDB.TrainingGroups select a;
|
var TrainingGroups = from a in FabApprovalDB.TrainingGroups select a;
|
||||||
List<TrainingGroup> GroupsToReturn = TrainingGroups.ToList();
|
List<TrainingGroup> GroupsToReturn = TrainingGroups.ToList();
|
||||||
|
|
||||||
@ -205,12 +193,10 @@ public class AdminDMO {
|
|||||||
try {
|
try {
|
||||||
existing = (from a in FabApprovalDB.TrainingGroups where a.TrainingGroupName == groupName select a).FirstOrDefault();
|
existing = (from a in FabApprovalDB.TrainingGroups where a.TrainingGroupName == groupName select a).FirstOrDefault();
|
||||||
} catch {
|
} catch {
|
||||||
// string test = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (existing == null) {
|
if (existing == null) {
|
||||||
//string sql = new StringBuilder();
|
|
||||||
string sql = "INSERT INTO TrainingGroups (TrainingGroupName) " + "VALUES ('" + groupName + "') ";
|
string sql = "INSERT INTO TrainingGroups (TrainingGroupName) " + "VALUES ('" + groupName + "') ";
|
||||||
|
|
||||||
this.db.Open();
|
this.db.Open();
|
||||||
@ -234,6 +220,7 @@ public class AdminDMO {
|
|||||||
} catch {
|
} catch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !NET8
|
#if !NET8
|
||||||
public List<TrainingGroupMember> GetTrainingGroupMembers(int GroupID) {
|
public List<TrainingGroupMember> GetTrainingGroupMembers(int GroupID) {
|
||||||
return (from a in FabApprovalDB.TrainingGroupMembers where a.TrainingGroupID == GroupID select a).ToList();
|
return (from a in FabApprovalDB.TrainingGroupMembers where a.TrainingGroupID == GroupID select a).ToList();
|
||||||
@ -259,34 +246,10 @@ public class AdminDMO {
|
|||||||
throw new Exception("The user already exists in this training group.");
|
throw new Exception("The user already exists in this training group.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//if (existing == null)
|
|
||||||
//{
|
|
||||||
// //string sql = new StringBuilder();
|
|
||||||
|
|
||||||
// string sql = "INSERT INTO TrainingGroupMembers (TrainingGroupID, UserID, FullName) " + "VALUES ('" + groupId + "','" + userId + "','" + userFullName + "') ";
|
|
||||||
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// this.db.Open();
|
|
||||||
// this.db.Execute(sql);
|
|
||||||
// }
|
|
||||||
// catch(Exception e)
|
|
||||||
// {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// return;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
public void DeleteFromGroup(int userId, int groupId) {
|
public void DeleteFromGroup(int userId, int groupId) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@GroupID", groupId);
|
parameters.Add("@GroupID", groupId);
|
||||||
parameters.Add("@UserID", userId);
|
parameters.Add("@UserID", userId);
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@ using System.Transactions;
|
|||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
using Fab2ApprovalSystem.Utilities;
|
using Fab2ApprovalSystem.Utilities;
|
||||||
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.DMO;
|
namespace Fab2ApprovalSystem.DMO;
|
||||||
|
|
||||||
public class AuditDMO {
|
public class AuditDMO {
|
||||||
@ -31,8 +29,6 @@ public class AuditDMO {
|
|||||||
|
|
||||||
public Audit InsertAudit(Audit audit) {
|
public Audit InsertAudit(Audit audit) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@AuditNo", value: audit.AuditNo, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@AuditNo", value: audit.AuditNo, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
parameters.Add("@OriginatorID", audit.OriginatorID);
|
parameters.Add("@OriginatorID", audit.OriginatorID);
|
||||||
|
|
||||||
@ -50,9 +46,6 @@ public class AuditDMO {
|
|||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@AuditNo", value: auditNo);
|
parameters.Add("@AuditNo", value: auditNo);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
//parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
|
||||||
|
|
||||||
//audit = this.db.Query<Audit>("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure).Single();
|
|
||||||
|
|
||||||
using (var multipleResultItems = db.QueryMultiple("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure)) {
|
using (var multipleResultItems = db.QueryMultiple("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure)) {
|
||||||
audit = multipleResultItems.Read<Audit>().SingleOrDefault();
|
audit = multipleResultItems.Read<Audit>().SingleOrDefault();
|
||||||
@ -76,29 +69,15 @@ public class AuditDMO {
|
|||||||
audit.AuditedAreaIDs.AddRange(auditorAreas);
|
audit.AuditedAreaIDs.AddRange(auditorAreas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//FabApprovalSystemEntitiesAll auditDb = new FabApprovalSystemEntitiesAll();
|
|
||||||
|
|
||||||
//var auditedStandardIDs = (from a in auditDb.C_8DAuditedStandardByAudit where a.AuditNo == audit.AuditNo select a.AuditedStandardID).ToList();
|
|
||||||
|
|
||||||
//foreach (var id in auditedStandardIDs)
|
|
||||||
//{
|
|
||||||
// audit.AuditedStandardIDs.Add(id);
|
|
||||||
//}
|
|
||||||
|
|
||||||
return audit;
|
return audit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Audit GetAuditItemReadOnly(int auditNo, int userID) {
|
public Audit GetAuditItemReadOnly(int auditNo, int userID) {
|
||||||
Audit audit = new();
|
Audit audit = new();
|
||||||
|
|
||||||
//isITAR = 2;
|
|
||||||
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@AuditNo", value: auditNo);
|
parameters.Add("@AuditNo", value: auditNo);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
//parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
|
||||||
|
|
||||||
//audit = this.db.Query<Audit>("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure).Single();
|
|
||||||
|
|
||||||
using (var multipleResultItems = db.QueryMultiple("_8DGetAuditItemReadOnly", parameters, commandType: CommandType.StoredProcedure)) {
|
using (var multipleResultItems = db.QueryMultiple("_8DGetAuditItemReadOnly", parameters, commandType: CommandType.StoredProcedure)) {
|
||||||
audit = multipleResultItems.Read<Audit>().SingleOrDefault();
|
audit = multipleResultItems.Read<Audit>().SingleOrDefault();
|
||||||
@ -164,11 +143,9 @@ public class AuditDMO {
|
|||||||
try {
|
try {
|
||||||
parameters.Add("AuditNo", audit.AuditNo);
|
parameters.Add("AuditNo", audit.AuditNo);
|
||||||
parameters.Add("Title", audit.AuditTitle);
|
parameters.Add("Title", audit.AuditTitle);
|
||||||
//parameters.Add("AuditTypeID", audit.AuditTypeID);
|
|
||||||
parameters.Add("AuditDate", audit.AuditDate);
|
parameters.Add("AuditDate", audit.AuditDate);
|
||||||
parameters.Add("AuditStatus", audit.AuditStatus);
|
parameters.Add("AuditStatus", audit.AuditStatus);
|
||||||
parameters.Add("AuditScore", audit.AuditScore);
|
parameters.Add("AuditScore", audit.AuditScore);
|
||||||
//parameters.Add("AuditedAreaID", audit.AuditedAreaID);
|
|
||||||
parameters.Add("Auditees", audit.Auditees);
|
parameters.Add("Auditees", audit.Auditees);
|
||||||
db.Execute("_8DUpdateAudit", param: parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DUpdateAudit", param: parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
@ -218,31 +195,6 @@ public class AuditDMO {
|
|||||||
throw new Exception(ex.Message + " " + ex.InnerException);
|
throw new Exception(ex.Message + " " + ex.InnerException);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//FabApprovalSystemEntitiesAll auditDb = new FabApprovalSystemEntitiesAll();
|
|
||||||
|
|
||||||
//List<int> auditedStandards = audit.AuditedStandardIDs;
|
|
||||||
//if (auditedStandards != null)
|
|
||||||
//{
|
|
||||||
// foreach (int auditedStandard in auditedStandards)
|
|
||||||
// {
|
|
||||||
// var auditStandardExists = (from a in auditDb.C_8DAuditedStandardByAudit where a.AuditNo == audit.AuditNo && a.AuditedStandardID == auditedStandard select a).ToList();
|
|
||||||
// if (auditStandardExists.Count() <= 0)
|
|
||||||
// {
|
|
||||||
// C_8DAuditedStandardByAudit standard = new C_8DAuditedStandardByAudit
|
|
||||||
// {
|
|
||||||
// AuditNo = audit.AuditNo,
|
|
||||||
// AuditedStandardID = auditedStandard
|
|
||||||
// };
|
|
||||||
// auditDb.C_8DAuditedStandardByAudit.Add(standard);
|
|
||||||
// auditDb.SaveChanges();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//parameters = new DynamicParameters();
|
|
||||||
//parameters.Add("AuditNo", audit.AuditNo);
|
|
||||||
//this.db.Execute("_8DUpdateAuditScore", parameters, commandType: CommandType.StoredProcedure);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<AuditReportAttachment> GetAuditReportAttachments(int auditNo) {
|
public IEnumerable<AuditReportAttachment> GetAuditReportAttachments(int auditNo) {
|
||||||
@ -486,23 +438,6 @@ public class AuditDMO {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> GetFileNameAndDocument(string fileGuid, int auditNo) {
|
|
||||||
List<string> results = new();
|
|
||||||
string fileName = GetAuditReportAttachmentFileName(fileGuid);
|
|
||||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
|
||||||
|
|
||||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "Audit\\" + auditNo.ToString();
|
|
||||||
string sDocument = Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
|
||||||
|
|
||||||
string FDir_AppData = _AppSettings.AttachmentFolder;
|
|
||||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
|
||||||
sDocument = string.Empty;
|
|
||||||
}
|
|
||||||
results.Add(fileName);
|
|
||||||
results.Add(sDocument);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Audit InsertAndGetAudit(CorrectiveActionDMO caDMO, AuditFindings data, int userID) {
|
public Audit InsertAndGetAudit(CorrectiveActionDMO caDMO, AuditFindings data, int userID) {
|
||||||
Audit audit = new();
|
Audit audit = new();
|
||||||
InsertAuditFindingsItem(data);
|
InsertAuditFindingsItem(data);
|
||||||
@ -542,72 +477,9 @@ public class AuditDMO {
|
|||||||
return audit;
|
return audit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AuditReportAttachSave(int auditNo, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var ccPhysicalPath = _AppSettings.AttachmentFolder + @"Audit\" + auditNo;
|
|
||||||
di = new DirectoryInfo(ccPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"Audit\" + auditNo + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
AuditReportAttachment attach = new() {
|
|
||||||
AuditNo = auditNo,
|
|
||||||
FileGUID = guid,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
//ccDMO.InsertCCAttachment(attach);
|
|
||||||
InsertAuditReportAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveAndInsert(int caFindingsID, int auditNo, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var ccPhysicalPath = _AppSettings.AttachmentFolder + @"Audit\" + auditNo;
|
|
||||||
di = new DirectoryInfo(ccPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"Audit\" + auditNo + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
AuditReportAttachment attach = new() {
|
|
||||||
CAFindingsID = caFindingsID,
|
|
||||||
AuditNo = auditNo,
|
|
||||||
FileGUID = guid,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
InsertAuditReportAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string NotifyActionItemOwner(int issueID, DateTime? dueDate, int? responsibleOwnerID, string emailTemplatesPath) {
|
public string NotifyActionItemOwner(int issueID, DateTime? dueDate, int? responsibleOwnerID, string emailTemplatesPath) {
|
||||||
string emailSentList = "";
|
string emailSentList = "";
|
||||||
|
|
||||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
|
||||||
string email = MiscDMO.GetEmail(responsibleOwnerID);
|
string email = MiscDMO.GetEmail(responsibleOwnerID);
|
||||||
|
|
||||||
string emailTemplate = "CorrectiveActionFindingAssigned.txt";
|
string emailTemplate = "CorrectiveActionFindingAssigned.txt";
|
||||||
|
@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Transactions;
|
using System.Transactions;
|
||||||
|
|
||||||
@ -16,12 +15,8 @@ namespace Fab2ApprovalSystem.DMO;
|
|||||||
|
|
||||||
public class ChangeControlDMO {
|
public class ChangeControlDMO {
|
||||||
|
|
||||||
private readonly AppSettings _AppSettings;
|
|
||||||
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
public ChangeControlDMO(AppSettings appSettings) =>
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
|
|
||||||
internal ChangeControlViewModel InsertChangeControl(ChangeControlViewModel cc) {
|
internal ChangeControlViewModel InsertChangeControl(ChangeControlViewModel cc) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@PlanNumber", value: cc.PlanNumber, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@PlanNumber", value: cc.PlanNumber, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
@ -40,42 +35,14 @@ public class ChangeControlDMO {
|
|||||||
parameters.Add("@planNumber", planNumber);
|
parameters.Add("@planNumber", planNumber);
|
||||||
|
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
//parameters.Add("@UserID", GlobalVars.USER_ID);
|
|
||||||
parameters.Add("@CanViewITAR", value: canViewITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@CanViewITAR", value: canViewITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
|
|
||||||
//cc = this.db.Query<ChangeControlViewModel>("CCGetChangeControl", parameters, commandType: CommandType.StoredProcedure).SingleOrDefault();
|
|
||||||
|
|
||||||
using (var multipleResultItems = db.QueryMultiple("CCGetChangeControl", parameters, commandType: CommandType.StoredProcedure)) {
|
using (var multipleResultItems = db.QueryMultiple("CCGetChangeControl", parameters, commandType: CommandType.StoredProcedure)) {
|
||||||
ccItem = multipleResultItems.Read<ChangeControlViewModel>().SingleOrDefault();
|
ccItem = multipleResultItems.Read<ChangeControlViewModel>().SingleOrDefault();
|
||||||
|
|
||||||
List<int> gens = multipleResultItems.Read<int>().ToList();
|
List<int> gens = multipleResultItems.Read<int>().ToList();
|
||||||
//if (ccItem != null && gens != null)
|
|
||||||
//{
|
|
||||||
// if (gens.Count > 0)
|
|
||||||
// ccItem.GenerationIDs.AddRange(gens);
|
|
||||||
//}
|
|
||||||
|
|
||||||
List<int> logis = multipleResultItems.Read<int>().ToList();
|
List<int> logis = multipleResultItems.Read<int>().ToList();
|
||||||
//if (ccItem != null && logis != null)
|
|
||||||
//{
|
|
||||||
// if (logis.Count > 0)
|
|
||||||
// ccItem.LogisticsIDs.AddRange(logis);
|
|
||||||
//}
|
|
||||||
|
|
||||||
List<int> procs = multipleResultItems.Read<int>().ToList();
|
List<int> procs = multipleResultItems.Read<int>().ToList();
|
||||||
//if (ccItem != null && procs != null)
|
|
||||||
//{
|
|
||||||
// if (procs.Count > 0)
|
|
||||||
// ccItem.ProcessIDs.AddRange(procs);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//var parts = multipleResultItems.Read<string>().ToList();
|
|
||||||
//if (ccItem != null && parts != null)
|
|
||||||
//{
|
|
||||||
// if (parts.Count > 0)
|
|
||||||
// ccItem.PartNumberIDs.AddRange(parts);
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return ccItem;
|
return ccItem;
|
||||||
}
|
}
|
||||||
@ -87,49 +54,14 @@ public class ChangeControlDMO {
|
|||||||
parameters.Add("@planNumber", planNumber);
|
parameters.Add("@planNumber", planNumber);
|
||||||
|
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
//parameters.Add("@UserID", GlobalVars.USER_ID);
|
|
||||||
parameters.Add("@CanViewITAR", value: canViewITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@CanViewITAR", value: canViewITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
|
|
||||||
//cc = this.db.Query<ChangeControlViewModel>("CCGetChangeControl", parameters, commandType: CommandType.StoredProcedure).SingleOrDefault();
|
|
||||||
|
|
||||||
using (var multipleResultItems = db.QueryMultiple("CCGetChangeControlRead", parameters, commandType: CommandType.StoredProcedure)) {
|
using (var multipleResultItems = db.QueryMultiple("CCGetChangeControlRead", parameters, commandType: CommandType.StoredProcedure)) {
|
||||||
ccItem = multipleResultItems.Read<ChangeControlViewModel>().SingleOrDefault();
|
ccItem = multipleResultItems.Read<ChangeControlViewModel>().SingleOrDefault();
|
||||||
|
|
||||||
List<int> gens = multipleResultItems.Read<int>().ToList();
|
List<int> gens = multipleResultItems.Read<int>().ToList();
|
||||||
//if (ccItem != null && gens != null)
|
|
||||||
//{
|
|
||||||
// if (gens.Count > 0)
|
|
||||||
// ccItem.GenerationIDs.AddRange(gens);
|
|
||||||
//}
|
|
||||||
|
|
||||||
List<int> logis = multipleResultItems.Read<int>().ToList();
|
List<int> logis = multipleResultItems.Read<int>().ToList();
|
||||||
//if (ccItem != null && logis != null)
|
|
||||||
//{
|
|
||||||
// if (logis.Count > 0)
|
|
||||||
// ccItem.LogisticsIDs.AddRange(logis);
|
|
||||||
//}
|
|
||||||
|
|
||||||
List<int> procs = multipleResultItems.Read<int>().ToList();
|
List<int> procs = multipleResultItems.Read<int>().ToList();
|
||||||
//if (ccItem != null && procs != null)
|
|
||||||
//{
|
|
||||||
// if (procs.Count > 0)
|
|
||||||
// ccItem.ProcessIDs.AddRange(procs);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//var tools = multipleResultItems.Read<int>().ToList();
|
|
||||||
//if (ccItem != null && tools != null)
|
|
||||||
//{
|
|
||||||
// if (tools.Count > 0)
|
|
||||||
// ccItem.ToolTypeIDs.AddRange(tools);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//var parts = multipleResultItems.Read<string>().ToList();
|
|
||||||
//if (ccItem != null && parts != null)
|
|
||||||
//{
|
|
||||||
// if (parts.Count > 0)
|
|
||||||
// ccItem.PartNumberIDs.AddRange(parts);
|
|
||||||
//}
|
|
||||||
|
|
||||||
canViewITAR = parameters.Get<int>("@CanViewITAR");
|
canViewITAR = parameters.Get<int>("@CanViewITAR");
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -147,13 +79,6 @@ public class ChangeControlDMO {
|
|||||||
return db.Query<CCLogistics>("CCGetLogistics", commandType: CommandType.StoredProcedure).ToList();
|
return db.Query<CCLogistics>("CCGetLogistics", commandType: CommandType.StoredProcedure).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <returns></returns>
|
|
||||||
//internal List<CCToolType> GetToolTypes()
|
|
||||||
//{
|
|
||||||
// var parameters = new DynamicParameters();
|
|
||||||
// return this.db.Query<CCToolType>("CCGetToolTypes", commandType: CommandType.StoredProcedure).ToList();
|
|
||||||
//}
|
|
||||||
|
|
||||||
internal List<CCProcess> GetProcesses() {
|
internal List<CCProcess> GetProcesses() {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
return db.Query<CCProcess>("CCGetProcesses", commandType: CommandType.StoredProcedure).ToList();
|
return db.Query<CCProcess>("CCGetProcesses", commandType: CommandType.StoredProcedure).ToList();
|
||||||
@ -175,73 +100,12 @@ public class ChangeControlDMO {
|
|||||||
parameters.Add("@IsMedical", model.IsMedical);
|
parameters.Add("@IsMedical", model.IsMedical);
|
||||||
parameters.Add("@IsRadHard", model.IsRadHard);
|
parameters.Add("@IsRadHard", model.IsRadHard);
|
||||||
parameters.Add("@Notes", model.Notes);
|
parameters.Add("@Notes", model.Notes);
|
||||||
//parameters.Add("@PartNumbers", model.PartNumbers);
|
|
||||||
parameters.Add("@IsAutomotive", model.IsAutomotive);
|
parameters.Add("@IsAutomotive", model.IsAutomotive);
|
||||||
//parameters.Add("@ToolTypes", model.ToolTypes);
|
|
||||||
parameters.Add("@Title", model.Title);
|
parameters.Add("@Title", model.Title);
|
||||||
parameters.Add("@ReasonForChange", model.ReasonForChange);
|
parameters.Add("@ReasonForChange", model.ReasonForChange);
|
||||||
parameters.Add("@ChangeDescription", model.ChangeDescription);
|
parameters.Add("@ChangeDescription", model.ChangeDescription);
|
||||||
db.Execute("CCUpdateChangeControl", param: parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("CCUpdateChangeControl", param: parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
//parameters = new DynamicParameters();
|
|
||||||
//parameters.Add("@PlanNumber", model.PlanNumber);
|
|
||||||
//this.db.Execute("CCDeleteGenerations", parameters, commandType: CommandType.StoredProcedure);
|
|
||||||
//List<int> gens = model.GenerationIDs;
|
|
||||||
//if (gens != null)
|
|
||||||
//{
|
|
||||||
// foreach (int genId in gens)
|
|
||||||
// {
|
|
||||||
// parameters = new DynamicParameters();
|
|
||||||
// parameters.Add("@PlanNumber", model.PlanNumber);
|
|
||||||
// parameters.Add("@GenerationID", genId);
|
|
||||||
// this.db.Execute("CCInsertGeneration", parameters, commandType: CommandType.StoredProcedure);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//parameters = new DynamicParameters();
|
|
||||||
//parameters.Add("@PlanNumber", model.PlanNumber);
|
|
||||||
//this.db.Execute("CCDeleteLogistics", parameters, commandType: CommandType.StoredProcedure);
|
|
||||||
//List<int> logistics = model.LogisticsIDs;
|
|
||||||
//if (logistics != null)
|
|
||||||
//{
|
|
||||||
// foreach (int logisticsId in logistics)
|
|
||||||
// {
|
|
||||||
// parameters = new DynamicParameters();
|
|
||||||
// parameters.Add("@PlanNumber", model.PlanNumber);
|
|
||||||
// parameters.Add("@LogisticsID", logisticsId);
|
|
||||||
// this.db.Execute("CCInsertLogistics", parameters, commandType: CommandType.StoredProcedure);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//parameters = new DynamicParameters();
|
|
||||||
//parameters.Add("@PlanNumber", model.PlanNumber);
|
|
||||||
//this.db.Execute("CCDeleteProcesses", parameters, commandType: CommandType.StoredProcedure);
|
|
||||||
//List<int> processes = model.ProcessIDs;
|
|
||||||
//if (processes != null)
|
|
||||||
//{
|
|
||||||
// foreach (int processId in processes)
|
|
||||||
// {
|
|
||||||
// parameters = new DynamicParameters();
|
|
||||||
// parameters.Add("@PlanNumber", model.PlanNumber);
|
|
||||||
// parameters.Add("@ProcessID", processId);
|
|
||||||
// this.db.Execute("CCInsertProcess", parameters, commandType: CommandType.StoredProcedure);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//parameters = new DynamicParameters();
|
|
||||||
//parameters.Add("@PlanNumber", model.PlanNumber);
|
|
||||||
//this.db.Execute("CCDeletePartNumbers", parameters, commandType: CommandType.StoredProcedure);
|
|
||||||
//if (model.PartNumbers != null)
|
|
||||||
//{
|
|
||||||
// string[] parts = model.PartNumbers.Split(new char[] { ',' });
|
|
||||||
// foreach (string part in parts)
|
|
||||||
// {
|
|
||||||
// parameters = new DynamicParameters();
|
|
||||||
// parameters.Add("@PlanNumber", model.PlanNumber);
|
|
||||||
// parameters.Add("@PartNumber", part);
|
|
||||||
// this.db.Execute("CCInsertPartNumber", parameters, commandType: CommandType.StoredProcedure);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
transaction.Complete();
|
transaction.Complete();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
transaction.Dispose();
|
transaction.Dispose();
|
||||||
@ -330,7 +194,6 @@ public class ChangeControlDMO {
|
|||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
parameters.Add("@CanViewITAR", value: canViewITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@CanViewITAR", value: canViewITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
|
|
||||||
//ccMeeting = this.db.Query<CCMeeting>("CCGetMeeting", parameters, commandType: CommandType.StoredProcedure).Single();
|
|
||||||
using (var multipleResultItems = db.QueryMultiple("CCGetMeetingRead", parameters, commandType: CommandType.StoredProcedure)) {
|
using (var multipleResultItems = db.QueryMultiple("CCGetMeetingRead", parameters, commandType: CommandType.StoredProcedure)) {
|
||||||
ccMeeting = multipleResultItems.Read<CCMeeting>().SingleOrDefault();
|
ccMeeting = multipleResultItems.Read<CCMeeting>().SingleOrDefault();
|
||||||
List<string> pcrvalues = multipleResultItems.Read<string>().ToList();
|
List<string> pcrvalues = multipleResultItems.Read<string>().ToList();
|
||||||
@ -351,7 +214,6 @@ public class ChangeControlDMO {
|
|||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
parameters.Add("@CanViewITAR", value: canViewITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@CanViewITAR", value: canViewITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
|
|
||||||
//ccMeeting = this.db.Query<CCMeeting>("CCGetMeetingRead", parameters, commandType: CommandType.StoredProcedure).Single();
|
|
||||||
using (var multipleResultItems = db.QueryMultiple("CCGetMeetingRead", parameters, commandType: CommandType.StoredProcedure)) {
|
using (var multipleResultItems = db.QueryMultiple("CCGetMeetingRead", parameters, commandType: CommandType.StoredProcedure)) {
|
||||||
ccMeeting = multipleResultItems.Read<CCMeeting>().SingleOrDefault();
|
ccMeeting = multipleResultItems.Read<CCMeeting>().SingleOrDefault();
|
||||||
List<string> pcrvalues = multipleResultItems.Read<string>().ToList();
|
List<string> pcrvalues = multipleResultItems.Read<string>().ToList();
|
||||||
@ -376,7 +238,6 @@ public class ChangeControlDMO {
|
|||||||
int result = 0;
|
int result = 0;
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@MeetingID", meeting.MeetingID);
|
parameters.Add("@MeetingID", meeting.MeetingID);
|
||||||
//parameters.Add("@PCRB", meeting.PCRB.ToUpper() == "SELECT" ? null : meeting.PCRB);
|
|
||||||
parameters.Add("@Decision", meeting.Decision);
|
parameters.Add("@Decision", meeting.Decision);
|
||||||
parameters.Add("@MeetingDate", meeting.MeetingDate);
|
parameters.Add("@MeetingDate", meeting.MeetingDate);
|
||||||
parameters.Add("@Notes", meeting.Notes);
|
parameters.Add("@Notes", meeting.Notes);
|
||||||
@ -526,9 +387,6 @@ public class ChangeControlDMO {
|
|||||||
parameters.Add("@Site", siteName);
|
parameters.Add("@Site", siteName);
|
||||||
db.Execute("CCInsertNewMeetingAttendee", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("CCInsertNewMeetingAttendee", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// /
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
internal void UpdateMeetingAttendee(int id, string attendeeName, string jobTitle, string siteName) {
|
internal void UpdateMeetingAttendee(int id, string attendeeName, string jobTitle, string siteName) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
@ -538,9 +396,6 @@ public class ChangeControlDMO {
|
|||||||
parameters.Add("@Site", siteName);
|
parameters.Add("@Site", siteName);
|
||||||
db.Execute("CCUpdateMeetingAttendee", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("CCUpdateMeetingAttendee", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// /
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
internal void UpdatePCRBAttendee(int id, int attendeeID, string jobTitle, string siteName) {
|
internal void UpdatePCRBAttendee(int id, int attendeeID, string jobTitle, string siteName) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
@ -593,10 +448,6 @@ public class ChangeControlDMO {
|
|||||||
db.Execute("CCUpdateMeetingActionItem_All", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("CCUpdateMeetingActionItem_All", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// /
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
internal void InsertMeetingActionItem(CCMeetingActionItem meetingActionItem) {
|
internal void InsertMeetingActionItem(CCMeetingActionItem meetingActionItem) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@MeetingID", meetingActionItem.MeetingID);
|
parameters.Add("@MeetingID", meetingActionItem.MeetingID);
|
||||||
@ -626,10 +477,6 @@ public class ChangeControlDMO {
|
|||||||
db.Execute("CCInsertPCRBActionItem", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("CCInsertPCRBActionItem", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// /
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
internal void UpdateMeetingActionItem(CCMeetingActionItem meetingActionItem) {
|
internal void UpdateMeetingActionItem(CCMeetingActionItem meetingActionItem) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@ID", meetingActionItem.ID);
|
parameters.Add("@ID", meetingActionItem.ID);
|
||||||
@ -659,20 +506,6 @@ public class ChangeControlDMO {
|
|||||||
db.Execute("CCUpdateMeetingActionItemRespPersons", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("CCUpdateMeetingActionItemRespPersons", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
/////
|
|
||||||
///// </summary>
|
|
||||||
//
|
|
||||||
//internal void UpdateMeetingActionItemAll(CCMeetingActionItemAll meetingActionItem)
|
|
||||||
//{
|
|
||||||
// var parameters = new DynamicParameters();
|
|
||||||
// parameters.Add("@ID", meetingActionItem.ID);
|
|
||||||
// parameters.Add("@Updates", meetingActionItem.Updates);
|
|
||||||
// parameters.Add("@ClosedStatus", meetingActionItem.ClosedStatus);
|
|
||||||
// parameters.Add("@UserID", meetingActionItem.ClosedBy);
|
|
||||||
// this.db.Execute("CCUpdateMeetingActionItem_All", parameters, commandType: CommandType.StoredProcedure);
|
|
||||||
//}
|
|
||||||
|
|
||||||
internal void DeleteMeetingActionItem(CCMeetingActionItem meetingAttendee) {
|
internal void DeleteMeetingActionItem(CCMeetingActionItem meetingAttendee) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@ID", meetingAttendee.ID);
|
parameters.Add("@ID", meetingAttendee.ID);
|
||||||
@ -730,9 +563,6 @@ public class ChangeControlDMO {
|
|||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
internal List<UserList> GetUsers() {
|
internal List<UserList> GetUsers() {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
return db.Query<UserList>("CCGetUsers", commandType: CommandType.StoredProcedure).ToList();
|
return db.Query<UserList>("CCGetUsers", commandType: CommandType.StoredProcedure).ToList();
|
||||||
@ -778,97 +608,4 @@ public class ChangeControlDMO {
|
|||||||
db.Execute("CCReassignOwner", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("CCReassignOwner", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AttachSaveCC(int planNumber, int attachID, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var ccPhysicalPath = _AppSettings.AttachmentFolder + @"ChangeControl\" + planNumber;
|
|
||||||
di = new DirectoryInfo(ccPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"ChangeControl\" + planNumber + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
CCAttachment attach = new() {
|
|
||||||
ID = attachID,
|
|
||||||
FileGUID = guid,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId
|
|
||||||
// Title = title,
|
|
||||||
// RequirementsNotes = requirementsNotes
|
|
||||||
};
|
|
||||||
|
|
||||||
// InsertCCAttachment(attach);
|
|
||||||
UpdateCCAttachmentDocument(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AttachSaveMeeting(int planNumber, int attachID, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var ccPhysicalPath = _AppSettings.AttachmentFolder + @"ChangeControl\" + planNumber;
|
|
||||||
di = new DirectoryInfo(ccPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"ChangeControl\" + planNumber + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
CCMeetingAttachment attach = new() {
|
|
||||||
ID = attachID,
|
|
||||||
FileGUID = guid,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId
|
|
||||||
};
|
|
||||||
|
|
||||||
// InsertCCAttachment(attach);
|
|
||||||
UpdateMeetingAttachmentDocument(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AttachSaveActionItem(int planNumber, int attachID, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var ccPhysicalPath = _AppSettings.AttachmentFolder + @"ChangeControl\" + planNumber;
|
|
||||||
di = new DirectoryInfo(ccPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"ChangeControl\" + planNumber + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
CCMeetingActionItemAll attach = new() {
|
|
||||||
ID = attachID,
|
|
||||||
FileGUID = guid,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// InsertCCAttachment(attach);
|
|
||||||
UpdateActionItemAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Transactions;
|
using System.Transactions;
|
||||||
|
|
||||||
@ -16,17 +15,12 @@ namespace Fab2ApprovalSystem.DMO;
|
|||||||
|
|
||||||
public class CorrectiveActionDMO {
|
public class CorrectiveActionDMO {
|
||||||
|
|
||||||
private readonly AppSettings _AppSettings;
|
|
||||||
private readonly WorkflowDMO wfDMO = new();
|
private readonly WorkflowDMO wfDMO = new();
|
||||||
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
public CorrectiveActionDMO(AppSettings appSettings) =>
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
|
|
||||||
public CorrectiveAction InsertCA(CorrectiveAction ca) {
|
public CorrectiveAction InsertCA(CorrectiveAction ca) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@CANo", value: ca.CANo, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@CANo", value: ca.CANo, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
parameters.Add("@RequestorID", ca.RequestorID);
|
parameters.Add("@RequestorID", ca.RequestorID);
|
||||||
|
|
||||||
@ -151,8 +145,6 @@ public class CorrectiveActionDMO {
|
|||||||
public CorrectiveAction GetCAItem(int caNo, int userID) {
|
public CorrectiveAction GetCAItem(int caNo, int userID) {
|
||||||
CorrectiveAction ca = new();
|
CorrectiveAction ca = new();
|
||||||
|
|
||||||
//isITAR = 2;
|
|
||||||
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@CANo", value: caNo);
|
parameters.Add("@CANo", value: caNo);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
@ -185,8 +177,6 @@ public class CorrectiveActionDMO {
|
|||||||
public CorrectiveAction GetCAItemReadOnly(int caNo, int userID) {
|
public CorrectiveAction GetCAItemReadOnly(int caNo, int userID) {
|
||||||
CorrectiveAction ca = new();
|
CorrectiveAction ca = new();
|
||||||
|
|
||||||
//isITAR = 2;
|
|
||||||
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@CANo", value: caNo);
|
parameters.Add("@CANo", value: caNo);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
@ -512,8 +502,6 @@ public class CorrectiveActionDMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void StartSectionApproval(int issueID, int userID, string DSection) {
|
public void StartSectionApproval(int issueID, int userID, string DSection) {
|
||||||
//string subRoles = wfDMO.GetSubRoleItems(issueID, (int)GlobalVars.DocumentType.CorrectiveActionSection);
|
|
||||||
|
|
||||||
// bubble the error
|
// bubble the error
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@CANo", issueID);
|
parameters.Add("@CANo", issueID);
|
||||||
@ -524,8 +512,6 @@ public class CorrectiveActionDMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void ApproveSection(int issueID, int userID, string DSection) {
|
public void ApproveSection(int issueID, int userID, string DSection) {
|
||||||
//string subRoles = wfDMO.GetSubRoleItems(issueID, (int)GlobalVars.DocumentType.CorrectiveActionSection);
|
|
||||||
|
|
||||||
// bubble the error
|
// bubble the error
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
@ -550,8 +536,6 @@ public class CorrectiveActionDMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void RejectSection(int issueID, int userID, string DSection, string comments) {
|
public void RejectSection(int issueID, int userID, string DSection, string comments) {
|
||||||
//string subRoles = wfDMO.GetSubRoleItems(issueID, (int)GlobalVars.DocumentType.CorrectiveActionSection);
|
|
||||||
|
|
||||||
// bubble the error
|
// bubble the error
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
@ -643,131 +627,4 @@ public class CorrectiveActionDMO {
|
|||||||
return ecnList;
|
return ecnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AttachSave(int caNo, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var ccPhysicalPath = _AppSettings.AttachmentFolder + @"CorrectiveAction\" + caNo;
|
|
||||||
di = new DirectoryInfo(ccPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"CorrectiveAction\" + caNo + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
CA_Attachment attach = new() {
|
|
||||||
CANo = caNo,
|
|
||||||
FileGUID = guid,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId,
|
|
||||||
Section = Functions.CASectionMapper(GlobalVars.CASection.Main)
|
|
||||||
};
|
|
||||||
|
|
||||||
// InsertCCAttachment(attach);
|
|
||||||
InsertCAAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void D4FilesAttachSave(int caNo, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var ccPhysicalPath = _AppSettings.AttachmentFolder + @"CorrectiveAction\" + caNo;
|
|
||||||
di = new DirectoryInfo(ccPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"CorrectiveAction\" + caNo + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
CA_Attachment attach = new() {
|
|
||||||
CANo = caNo,
|
|
||||||
FileGUID = guid,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId,
|
|
||||||
Section = Functions.CASectionMapper(GlobalVars.CASection.D4)
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
//InsertCCAttachment(attach);
|
|
||||||
InsertCAAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveD7PA_Attachemnt(int d7PAID, int caNo, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var ccPhysicalPath = _AppSettings.AttachmentFolder + @"CorrectiveAction\" + caNo;
|
|
||||||
di = new DirectoryInfo(ccPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"CorrectiveAction\" + caNo + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
CA_Attachment attach = new() {
|
|
||||||
D7PAID = d7PAID,
|
|
||||||
CANo = caNo,
|
|
||||||
FileGUID = guid,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId,
|
|
||||||
Section = Functions.CASectionMapper(GlobalVars.CASection.D7)
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
InsertCAAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveD5D6CA_Attachemnt(int d5d6CAID, int caNo, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var ccPhysicalPath = _AppSettings.AttachmentFolder + @"CorrectiveAction\" + caNo;
|
|
||||||
di = new DirectoryInfo(ccPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"CorrectiveAction\" + caNo + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
CA_Attachment attach = new() {
|
|
||||||
D5D6CAID = d5d6CAID,
|
|
||||||
CANo = caNo,
|
|
||||||
FileGUID = guid,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId,
|
|
||||||
Section = Functions.CASectionMapper(GlobalVars.CASection.D5)
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
InsertCAAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Transactions;
|
using System.Transactions;
|
||||||
@ -21,8 +20,6 @@ public class ECN_DMO {
|
|||||||
|
|
||||||
internal ECN InsertECN(ECN ecn) {
|
internal ECN InsertECN(ECN ecn) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@ECNNumber", value: ecn.ECNNumber, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@ECNNumber", value: ecn.ECNNumber, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
parameters.Add("@OriginatorID", ecn.OriginatorID);
|
parameters.Add("@OriginatorID", ecn.OriginatorID);
|
||||||
|
|
||||||
@ -33,12 +30,6 @@ public class ECN_DMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void UpdateECN(ECN ecn) {
|
internal void UpdateECN(ECN ecn) {
|
||||||
//ECN temp = GetECN(ecn.ECNNumber);
|
|
||||||
//if (temp.Equals(ecn))
|
|
||||||
//{
|
|
||||||
// string s = "good to go...";
|
|
||||||
//}
|
|
||||||
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
using (TransactionScope transanction = new()) {
|
using (TransactionScope transanction = new()) {
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
@ -203,11 +194,8 @@ public class ECN_DMO {
|
|||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@ECNNumber", value: ecnNumber);
|
parameters.Add("@ECNNumber", value: ecnNumber);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
//parameters.Add("@UserID", GlobalVars.USER_ID);
|
|
||||||
parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
|
|
||||||
//StringBuilder query = new StringBuilder("ECNGetItem");
|
|
||||||
|
|
||||||
using (var multipleResultItems = db.QueryMultiple("ECNGetItem", parameters, commandType: CommandType.StoredProcedure)) {
|
using (var multipleResultItems = db.QueryMultiple("ECNGetItem", parameters, commandType: CommandType.StoredProcedure)) {
|
||||||
ecnItem = multipleResultItems.Read<ECN>().SingleOrDefault();
|
ecnItem = multipleResultItems.Read<ECN>().SingleOrDefault();
|
||||||
|
|
||||||
@ -285,11 +273,8 @@ public class ECN_DMO {
|
|||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@ECNNumber", value: ecnNumber);
|
parameters.Add("@ECNNumber", value: ecnNumber);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
//parameters.Add("@UserID", GlobalVars.USER_ID);
|
|
||||||
parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
|
|
||||||
//StringBuilder query = new StringBuilder("ECNGetItem");
|
|
||||||
|
|
||||||
using (var multipleResultItems = db.QueryMultiple("ECNGetItemForRead", parameters, commandType: CommandType.StoredProcedure)) {
|
using (var multipleResultItems = db.QueryMultiple("ECNGetItemForRead", parameters, commandType: CommandType.StoredProcedure)) {
|
||||||
ecnItem = multipleResultItems.Read<ECN>().SingleOrDefault();
|
ecnItem = multipleResultItems.Read<ECN>().SingleOrDefault();
|
||||||
|
|
||||||
@ -347,25 +332,11 @@ public class ECN_DMO {
|
|||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@ECNNumber", value: ecnNumber);
|
parameters.Add("@ECNNumber", value: ecnNumber);
|
||||||
|
|
||||||
//StringBuilder query = new StringBuilder("ECNGetItem");
|
|
||||||
|
|
||||||
using (var multipleResultItems = db.QueryMultiple("ECNGetPdfItem", parameters, commandType: CommandType.StoredProcedure)) {
|
using (var multipleResultItems = db.QueryMultiple("ECNGetPdfItem", parameters, commandType: CommandType.StoredProcedure)) {
|
||||||
ecnItem = multipleResultItems.Read<ECNPdf>().SingleOrDefault();
|
ecnItem = multipleResultItems.Read<ECNPdf>().SingleOrDefault();
|
||||||
|
|
||||||
List<string> departments = multipleResultItems.Read<string>().ToList();
|
List<string> departments = multipleResultItems.Read<string>().ToList();
|
||||||
//if (ecnItem != null && departments != null)
|
|
||||||
//{
|
|
||||||
// if (departments.Count > 0)
|
|
||||||
// ecnItem.AffectedDepartments.AddRange(departments);
|
|
||||||
//}
|
|
||||||
|
|
||||||
List<string> modules = multipleResultItems.Read<string>().ToList();
|
List<string> modules = multipleResultItems.Read<string>().ToList();
|
||||||
//if (ecnItem != null && modules != null)
|
|
||||||
//{
|
|
||||||
// if (modules.Count > 0)
|
|
||||||
// ecnItem.AffectedModules.AddRange(modules);
|
|
||||||
//}
|
|
||||||
|
|
||||||
List<string> attachments = multipleResultItems.Read<string>().ToList();
|
List<string> attachments = multipleResultItems.Read<string>().ToList();
|
||||||
if (ecnItem != null && attachments != null) {
|
if (ecnItem != null && attachments != null) {
|
||||||
if (attachments.Count > 0)
|
if (attachments.Count > 0)
|
||||||
@ -426,17 +397,6 @@ public class ECN_DMO {
|
|||||||
return db.Query<ECNArea>(query.ToString()).ToList();
|
return db.Query<ECNArea>(query.ToString()).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <returns></returns>
|
|
||||||
//internal List<ECNTechnology> GetECNTechnology(int? areaId)
|
|
||||||
//{
|
|
||||||
// var parameters = new DynamicParameters();
|
|
||||||
// parameters.Add("@AreaId", value: areaId);
|
|
||||||
|
|
||||||
// StringBuilder query = new StringBuilder("SELECT TechnologyID, Technology FROM ECNTechnology WHERE AreaID = @AreaId ORDER BY Technology");
|
|
||||||
// return this.db.Query<ECNTechnology>(query.ToString(), parameters ).ToList();
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
internal List<ECNTechnology> GetECNTechnologies() {
|
internal List<ECNTechnology> GetECNTechnologies() {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
@ -540,7 +500,6 @@ public class ECN_DMO {
|
|||||||
db.Execute("ECNReSubmitForApproval", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("ECNReSubmitForApproval", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
appoverCount = parameters.Get<int>("@AppoverCount");
|
appoverCount = parameters.Get<int>("@AppoverCount");
|
||||||
//allowedITAR = parameters.Get<int>("@AllowedITAR");
|
|
||||||
newECNNumber = parameters.Get<int>("@NewECNNumber");
|
newECNNumber = parameters.Get<int>("@NewECNNumber");
|
||||||
return appoverCount;
|
return appoverCount;
|
||||||
}
|
}
|
||||||
@ -751,42 +710,4 @@ public class ECN_DMO {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string AttachSave(AppSettings appSettings, int ecnNumber, string returnString, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
|
|
||||||
string ecnFolderPath = appSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString();
|
|
||||||
|
|
||||||
DirectoryInfo di = new(ecnFolderPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
try {
|
|
||||||
di.Create();
|
|
||||||
} catch {
|
|
||||||
returnString = "Error creating ECN directory.";
|
|
||||||
}
|
|
||||||
if (returnString == "") {
|
|
||||||
var physicalPath = Path.Combine(ecnFolderPath, fileName);
|
|
||||||
if (!File.Exists(physicalPath)) {
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
ECNAttachment attach = new() {
|
|
||||||
ECNNumber = ecnNumber,
|
|
||||||
FileName = fileName,
|
|
||||||
UserID = userId,
|
|
||||||
};
|
|
||||||
if (File.Exists(physicalPath)) {
|
|
||||||
InsertECNAttachment(attach);
|
|
||||||
} else {
|
|
||||||
returnString = "File was not uploaded to server.";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
returnString = "Cannot have duplicate file names.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnString;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -18,16 +16,11 @@ namespace Fab2ApprovalSystem.DMO;
|
|||||||
|
|
||||||
public class LotDispositionDMO {
|
public class LotDispositionDMO {
|
||||||
|
|
||||||
private readonly AppSettings _AppSettings;
|
|
||||||
private readonly WorkflowDMO wfDMO = new();
|
private readonly WorkflowDMO wfDMO = new();
|
||||||
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
public LotDispositionDMO(AppSettings appSettings) =>
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
|
|
||||||
public IEnumerable<IssuesViewModel> GetTaskList(int userID) {
|
public IEnumerable<IssuesViewModel> GetTaskList(int userID) {
|
||||||
// eventually, the View Model will refer to a generic task list instead of the just Lot Disposition Items
|
// eventually, the View Model will refer to a generic task list instead of the just Lot Disposition Items
|
||||||
//var lotDispostions = this.db.Query<IssuesViewModel>("GetLotDispositionsByUser", new { UserID = userID }, commandType: CommandType.StoredProcedure).ToList();
|
|
||||||
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
@ -121,7 +114,6 @@ public class LotDispositionDMO {
|
|||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@IssueID", value: issueID);
|
parameters.Add("@IssueID", value: issueID);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
//parameters.Add("@UserID", GlobalVars.USER_ID);
|
|
||||||
parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
|
|
||||||
using (var multipleResultItems = db.QueryMultiple("GetLotDispositionItem", parameters, commandType: CommandType.StoredProcedure)) {
|
using (var multipleResultItems = db.QueryMultiple("GetLotDispositionItem", parameters, commandType: CommandType.StoredProcedure)) {
|
||||||
@ -149,7 +141,6 @@ public class LotDispositionDMO {
|
|||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@IssueID", value: issueID);
|
parameters.Add("@IssueID", value: issueID);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
//parameters.Add("@UserID", GlobalVars.USER_ID);
|
|
||||||
parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
|
|
||||||
using (var multipleResultItems = db.QueryMultiple("GetLotDispositionItemForRead", parameters, commandType: CommandType.StoredProcedure)) {
|
using (var multipleResultItems = db.QueryMultiple("GetLotDispositionItemForRead", parameters, commandType: CommandType.StoredProcedure)) {
|
||||||
@ -168,7 +159,6 @@ public class LotDispositionDMO {
|
|||||||
|
|
||||||
public int GetRHLotCount(int issueID) {
|
public int GetRHLotCount(int issueID) {
|
||||||
StringBuilder query = new("SELECT COUNT(*) FROM dbo.fnGetLot_RH(@IssueID) ");
|
StringBuilder query = new("SELECT COUNT(*) FROM dbo.fnGetLot_RH(@IssueID) ");
|
||||||
//query.Append("WHERE UserID = @UserID AND AND EmployeeStatus = 'Active'");
|
|
||||||
return db.Query<int>(query.ToString(), new { IssueID = issueID }).SingleOrDefault();
|
return db.Query<int>(query.ToString(), new { IssueID = issueID }).SingleOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,35 +190,6 @@ public class LotDispositionDMO {
|
|||||||
|
|
||||||
// Lot Update
|
// Lot Update
|
||||||
|
|
||||||
//parameters = new DynamicParameters();
|
|
||||||
//IEnumerable<Lot> lots = lotDispo.Lots;
|
|
||||||
//foreach (Lot lot in lots)
|
|
||||||
//{
|
|
||||||
// parameters = new DynamicParameters();
|
|
||||||
// parameters.Add("@LotNumber", lot.LotNumber);
|
|
||||||
// parameters.Add("@IssueID", lotDispo.IssueID);
|
|
||||||
// parameters.Add("@Description", lot.Description);
|
|
||||||
// parameters.Add("@NewPartNo", lot.NewPartNo);
|
|
||||||
// parameters.Add("@WipPartNo", lot.WipPartNo);
|
|
||||||
// parameters.Add("@DiePartNo", lot.DiePartNo);
|
|
||||||
// parameters.Add("@ProductFamily", lot.ProductFamily);
|
|
||||||
// parameters.Add("@Gen", lot.Gen);
|
|
||||||
|
|
||||||
// parameters.Add("@Channel", lot.Channel);
|
|
||||||
// parameters.Add("@Hexsize", lot.Hexsize);
|
|
||||||
|
|
||||||
// parameters.Add("@Voltage", lot.Voltage);
|
|
||||||
// parameters.Add("@WaferCount", lot.WaferCount);
|
|
||||||
// parameters.Add("@DieCount", lot.DieCount);
|
|
||||||
|
|
||||||
// parameters.Add("@Location", lot.Location);
|
|
||||||
// parameters.Add("@TotalCost", lot.TotalCost);
|
|
||||||
// parameters.Add("@LotStatusOptionID", lot.LotStatusOption.LotStatusOptionID);
|
|
||||||
|
|
||||||
// this.db.Execute("InsertLot", parameters, commandType: CommandType.StoredProcedure);
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
// LotDispoDepartment
|
// LotDispoDepartment
|
||||||
List<int> lotDispDepIDs = lotDispo.DepartmentIDs;
|
List<int> lotDispDepIDs = lotDispo.DepartmentIDs;
|
||||||
|
|
||||||
@ -443,123 +404,10 @@ public class LotDispositionDMO {
|
|||||||
lot.ScrapCount = 0;
|
lot.ScrapCount = 0;
|
||||||
lot.ReleaseCount = 0;
|
lot.ReleaseCount = 0;
|
||||||
}
|
}
|
||||||
//else if (lot.LotStatusOption.LotStatusOptionID == (int)GlobalVars.LotStatusOption.NotAvailable)
|
|
||||||
//{
|
|
||||||
// sl.ScrapCount = 0;
|
|
||||||
// sl.ReleaseCount = 0;
|
|
||||||
|
|
||||||
// lot.ScrapCount = 0;
|
|
||||||
// lot.ReleaseCount = 0;
|
|
||||||
//}
|
|
||||||
|
|
||||||
UpdateLotScrapReleaseStatus(sl);
|
UpdateLotScrapReleaseStatus(sl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the Lot object with additional info based on Lot data downlaoded from SPN
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
//void GetLotInformation(Lot lot)
|
|
||||||
//{
|
|
||||||
// string qryLotInfo = "SELECT WP_LOT_NO, WP_PART_NUMBER, MP_PRODUCT_FAMILY, MP_DESCRIPTION, WP_CURRENT_QTY, WP_CURRENT_LOCATION, DieLotNumber, DiePartNo, DieCount FROM SPNLot WHERE WP_Lot_No = @LotNumber ";
|
|
||||||
// var lotInfoRow = this.db.Query<dynamic>(qryLotInfo, new { lot.LotNumber }).ToList();
|
|
||||||
|
|
||||||
// //lot.LotNumber = lotInfoRow.Get<string>("@WP_LOT_NO");
|
|
||||||
// //lot.WipPartNo = lotInfoRow.Get<int>("@WP_Part_Number");
|
|
||||||
// ////lotInfoRow.WP_LOT_NO;
|
|
||||||
// //lot.WipPartNo = lotInfoRow.WP_Part_Number;
|
|
||||||
|
|
||||||
// foreach (dynamic lotInfoColumn in lotInfoRow)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// lot.LotNumber = lotInfoColumn.WP_LOT_NO;
|
|
||||||
// lot.DieLotNumber = lotInfoColumn.DieLotNumber;
|
|
||||||
|
|
||||||
// if (lotInfoColumn.WP_PART_NUMBER != null)
|
|
||||||
// lot.WipPartNo = lotInfoColumn.WP_PART_NUMBER.Trim();
|
|
||||||
|
|
||||||
// if (lotInfoColumn.WP_CURRENT_LOCATION != null)
|
|
||||||
// {
|
|
||||||
// lot.Location = lotInfoColumn.WP_CURRENT_LOCATION;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (lotInfoColumn.MP_DESCRIPTION != null)
|
|
||||||
// {
|
|
||||||
// lot.Description = lotInfoColumn.MP_DESCRIPTION;
|
|
||||||
// if (lot.Description.Length > 0)
|
|
||||||
// {
|
|
||||||
// string[] temp = lot.Description.Split(new char[] { ',' });
|
|
||||||
// if (temp.Length > 0)
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// lot.ProductFamily = temp[0];
|
|
||||||
// }
|
|
||||||
// catch { } // ignore the error
|
|
||||||
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// lot.Gen = double.Parse(temp[2].Substring(1,temp[2].Length - 1));
|
|
||||||
// }
|
|
||||||
// catch { }// ignore the error
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// lot.Hexsize = double.Parse(temp[6]);
|
|
||||||
// }
|
|
||||||
// catch { }// ignore the error
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (lotInfoColumn.DieCount != null)
|
|
||||||
// lot.DieCount = int.Parse(lotInfoColumn.DieCount.ToString());
|
|
||||||
|
|
||||||
// if (lotInfoColumn.DiePartNo != null)
|
|
||||||
// lot.DiePartNo = lotInfoColumn.DiePartNo.Trim();
|
|
||||||
|
|
||||||
// if (lotInfoColumn.WP_CURRENT_QTY != null)
|
|
||||||
// lot.WaferCount = lotInfoColumn.WP_CURRENT_QTY;
|
|
||||||
|
|
||||||
// if (lot.WipPartNo.Length > 0 || lot.DiePartNo.Length > 0)
|
|
||||||
// {
|
|
||||||
// qryLotInfo = "SELECT DiePartNo, SourceFAB, Diameter, Silicon, Gen, Layers,HexSize,Voltage,Channel, Type AS ProductFamily, WaferCost, DieCost FROM FabApprovalSystem.dbo.StdCost WHERE WIPWaferNo = @WIPPartNo OR DiePartNo = @DiePartNo ";
|
|
||||||
// var moreLotInfoRow = this.db.Query<dynamic>(qryLotInfo, new { lot.WipPartNo, lot.DiePartNo }).ToList();
|
|
||||||
|
|
||||||
// foreach (var moreLotInfoColumn in moreLotInfoRow)
|
|
||||||
// {
|
|
||||||
// lot.DieCost = double.Parse(moreLotInfoColumn.DieCost.ToString());
|
|
||||||
// lot.WaferCost = double.Parse(moreLotInfoColumn.WaferCost.ToString());
|
|
||||||
|
|
||||||
// if (moreLotInfoColumn.Channel != null)
|
|
||||||
// lot.Channel = moreLotInfoColumn.Channel;
|
|
||||||
|
|
||||||
// //if (moreLotInfoColumn.ProductFamily != null)
|
|
||||||
// // lot.ProductFamily = moreLotInfoColumn.ProductFamily;
|
|
||||||
|
|
||||||
// if (moreLotInfoColumn.Hexsize != null)
|
|
||||||
// lot.Hexsize = moreLotInfoColumn.Hexsize;
|
|
||||||
|
|
||||||
// if (moreLotInfoColumn.Voltage != null)
|
|
||||||
// lot.Voltage = moreLotInfoColumn.Voltage;
|
|
||||||
|
|
||||||
// //if (moreLotInfoColumn.Gen != null)
|
|
||||||
// // lot.Gen = moreLotInfoColumn.Gen;
|
|
||||||
|
|
||||||
// if (lot.DieCount == 0)
|
|
||||||
// lot.TotalCost = Math.Round(lot.WaferCount * lot.WaferCost,2);
|
|
||||||
// else
|
|
||||||
// lot.TotalCost = Math.Round(lot.DieCount * lot.DieCost,2);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //return lotStatusOption;
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public IEnumerable<LotStatusOptionViewModel> GetLotStatusOptions() {
|
public IEnumerable<LotStatusOptionViewModel> GetLotStatusOptions() {
|
||||||
@ -571,86 +419,6 @@ public class LotDispositionDMO {
|
|||||||
// NOTE: Any new fields that needs to be added to select list , needs to be referenced prior to the "LS.LotStatusOptionID , LS.LotStatusOption" fields
|
// NOTE: Any new fields that needs to be added to select list , needs to be referenced prior to the "LS.LotStatusOptionID , LS.LotStatusOption" fields
|
||||||
|
|
||||||
db.Open();
|
db.Open();
|
||||||
#region Commented Code
|
|
||||||
/*
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
sql.Append("SELECT DISTINCT SQ.IssueIDs AS MRBsLinkedToLot , DispoType.MRBDispoType, SQP.IssueIDs AS IssueIDWithoutMRB, ");
|
|
||||||
sql.Append("CASE WHEN L.LotStatusOptionID = 2 THEN 1 ");
|
|
||||||
sql.Append("WHEN PATINDEX('%B%', DispoType.MRBDispoType) > 0 AND L.LotStatusOptionID <> 2 THEN 0 ");
|
|
||||||
sql.Append("WHEN PATINDEX('%X%', DispoType.MRBDispoType) > 0 AND PATINDEX('%B%', DispoType.MRBDispoType) = 0 THEN 0 ");
|
|
||||||
|
|
||||||
sql.Append("WHEN (PATINDEX('%D%', DispoType.MRBDispoType) > 0 ");
|
|
||||||
sql.Append(" AND PATINDEX('%X%', DispoType.MRBDispoType) = 0 ");
|
|
||||||
sql.Append(" AND PATINDEX('%B%', DispoType.MRBDispoType) = 0 ");
|
|
||||||
sql.Append(" AND LS.LotStatusOptionID <> 6 ) ");
|
|
||||||
sql.Append(" AND (LTRIM(RTRIM(Location)) <> 'QDB' AND LTRIM(RTRIM(Location)) <> 'EDB') THEN 0 ");
|
|
||||||
|
|
||||||
sql.Append("ELSE 1 ");
|
|
||||||
sql.Append("END AS GoodToSubmit, ");
|
|
||||||
|
|
||||||
sql.Append("CASE WHEN L.LotStatusOptionID = 2 THEN 'NA' ");
|
|
||||||
sql.Append("WHEN (PATINDEX('%B%', DispoType.MRBDispoType) > 0 AND L.LotStatusOptionID <> 2) ");
|
|
||||||
sql.Append("OR ( ");
|
|
||||||
sql.Append(" (PATINDEX('%D%', DispoType.MRBDispoType) > 0 ");
|
|
||||||
sql.Append(" AND PATINDEX('%X%', DispoType.MRBDispoType) = 0 ");
|
|
||||||
sql.Append(" AND PATINDEX('%B%', DispoType.MRBDispoType) = 0 ");
|
|
||||||
sql.Append(" AND LS.LotStatusOptionID <> 6 AND (LTRIM(RTRIM(Location)) <> 'QDB' AND LTRIM(RTRIM(Location)) <> 'EDB')) ");
|
|
||||||
sql.Append(" )");
|
|
||||||
sql.Append(" THEN 'MRB Disposition different from Lot Dispostion' ");
|
|
||||||
|
|
||||||
sql.Append("WHEN PATINDEX('%X%', DispoType.MRBDispoType) > 0 AND PATINDEX('%B%', DispoType.MRBDispoType) = 0 THEN 'MRB Dispo missing' ");
|
|
||||||
sql.Append("ELSE 'NA' ");
|
|
||||||
sql.Append("END AS SubmitErrorMessage, ");
|
|
||||||
|
|
||||||
sql.Append(" ");
|
|
||||||
sql.Append("L.LotID, L.LotNumber, L.IssueID ,L.DieLotNumber ,L.Description ,L.NewPartNo ,L.WipPartNo ,L.DiePartNo ,L.ProductFamily, ");
|
|
||||||
sql.Append("L.Gen ,L.Channel, L.HexSize, L.Voltage, L.WaferCount, L.DieCount, L.Location, L.TotalCost, L.LotStatusOptionID,");
|
|
||||||
sql.Append("S.ReleaseCount, S.ScrapCount, L.QualityCode, LS.LotStatusOptionID , LS.LotStatusOption FROM Lot L ");
|
|
||||||
sql.Append("INNER JOIN LotStatusOption LS ON L.LotStatusOptionID = LS.LotStatusOptionID ");
|
|
||||||
sql.Append("LEFT JOIN ScrapLot S ON L.LotNumber = S.LotNo AND L.IssueID = S.IssueID ");
|
|
||||||
|
|
||||||
sql.Append("LEFT JOIN ");
|
|
||||||
sql.Append("(SELECT DISTINCT L.LotID, STUFF ");
|
|
||||||
// Code changed 12/11/2019 RJK
|
|
||||||
//sql.Append("((SELECT DISTINCT ',' + CAST(ML.MRBNumber AS varchar(512)) ");
|
|
||||||
sql.Append("((SELECT DISTINCT ',' + CAST(ML.MRBNumber AS varchar(512)) + '_' + CAST(ISNULL(ML.DispoType,'') AS varchar(512)) ");
|
|
||||||
sql.Append("FROM vMRBLot ML ");
|
|
||||||
//sql.Append("WHERE SUBSTRING(LTRIM(RTRIM(L.LotNumber)),1,7) = SUBSTRING(LTRIM(RTRIM(ML.LotNumber)),1,7) ");
|
|
||||||
sql.Append("WHERE LTRIM(RTRIM(L.LotNumber)) = LTRIM(RTRIM(ML.LotNumber)) ");
|
|
||||||
sql.Append("FOR XML PATH('')), 1, 1, '') AS IssueIDs ");
|
|
||||||
sql.Append("FROM Lot L) AS SQ ");
|
|
||||||
sql.Append("ON L.LotID = SQ.LotID ");
|
|
||||||
|
|
||||||
sql.Append("LEFT JOIN ");
|
|
||||||
sql.Append("(SELECT DISTINCT L.LotID, STUFF ");
|
|
||||||
sql.Append("((SELECT DISTINCT ',' + CAST(ML.MRBNumber AS varchar(512)) ");
|
|
||||||
sql.Append("FROM vMRBLot ML ");
|
|
||||||
sql.Append("WHERE LTRIM(RTRIM(L.LotNumber)) = LTRIM(RTRIM(ML.LotNumber)) ");
|
|
||||||
sql.Append("FOR XML PATH('')), 1, 1, '') AS IssueIDs ");
|
|
||||||
sql.Append("FROM Lot L) AS SQP ");
|
|
||||||
sql.Append("ON L.LotID = SQP.LotID ");
|
|
||||||
|
|
||||||
sql.Append("LEFT JOIN ");
|
|
||||||
sql.Append("(SELECT DISTINCT L.LotID, STUFF ");
|
|
||||||
sql.Append("((SELECT DISTINCT ',' + CAST(ISNULL(ML.DispoType, 'X') AS varchar(512)) ");
|
|
||||||
sql.Append("FROM vMRBLot ML ");
|
|
||||||
sql.Append("WHERE LTRIM(RTRIM(L.LotNumber)) = LTRIM(RTRIM(ML.LotNumber)) ");
|
|
||||||
sql.Append("FOR XML PATH('')), 1, 1, '') AS MRBDispoType ");
|
|
||||||
sql.Append("FROM Lot L) AS DispoType ");
|
|
||||||
sql.Append("ON L.LotID = DispoType.LotID ");
|
|
||||||
|
|
||||||
sql.Append("WHERE L.IssueID = " + issueID);
|
|
||||||
|
|
||||||
var data = this.db.Query<Lot, LotStatusOptionViewModel, Lot>
|
|
||||||
(sql.ToString(), (lot, lotstatusoption) =>
|
|
||||||
{
|
|
||||||
lot.LotStatusOption = lotstatusoption;
|
|
||||||
return lot;
|
|
||||||
},
|
|
||||||
splitOn: "LotStatusOptionID").ToList();
|
|
||||||
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@IssueID", issueID, DbType.Int32);
|
parameters.Add("@IssueID", issueID, DbType.Int32);
|
||||||
@ -951,16 +719,12 @@ public class LotDispositionDMO {
|
|||||||
totalReleaseCost += releaseCost;
|
totalReleaseCost += releaseCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
return new LotDispositionLotSummaryViewModel() {
|
return new LotDispositionLotSummaryViewModel() {
|
||||||
LotCount = lotCount,
|
LotCount = lotCount,
|
||||||
ReleaseCost = string.Format("{0:C}", totalReleaseCost),
|
ReleaseCost = string.Format("{0:C}", totalReleaseCost),
|
||||||
//Math.Round(totalReleaseCost, 2).ToString(,
|
|
||||||
ReleaseWaferCount = totalWaferReleaseCount,
|
ReleaseWaferCount = totalWaferReleaseCount,
|
||||||
ReleaseDieCount = totalDieReleaseCount,
|
ReleaseDieCount = totalDieReleaseCount,
|
||||||
ScrapCost = string.Format("{0:C}", totalScrapCost),
|
ScrapCost = string.Format("{0:C}", totalScrapCost),
|
||||||
//Math.Round(totalScrapCost, 2),
|
|
||||||
ScrapWaferCount = totalWaferScrapCount,
|
ScrapWaferCount = totalWaferScrapCount,
|
||||||
ScrapDieCount = totalDieScrapCount
|
ScrapDieCount = totalDieScrapCount
|
||||||
|
|
||||||
@ -1036,61 +800,4 @@ public class LotDispositionDMO {
|
|||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AttachSave(int issueID, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + "LotDisposition", fileName);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
Attachment attach = new() {
|
|
||||||
IssueID = issueID,
|
|
||||||
FileName = fileName,
|
|
||||||
UserID = userId,
|
|
||||||
};
|
|
||||||
InsertLotDispositionAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ExcelLotOpen(int issueID, string userIdentityName, string lotTempPipeLine, string fullFileName, Stream stream) {
|
|
||||||
string physicalPath;
|
|
||||||
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
string fName = userIdentityName + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
|
|
||||||
|
|
||||||
physicalPath = Path.Combine(lotTempPipeLine, fName + "." + fileExtension);
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
#if !NET8
|
|
||||||
ExcelData x = new ExcelData(physicalPath);
|
|
||||||
var lotNumbers = x.ReadData();
|
|
||||||
|
|
||||||
foreach (var lotInfo in lotNumbers) {
|
|
||||||
Lot l = new Lot();
|
|
||||||
l.LotNumber = lotInfo.LotNo;
|
|
||||||
l.IssueID = issueID;
|
|
||||||
if (l.LotStatusOptionID == 0)
|
|
||||||
l.LotStatusOption.LotStatusOptionID = (int)GlobalVars.LotStatusOption.Release;
|
|
||||||
|
|
||||||
InsertLot(l, true);
|
|
||||||
//if (!mrbDMO.DoesMRBLotExist(lotInfo.LotNo))
|
|
||||||
//{
|
|
||||||
// //get All the MRBs associated to the Parent lot
|
|
||||||
// //insert the lot into the MRBChildLotNotInMRB table and NOT in the MRB Lot table for each MRB
|
|
||||||
// InsertChildLot_NotInTheMRB(lotInfo.LotNo);
|
|
||||||
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FileInfo f = new(physicalPath);
|
|
||||||
if (f.Exists)
|
|
||||||
f.Delete();
|
|
||||||
|
|
||||||
return physicalPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Transactions;
|
using System.Transactions;
|
||||||
@ -17,13 +16,9 @@ namespace Fab2ApprovalSystem.DMO;
|
|||||||
|
|
||||||
public class LotTravelerDMO {
|
public class LotTravelerDMO {
|
||||||
|
|
||||||
private readonly AppSettings _AppSettings;
|
|
||||||
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
private readonly WorkflowDMO wfDMO = new();
|
private readonly WorkflowDMO wfDMO = new();
|
||||||
|
|
||||||
public LotTravelerDMO(AppSettings appSettings) =>
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
///
|
///
|
||||||
internal LTWorkRequest InsertWorkRequest(LTWorkRequest workRequest) {
|
internal LTWorkRequest InsertWorkRequest(LTWorkRequest workRequest) {
|
||||||
@ -59,9 +54,6 @@ public class LotTravelerDMO {
|
|||||||
workRequestItem.ModuleIDs.AddRange(modules);
|
workRequestItem.ModuleIDs.AddRange(modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
//var holdsteps = multipleResultItems.Read<LTHoldStep>().SingleOrDefault();
|
|
||||||
//workRequestItem.LTHoldStep = holdsteps;
|
|
||||||
|
|
||||||
isITAR = parameters.Get<int>("@IsITAR");
|
isITAR = parameters.Get<int>("@IsITAR");
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -121,9 +113,6 @@ public class LotTravelerDMO {
|
|||||||
workRequestItem.ModuleIDs.AddRange(modules);
|
workRequestItem.ModuleIDs.AddRange(modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
//var holdsteps = multipleResultItems.Read<LTHoldStep>().SingleOrDefault();
|
|
||||||
//workRequestItem.LTHoldStep = holdsteps;
|
|
||||||
|
|
||||||
isITAR = parameters.Get<int>("@IsITAR");
|
isITAR = parameters.Get<int>("@IsITAR");
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -149,7 +138,6 @@ public class LotTravelerDMO {
|
|||||||
parameters.Add("@AllocationToUse", data.AllocationToUse);
|
parameters.Add("@AllocationToUse", data.AllocationToUse);
|
||||||
parameters.Add("@PredictedCyleTime", data.PredictedCyleTime);
|
parameters.Add("@PredictedCyleTime", data.PredictedCyleTime);
|
||||||
parameters.Add("@DeptChargedForRawWafers", data.ChargeDepartment);
|
parameters.Add("@DeptChargedForRawWafers", data.ChargeDepartment);
|
||||||
//parameters.Add("@EstimatedBinCLoseDate", data.EstimatedBinCLoseDate);
|
|
||||||
parameters.Add("@TotalQty", data.TotalQty);
|
parameters.Add("@TotalQty", data.TotalQty);
|
||||||
parameters.Add("@WIPArea", data.WIPArea);
|
parameters.Add("@WIPArea", data.WIPArea);
|
||||||
parameters.Add("@LotStartDate", data.LotStartDate);
|
parameters.Add("@LotStartDate", data.LotStartDate);
|
||||||
@ -422,11 +410,6 @@ public class LotTravelerDMO {
|
|||||||
|
|
||||||
result = parameters.Get<int>("@Result");
|
result = parameters.Get<int>("@Result");
|
||||||
|
|
||||||
//if (result == -1)
|
|
||||||
//{
|
|
||||||
// throw new Exception("In order to do the UPDATE or SUBMIT operation the record needs to exclusively locked by you.\nThe record was unlocked by the system due to inactivity for more than 30 minutes, hence the update was not successful");
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void UpdateHoldStep(LTHoldStep model) {
|
internal void UpdateHoldStep(LTHoldStep model) {
|
||||||
@ -443,8 +426,6 @@ public class LotTravelerDMO {
|
|||||||
|
|
||||||
db.Execute("LTUpdateHoldStep", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("LTUpdateHoldStep", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
//int id = parameters.Get<int>("@LTHoldStepID");
|
|
||||||
//model.ID = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void InsertHoldStepRevision(LTHoldStep model) {
|
internal void InsertHoldStepRevision(LTHoldStep model) {
|
||||||
@ -470,7 +451,6 @@ public class LotTravelerDMO {
|
|||||||
int result = 0;
|
int result = 0;
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@LTHoldStepID", model.ID, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@LTHoldStepID", model.ID, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
//parameters.Add("@BaseFlow", model.BaseFlow);
|
|
||||||
parameters.Add("@BaseFlowLocation", model.Location);
|
parameters.Add("@BaseFlowLocation", model.Location);
|
||||||
parameters.Add("@BaseFlowOperationSeq", model.OperSequence);
|
parameters.Add("@BaseFlowOperationSeq", model.OperSequence);
|
||||||
parameters.Add("@BaseFlowOperation", model.Operation);
|
parameters.Add("@BaseFlowOperation", model.Operation);
|
||||||
@ -478,16 +458,8 @@ public class LotTravelerDMO {
|
|||||||
parameters.Add("@ChangeInstruction", model.ChangeInstructions);
|
parameters.Add("@ChangeInstruction", model.ChangeInstructions);
|
||||||
parameters.Add("@LTWorkRequestID", model.LTWorkRequestID);
|
parameters.Add("@LTWorkRequestID", model.LTWorkRequestID);
|
||||||
parameters.Add("@UpdatedBy", model.UpdatedBy);
|
parameters.Add("@UpdatedBy", model.UpdatedBy);
|
||||||
//parameters.Add("@Result", result, direction: ParameterDirection.InputOutput);
|
|
||||||
|
|
||||||
db.Execute("LTUpdateHoldStepRevision", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("LTUpdateHoldStepRevision", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
//result = parameters.Get<int>("@Result");
|
|
||||||
//if (result == -1)
|
|
||||||
//{
|
|
||||||
// throw new Exception("Cannot add the Hold Step as the step has already been passed in the Mfg Process.");
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void DeleteHoldStep(int holdStepID, int userID) {
|
internal void DeleteHoldStep(int holdStepID, int userID) {
|
||||||
@ -524,7 +496,6 @@ public class LotTravelerDMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal IEnumerable<LTWorkRequestAttachment> GetHoldStepAttachemnts(int holdStepID) {
|
internal IEnumerable<LTWorkRequestAttachment> GetHoldStepAttachemnts(int holdStepID) {
|
||||||
//var holdStepAttachments = this.db.Query<LTWorkRequestAttachment>("SELECT * FROM LTWorkRequestAttachment WHERE HoldStepID = @HoldStep ORDER BY UploadDateTime", new { holdStep }, commandType: CommandType.Text).ToList();
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@HoldStepID", holdStepID);
|
parameters.Add("@HoldStepID", holdStepID);
|
||||||
List<LTWorkRequestAttachment> data = db.Query<LTWorkRequestAttachment>("LTGetHoldStepAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<LTWorkRequestAttachment> data = db.Query<LTWorkRequestAttachment>("LTGetHoldStepAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
@ -532,7 +503,6 @@ public class LotTravelerDMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal IEnumerable<LTWorkRequestAttachment> GetLotTravHoldStepAttachemnts(int ltHoldStepID) {
|
internal IEnumerable<LTWorkRequestAttachment> GetLotTravHoldStepAttachemnts(int ltHoldStepID) {
|
||||||
//var holdStepAttachments = this.db.Query<LTWorkRequestAttachment>("SELECT * FROM LTWorkRequestAttachment WHERE HoldStepID = @HoldStep ORDER BY UploadDateTime", new { holdStep }, commandType: CommandType.Text).ToList();
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@LTHoldStepID", ltHoldStepID);
|
parameters.Add("@LTHoldStepID", ltHoldStepID);
|
||||||
List<LTWorkRequestAttachment> data = db.Query<LTWorkRequestAttachment>("LTGetLotTravHoldStepAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<LTWorkRequestAttachment> data = db.Query<LTWorkRequestAttachment>("LTGetLotTravHoldStepAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
@ -612,7 +582,6 @@ public class LotTravelerDMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal IEnumerable<LTWorkRequestAttachment> GetWorkRequestAttachments(int workRequestID) {
|
internal IEnumerable<LTWorkRequestAttachment> GetWorkRequestAttachments(int workRequestID) {
|
||||||
//var holdStepAttachments = this.db.Query<LTWorkRequestAttachment>("SELECT * FROM LTWorkRequestAttachment WHERE HoldStepID = @HoldStep ORDER BY UploadDateTime", new { holdStep }, commandType: CommandType.Text).ToList();
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@WorkRequestID", workRequestID);
|
parameters.Add("@WorkRequestID", workRequestID);
|
||||||
List<LTWorkRequestAttachment> data = db.Query<LTWorkRequestAttachment>("LTGetWorkRequestAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<LTWorkRequestAttachment> data = db.Query<LTWorkRequestAttachment>("LTGetWorkRequestAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
@ -786,12 +755,10 @@ public class LotTravelerDMO {
|
|||||||
|
|
||||||
db.Execute("LTInsertLTLot", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("LTInsertLTLot", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
//int lotID = parameters.Get<int>("@LotID");
|
|
||||||
if (parameters.Get<int>("@WRWithExistingLot") != 0) {
|
if (parameters.Get<int>("@WRWithExistingLot") != 0) {
|
||||||
lot.WRWithExistingLot = parameters.Get<int>("@WRWithExistingLot");
|
lot.WRWithExistingLot = parameters.Get<int>("@WRWithExistingLot");
|
||||||
}
|
}
|
||||||
|
|
||||||
//return lotID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<LTLot> GetLotList(int workRequestID) {
|
public IEnumerable<LTLot> GetLotList(int workRequestID) {
|
||||||
@ -810,7 +777,6 @@ public class LotTravelerDMO {
|
|||||||
sql.Append("LEFT JOIN Users U ON L.LotUploadedBy = U.UserID ");
|
sql.Append("LEFT JOIN Users U ON L.LotUploadedBy = U.UserID ");
|
||||||
sql.Append("WHERE WR.SWRNumber = @SWRNumber ORDER BY LotNumber ");
|
sql.Append("WHERE WR.SWRNumber = @SWRNumber ORDER BY LotNumber ");
|
||||||
List<LTLot> lots = db.Query<LTLot>(sql.ToString(), new { @SWRNumber = swrNumber }, commandType: CommandType.Text).ToList();
|
List<LTLot> lots = db.Query<LTLot>(sql.ToString(), new { @SWRNumber = swrNumber }, commandType: CommandType.Text).ToList();
|
||||||
//var lots = this.db.Query<LTLot>("SELECT L.*, U.FirstName + ' ' + U.LastName AS UploadedByName FROM LTWorkRequest WR INNER JOIN LTLot L ON WR.ID = L.WorkRequestID AND WR.IsCurrentRevision = 1 LEFT JOIN Users U ON L.LotUploadedBy = U.UserID WHERE WR.SWRNumber = @SWRNumber ORDER BY LotNumber ", new { swrNumber }, commandType: CommandType.Text).ToList();
|
|
||||||
return lots;
|
return lots;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -999,7 +965,6 @@ public class LotTravelerDMO {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//var data = this.db.Query<LotTravelerPdf>("LTGetLotTravelerForPDF", parameters, commandType: CommandType.StoredProcedure).Single();
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1088,220 +1053,4 @@ public class LotTravelerDMO {
|
|||||||
db.Execute("LTReassignOriginator", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("LTReassignOriginator", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HoldStepAttachSave(int holdStepID, int swrNo, string docType, string comments, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
//int currentRevision = 1;
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var SWRPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
|
||||||
di = new DirectoryInfo(SWRPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
//var SWR_RevPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\Rev" + currentRevision;
|
|
||||||
var SWR_RevPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
|
||||||
di = new DirectoryInfo(SWR_RevPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
//var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\Rev" + currentRevision + @"\", guid + fileExtension);
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
LTWorkRequestAttachment attach = new() {
|
|
||||||
FileGUID = guid,
|
|
||||||
LTHoldStepID = holdStepID,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId,
|
|
||||||
DocType = docType,
|
|
||||||
Comments = comments
|
|
||||||
};
|
|
||||||
|
|
||||||
InsertLotHoldStepAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HoldStepAttachSaveRev(int holdStepID, int swrNo, string docType, string comments, bool newRevision, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
//int currentRevision = 1;
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var SWRPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
|
||||||
di = new DirectoryInfo(SWRPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
//var SWR_RevPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\Rev" + currentRevision;
|
|
||||||
var SWR_RevPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
|
||||||
di = new DirectoryInfo(SWR_RevPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
//var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\Rev" + currentRevision + @"\", guid + fileExtension);
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
LTWorkRequestAttachment attach = new() {
|
|
||||||
FileGUID = guid,
|
|
||||||
LTHoldStepID = holdStepID,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId,
|
|
||||||
DocType = docType,
|
|
||||||
Comments = comments
|
|
||||||
};
|
|
||||||
if (newRevision)
|
|
||||||
InsertLotHoldStepAttachmentRevision(attach);
|
|
||||||
else
|
|
||||||
InsertLotHoldStepAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AttachSaveWorkRequestRevision(int workRequestID, int swrNo, string docType, string attachComments, bool newRevision, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
//int currentRevision = 1;
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var SWRPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
|
||||||
di = new DirectoryInfo(SWRPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
//var SWR_RevPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\Rev" + currentRevision;
|
|
||||||
var SWR_RevPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
|
||||||
di = new DirectoryInfo(SWR_RevPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
LTWorkRequestAttachment attach = new() {
|
|
||||||
WorkRequestID = workRequestID,
|
|
||||||
FileGUID = guid,
|
|
||||||
LTHoldStepID = -1,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId,
|
|
||||||
DocType = docType,
|
|
||||||
Comments = attachComments
|
|
||||||
};
|
|
||||||
|
|
||||||
// InsertWorkRequestAttachment(attach);
|
|
||||||
if (newRevision)
|
|
||||||
InsertWorkRequestAttachmentRevision(attach);
|
|
||||||
else
|
|
||||||
InsertWorkRequestAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AttachSaveWorkRequest(int workRequestID, int swrNo, string comments, string docType, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
//int currentRevision = 1;
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var SWRPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
|
||||||
di = new DirectoryInfo(SWRPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
//var SWR_RevPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\Rev" + currentRevision;
|
|
||||||
var SWR_RevPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
|
||||||
di = new DirectoryInfo(SWR_RevPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
LTWorkRequestAttachment attach = new() {
|
|
||||||
WorkRequestID = workRequestID,
|
|
||||||
FileGUID = guid,
|
|
||||||
LTHoldStepID = -1,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId,
|
|
||||||
DocType = docType,
|
|
||||||
Comments = comments
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
InsertWorkRequestAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LotTravHoldStepAttachSaveRev(int ltHoldStepID, int swrNo, string docType, int prevLotTravRevID, int newLotTravRevID, bool newRevision, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
//int currentRevision = 1;
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
|
||||||
DirectoryInfo di;
|
|
||||||
var SWRPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
|
||||||
di = new DirectoryInfo(SWRPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
//var SWR_RevPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\Rev" + currentRevision;
|
|
||||||
var SWR_RevPhysicalPath = _AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
|
||||||
di = new DirectoryInfo(SWR_RevPhysicalPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
//var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\Rev" + currentRevision + @"\", guid + fileExtension);
|
|
||||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
LTLotTravAttachment attach = new() {
|
|
||||||
FileGUID = guid,
|
|
||||||
LTLotTravHoldStepID = ltHoldStepID,
|
|
||||||
LotTravelerRevisionID = newLotTravRevID,
|
|
||||||
FileName = fileName,
|
|
||||||
UploadedByID = userId,
|
|
||||||
DocType = docType
|
|
||||||
};
|
|
||||||
if (newRevision) {
|
|
||||||
try {
|
|
||||||
InsertLotTravLotHoldStepAttachmentRevision(attach);
|
|
||||||
} catch {
|
|
||||||
//roll back the revision creation
|
|
||||||
RestoreLotTravToPrevRevision(prevLotTravRevID, newLotTravRevID);
|
|
||||||
throw new Exception("There was a problem while creating the revision, Please logout and log back and then retry. \n If the problem persist please contact the Site Administrator");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else
|
|
||||||
InsertLotTravLotHoldStepAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -2,11 +2,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
|
||||||
using System.Transactions;
|
using System.Transactions;
|
||||||
|
|
||||||
using Dapper;
|
using Dapper;
|
||||||
@ -28,8 +25,6 @@ public class MRB_DMO {
|
|||||||
|
|
||||||
internal MRB InsertMRB(MRB mrb) {
|
internal MRB InsertMRB(MRB mrb) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@MRBNumber", value: mrb.MRBNumber, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@MRBNumber", value: mrb.MRBNumber, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
parameters.Add("@OriginatorID", mrb.OriginatorID);
|
parameters.Add("@OriginatorID", mrb.OriginatorID);
|
||||||
|
|
||||||
@ -116,22 +111,6 @@ public class MRB_DMO {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//List<int> dispositionIDs = mrb.DispositionIDs;
|
|
||||||
//if (dispositionIDs != null)
|
|
||||||
//{
|
|
||||||
// parameters = new DynamicParameters();
|
|
||||||
// parameters.Add("@MRBNumber", mrb.MRBNumber);
|
|
||||||
// this.db.Execute("MRBDeleteDispositionsByMRB", parameters, commandType: CommandType.StoredProcedure);
|
|
||||||
|
|
||||||
// foreach (int dispositionID in dispositionIDs)
|
|
||||||
// {
|
|
||||||
// parameters = new DynamicParameters();
|
|
||||||
// parameters.Add("@MRBNumber", mrb.MRBNumber);
|
|
||||||
// parameters.Add("@DispositionID", dispositionID);
|
|
||||||
// this.db.Execute("MRBInsertDispositionsByMRB", parameters, commandType: CommandType.StoredProcedure);
|
|
||||||
// }
|
|
||||||
|
|
||||||
//}
|
|
||||||
transanction.Complete();
|
transanction.Complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,10 +187,6 @@ public class MRB_DMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal IEnumerable<Disposition> GetDispositions(int mrbNumber) {
|
internal IEnumerable<Disposition> GetDispositions(int mrbNumber) {
|
||||||
//var disposition = this.db.Query<Disposition>("MRBGetDispositionsByMRB", new { @MRBNumber = mrbNumber }, commandType: CommandType.StoredProcedure).ToList();
|
|
||||||
|
|
||||||
// StringBuilder sql = new StringBuilder();
|
|
||||||
|
|
||||||
db.Open();
|
db.Open();
|
||||||
List<Disposition> disposition = db.Query<Disposition, CloseToQDBOptionViewModel, Disposition>
|
List<Disposition> disposition = db.Query<Disposition, CloseToQDBOptionViewModel, Disposition>
|
||||||
(
|
(
|
||||||
@ -266,8 +241,6 @@ public class MRB_DMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal IEnumerable<MRBHoldFlagReport> GetMRBHoldFlagReport(int mrbNumber) {
|
internal IEnumerable<MRBHoldFlagReport> GetMRBHoldFlagReport(int mrbNumber) {
|
||||||
//db.Open();
|
|
||||||
|
|
||||||
string sql = "SELECT * FROM MRBHoldFlagReport WHERE MRBNumber = @MRBNumber ORDER BY LotNo";
|
string sql = "SELECT * FROM MRBHoldFlagReport WHERE MRBNumber = @MRBNumber ORDER BY LotNo";
|
||||||
List<MRBHoldFlagReport> data = db.Query<MRBHoldFlagReport>(sql, new { MRBNumber = mrbNumber }).ToList();
|
List<MRBHoldFlagReport> data = db.Query<MRBHoldFlagReport>(sql, new { MRBNumber = mrbNumber }).ToList();
|
||||||
|
|
||||||
@ -275,8 +248,6 @@ public class MRB_DMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal IEnumerable<MRBLotsTobeSentToSPN> GetMRHoldFlagSentHistory(int mrbNumber) {
|
internal IEnumerable<MRBLotsTobeSentToSPN> GetMRHoldFlagSentHistory(int mrbNumber) {
|
||||||
//db.Open();
|
|
||||||
|
|
||||||
string sql = "SELECT * FROM MRBLotsToBeSentToSPN WHERE MRBNumber = @MRBNumber ORDER BY LotNumber";
|
string sql = "SELECT * FROM MRBLotsToBeSentToSPN WHERE MRBNumber = @MRBNumber ORDER BY LotNumber";
|
||||||
List<MRBLotsTobeSentToSPN> data = db.Query<MRBLotsTobeSentToSPN>(sql, new { MRBNumber = mrbNumber }).ToList();
|
List<MRBLotsTobeSentToSPN> data = db.Query<MRBLotsTobeSentToSPN>(sql, new { MRBNumber = mrbNumber }).ToList();
|
||||||
|
|
||||||
@ -284,7 +255,6 @@ public class MRB_DMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal IEnumerable<string> GetTools() =>
|
internal IEnumerable<string> GetTools() =>
|
||||||
//return db.Query<string>("SELECT DISTINCT RTRIM(WO_STATION_ID) AS ToolID from vFAB2SPN_WO_RECORD ORDER BY 1").ToList();
|
|
||||||
db.Query<string>("SELECT 'NA', '1' UNION SELECT DISTINCT LTRIM(RTRIM(ToolID)),LTRIM(RTRIM(ToolID)) FROM [TEMIRWAP019].[SPNPDB].[dbo].[tblToolGroups2] ORDER BY 2").ToList();
|
db.Query<string>("SELECT 'NA', '1' UNION SELECT DISTINCT LTRIM(RTRIM(ToolID)),LTRIM(RTRIM(ToolID)) FROM [TEMIRWAP019].[SPNPDB].[dbo].[tblToolGroups2] ORDER BY 2").ToList();
|
||||||
|
|
||||||
internal MRB GetToolIssueStartEndDateData(int mrbNumber, IDbTransaction dbTrans = null) {
|
internal MRB GetToolIssueStartEndDateData(int mrbNumber, IDbTransaction dbTrans = null) {
|
||||||
@ -322,17 +292,6 @@ public class MRB_DMO {
|
|||||||
var analysisTime = DateTime.Now;
|
var analysisTime = DateTime.Now;
|
||||||
|
|
||||||
// get mrb info
|
// get mrb info
|
||||||
//var mrbInfo = db.Query(
|
|
||||||
// "SELECT ToolCSV, IssueStartDate, IssueEndDate FROM MRB WHERE MRBNumber = @mrbNo",
|
|
||||||
// new { mrbNo = mrbNumber }).First();
|
|
||||||
|
|
||||||
//var tools = ((string)mrbInfo.ToolCSV).Split(',');
|
|
||||||
//DateTime? issueStartDate = mrbInfo.IssueStartDate;
|
|
||||||
//DateTime? issueEndDate = mrbInfo.IssueEndDate;
|
|
||||||
|
|
||||||
//if (issueStartDate.HasValue == false) throw new Exception("MRB Issue Start Date cannot be blank");
|
|
||||||
//if (issueEndDate.HasValue == false) throw new Exception("MRB Issue End Date cannot be blank");
|
|
||||||
|
|
||||||
// search WO for MRB tools between incident start+end to find the earliest WO record for this lot and use the Out time
|
// search WO for MRB tools between incident start+end to find the earliest WO record for this lot and use the Out time
|
||||||
|
|
||||||
DateTime? incidentTime = null;
|
DateTime? incidentTime = null;
|
||||||
@ -340,7 +299,6 @@ public class MRB_DMO {
|
|||||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||||
incidentTime = db.Query<DateTime?>(
|
incidentTime = db.Query<DateTime?>(
|
||||||
"SELECT MIN(OutTime) FROM WO_RECORD_MJ " +
|
"SELECT MIN(OutTime) FROM WO_RECORD_MJ " +
|
||||||
//"SELECT MIN(OutTime) FROM vFAB2SPN_WO_RECORD " +
|
|
||||||
"WHERE WO_LOT_NO = @LotNo " +
|
"WHERE WO_LOT_NO = @LotNo " +
|
||||||
"AND WO_STATION_ID IN @Tools " +
|
"AND WO_STATION_ID IN @Tools " +
|
||||||
"AND (InTime BETWEEN @StartDate AND @EndDate " +
|
"AND (InTime BETWEEN @StartDate AND @EndDate " +
|
||||||
@ -377,14 +335,12 @@ public class MRB_DMO {
|
|||||||
string parmsXML =
|
string parmsXML =
|
||||||
new System.Xml.Linq.XElement("IssueStartDate", issueStartDate).ToString() +
|
new System.Xml.Linq.XElement("IssueStartDate", issueStartDate).ToString() +
|
||||||
new System.Xml.Linq.XElement("IssueEndDate", issueEndDate).ToString() +
|
new System.Xml.Linq.XElement("IssueEndDate", issueEndDate).ToString() +
|
||||||
//new System.Xml.Linq.XElement("ToolCSV", (string)mrbInfo.ToolCSV).ToString();
|
|
||||||
new System.Xml.Linq.XElement("ToolCSV", toolCSV).ToString();
|
new System.Xml.Linq.XElement("ToolCSV", toolCSV).ToString();
|
||||||
IEnumerable<LotSplitAnalysisResult> analysisResults = null;
|
IEnumerable<LotSplitAnalysisResult> analysisResults = null;
|
||||||
|
|
||||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||||
analysisResults = db.Query<LotSplitAnalysisResult>(
|
analysisResults = db.Query<LotSplitAnalysisResult>(
|
||||||
"AnalyzeLotAncestry_TEST",
|
"AnalyzeLotAncestry_TEST",
|
||||||
//"AnalyzeLotAncestry",
|
|
||||||
new {
|
new {
|
||||||
LotNo = incidentLotNo,
|
LotNo = incidentLotNo,
|
||||||
IncidentTime = incidentTime,
|
IncidentTime = incidentTime,
|
||||||
@ -524,12 +480,8 @@ public class MRB_DMO {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
internal bool ChildLotsUpdateInSPNWithNewDispoType(Lot parentLot, MRB mrb) {
|
internal bool ChildLotsUpdateInSPNWithNewDispoType(Lot parentLot, MRB mrb) {
|
||||||
//db.Open();
|
|
||||||
|
|
||||||
//var dbTrans = db.BeginTransaction();
|
|
||||||
var analysisTime = DateTime.Now;
|
var analysisTime = DateTime.Now;
|
||||||
DateTime? incidentTime = null;
|
DateTime? incidentTime = null;
|
||||||
//var tools = ((string)mrb.ToolCSV).Split(',');
|
|
||||||
|
|
||||||
// This is the "time", when the lot was first uploaded into the system
|
// This is the "time", when the lot was first uploaded into the system
|
||||||
// Get the child lots that were split after this datetime
|
// Get the child lots that were split after this datetime
|
||||||
@ -583,10 +535,6 @@ public class MRB_DMO {
|
|||||||
db.Open();
|
db.Open();
|
||||||
var dbTrans = db.BeginTransaction();
|
var dbTrans = db.BeginTransaction();
|
||||||
|
|
||||||
//var newAnalysisResults = from r in analysisResults
|
|
||||||
// where r.IsAffected.HasValue && r.IsAffected == true
|
|
||||||
// select r;
|
|
||||||
|
|
||||||
IEnumerable<LotSplitAnalysisResult> newAnalysisResults = analysisResults.Where(r => r.IsAffected.HasValue && r.IsAffected == true).ToList();
|
IEnumerable<LotSplitAnalysisResult> newAnalysisResults = analysisResults.Where(r => r.IsAffected.HasValue && r.IsAffected == true).ToList();
|
||||||
try {
|
try {
|
||||||
// insert lots
|
// insert lots
|
||||||
@ -744,31 +692,9 @@ public class MRB_DMO {
|
|||||||
|
|
||||||
db.Execute("MRBUpdateLot", parameters, commandType: CommandType.StoredProcedure, transaction: dbTrans);
|
db.Execute("MRBUpdateLot", parameters, commandType: CommandType.StoredProcedure, transaction: dbTrans);
|
||||||
|
|
||||||
////routine to cascade the "dispo type" to all the child lots in SPN (Lot that are not present in FAb App Sys,)
|
// routine to cascade the "dispo type" to all the child lots in SPN (Lot that are not present in FAb App Sys,)
|
||||||
// MRB mrbInfo = GetToolIssueStartEndDateData(lot.MRBNumber, dbTrans);
|
// MRB mrbInfo = GetToolIssueStartEndDateData(lot.MRBNumber, dbTrans);
|
||||||
|
|
||||||
//if (!mrbInfo.ToolCSV.ToUpper().Equals("NA"))
|
|
||||||
//{
|
|
||||||
// bool existingLotUpdated;
|
|
||||||
// Lot l = new Lot();
|
|
||||||
// l.LotNumber = lot.LotNumber;
|
|
||||||
// if (lot.DispoType.ToString().Trim().Length == 1)
|
|
||||||
// {
|
|
||||||
// l.DispoType = lot.DispoType;
|
|
||||||
// }
|
|
||||||
// l.MRBNumber = lot.MRBNumber;
|
|
||||||
// // check if the lot was sent to SPN
|
|
||||||
// bool lotSentToSPN = IsLotSentToSPN(l.LotNumber, l.MRBNumber, dbTrans);
|
|
||||||
// //only get the child lots if it has been sent to SPN to set the MRB Flag
|
|
||||||
// if (lotSentToSPN)
|
|
||||||
// {
|
|
||||||
// if (!GetChildLotsFromSPNForDispoTypeUpdate(lot.MRBNumber, lot.LotNumber, mrbInfo.ToolCSV, mrbInfo.IssueStartDate, mrbInfo.IssueEndDate, lot.DispoType, dbTrans))
|
|
||||||
// {
|
|
||||||
// //warnings.AppendFormat("Lot number {0} is not affected by these tools and issue start/end time.\n", l.LotNumber);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//}
|
|
||||||
dbTrans.Commit();
|
dbTrans.Commit();
|
||||||
|
|
||||||
} catch {
|
} catch {
|
||||||
@ -817,18 +743,6 @@ public class MRB_DMO {
|
|||||||
return db.Query<MRBAttachment>(sql.ToString(), new { AttachmentID = attachmentID }).SingleOrDefault();
|
return db.Query<MRBAttachment>(sql.ToString(), new { AttachmentID = attachmentID }).SingleOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
//internal IEnumerable<MRBAttachment> GetMRBAttachmentsByFilename(string fileName)
|
|
||||||
//{
|
|
||||||
// StringBuilder sql = new StringBuilder();
|
|
||||||
// sql.Append("SELECT A.AttachmentID, A.MRBNumber, A.FileName, A.UserID, CONVERT(VARCHAR(10), A.UploadDate, 101) AS UploadDate, ");
|
|
||||||
// sql.Append("U.FirstName + ' ' + U.LastName AS FullName ");
|
|
||||||
// sql.Append("FROM MRBAttachment A INNER JOIN Users U ON A.UserID = U.UserID ");
|
|
||||||
// sql.Append("WHERE A.Filename = @filename");
|
|
||||||
|
|
||||||
// var attachments = this.db.Query<MRBAttachment>(sql.ToString(), new { filename = fileName }).ToList();
|
|
||||||
// return attachments;
|
|
||||||
//}
|
|
||||||
|
|
||||||
internal void DeleteMRBAttachment(int attachmentID) {
|
internal void DeleteMRBAttachment(int attachmentID) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@AttachmentID", attachmentID);
|
parameters.Add("@AttachmentID", attachmentID);
|
||||||
@ -846,11 +760,6 @@ public class MRB_DMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal IEnumerable<ContainmentActionObj> GetContainmentActions(int mrbNumber) {
|
internal IEnumerable<ContainmentActionObj> GetContainmentActions(int mrbNumber) {
|
||||||
//db.Open();
|
|
||||||
|
|
||||||
//string sql = "SELECT * FROM MRBContainmentAction WHERE MRBNumber = " + mrbNumber;
|
|
||||||
//var data = this.db.Query<ContainmentActionObj>(sql).ToList();
|
|
||||||
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@MRBNumber", mrbNumber);
|
parameters.Add("@MRBNumber", mrbNumber);
|
||||||
|
|
||||||
@ -864,7 +773,6 @@ public class MRB_DMO {
|
|||||||
parameters.Add("@ContainmentActionID", model.ContainmentActionID, DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@ContainmentActionID", model.ContainmentActionID, DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
parameters.Add("@MRBNumber", model.MRBNumber);
|
parameters.Add("@MRBNumber", model.MRBNumber);
|
||||||
parameters.Add("@ContainmentAction", model.ContainmentAction);
|
parameters.Add("@ContainmentAction", model.ContainmentAction);
|
||||||
//parameters.Add("@ResponsibilityOwner", model.ResponsibilityOwner);
|
|
||||||
parameters.Add("@ResponsibilityOwnerID", model.ResponsibilityOwnerID);
|
parameters.Add("@ResponsibilityOwnerID", model.ResponsibilityOwnerID);
|
||||||
parameters.Add("@ECD", model.ECD);
|
parameters.Add("@ECD", model.ECD);
|
||||||
parameters.Add("@ImplementedDate", model.ImplementedDate);
|
parameters.Add("@ImplementedDate", model.ImplementedDate);
|
||||||
@ -880,7 +788,6 @@ public class MRB_DMO {
|
|||||||
parameters.Add("@ContainmentActionID", model.ContainmentActionID);
|
parameters.Add("@ContainmentActionID", model.ContainmentActionID);
|
||||||
parameters.Add("@ContainmentAction", model.ContainmentAction);
|
parameters.Add("@ContainmentAction", model.ContainmentAction);
|
||||||
parameters.Add("@ResponsibilityOwnerID", model.ResponsibilityOwnerID);
|
parameters.Add("@ResponsibilityOwnerID", model.ResponsibilityOwnerID);
|
||||||
//parameters.Add("@ResponsibilityOwner", model.ResponsibilityOwner);
|
|
||||||
parameters.Add("@ECD", model.ECD);
|
parameters.Add("@ECD", model.ECD);
|
||||||
parameters.Add("@ImplementedDate", model.ImplementedDate);
|
parameters.Add("@ImplementedDate", model.ImplementedDate);
|
||||||
|
|
||||||
@ -914,9 +821,6 @@ public class MRB_DMO {
|
|||||||
db.Execute("UPDATE MRB SET ApprovalStatus = " + (int)GlobalVars.ApprovalOption.Closed + ", CloseDate = GETDATE() WHERE MRBNumber = " + mrbNumber, commandType: CommandType.Text);
|
db.Execute("UPDATE MRB SET ApprovalStatus = " + (int)GlobalVars.ApprovalOption.Closed + ", CloseDate = GETDATE() WHERE MRBNumber = " + mrbNumber, commandType: CommandType.Text);
|
||||||
|
|
||||||
internal void SetDispositionTypeForAllLots(int mrbNumber, string dispoType) =>
|
internal void SetDispositionTypeForAllLots(int mrbNumber, string dispoType) =>
|
||||||
//var sql = "UPDATE MRBLot SET DispoType = '" + dispoType + "' WHERE MRBNumber = " + mrbNumber;
|
|
||||||
//this.db.Execute(sql, commandType: CommandType.Text);
|
|
||||||
|
|
||||||
db.Execute("MRBSetDispositionTypeForAllLots", new { @MRBNumber = mrbNumber, @DispoType = dispoType }, commandType: CommandType.StoredProcedure);
|
db.Execute("MRBSetDispositionTypeForAllLots", new { @MRBNumber = mrbNumber, @DispoType = dispoType }, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
internal void GetLotWaferDieCount(int mrbNumber, out int lotCount, out int waferCount, out int dieCount) {
|
internal void GetLotWaferDieCount(int mrbNumber, out int lotCount, out int waferCount, out int dieCount) {
|
||||||
@ -945,18 +849,6 @@ public class MRB_DMO {
|
|||||||
internal void LogHoldFlagSentToSPNHistory(int mrbNumber) =>
|
internal void LogHoldFlagSentToSPNHistory(int mrbNumber) =>
|
||||||
db.Execute("MRBLogHoldFlagSentToSPNHistory", new { @MRBNumber = mrbNumber }, commandType: CommandType.StoredProcedure);
|
db.Execute("MRBLogHoldFlagSentToSPNHistory", new { @MRBNumber = mrbNumber }, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
//internal IEnumerable<string> GetSPN_MRB_HoldFlagLots(int mrbNumber)
|
|
||||||
//{
|
|
||||||
// var disposition = this.db.Query<string>("MRBGet_SPN_HoldLots", new { @MRBNumber = mrbNumber }, commandType: CommandType.StoredProcedure).ToList();
|
|
||||||
// return disposition;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//internal void InsertSPN_MRB_HoldFlagLots(int mrbNumber)
|
|
||||||
//{
|
|
||||||
// var disposition = this.db.Query<string>("MRBInsertSPN_HoldFlagLots", new { @MRBNumber = mrbNumber }, commandType: CommandType.StoredProcedure).ToList();
|
|
||||||
// //return disposition;
|
|
||||||
//}
|
|
||||||
|
|
||||||
internal void InsertMRB_QDB_HoldFlag(string guid, string data, string operation) {
|
internal void InsertMRB_QDB_HoldFlag(string guid, string data, string operation) {
|
||||||
string[] tempData = data.Split(new char[] { '~' });
|
string[] tempData = data.Split(new char[] { '~' });
|
||||||
|
|
||||||
@ -981,12 +873,6 @@ public class MRB_DMO {
|
|||||||
db.Execute("MRBUpdateQDB_HoldProcessedFlag", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("MRBUpdateQDB_HoldProcessedFlag", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
//internal IEnumerable<string> GetLotsForMRBHoldFlags(string guid)
|
|
||||||
//{
|
|
||||||
// var data = this.db.Query<string>("MRBGetMRB_QDB_HoldFlags", new { @Guid = guid }, commandType: CommandType.StoredProcedure).ToList();
|
|
||||||
// return data;
|
|
||||||
//}
|
|
||||||
|
|
||||||
public IEnumerable<CAUserList> GetUserList() {
|
public IEnumerable<CAUserList> GetUserList() {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
List<CAUserList> userList = db.Query<CAUserList>("_8DGetUserList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<CAUserList> userList = db.Query<CAUserList>("_8DGetUserList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
@ -1013,319 +899,4 @@ public class MRB_DMO {
|
|||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ImportRemoveQDBFlag(string operation, out string physicalPath, string userIdentityName, string a, string b, string c, string fullFileName, Stream stream) {
|
|
||||||
IEnumerable<string> lotDataList = null;
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
physicalPath = Path.Combine(_AppSettings.LotTempPipeLine, guid + "." + fileExtension);
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
#if !NET8
|
|
||||||
ExcelData x = new ExcelData(physicalPath);
|
|
||||||
lotDataList = x.ReadQDBFlagData();
|
|
||||||
|
|
||||||
foreach (string lotData in lotDataList) {
|
|
||||||
InsertMRB_QDB_HoldFlag(guid, lotData, operation);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FileInfo f = new(physicalPath);
|
|
||||||
if (f.Exists)
|
|
||||||
f.Delete();
|
|
||||||
|
|
||||||
//Send the data to SPN
|
|
||||||
if (SendQDBFlagToSPN(guid, userIdentityName, a, b, c))
|
|
||||||
UpdateMRB_QDB_HoldFlag(guid, true);
|
|
||||||
else {
|
|
||||||
UpdateMRB_QDB_HoldFlag(guid, false);
|
|
||||||
return "Problems while uploading to SPN";
|
|
||||||
}
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool BatchFTP(string sourceFile, string destFile, string ftpLogDirectory, string userIdentityName, string a, string b, string c) {
|
|
||||||
FileInfo sourcefile = new(sourceFile);
|
|
||||||
|
|
||||||
//FileInfo sourcefile = new FileInfo(@"C:\Websites\ECNViewerAckResultToSPN\S15122017102017.ecn");
|
|
||||||
|
|
||||||
try {
|
|
||||||
//Functions.WriteEvent("HR Emp", "SPNData - Start Send(): FTPing " + sourceFile + " to SPN server.", System.Diagnostics.EventLogEntryType.Information);
|
|
||||||
|
|
||||||
//System.Security.SecureString ss = new System.Security.SecureString();
|
|
||||||
//foreach (char c in credentialsStorage.Password)
|
|
||||||
// ss.AppendChar(c);
|
|
||||||
|
|
||||||
ProcessStartInfo psiFab1 = new();
|
|
||||||
Process procFab1 = new();
|
|
||||||
StringBuilder sb = new();
|
|
||||||
|
|
||||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
|
||||||
psiFab1.FileName = a; // Server.MapPath("/FTPBatch/" + @Functions.FTPSPNBatch_Test());
|
|
||||||
} else {
|
|
||||||
psiFab1.FileName = b; // Server.MapPath("/FTPBatch/" + @Functions.FTPSPNBatch());
|
|
||||||
}
|
|
||||||
|
|
||||||
psiFab1.Arguments = sourcefile.FullName + " " + destFile;
|
|
||||||
|
|
||||||
psiFab1.RedirectStandardOutput = true;
|
|
||||||
psiFab1.UseShellExecute = false;
|
|
||||||
psiFab1.WorkingDirectory = c; // Server.MapPath("/FTPBatch/");
|
|
||||||
//credentialsStorage = MiscDMO.GetCredentialsInfo("TEMSA01EC", "LocalAdmin");
|
|
||||||
//psiFab1.UserName = credentialsStorage.UserName;
|
|
||||||
//psiFab1.Password = ss;
|
|
||||||
|
|
||||||
procFab1.StartInfo = psiFab1;
|
|
||||||
procFab1.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data);
|
|
||||||
;
|
|
||||||
procFab1.Start();
|
|
||||||
procFab1.BeginOutputReadLine();
|
|
||||||
procFab1.WaitForExit(4000);
|
|
||||||
|
|
||||||
File.WriteAllText(Path.Combine(ftpLogDirectory, sourcefile.Name + ".txt"), sb.ToString());
|
|
||||||
|
|
||||||
//procFab1.StartInfo = psiFab1;
|
|
||||||
//procFab1.Start();
|
|
||||||
|
|
||||||
//Functions.WriteEvent("HR Emp", "SPNData - Finish FTPing to SPN server.", System.Diagnostics.EventLogEntryType.Information);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Functions.WriteEvent(_AppSettings, userIdentityName + "\r\n Approve\r\n" + e.Message.ToString(), EventLogEntryType.Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SendQDBFlagToSPN(string guid, string userIdentityName, string a, string b, string c) {
|
|
||||||
StringBuilder output = new();
|
|
||||||
try {
|
|
||||||
IEnumerable<string> data = GetMRB_QDB_HoldFlags(guid);
|
|
||||||
foreach (string tempData in data) {
|
|
||||||
//output = new StringBuilder();
|
|
||||||
output.Append(tempData.Trim() + Environment.NewLine);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (output.Length > 0) {
|
|
||||||
DateTime dt = DateTime.Now;
|
|
||||||
string newsourceFileName = "S" + dt.Day.ToString("00") + dt.Month.ToString("00") + dt.Year.ToString("00") + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00") + ".mrb";
|
|
||||||
string newDestFileName = "S" + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00") + ".mrb";
|
|
||||||
|
|
||||||
//string outputFile = @"C:\Websites\SPNLotHoldFlag\" + newsourceFileName;
|
|
||||||
string outputFile = _AppSettings.HoldFlagDirectory + newsourceFileName;
|
|
||||||
|
|
||||||
File.WriteAllText(outputFile, output.ToString());
|
|
||||||
|
|
||||||
#if (DEBUG)
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
#endif
|
|
||||||
try {
|
|
||||||
//#if (!DEBUG)
|
|
||||||
//FTPWrapper spfSPN = new FTPWrapper(outputFile, newDestFileName);
|
|
||||||
//spfSPN.FTPToSPN();
|
|
||||||
|
|
||||||
if (BatchFTP(outputFile, newDestFileName, _AppSettings.SPNMRBHoldFlagFTPLogDirectory, userIdentityName, a, b, c)) {
|
|
||||||
UpdateMRB_QDB_HoldFlag(guid, true);
|
|
||||||
} else {
|
|
||||||
UpdateMRB_QDB_HoldFlag(guid, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//#endif
|
|
||||||
} catch (Exception e) {
|
|
||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "MRB =" + guid.ToString() + " FTPToSPN(): FTP Upload Error " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = -1, UserID = userIdentityName, DocumentType = "MRB", OperationType = "Error", Comments = exceptionString });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "MRB =" + guid.ToString() + " SPN Hold Flag(SendToSPN) " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
|
||||||
Functions.WriteEvent(_AppSettings, userIdentityName + "\r\n Approve\r\n" + e.Message.ToString(), EventLogEntryType.Error);
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = -1, UserID = userIdentityName, DocumentType = "MRB", OperationType = "Error", Comments = exceptionString });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "GUID =" + guid.ToString() + " SPN Hold Flag(SendToSPN) " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
|
||||||
Functions.WriteEvent(_AppSettings, userIdentityName + "\r\n Approve\r\n" + e.Message.ToString(), EventLogEntryType.Error);
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = -1, UserID = userIdentityName, DocumentType = "MRB", OperationType = "Error", Comments = exceptionString });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ImportAddQDBFlag(string operation, out string physicalPath, string userIdentityName, string a, string b, string c, string fullFileName, Stream stream) {
|
|
||||||
IEnumerable<string> lotDataList = null;
|
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
physicalPath = Path.Combine(_AppSettings.LotTempPipeLine, guid + "." + fileExtension);
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !NET8
|
|
||||||
ExcelData x = new ExcelData(physicalPath);
|
|
||||||
lotDataList = x.ReadQDBFlagData();
|
|
||||||
|
|
||||||
foreach (string lotData in lotDataList) {
|
|
||||||
InsertMRB_QDB_HoldFlag(guid, lotData, operation);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FileInfo f = new(physicalPath);
|
|
||||||
if (f.Exists)
|
|
||||||
f.Delete();
|
|
||||||
|
|
||||||
if (SendQDBFlagToSPN(guid, userIdentityName, a, b, c))
|
|
||||||
UpdateMRB_QDB_HoldFlag(guid, true);
|
|
||||||
else {
|
|
||||||
UpdateMRB_QDB_HoldFlag(guid, false);
|
|
||||||
return "Problems while uploading to SPN";
|
|
||||||
}
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AttachSave(int mrbNumber, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
string physicalFileName;
|
|
||||||
string physicalPath;
|
|
||||||
|
|
||||||
// Check to see if this filename is in use
|
|
||||||
var attachments = GetMRBAttachments(mrbNumber);
|
|
||||||
if (attachments.Count() > 0) {
|
|
||||||
if (attachments.Count(a => string.Equals(a.FileName, fileName, StringComparison.OrdinalIgnoreCase)) > 0) {
|
|
||||||
// This filename is used on this MRB
|
|
||||||
// So we want to delete those records so the new record replaces them
|
|
||||||
foreach (var a in attachments) {
|
|
||||||
DeleteMRBAttachment(a.AttachmentID);
|
|
||||||
|
|
||||||
physicalFileName = a.Path;
|
|
||||||
if (string.IsNullOrEmpty(physicalFileName))
|
|
||||||
physicalFileName = a.FileName;
|
|
||||||
physicalPath = Path.Combine(_AppSettings.AttachmentFolder + "MRB", physicalFileName);
|
|
||||||
|
|
||||||
if (File.Exists(physicalPath))
|
|
||||||
File.Delete(physicalPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
physicalFileName = mrbNumber.ToString() + "_" + Guid.NewGuid().ToString() + Path.GetExtension(fileName);
|
|
||||||
physicalPath = Path.Combine(_AppSettings.AttachmentFolder + "MRB", physicalFileName);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
MRBAttachment attach = new() {
|
|
||||||
MRBNumber = mrbNumber,
|
|
||||||
FileName = fileName,
|
|
||||||
Path = physicalFileName,
|
|
||||||
#if (DEBUG)
|
|
||||||
UserID = 114,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (!DEBUG)
|
|
||||||
UserID = userId,
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
InsertMRBAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ExcelLotOpen(int mrbNumber, StringBuilder warnings, IEnumerable<Disposition> dispos, string userIdentityName, string lotTempPipeLine, string fullFileName, Stream stream) {
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
var fileExtension = Path.GetExtension(fullFileName);
|
|
||||||
string fName = userIdentityName + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
|
|
||||||
string physicalPath = Path.Combine(lotTempPipeLine, fName + "." + fileExtension);
|
|
||||||
|
|
||||||
#if !NET8
|
|
||||||
IEnumerable<ExcelData.ExcelLotInfo> lotNumbers;
|
|
||||||
|
|
||||||
try {
|
|
||||||
using (var fileStream = new FileStream(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
ExcelData x = new ExcelData(physicalPath);
|
|
||||||
lotNumbers = x.ReadData();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
throw new Exception(String.Format("Invalid file format for {0}: {1}", fileName, ex.Message));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get Tool, Issue Start and End Date
|
|
||||||
|
|
||||||
MRB mrbInfo = GetToolIssueStartEndDateData(mrbNumber, null);
|
|
||||||
|
|
||||||
foreach (var lotInfo in lotNumbers) {
|
|
||||||
if (lotInfo.LotDispo.Length == 1) {
|
|
||||||
if (dispos.Count(d => d.DispositionType.Trim().ToUpper() == lotInfo.LotDispo.Trim().ToUpper()) == 0) {
|
|
||||||
throw new Exception(String.Format("Invalid lot disposition {0} for lot no {1}",
|
|
||||||
lotInfo.LotDispo, lotInfo.LotNo));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// RJK - 12/17
|
|
||||||
// Only find the child Splits when a Tool or a list of Tools is provided
|
|
||||||
if (!mrbInfo.ToolCSV.ToUpper().Equals("NA")) {
|
|
||||||
foreach (var lotInfo in lotNumbers) {
|
|
||||||
bool existingLotUpdated;
|
|
||||||
Lot l = new Lot();
|
|
||||||
l.LotNumber = lotInfo.LotNo;
|
|
||||||
if (lotInfo.LotDispo.Length == 1) {
|
|
||||||
l.DispoType = lotInfo.LotDispo[0];
|
|
||||||
}
|
|
||||||
l.MRBNumber = mrbNumber;
|
|
||||||
InsertLot(l, true, out existingLotUpdated);
|
|
||||||
// cannot do the check below , because what if the parent lot had splits after the prior lot split analysis
|
|
||||||
//if (!existingLotUpdated)
|
|
||||||
//{
|
|
||||||
if (!InsertLotSplitsAffectedByIncident(mrbNumber, l.LotNumber, mrbInfo.ToolCSV, mrbInfo.IssueStartDate, mrbInfo.IssueEndDate)) {
|
|
||||||
warnings.AppendFormat("Lot number {0} is not affected by these tools and issue start/end time.\n Uploaded without Lot Genealogy tracing", l.LotNumber);
|
|
||||||
}
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not required - Will be using each lot's Insert Date time stamp,
|
|
||||||
// as lot could be added using search functionality
|
|
||||||
// UpdateLastLotSplitAnalysisTime(mrbNumber);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// RJK - 12/17
|
|
||||||
// Only find the child Splits when a Tool or a list of Tools is provided
|
|
||||||
foreach (var lotInfo in lotNumbers) {
|
|
||||||
bool existingLotUpdated;
|
|
||||||
Lot l = new Lot();
|
|
||||||
l.LotNumber = lotInfo.LotNo;
|
|
||||||
if (lotInfo.LotDispo.Length == 1) {
|
|
||||||
l.DispoType = lotInfo.LotDispo[0];
|
|
||||||
}
|
|
||||||
l.MRBNumber = mrbNumber;
|
|
||||||
// do not insert any new lots when importing from excel
|
|
||||||
InsertLot(l, true, out existingLotUpdated);
|
|
||||||
//UpdateLotDispoType(mrbNumber, l.LotNumber, l.DispoType);
|
|
||||||
|
|
||||||
//if (!existingLotUpdated)
|
|
||||||
//{
|
|
||||||
// if (!InsertLotSplitsAffectedByIncident(mrbNumber, l.LotNumber, mrbInfo.ToolCSV, mrbInfo.IssueStartDate, mrbInfo.IssueEndDate))
|
|
||||||
// {
|
|
||||||
// warnings.AppendFormat("Lot number {0} is not affected by these tools and issue start/end time.\n", l.LotNumber);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FileInfo f = new(physicalPath);
|
|
||||||
if (f.Exists)
|
|
||||||
f.Delete();
|
|
||||||
|
|
||||||
return physicalPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -22,7 +22,6 @@ public class MiscDMO {
|
|||||||
string sql = "";
|
string sql = "";
|
||||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||||
if (searchBy == GlobalVars.LOT_NO)
|
if (searchBy == GlobalVars.LOT_NO)
|
||||||
//sql = "SELECT WP_LOT_NO + '/' + ISNULL(WP_LOT_NO,'') AS LotNumber FROM WP_RECORD_MJ WHERE WP_LOT_NO LIKE '%" + searchText + "%' ";
|
|
||||||
sql = "SELECT WP_LOT_NO + '/' + ISNULL(WP_LOT_NO,'') AS LotNumber FROM SPNLot WHERE WP_LOT_NO LIKE '%" + searchText + "%' ";
|
sql = "SELECT WP_LOT_NO + '/' + ISNULL(WP_LOT_NO,'') AS LotNumber FROM SPNLot WHERE WP_LOT_NO LIKE '%" + searchText + "%' ";
|
||||||
else if (searchBy == GlobalVars.LOCATION) {
|
else if (searchBy == GlobalVars.LOCATION) {
|
||||||
sql = "SELECT WP_LOT_NO + '/' + ISNULL(WP_LOT_NO,'') AS LotNumber FROM SPNLot WHERE WP_CURRENT_LOCATION = '" + searchText.Trim() + "' AND WP_LOT_NO + '/' + ISNULL(WP_LOT_NO,'') IS NOT NULL";
|
sql = "SELECT WP_LOT_NO + '/' + ISNULL(WP_LOT_NO,'') AS LotNumber FROM SPNLot WHERE WP_CURRENT_LOCATION = '" + searchText.Trim() + "' AND WP_LOT_NO + '/' + ISNULL(WP_LOT_NO,'') IS NOT NULL";
|
||||||
@ -73,13 +72,6 @@ public class MiscDMO {
|
|||||||
sql.Append("SELECT PartNumber + '~' + SiliconPart + '~' + ProcessFlow + '~' + PartDescription AS WIPPartData ");
|
sql.Append("SELECT PartNumber + '~' + SiliconPart + '~' + ProcessFlow + '~' + PartDescription AS WIPPartData ");
|
||||||
sql.Append("FROM vWIPPartData WHERE PartNumber LIKE '%" + searchText + "%' ORDER BY PartNumber");
|
sql.Append("FROM vWIPPartData WHERE PartNumber LIKE '%" + searchText + "%' ORDER BY PartNumber");
|
||||||
|
|
||||||
//StringBuilder sql = new StringBuilder();
|
|
||||||
//sql.Append("SELECT TO_PART AS PartNumber, FROM_PART AS SiliconPart, P.MP_DESCRIPTION AS PartDescirption, ");
|
|
||||||
//sql.Append("RTRIM(LTRIM(SUBSTRING(TO_PART_PROC, PATINDEX('% %', TO_PART_PROC), LEN(TO_PART_PROC)))) AS ProcessFlow ");
|
|
||||||
//sql.Append("FROM TEMIRWAP019.FAB2SPN.dbo.PG_RECORD W ");
|
|
||||||
//sql.Append("INNER JOIN TEMIRWAP019.Fab2SPN.dbo.MP_RECORD P ON W.TO_PART = P.MP_PART_NUMBER ");
|
|
||||||
//sql.Append("WHERE PartNumber LIKE '%" + searchText + "%' ORDER BY PartNumber ");
|
|
||||||
|
|
||||||
List<WIPPart> parList = db.Query<WIPPart>(sql.ToString()).ToList();
|
List<WIPPart> parList = db.Query<WIPPart>(sql.ToString()).ToList();
|
||||||
db.Close();
|
db.Close();
|
||||||
return parList;
|
return parList;
|
||||||
@ -92,7 +84,6 @@ public class MiscDMO {
|
|||||||
qryLotInfo.Append("WP_CURRENT_QTY, WP_CURRENT_LOCATION, DieLotNumber, DiePartNo, DieCount, MP_QUALITY_CODE FROM SPNLot ");
|
qryLotInfo.Append("WP_CURRENT_QTY, WP_CURRENT_LOCATION, DieLotNumber, DiePartNo, DieCount, MP_QUALITY_CODE FROM SPNLot ");
|
||||||
qryLotInfo.Append("WHERE WP_Lot_No = @LotNumber ");
|
qryLotInfo.Append("WHERE WP_Lot_No = @LotNumber ");
|
||||||
|
|
||||||
//var tempLotNumber = lot.LotNumber.Substring(0, 9);
|
|
||||||
var tempLotNumber = "";
|
var tempLotNumber = "";
|
||||||
if (lot.LotNumber.IndexOf('/') >= 0) {
|
if (lot.LotNumber.IndexOf('/') >= 0) {
|
||||||
tempLotNumber = lot.LotNumber.Substring(0, lot.LotNumber.IndexOf('/'));
|
tempLotNumber = lot.LotNumber.Substring(0, lot.LotNumber.IndexOf('/'));
|
||||||
@ -130,7 +121,6 @@ public class MiscDMO {
|
|||||||
} catch { } // ignore the error
|
} catch { } // ignore the error
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//lot.Gen = double.Parse(temp[2].Substring(1, temp[2].Length - 1));
|
|
||||||
if (lot.Description.StartsWith("MA,"))
|
if (lot.Description.StartsWith("MA,"))
|
||||||
lot.Gen = temp[2];
|
lot.Gen = temp[2];
|
||||||
else
|
else
|
||||||
@ -184,8 +174,6 @@ public class MiscDMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// added this code if the data shows up at the 6600 location and also at QDB for a lot.
|
// added this code if the data shows up at the 6600 location and also at QDB for a lot.
|
||||||
//if (lot.DieCost > 0)
|
|
||||||
// lot.Location = "QDB";
|
|
||||||
|
|
||||||
if (lotInfoColumn.MP_QUALITY_CODE != null)
|
if (lotInfoColumn.MP_QUALITY_CODE != null)
|
||||||
lot.QualityCode = lotInfoColumn.MP_QUALITY_CODE.Trim();
|
lot.QualityCode = lotInfoColumn.MP_QUALITY_CODE.Trim();
|
||||||
@ -193,12 +181,8 @@ public class MiscDMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
db.Close();
|
db.Close();
|
||||||
//return lotStatusOption;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// /
|
|
||||||
/// </summary>
|
|
||||||
public static IEnumerable<UserProfile> GetUserList() {
|
public static IEnumerable<UserProfile> GetUserList() {
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
@ -358,14 +342,6 @@ public class MiscDMO {
|
|||||||
public static void GetLTLotInformation(LTLot lot) {
|
public static void GetLTLotInformation(LTLot lot) {
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
StringBuilder qryLotInfo = new();
|
StringBuilder qryLotInfo = new();
|
||||||
//qryLotInfo.Append("SELECT DISTINCT ");
|
|
||||||
//qryLotInfo.Append("WP_LOT_NO, WP_CURRENT_QTY, WP.WP_PART_NUMBER, MP_DESCRIPTION, WP_PROCESS, WO_LOCATION, WO_OPER_NO, WP_STATUS ");
|
|
||||||
//qryLotInfo.Append("FROM TEMIRWAP019.FAB2SPN.dbo.WO_RECORD WO ");
|
|
||||||
//qryLotInfo.Append("INNER JOIN TEMIRWAP019.FAB2SPN.dbo.WP_RECORD WP ");
|
|
||||||
//qryLotInfo.Append("ON WO.WO_LOT_NO = WP.WP_LOT_NO AND WO.InTime = (SELECT MAX(InTime) FROM TEMIRWAP019.FAB2SPN.dbo.WO_RECORD WHERE WO_LOT_NO = @LotNumber) ");
|
|
||||||
//qryLotInfo.Append("LEFT JOIN TEMIRWAP019.FAB2SPN.dbo.MP_RECORD MP ");
|
|
||||||
//qryLotInfo.Append("ON WP.WP_PART_NUMBER = MP.MP_PART_NUMBER ");
|
|
||||||
//qryLotInfo.Append("WHERE WO_LOT_NO = @LotNumber ");
|
|
||||||
|
|
||||||
qryLotInfo.Append("SELECT DISTINCT ");
|
qryLotInfo.Append("SELECT DISTINCT ");
|
||||||
qryLotInfo.Append("WP_LOT_NO, WP_CURRENT_QTY, WP.WP_PART_NUMBER, MP_DESCRIPTION, WP_PROCESS, WP_CURRENT_LOCATION, WP_OPER_NO, WP_STATUS ");
|
qryLotInfo.Append("WP_LOT_NO, WP_CURRENT_QTY, WP.WP_PART_NUMBER, MP_DESCRIPTION, WP_PROCESS, WP_CURRENT_LOCATION, WP_OPER_NO, WP_STATUS ");
|
||||||
@ -374,8 +350,6 @@ public class MiscDMO {
|
|||||||
qryLotInfo.Append("ON WP.WP_PART_NUMBER = MP.MP_PART_NUMBER ");
|
qryLotInfo.Append("ON WP.WP_PART_NUMBER = MP.MP_PART_NUMBER ");
|
||||||
qryLotInfo.Append("WHERE WP_LOT_NO = @LotNumber ");
|
qryLotInfo.Append("WHERE WP_LOT_NO = @LotNumber ");
|
||||||
|
|
||||||
//var tempLotNumber = lot.LotNumber.Substring(0, 9);
|
|
||||||
|
|
||||||
var tempLotNumber = "";
|
var tempLotNumber = "";
|
||||||
if (lot.LotNumber.IndexOf('/') >= 0) {
|
if (lot.LotNumber.IndexOf('/') >= 0) {
|
||||||
tempLotNumber = lot.LotNumber.Substring(0, lot.LotNumber.IndexOf('/'));
|
tempLotNumber = lot.LotNumber.Substring(0, lot.LotNumber.IndexOf('/'));
|
||||||
@ -437,7 +411,6 @@ public class MiscDMO {
|
|||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@ApprovalId", approvalId);
|
parameters.Add("@ApprovalId", approvalId);
|
||||||
db.Query<CredentialsStorage>("UpdateApprovalLastNotifyDate", param: parameters, commandType: CommandType.StoredProcedure).Single();
|
db.Query<CredentialsStorage>("UpdateApprovalLastNotifyDate", param: parameters, commandType: CommandType.StoredProcedure).Single();
|
||||||
//return data;
|
|
||||||
}
|
}
|
||||||
//================================================================== End of Class
|
|
||||||
}
|
}
|
@ -1,7 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using Dapper;
|
using Dapper;
|
||||||
@ -13,12 +12,8 @@ namespace Fab2ApprovalSystem.DMO;
|
|||||||
|
|
||||||
public class PartsRequestDMO {
|
public class PartsRequestDMO {
|
||||||
|
|
||||||
private readonly AppSettings _AppSettings;
|
|
||||||
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
public PartsRequestDMO(AppSettings appSettings) =>
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
|
|
||||||
public IEnumerable<PartsRequestList> GetPartsRequestList() {
|
public IEnumerable<PartsRequestList> GetPartsRequestList() {
|
||||||
List<PartsRequestList> r = db.Query<PartsRequestList>("PartsRequestGetList", commandType: CommandType.StoredProcedure).ToList();
|
List<PartsRequestList> r = db.Query<PartsRequestList>("PartsRequestGetList", commandType: CommandType.StoredProcedure).ToList();
|
||||||
return r;
|
return r;
|
||||||
@ -114,28 +109,4 @@ public class PartsRequestDMO {
|
|||||||
db.Execute("PartsRequestDelete", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("PartsRequestDelete", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AttachSave(int prNumber, int userId, string fullFileName, Stream stream) {
|
|
||||||
// Some browsers send file names with full path.
|
|
||||||
// We are only interested in the file name.
|
|
||||||
var fileName = Path.GetFileName(fullFileName);
|
|
||||||
|
|
||||||
string prFolderPath = _AppSettings.AttachmentFolder + "PartsRequest\\" + prNumber.ToString();
|
|
||||||
|
|
||||||
DirectoryInfo di = new(prFolderPath);
|
|
||||||
if (!di.Exists)
|
|
||||||
di.Create();
|
|
||||||
|
|
||||||
var physicalPath = Path.Combine(prFolderPath, fileName);
|
|
||||||
|
|
||||||
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
|
||||||
stream.CopyTo(fileStream);
|
|
||||||
}
|
|
||||||
PartsRequestAttachment attach = new() {
|
|
||||||
PRNumber = prNumber,
|
|
||||||
FileName = fileName,
|
|
||||||
UserID = userId,
|
|
||||||
};
|
|
||||||
InsertAttachment(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -13,7 +13,6 @@ public class SAM_DMO {
|
|||||||
|
|
||||||
public int HasITARAccess(string userID) {
|
public int HasITARAccess(string userID) {
|
||||||
StringBuilder query = new("SELECT COUNT(*) FROM dbo.fnIsUserITARCompliant(@UserID) ");
|
StringBuilder query = new("SELECT COUNT(*) FROM dbo.fnIsUserITARCompliant(@UserID) ");
|
||||||
//query.Append("WHERE UserID = @UserID AND AND EmployeeStatus = 'Active'");
|
|
||||||
return db.Query<int>(query.ToString(), new { UserID = userID }).SingleOrDefault();
|
return db.Query<int>(query.ToString(), new { UserID = userID }).SingleOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@ public class TrainingDMO {
|
|||||||
|
|
||||||
public int Create(int issueId) {
|
public int Create(int issueId) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@TrainingId", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@TrainingId", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
parameters.Add("@ECNNumber", issueId);
|
parameters.Add("@ECNNumber", issueId);
|
||||||
|
|
||||||
@ -32,9 +30,6 @@ public class TrainingDMO {
|
|||||||
|
|
||||||
public int CreateAssignment(int trainingId, int userId) {
|
public int CreateAssignment(int trainingId, int userId) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
|
||||||
//parameters.Add("@TrainingId", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
|
||||||
parameters.Add("@TrainingID", trainingId);
|
parameters.Add("@TrainingID", trainingId);
|
||||||
parameters.Add("@UserID", userId);
|
parameters.Add("@UserID", userId);
|
||||||
parameters.Add("@AssignmentID", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@AssignmentID", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
@ -147,9 +142,6 @@ public class TrainingDMO {
|
|||||||
public void AddTrainingGroupToECN(int ECNNumber, int groupId) {
|
public void AddTrainingGroupToECN(int ECNNumber, int groupId) {
|
||||||
#if !NET8
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
//ECNTrainingBy ecnTraining = new ECNTrainingBy();
|
|
||||||
//ecnTraining.AcknowledgementTrainingByID = groupId;
|
|
||||||
//ecnTraining.ECNNumber = ECNNumber;
|
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
var parameters = new DynamicParameters();
|
||||||
parameters.Add("@ECNNumber", ECNNumber);
|
parameters.Add("@ECNNumber", ECNNumber);
|
||||||
@ -157,7 +149,6 @@ public class TrainingDMO {
|
|||||||
|
|
||||||
this.db.Execute("ECNInsertTrainingBy", parameters, commandType: CommandType.StoredProcedure);
|
this.db.Execute("ECNInsertTrainingBy", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
//db.ECNTrainingBies.Add(ecnTraining);
|
|
||||||
#else
|
#else
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
#endif
|
#endif
|
||||||
@ -166,16 +157,11 @@ public class TrainingDMO {
|
|||||||
public void SetTrainingFlag(int ECNNumber) {
|
public void SetTrainingFlag(int ECNNumber) {
|
||||||
#if !NET8
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
//ECNTrainingBy ecnTraining = new ECNTrainingBy();
|
|
||||||
//ecnTraining.AcknowledgementTrainingByID = groupId;
|
|
||||||
//ecnTraining.ECNNumber = ECNNumber;
|
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
var parameters = new DynamicParameters();
|
||||||
parameters.Add("@ECNNumber", ECNNumber);
|
parameters.Add("@ECNNumber", ECNNumber);
|
||||||
|
|
||||||
this.db.Execute("ECNSetTrainingFlag", parameters, commandType: CommandType.StoredProcedure);
|
this.db.Execute("ECNSetTrainingFlag", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
//db.ECNTrainingBies.Add(ecnTraining);
|
|
||||||
#else
|
#else
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
#endif
|
#endif
|
||||||
@ -235,10 +221,7 @@ public class TrainingDMO {
|
|||||||
|
|
||||||
public void AcknowledgeDocument(int trainingDocAckID) {
|
public void AcknowledgeDocument(int trainingDocAckID) {
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@TrainingDocAckID", trainingDocAckID);
|
parameters.Add("@TrainingDocAckID", trainingDocAckID);
|
||||||
//parameters.Add("@AttachmentID", attachmentID);
|
|
||||||
|
|
||||||
db.Execute("TrainingAcknowledgeDocument", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("TrainingAcknowledgeDocument", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
@ -447,7 +430,6 @@ public class TrainingDMO {
|
|||||||
foreach (TrainingAssignment trainingAssignment in trainingAssignments) {
|
foreach (TrainingAssignment trainingAssignment in trainingAssignments) {
|
||||||
DeleteTrainingAssignment(trainingAssignment.ID);
|
DeleteTrainingAssignment(trainingAssignment.ID);
|
||||||
DeleteTrainingDocAck(trainingAssignment.ID);
|
DeleteTrainingDocAck(trainingAssignment.ID);
|
||||||
//db.SaveChanges();
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
@ -17,11 +17,6 @@ public class UserAccountDMO {
|
|||||||
|
|
||||||
public IEnumerable<LoginModel> GetAllUsers() {
|
public IEnumerable<LoginModel> GetAllUsers() {
|
||||||
StringBuilder sql = new();
|
StringBuilder sql = new();
|
||||||
//sql.Append("SELECT U.FirstName + ' ' + U.LastName AS FullName, U1.FirstName + ' ' + U1.LastName AS DelegatedToFullName, U.* ");
|
|
||||||
//sql.Append("FROM Users U LEFT JOIN Users U1 ");
|
|
||||||
//sql.Append("ON U.UserID = U1.DelegatedTo ORDER BY FirstName ");
|
|
||||||
|
|
||||||
//sql.Append("SELECT FirstName + ' ' + LastName AS FullName, * FROM Users ORDER BY FirstName ");
|
|
||||||
sql.Append(" SELECT U.FirstName + ' ' + U.LastName AS FullName, U.* , U1.FirstName + ' ' + U1.LastName AS DelegatedToFullName ");
|
sql.Append(" SELECT U.FirstName + ' ' + U.LastName AS FullName, U.* , U1.FirstName + ' ' + U1.LastName AS DelegatedToFullName ");
|
||||||
sql.Append("FROM Users U LEFT JOIN Users U1 ON U.DelegatedTo = U1.UserID ");
|
sql.Append("FROM Users U LEFT JOIN Users U1 ON U.DelegatedTo = U1.UserID ");
|
||||||
sql.Append("ORDER BY FirstName ");
|
sql.Append("ORDER BY FirstName ");
|
||||||
@ -31,11 +26,6 @@ public class UserAccountDMO {
|
|||||||
|
|
||||||
public IEnumerable<LoginModel> GetAllActiveUsers() {
|
public IEnumerable<LoginModel> GetAllActiveUsers() {
|
||||||
StringBuilder sql = new();
|
StringBuilder sql = new();
|
||||||
//sql.Append("SELECT U.FirstName + ' ' + U.LastName AS FullName, U1.FirstName + ' ' + U1.LastName AS DelegatedToFullName, U.* ");
|
|
||||||
//sql.Append("FROM Users U LEFT JOIN Users U1 ");
|
|
||||||
//sql.Append("ON U.UserID = U1.DelegatedTo ORDER BY FirstName ");
|
|
||||||
|
|
||||||
//sql.Append("SELECT FirstName + ' ' + LastName AS FullName, * FROM Users ORDER BY FirstName ");
|
|
||||||
sql.Append(" SELECT U.FirstName + ' ' + U.LastName AS FullName, U.* , U1.FirstName + ' ' + U1.LastName AS DelegatedToFullName ");
|
sql.Append(" SELECT U.FirstName + ' ' + U.LastName AS FullName, U.* , U1.FirstName + ' ' + U1.LastName AS DelegatedToFullName ");
|
||||||
sql.Append("FROM Users U LEFT JOIN Users U1 ON U.DelegatedTo = U1.UserID ");
|
sql.Append("FROM Users U LEFT JOIN Users U1 ON U.DelegatedTo = U1.UserID ");
|
||||||
sql.Append("WHERE U.IsActive = 1 ");
|
sql.Append("WHERE U.IsActive = 1 ");
|
||||||
@ -45,9 +35,6 @@ public class UserAccountDMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LoginModel GetUser(string loginID) =>
|
public LoginModel GetUser(string loginID) =>
|
||||||
//StringBuilder sql = new StringBuilder();
|
|
||||||
//sql.Append("SELECT * FROM Users WHERE LoginID = '" + loginID + "'");
|
|
||||||
//return this.db.Query<LoginModel>(sql.ToString()).SingleOrDefault();
|
|
||||||
db.Query<LoginModel>("SELECT FirstName + ' ' + LastName AS FullName, * FROM Users WHERE LoginID = @loginID AND IsActive = 1 ", new { loginID = loginID }).Take(1).SingleOrDefault();
|
db.Query<LoginModel>("SELECT FirstName + ' ' + LastName AS FullName, * FROM Users WHERE LoginID = @loginID AND IsActive = 1 ", new { loginID = loginID }).Take(1).SingleOrDefault();
|
||||||
|
|
||||||
public LoginModel GetUserByID(int userID) {
|
public LoginModel GetUserByID(int userID) {
|
||||||
@ -79,7 +66,6 @@ public class UserAccountDMO {
|
|||||||
|
|
||||||
internal void DeleteUser(LoginModel model) {
|
internal void DeleteUser(LoginModel model) {
|
||||||
string sql;
|
string sql;
|
||||||
//sql = "DELETE Users WHERE UserID = @UserID";
|
|
||||||
sql = "UPDATE Users SET IsActive = 0 WHERE UserID = @UserID";
|
sql = "UPDATE Users SET IsActive = 0 WHERE UserID = @UserID";
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@UserID", model.UserID);
|
parameters.Add("@UserID", model.UserID);
|
||||||
@ -88,8 +74,6 @@ public class UserAccountDMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void InsertUser(LoginModel model) {
|
internal void InsertUser(LoginModel model) {
|
||||||
//string sql;
|
|
||||||
//sql = "INSERT Users (LoginID, FirstName, LastName, IsAdmin) VALUES (@LoginID, @FirstName, @LastName, @IsAdmin )";
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@UserID", model.UserID, DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@UserID", model.UserID, DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
parameters.Add("@LoginID", model.LoginID);
|
parameters.Add("@LoginID", model.LoginID);
|
||||||
|
@ -15,18 +15,6 @@ namespace Fab2ApprovalSystem.DMO;
|
|||||||
public class WorkflowDMO {
|
public class WorkflowDMO {
|
||||||
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
//delegate TResult MathFunction<T1, T2, TResult>(T1 var1, T2 var2);
|
|
||||||
|
|
||||||
//static void PrintResult<T1, T2, TResult>(MathFunction<T1, T2,
|
|
||||||
// TResult> mathFunction, T1 var1, T2 var2)
|
|
||||||
//{
|
|
||||||
// TResult result = mathFunction(var1, var2);
|
|
||||||
// Console.WriteLine(String.Format("Result is {0}", result));
|
|
||||||
//}
|
|
||||||
|
|
||||||
//PrintResult((x, y) => x / y, 2, 8);
|
|
||||||
//GenericDelegateNumber<int, int> e = new GenericDelegateNumber<int, int>(AddInt);
|
|
||||||
|
|
||||||
public string GetSubRoleItems(int issueID, int docType) {
|
public string GetSubRoleItems(int issueID, int docType) {
|
||||||
List<string> subRoleItems = new();
|
List<string> subRoleItems = new();
|
||||||
StringBuilder sqlString = new();
|
StringBuilder sqlString = new();
|
||||||
@ -240,19 +228,10 @@ public class WorkflowDMO {
|
|||||||
/* ===== Remove the code for Director Approval Loop - Changed per Dixie's request 08/06/2018
|
/* ===== Remove the code for Director Approval Loop - Changed per Dixie's request 08/06/2018
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//If Location = "QDB" OR PRRequired or MRB Required OR(Product = MA / RH AND Location = Probe) Get "Director" Role for all departments, except "Facilities"
|
|
||||||
|
|
||||||
sqlString = new StringBuilder();
|
sqlString = new StringBuilder();
|
||||||
//sqlString.Append("SELECT COUNT(*) FROM LotDisposition LD INNER JOIN Lot L ON LD.IssueID = L.IssueID ");
|
|
||||||
//sqlString.Append("WHERE ( ((L.ProductFamily = 'RH' OR L.ProductFamily = 'MA') ");
|
|
||||||
//sqlString.Append("AND (Location = '6300' OR Location = '6400' OR Location = '6600')) ");
|
|
||||||
//sqlString.Append("OR Location = 'QDB' OR Location = 'EDB' OR LD.PERequired = 1 OR LD.MRBRequired = 1) AND LD.IssueID = @IssueID ");
|
|
||||||
|
|
||||||
// 09/01/2020 -
|
// 09/01/2020 -
|
||||||
// Per Hans, do not include directors if PE required is checked
|
// Per Hans, do not include directors if PE required is checked
|
||||||
//sqlString.Append("SELECT COUNT(*) FROM LotDisposition LD INNER JOIN Lot L ON LD.IssueID = L.IssueID ");
|
|
||||||
//sqlString.Append("WHERE (LD.PERequired = 1 OR Location = 'QDB' OR Location = 'EDB' ) ");
|
|
||||||
//sqlString.Append("AND LD.IssueID = @IssueID ");
|
|
||||||
|
|
||||||
// 09/01/2020
|
// 09/01/2020
|
||||||
// Per Hans, do not include directors if PE required is checked
|
// Per Hans, do not include directors if PE required is checked
|
||||||
@ -300,7 +279,6 @@ public class WorkflowDMO {
|
|||||||
int recordCount = 0;
|
int recordCount = 0;
|
||||||
// EMERGENCY TECNS ==============================================================================================
|
// EMERGENCY TECNS ==============================================================================================
|
||||||
if (GlobalVars.DocumentType.EECN == (GlobalVars.DocumentType)documentType) {
|
if (GlobalVars.DocumentType.EECN == (GlobalVars.DocumentType)documentType) {
|
||||||
//subRoleItems.Add("'QA Pre Approver'");
|
|
||||||
qryString.Clear();
|
qryString.Clear();
|
||||||
qryString.Append("SELECT DISTINCT SRC.SubRoleCategoryItem FROM DocumentType D ");
|
qryString.Append("SELECT DISTINCT SRC.SubRoleCategoryItem FROM DocumentType D ");
|
||||||
qryString.Append("INNER JOIN Workflows W ON D.DocumentTypeID = W.DocumentTypeID ");
|
qryString.Append("INNER JOIN Workflows W ON D.DocumentTypeID = W.DocumentTypeID ");
|
||||||
@ -309,25 +287,13 @@ public class WorkflowDMO {
|
|||||||
qryString.Append("INNER JOIN SubRole SR ON R.RoleID = SR.RoleID ");
|
qryString.Append("INNER JOIN SubRole SR ON R.RoleID = SR.RoleID ");
|
||||||
qryString.Append("INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID ");
|
qryString.Append("INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID ");
|
||||||
qryString.Append("WHERE D.DocumentTypeID = @DocumentType");
|
qryString.Append("WHERE D.DocumentTypeID = @DocumentType");
|
||||||
//qryString.Append("WHERE D.DocumentTypeID = 3");
|
|
||||||
//subRoleItems.Add("'QA_Admin'");
|
|
||||||
List<dynamic> dataRows = db.Query<dynamic>(qryString.ToString(), new { DocumentType = documentType }).ToList();
|
List<dynamic> dataRows = db.Query<dynamic>(qryString.ToString(), new { DocumentType = documentType }).ToList();
|
||||||
foreach (var dataRow in dataRows) {
|
foreach (var dataRow in dataRows) {
|
||||||
subRoleItems.Add("'" + dataRow.SubRoleCategoryItem.ToString() + "'");
|
subRoleItems.Add("'" + dataRow.SubRoleCategoryItem.ToString() + "'");
|
||||||
}
|
}
|
||||||
//subRoleItems.Add("'QA Final Approver'");
|
} else {
|
||||||
} //===============================================================================================================
|
|
||||||
else {
|
|
||||||
subRoleItems.Add("'QA Pre Approver'");
|
subRoleItems.Add("'QA Pre Approver'");
|
||||||
// get the affected Department: Removed by JRO per Jeanne
|
// get the affected Department: Removed by JRO per Jeanne
|
||||||
//qryString.Clear();
|
|
||||||
//qryString.Append("SELECT ModuleName FROM ECNModule E INNER JOIN ECNAffectedModule AM ON E.ModuleID = AM.ModuleID WHERE AM.ECNNumber= @ECNNumber");
|
|
||||||
//var dataRows = this.db.Query<dynamic>(qryString.ToString(), new { ECNNumber = ecnNumber }).ToList();
|
|
||||||
//foreach (var dataRow in dataRows)
|
|
||||||
//{
|
|
||||||
// subRoleItems.Add("'" + dataRow.ModuleName.ToString() + "'");
|
|
||||||
//}
|
|
||||||
// get the approvers
|
|
||||||
qryString.Clear();
|
qryString.Clear();
|
||||||
qryString.Append("SELECT SubRoleCategoryItem FROM SubRoleCategory S INNER JOIN ECNAffectedDepartment AD ON S.SubRoleCategoryID = AD.DepartmentID WHERE AD.ECNNumber= @ECNNumber");
|
qryString.Append("SELECT SubRoleCategoryItem FROM SubRoleCategory S INNER JOIN ECNAffectedDepartment AD ON S.SubRoleCategoryID = AD.DepartmentID WHERE AD.ECNNumber= @ECNNumber");
|
||||||
List<dynamic> dataRows = db.Query<dynamic>(qryString.ToString(), new { ECNNumber = ecnNumber }).ToList();
|
List<dynamic> dataRows = db.Query<dynamic>(qryString.ToString(), new { ECNNumber = ecnNumber }).ToList();
|
||||||
@ -346,13 +312,6 @@ public class WorkflowDMO {
|
|||||||
recordCount = db.Query<int>(qryString.ToString(), new { ECNNumber = ecnNumber }).Single();
|
recordCount = db.Query<int>(qryString.ToString(), new { ECNNumber = ecnNumber }).Single();
|
||||||
if (recordCount > 0) {
|
if (recordCount > 0) {
|
||||||
subRoleItems.Add("'Environment'");
|
subRoleItems.Add("'Environment'");
|
||||||
//qryString.Clear();
|
|
||||||
//qryString.Append("SELECT SubRoleCategoryItem FROM [SubRoleCategory] WHERE SubRoleCategoryItem = 'Environment' ");
|
|
||||||
//dataRows = this.db.Query<dynamic>(qryString.ToString()).ToList();
|
|
||||||
//foreach (var dataRow in dataRows)
|
|
||||||
//{
|
|
||||||
// subRoleItems.Add("'" + dataRow.SubRoleCategoryItem.ToString() + "'");
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the "Capacity" Impact SubRole
|
// Get the "Capacity" Impact SubRole
|
||||||
@ -361,13 +320,6 @@ public class WorkflowDMO {
|
|||||||
recordCount = db.Query<int>(qryString.ToString(), new { ECNNumber = ecnNumber }).Single();
|
recordCount = db.Query<int>(qryString.ToString(), new { ECNNumber = ecnNumber }).Single();
|
||||||
if (recordCount > 0) {
|
if (recordCount > 0) {
|
||||||
subRoleItems.Add("'Capacity'");
|
subRoleItems.Add("'Capacity'");
|
||||||
//qryString.Clear();
|
|
||||||
//qryString.Append("SELECT SubRoleCategoryItem FROM [SubRoleCategory] WHERE SubRoleCategoryItem = 'Capacity' ");
|
|
||||||
//dataRows = this.db.Query<dynamic>(qryString.ToString()).ToList();
|
|
||||||
//foreach (var dataRow in dataRows)
|
|
||||||
//{
|
|
||||||
// subRoleItems.Add("'" + dataRow.SubRoleCategoryItem.ToString() + "'");
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the "MaterialConsumptionChangeRequired" Impact SubRole
|
// Get the "MaterialConsumptionChangeRequired" Impact SubRole
|
||||||
@ -376,13 +328,6 @@ public class WorkflowDMO {
|
|||||||
recordCount = db.Query<int>(qryString.ToString(), new { ECNNumber = ecnNumber }).Single();
|
recordCount = db.Query<int>(qryString.ToString(), new { ECNNumber = ecnNumber }).Single();
|
||||||
if (recordCount > 0) {
|
if (recordCount > 0) {
|
||||||
subRoleItems.Add("'MaterialConsumption'");
|
subRoleItems.Add("'MaterialConsumption'");
|
||||||
//qryString.Clear();
|
|
||||||
//qryString.Append("SELECT SubRoleCategoryItem FROM [SubRoleCategory] WHERE SubRoleCategoryItem = 'MaterialConsumption' ");
|
|
||||||
//dataRows = this.db.Query<dynamic>(qryString.ToString()).ToList();
|
|
||||||
//foreach (var dataRow in dataRows)
|
|
||||||
//{
|
|
||||||
// subRoleItems.Add("'" + dataRow.SubRoleCategoryItem.ToString() + "'");
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the "NewPartFlow" Impact SubRole
|
// Get the "NewPartFlow" Impact SubRole
|
||||||
@ -392,21 +337,12 @@ public class WorkflowDMO {
|
|||||||
if (recordCount > 0) {
|
if (recordCount > 0) {
|
||||||
subRoleItems.Add("'NewPartFlow'");
|
subRoleItems.Add("'NewPartFlow'");
|
||||||
subRoleItems.Add("'SPN-Execution'");
|
subRoleItems.Add("'SPN-Execution'");
|
||||||
//subRoleItems.Add("'TestProgram'");
|
|
||||||
subRoleItems.Add("'Metrology Change'");
|
subRoleItems.Add("'Metrology Change'");
|
||||||
subRoleItems.Add("'SPC'");
|
subRoleItems.Add("'SPC'");
|
||||||
//qryString.Clear();
|
|
||||||
//qryString.Append("SELECT SubRoleCategoryItem FROM [SubRoleCategory] WHERE SubRoleCategoryItem = 'NewPartFlow' ");
|
|
||||||
//dataRows = this.db.Query<dynamic>(qryString.ToString()).ToList();
|
|
||||||
//foreach (var dataRow in dataRows)
|
|
||||||
//{
|
|
||||||
// subRoleItems.Add("'" + dataRow.SubRoleCategoryItem.ToString() + "'");
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
subRoleItems.Add("'Document Control Admin'");
|
subRoleItems.Add("'Document Control Admin'");
|
||||||
subRoleItems.Add("'Training Notification'");
|
subRoleItems.Add("'Training Notification'");
|
||||||
//=======================================================================================================================
|
|
||||||
|
|
||||||
// Execution level========================================================================================================
|
// Execution level========================================================================================================
|
||||||
// Get the "SPN" SubRole
|
// Get the "SPN" SubRole
|
||||||
@ -414,15 +350,6 @@ public class WorkflowDMO {
|
|||||||
qryString.Append("SELECT COUNT(*) FROM ECN WHERE ECNNumber= @ECNNumber AND (SPNChangeRequired = 1) ");
|
qryString.Append("SELECT COUNT(*) FROM ECN WHERE ECNNumber= @ECNNumber AND (SPNChangeRequired = 1) ");
|
||||||
recordCount = db.Query<int>(qryString.ToString(), new { ECNNumber = ecnNumber }).Single();
|
recordCount = db.Query<int>(qryString.ToString(), new { ECNNumber = ecnNumber }).Single();
|
||||||
if (recordCount > 0) {
|
if (recordCount > 0) {
|
||||||
//subRoleItems.Add("'SPN-Execution'");
|
|
||||||
|
|
||||||
//qryString.Clear();
|
|
||||||
//qryString.Append("SELECT SubRoleCategoryItem FROM [SubRoleCategory] WHERE SubRoleCategoryItem = 'SPN' ");
|
|
||||||
//dataRows = this.db.Query<dynamic>(qryString.ToString()).ToList();
|
|
||||||
//foreach (var dataRow in dataRows)
|
|
||||||
//{
|
|
||||||
// subRoleItems.Add("'" + dataRow.SubRoleCategoryItem.ToString() + "'");
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the "Metrology Change" SubRole
|
// Get the "Metrology Change" SubRole
|
||||||
@ -622,11 +549,9 @@ public class WorkflowDMO {
|
|||||||
|
|
||||||
public string ReAssignApproval(int issueID, int assignedFromUser, int assignedToUser, byte step, int docType) {
|
public string ReAssignApproval(int issueID, int assignedFromUser, int assignedToUser, byte step, int docType) {
|
||||||
string email = "";
|
string email = "";
|
||||||
//string emailArray = "";
|
|
||||||
string emailIDArray = "";
|
string emailIDArray = "";
|
||||||
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
;
|
|
||||||
email = "";
|
email = "";
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@IssueID", issueID);
|
parameters.Add("@IssueID", issueID);
|
||||||
@ -644,11 +569,9 @@ public class WorkflowDMO {
|
|||||||
|
|
||||||
public string DelegateDocumentApproval(int issueID, int delegateFromUser, int delegateToUser) {
|
public string DelegateDocumentApproval(int issueID, int delegateFromUser, int delegateToUser) {
|
||||||
string email = "";
|
string email = "";
|
||||||
//string emailArray = "";
|
|
||||||
string emailID = "";
|
string emailID = "";
|
||||||
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
;
|
|
||||||
email = "";
|
email = "";
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@IssueID", issueID);
|
parameters.Add("@IssueID", issueID);
|
||||||
@ -664,13 +587,11 @@ public class WorkflowDMO {
|
|||||||
|
|
||||||
public string AddAdditionalApproval(int issueID, string userIDs, byte step, int documentType) {
|
public string AddAdditionalApproval(int issueID, string userIDs, byte step, int documentType) {
|
||||||
string email = "";
|
string email = "";
|
||||||
//string emailArray = "";
|
|
||||||
string emailIDArray = "";
|
string emailIDArray = "";
|
||||||
|
|
||||||
string[] arrayOfUsers = userIDs.Split(new char[] { '~' });
|
string[] arrayOfUsers = userIDs.Split(new char[] { '~' });
|
||||||
|
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
;
|
|
||||||
for (int i = 0; i < arrayOfUsers.Length; i++) {
|
for (int i = 0; i < arrayOfUsers.Length; i++) {
|
||||||
email = "";
|
email = "";
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
@ -689,14 +610,12 @@ public class WorkflowDMO {
|
|||||||
|
|
||||||
public string AddEECNApproval(int ecnNumber, byte step, int documentType, string engUserIDs, string opUserIDs) {
|
public string AddEECNApproval(int ecnNumber, byte step, int documentType, string engUserIDs, string opUserIDs) {
|
||||||
string email = "";
|
string email = "";
|
||||||
//string emailArray = "";
|
|
||||||
string emailIDArray = "";
|
string emailIDArray = "";
|
||||||
|
|
||||||
string[] arrayOfUsers = engUserIDs.Split(new char[] { '~' });
|
string[] arrayOfUsers = engUserIDs.Split(new char[] { '~' });
|
||||||
|
|
||||||
// Engineering SubRole
|
// Engineering SubRole
|
||||||
DynamicParameters parameters = new();
|
DynamicParameters parameters = new();
|
||||||
;
|
|
||||||
for (int i = 0; i < arrayOfUsers.Length; i++) {
|
for (int i = 0; i < arrayOfUsers.Length; i++) {
|
||||||
email = "";
|
email = "";
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
@ -714,7 +633,6 @@ public class WorkflowDMO {
|
|||||||
// Operations SubRole
|
// Operations SubRole
|
||||||
arrayOfUsers = opUserIDs.Split(new char[] { '~' });
|
arrayOfUsers = opUserIDs.Split(new char[] { '~' });
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
;
|
|
||||||
for (int i = 0; i < arrayOfUsers.Length; i++) {
|
for (int i = 0; i < arrayOfUsers.Length; i++) {
|
||||||
email = "";
|
email = "";
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
|
@ -275,16 +275,26 @@
|
|||||||
<Compile Include="DMO\WorkflowDMO.cs" />
|
<Compile Include="DMO\WorkflowDMO.cs" />
|
||||||
<Compile Include="Jobs\OOOTrainingReportJob.cs" />
|
<Compile Include="Jobs\OOOTrainingReportJob.cs" />
|
||||||
<Compile Include="JobSchedules\OOOTrainingReportJobSchedule.cs" />
|
<Compile Include="JobSchedules\OOOTrainingReportJobSchedule.cs" />
|
||||||
|
<Compile Include="Misc\AuditHelper.cs" />
|
||||||
|
<Compile Include="Misc\ChangeControlHelper.cs" />
|
||||||
|
<Compile Include="Misc\CorrectiveActionHelper.cs" />
|
||||||
<Compile Include="Misc\DemoHelper.cs" />
|
<Compile Include="Misc\DemoHelper.cs" />
|
||||||
<Compile Include="Misc\Documentum.cs" />
|
<Compile Include="Misc\Documentum.cs" />
|
||||||
|
<Compile Include="Misc\ECNHelper.cs" />
|
||||||
<Compile Include="Misc\EmailNotification.cs" />
|
<Compile Include="Misc\EmailNotification.cs" />
|
||||||
<Compile Include="Misc\ExcelData.cs" />
|
<Compile Include="Misc\ExcelData.cs" />
|
||||||
<Compile Include="Misc\ftplib.cs" />
|
<Compile Include="Misc\ftplib.cs" />
|
||||||
<Compile Include="Misc\FTPWrapper.cs" />
|
<Compile Include="Misc\FTPWrapper.cs" />
|
||||||
<Compile Include="Misc\Functions.cs" />
|
<Compile Include="Misc\Functions.cs" />
|
||||||
<Compile Include="Misc\GlobalVars.cs" />
|
<Compile Include="Misc\GlobalVars.cs" />
|
||||||
|
<Compile Include="Misc\HomeHelper.cs" />
|
||||||
|
<Compile Include="Misc\LotDispositionHelper.cs" />
|
||||||
<Compile Include="Misc\LotNoTemplate.cs" />
|
<Compile Include="Misc\LotNoTemplate.cs" />
|
||||||
|
<Compile Include="Misc\LotTravelerHelper.cs" />
|
||||||
|
<Compile Include="Misc\MRBHelper.cs" />
|
||||||
|
<Compile Include="Misc\PartsRequestHelper.cs" />
|
||||||
<Compile Include="Misc\SessionExpireFilterAttribute.cs" />
|
<Compile Include="Misc\SessionExpireFilterAttribute.cs" />
|
||||||
|
<Compile Include="Misc\TrainingHelper.cs" />
|
||||||
<Compile Include="Misc\UserProfileDTO.cs" />
|
<Compile Include="Misc\UserProfileDTO.cs" />
|
||||||
<Compile Include="Misc\Zipper.cs" />
|
<Compile Include="Misc\Zipper.cs" />
|
||||||
<Compile Include="Models\AccountViewModels.cs" />
|
<Compile Include="Models\AccountViewModels.cs" />
|
||||||
|
@ -83,7 +83,7 @@ public class MvcApplication : System.Web.HttpApplication {
|
|||||||
try {
|
try {
|
||||||
Session[GlobalVars.SESSION_USERNAME] = "";
|
Session[GlobalVars.SESSION_USERNAME] = "";
|
||||||
Session[GlobalVars.SESSION_USERID] = "";
|
Session[GlobalVars.SESSION_USERID] = "";
|
||||||
Session[GlobalVars.IS_ADMIN] = "";
|
Session[GlobalVars.IS_ADMIN] = null;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Functions.WriteEvent(null, @User.Identity.Name + "\r\n Session Closed - \r\n" + ex.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(null, @User.Identity.Name + "\r\n Session Closed - \r\n" + ex.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
||||||
}
|
}
|
||||||
|
88
Fab2ApprovalSystem/Misc/AuditHelper.cs
Normal file
88
Fab2ApprovalSystem/Misc/AuditHelper.cs
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
|
|
||||||
|
public class AuditHelper {
|
||||||
|
|
||||||
|
public static List<string> GetFileNameAndDocument(AppSettings appSettings, AuditDMO auditDMO, string fileGuid, int auditNo) {
|
||||||
|
List<string> results = new();
|
||||||
|
string fileName = auditDMO.GetAuditReportAttachmentFileName(fileGuid);
|
||||||
|
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||||
|
|
||||||
|
string ecnFolderPath = appSettings.AttachmentFolder + "Audit\\" + auditNo.ToString();
|
||||||
|
string sDocument = Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||||
|
|
||||||
|
string FDir_AppData = appSettings.AttachmentFolder;
|
||||||
|
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||||
|
sDocument = string.Empty;
|
||||||
|
}
|
||||||
|
results.Add(fileName);
|
||||||
|
results.Add(sDocument);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AuditReportAttachSave(AppSettings appSettings, AuditDMO auditDMO, int auditNo, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var ccPhysicalPath = appSettings.AttachmentFolder + @"Audit\" + auditNo;
|
||||||
|
di = new DirectoryInfo(ccPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"Audit\" + auditNo + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
AuditReportAttachment attach = new() {
|
||||||
|
AuditNo = auditNo,
|
||||||
|
FileGUID = guid,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
auditDMO.InsertAuditReportAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SaveAndInsert(AppSettings appSettings, AuditDMO auditDMO, int caFindingsID, int auditNo, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var ccPhysicalPath = appSettings.AttachmentFolder + @"Audit\" + auditNo;
|
||||||
|
di = new DirectoryInfo(ccPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"Audit\" + auditNo + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
AuditReportAttachment attach = new() {
|
||||||
|
CAFindingsID = caFindingsID,
|
||||||
|
AuditNo = auditNo,
|
||||||
|
FileGUID = guid,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
auditDMO.InsertAuditReportAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
96
Fab2ApprovalSystem/Misc/ChangeControlHelper.cs
Normal file
96
Fab2ApprovalSystem/Misc/ChangeControlHelper.cs
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
|
|
||||||
|
public class ChangeControlHelper {
|
||||||
|
|
||||||
|
public static void AttachSaveCC(AppSettings appSettings, ChangeControlDMO changeControlDMO, int planNumber, int attachID, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var ccPhysicalPath = appSettings.AttachmentFolder + @"ChangeControl\" + planNumber;
|
||||||
|
di = new DirectoryInfo(ccPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"ChangeControl\" + planNumber + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
CCAttachment attach = new() {
|
||||||
|
ID = attachID,
|
||||||
|
FileGUID = guid,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId
|
||||||
|
};
|
||||||
|
|
||||||
|
changeControlDMO.UpdateCCAttachmentDocument(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AttachSaveMeeting(AppSettings appSettings, ChangeControlDMO changeControlDMO, int planNumber, int attachID, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var ccPhysicalPath = appSettings.AttachmentFolder + @"ChangeControl\" + planNumber;
|
||||||
|
di = new DirectoryInfo(ccPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"ChangeControl\" + planNumber + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
CCMeetingAttachment attach = new() {
|
||||||
|
ID = attachID,
|
||||||
|
FileGUID = guid,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId
|
||||||
|
};
|
||||||
|
|
||||||
|
changeControlDMO.UpdateMeetingAttachmentDocument(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AttachSaveActionItem(AppSettings appSettings, ChangeControlDMO changeControlDMO, int planNumber, int attachID, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var ccPhysicalPath = appSettings.AttachmentFolder + @"ChangeControl\" + planNumber;
|
||||||
|
di = new DirectoryInfo(ccPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"ChangeControl\" + planNumber + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
CCMeetingActionItemAll attach = new() {
|
||||||
|
ID = attachID,
|
||||||
|
FileGUID = guid,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
changeControlDMO.UpdateActionItemAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
464
Fab2ApprovalSystem/Misc/CorrectiveActionHelper.cs
Normal file
464
Fab2ApprovalSystem/Misc/CorrectiveActionHelper.cs
Normal file
@ -0,0 +1,464 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
|
|
||||||
|
public class CorrectiveActionHelper {
|
||||||
|
|
||||||
|
public static void ProcessCARDueDates(AppSettings appSettings, CAD3D5D7Due dueCA, CorrectiveAction ca, LoginModel user) {
|
||||||
|
string[] emailparams = new string[7];
|
||||||
|
string emailTemplate = "D3D5D7Due.txt";
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string subject = "Corrective Action " + dueCA.ItemDue + " " + dueCA.ExpiryType + " - " + Functions.ReturnCANoStringFormat(dueCA.CANo);
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(dueCA.CANo);
|
||||||
|
emailparams[1] = dueCA.CANo.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = dueCA.ExpiryType;
|
||||||
|
emailparams[4] = dueCA.ItemDue;
|
||||||
|
if (ca.D3DueDate != null) {
|
||||||
|
emailparams[5] = ca.D3DueDate is null ? string.Empty : ca.D3DueDate.Value.ToString();
|
||||||
|
} else {
|
||||||
|
emailparams[5] = "N/A";
|
||||||
|
}
|
||||||
|
if (ca.D5D7DueDate != null) {
|
||||||
|
emailparams[6] = ca.D5D7DueDate is null ? string.Empty : ca.D5D7DueDate.Value.ToString();
|
||||||
|
} else {
|
||||||
|
emailparams[6] = "N/A";
|
||||||
|
}
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, user.Email, "jonathan.ouellette@infineon.com", subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void NotifyUsersDSectionApproved(AppSettings appSettings, int issueID, string dSection, string userEmail) {
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string emailTemplate = "CorrectiveActionSectionApproved.txt";
|
||||||
|
string subject = "Corrective Action Section Approval - " + Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = dSection;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void NotifyForD5D6D7Validation(AppSettings appSettings, int issueID, string dSection, string userEmail) {
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string emailTemplate = "CorrectiveActionSectionApproved.txt";
|
||||||
|
string subject = "Corrective Action Section Approval - " + Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = dSection;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void NotifySectionRejection(AppSettings appSettings, int issueID, int loggedInUserId, string section, string comment, LoginModel recipient, LoginModel loggedInUser) {
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string recipientEmail = recipient.Email;
|
||||||
|
string emailTemplate = "CorrectiveActionSectionRejection.txt";
|
||||||
|
string subject = "Corrective Action Rejection - " + Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[6];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = section;
|
||||||
|
emailparams[4] = loggedInUser.FirstName + " " + loggedInUser.LastName;
|
||||||
|
emailparams[5] = comment;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, recipientEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void NotifySectionRejection(AppSettings appSettings, int issueID, string section, string comment, LoginModel recipient, LoginModel loggedInUser) {
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string recipientEmail = recipient.Email;
|
||||||
|
string emailTemplate = "CorrectiveActionSectionRejection.txt";
|
||||||
|
string subject = "Corrective Action Rejection - " + Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[6];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = section;
|
||||||
|
emailparams[4] = loggedInUser.FirstName + " " + loggedInUser.LastName;
|
||||||
|
emailparams[5] = comment;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, recipientEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyCompletionOf8D(AppSettings appSettings, int issueID, DateTime? followUpDate) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string emailTemplate = "CorrectiveActionCompleted.txt";
|
||||||
|
List<string> emailIst = MiscDMO.Get8DEmailListForClosureNotification(issueID);
|
||||||
|
string subject = "Corrective Action Completion - " + Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = GlobalVars.hostURL;
|
||||||
|
emailparams[2] = issueID.ToString();
|
||||||
|
emailparams[3] = followUpDate is null ? string.Empty : followUpDate.Value.ToString();
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyClosureOf8D(AppSettings appSettings, int issueID) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string emailTemplate = "CorrectiveActionClosed.txt";
|
||||||
|
List<string> emailIst = MiscDMO.Get8DEmailListForClosureNotification(issueID);
|
||||||
|
string subject = "Corrective Action Follow Up Closure - " + Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[3];
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = GlobalVars.hostURL;
|
||||||
|
emailparams[2] = issueID.ToString();
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyActionItemCompletion(AppSettings appSettings, int issueID, DateTime? dueDate, int? recipientId, string template) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string emailTemplate = template;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string email = MiscDMO.GetEmail(recipientId);
|
||||||
|
string subject = "8D Action Item Completion - " + Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[5];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = dueDate is null ? string.Empty : dueDate.Value.ToString();
|
||||||
|
emailparams[2] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.CorrectiveAction);
|
||||||
|
emailparams[3] = GlobalVars.hostURL;
|
||||||
|
emailparams[4] = issueID.ToString();
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyActionItemOwner(AppSettings appSettings, int issueID, DateTime? dueDate, int? responsibleOwnerID, string template) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string emailTemplate = template;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string email = MiscDMO.GetEmail(responsibleOwnerID);
|
||||||
|
string subject = "Action Item in " + Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[5];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = dueDate is null ? string.Empty : dueDate.Value.ToString();
|
||||||
|
emailparams[2] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.CorrectiveAction);
|
||||||
|
emailparams[3] = GlobalVars.hostURL;
|
||||||
|
emailparams[4] = issueID.ToString();
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void NotifyAssignee(AppSettings appSettings, int issueID, string template, DateTime? D3DueDate, DateTime? D5D7DueDate, string email) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string emailTemplate = template;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string subject = "CAR Assigned - " + Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[6];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.CorrectiveAction);
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = issueID.ToString();
|
||||||
|
emailparams[4] = D3DueDate is not null ? D3DueDate.Value.ToString() : "N/A";
|
||||||
|
emailparams[5] = D5D7DueDate is not null ? D5D7DueDate.Value.ToString() : "N/A";
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void NotifyRequestor(AppSettings appSettings, int issueID, DateTime? dueDate, string template, string email) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string emailTemplate = template;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string subject = "Corrective Action Assignment - " + Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[5];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = dueDate is null ? string.Empty : dueDate.Value.ToString();
|
||||||
|
emailparams[2] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.CorrectiveAction);
|
||||||
|
emailparams[3] = GlobalVars.hostURL;
|
||||||
|
emailparams[4] = issueID.ToString();
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string AddAdditionalApproval(AppSettings appSettings, int issueID, string emailSentList, string emailArray) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string emailTemplate = "CorrectiveActionAssigned.txt";
|
||||||
|
string subject = "Corrective Action Assignment - Final Approval";
|
||||||
|
|
||||||
|
string[] emailIst = emailArray.Split(new char[] { '~' });
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
if (email.Length > 0) {
|
||||||
|
subject = "Corrective Action Assignment";
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[3];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyApprovers(AppSettings appSettings, int issueID, List<string> emailIst) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string subject = "Corrective Action Assignment";
|
||||||
|
string emailTemplate = "CorrectiveActionAssigned.txt";
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
subject = "Corrective Action Assignment - Final Approval";
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[3];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void NotifySectionApprover(AppSettings appSettings, int issueID, string section, string userEmail) {
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string subject = "Corrective Action Assignment";
|
||||||
|
string emailTemplate = "CorrectiveActionSectionAssignee.txt";
|
||||||
|
|
||||||
|
subject = "Corrective Action Assignment - Section Approval";
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = section;
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyRejectionToAssignee(AppSettings appSettings, int issueID, string comments, string username, List<string> emailIst) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string subject = "Corrective Action Rejection";
|
||||||
|
string emailTemplate = "CorrectiveActionReject.txt";
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
subject = "Corrective Action Rejection";
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[5];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = username;
|
||||||
|
emailparams[4] = comments;
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
return userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReAssignApproval(AppSettings appSettings, int issueID, string email) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string subject = "Corrective Action Re-Assignment";
|
||||||
|
string emailTemplate = "CorrectiveActionReAssigned.txt";
|
||||||
|
|
||||||
|
subject = "Corrective Action Re-Assignment" + " - Email would be sent to " + email;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[3];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
userEmail = email;
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReAssignApproverByAdmin(AppSettings appSettings, int issueID, string email) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "CorrectiveAction";
|
||||||
|
string subject = "Corrective Action Re-Assignment";
|
||||||
|
string emailTemplate = "CorrectiveActionReAssigned.txt";
|
||||||
|
|
||||||
|
subject = "Corrective Action Re-Assignment" + " - Email would be sent to " + email;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[3];
|
||||||
|
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
userEmail = email;
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AttachSave(AppSettings appSettings, CorrectiveActionDMO correctiveActionDMO, int caNo, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var ccPhysicalPath = appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo;
|
||||||
|
di = new DirectoryInfo(ccPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
CA_Attachment attach = new() {
|
||||||
|
CANo = caNo,
|
||||||
|
FileGUID = guid,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId,
|
||||||
|
Section = Functions.CASectionMapper(GlobalVars.CASection.Main)
|
||||||
|
};
|
||||||
|
|
||||||
|
correctiveActionDMO.InsertCAAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void D4FilesAttachSave(AppSettings appSettings, CorrectiveActionDMO correctiveActionDMO, int caNo, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var ccPhysicalPath = appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo;
|
||||||
|
di = new DirectoryInfo(ccPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
CA_Attachment attach = new() {
|
||||||
|
CANo = caNo,
|
||||||
|
FileGUID = guid,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId,
|
||||||
|
Section = Functions.CASectionMapper(GlobalVars.CASection.D4)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
correctiveActionDMO.InsertCAAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SaveD7PA_Attachemnt(AppSettings appSettings, CorrectiveActionDMO correctiveActionDMO, int d7PAID, int caNo, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var ccPhysicalPath = appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo;
|
||||||
|
di = new DirectoryInfo(ccPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
CA_Attachment attach = new() {
|
||||||
|
D7PAID = d7PAID,
|
||||||
|
CANo = caNo,
|
||||||
|
FileGUID = guid,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId,
|
||||||
|
Section = Functions.CASectionMapper(GlobalVars.CASection.D7)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
correctiveActionDMO.InsertCAAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SaveD5D6CA_Attachemnt(AppSettings appSettings, CorrectiveActionDMO correctiveActionDMO, int d5d6CAID, int caNo, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var ccPhysicalPath = appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo;
|
||||||
|
di = new DirectoryInfo(ccPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
CA_Attachment attach = new() {
|
||||||
|
D5D6CAID = d5d6CAID,
|
||||||
|
CANo = caNo,
|
||||||
|
FileGUID = guid,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId,
|
||||||
|
Section = Functions.CASectionMapper(GlobalVars.CASection.D5)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
correctiveActionDMO.InsertCAAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
524
Fab2ApprovalSystem/Misc/ECNHelper.cs
Normal file
524
Fab2ApprovalSystem/Misc/ECNHelper.cs
Normal file
@ -0,0 +1,524 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
|
|
||||||
|
public class ECNHelper {
|
||||||
|
|
||||||
|
private const string ECN_PREFIX = "ECN_";
|
||||||
|
private const string TECN_PREFIX = "TECN_";
|
||||||
|
private const string ETECN_PREFIX = "ETECN_";
|
||||||
|
|
||||||
|
public static bool IsITAR(ECN ecn) {
|
||||||
|
if (ecn.IsRH && !ecn.IsAU && !ecn.IsIndustrial && !ecn.IsMA) {
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyEmergencyTECNApproval(AppSettings appSettings, int ecnNumber, DateTime? expDate, ECN ecn) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string senderName = "E-TECN";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string subject = "E-TECN Approved";
|
||||||
|
string emailTemplate = "ETECNApproved.txt";
|
||||||
|
List<string> emailIst = MiscDMO.GetEmergencyTECNApprovalNotifyList(ecnNumber).Distinct().ToList();
|
||||||
|
string ecnFolderPath = appSettings.AttachmentFolder + "E-TECNZipped\\" + ETECN_PREFIX + ecnNumber.ToString() + ".zip";
|
||||||
|
subject = "E-TECN Approved notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[5];
|
||||||
|
emailparams[0] = ecnNumber.ToString();
|
||||||
|
emailparams[1] = ecnNumber.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = "E-TECN";
|
||||||
|
emailparams[4] = expDate is null ? string.Empty : expDate.Value.ToString();
|
||||||
|
|
||||||
|
if (IsITAR(ecn))
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, emailparams);
|
||||||
|
else
|
||||||
|
en.SendNotificationEmailWithAttachment(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, ecnFolderPath, emailparams);
|
||||||
|
|
||||||
|
emailSentList = string.Join(", ", emailIst.Distinct().ToArray());
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyApproversForCancellation(AppSettings appSettings, int ecnNumber, byte currentStep, int documentType, string ecnTypeString, ECN ecn) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = ecnTypeString;
|
||||||
|
string emailTemplate = "TECNCancellationApproval.txt";
|
||||||
|
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@ecnNumber, currentStep, documentType).Distinct().ToList();
|
||||||
|
string subject = ecnTypeString + " Cancellation Approval Required - " + ecnNumber + " for " + ecn.Title + ", Cancellation initiated on :" + ecn.CancellationDate;
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = ecnNumber.ToString();
|
||||||
|
emailparams[1] = ecnNumber.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = ecnTypeString;
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyApproversForRecall(AppSettings appSettings, int ecnNumber, byte currentStep, int documentType, string ecnTypeString, string recallComments, ECN ecn) {
|
||||||
|
string emailSentList = "";
|
||||||
|
|
||||||
|
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@ecnNumber, currentStep, documentType).Distinct().ToList();
|
||||||
|
emailIst.Add("Jeanne.McIntyre@infineon.com");
|
||||||
|
emailIst.Add("Jonathan.Ouellette@infineon.com");
|
||||||
|
string emailTemplate = "ECNRecallApproval.txt";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string subject = ecnTypeString + " Recalled - " + ecnNumber + " for " + ecn.Title + ", Recall initiated on :" + DateTime.Now.ToString();
|
||||||
|
string senderName = ecnTypeString;
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[5];
|
||||||
|
emailparams[0] = ecnNumber.ToString();
|
||||||
|
emailparams[1] = ecnNumber.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = ecnTypeString;
|
||||||
|
emailparams[4] = recallComments;
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyApproversForExpiration(AppSettings appSettings, int ecnNumber, byte currentStep, int documentType, string ecnTypeString, ECN ecn) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = ecnTypeString;
|
||||||
|
string emailTemplate = "TECNExpirationApproval.txt";
|
||||||
|
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@ecnNumber, currentStep, documentType).Distinct().ToList();
|
||||||
|
string subject = " TECN Expiration Approval Reqquired - " + ecnTypeString + "# " + ecnNumber + " for " + ecn.Title + ", Expired:" + ecn.ExpirationDate;
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = ecnNumber.ToString();
|
||||||
|
emailparams[1] = ecnNumber.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = ecnTypeString;
|
||||||
|
userEmail = email;
|
||||||
|
#if (DEBUG)
|
||||||
|
userEmail = GlobalVars.SENDER_EMAIL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyTECNCancellation(AppSettings appSettings, UserAccountDMO userDMO, int ecnNumber, string ecnFolderPath, ECN ecn, List<int> notificationUserList) {
|
||||||
|
string emailSentList = "";
|
||||||
|
List<string> emailIst = MiscDMO.GetTECNCancelledApprovalNotifyList(ecnNumber).Distinct().ToList();
|
||||||
|
foreach (int userId in notificationUserList) {
|
||||||
|
string email = userDMO.GetUserEmailByID(userId);
|
||||||
|
if (email != null && !emailIst.Contains(email))
|
||||||
|
emailIst.Add(email);
|
||||||
|
}
|
||||||
|
|
||||||
|
string subject = string.Empty;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string emailTemplate = "TECNCancelled.txt";
|
||||||
|
if (ecn.CancellationApprovalDate == null) {
|
||||||
|
subject = "TECN Cancellation Initiated Notice - " + ecnNumber + " for " + ecn.Title + ", Cancellation Initiated on:" + DateTime.Now;
|
||||||
|
} else {
|
||||||
|
subject = "TECN Cancellation Approved Notice - " + ecnNumber + " for " + ecn.Title + ", Cancelled:" + ecn.CancellationApprovalDate;
|
||||||
|
}
|
||||||
|
string senderName = "ECN";
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[5];
|
||||||
|
emailparams[0] = ecnNumber.ToString();
|
||||||
|
emailparams[1] = ecnNumber.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = "TECN";
|
||||||
|
emailparams[4] = DateTime.Now.ToString();
|
||||||
|
|
||||||
|
#if (DEBUG)
|
||||||
|
userEmail = GlobalVars.SENDER_EMAIL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (IsITAR(ecn))
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, emailparams);
|
||||||
|
else
|
||||||
|
en.SendNotificationEmailWithAttachment(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, ecnFolderPath, emailparams);
|
||||||
|
emailSentList = string.Join(", ", emailIst.Distinct().ToArray());
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyTECNAutoCancellation(AppSettings appSettings, int ecnNumber, int tecnNumber, List<string> attachments, ECN ecn) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string senderName = "ECN";
|
||||||
|
string subject = string.Empty;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string emailTemplate = "TECNAutoCancelled.txt";
|
||||||
|
List<string> emailIst = MiscDMO.GetTECNCancelledApprovalNotifyList(ecnNumber).Distinct().ToList();
|
||||||
|
subject = "TECN Conversion and Cancellation Notice - " + tecnNumber + " for " + ecn.Title + ", Converted on:" + DateTime.Now;
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[6];
|
||||||
|
emailparams[0] = tecnNumber.ToString();
|
||||||
|
emailparams[1] = tecnNumber.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = "TECN";
|
||||||
|
emailparams[4] = DateTime.Now.ToString();
|
||||||
|
emailparams[5] = ecnNumber.ToString();
|
||||||
|
|
||||||
|
#if (DEBUG)
|
||||||
|
userEmail = GlobalVars.SENDER_EMAIL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (IsITAR(ecn))
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, emailparams);
|
||||||
|
else
|
||||||
|
en.SendNotificationEmailWithAttachments(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, attachments, emailparams);
|
||||||
|
emailSentList = string.Join(", ", emailIst.Distinct().ToArray());
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyTECNExpiration(AppSettings appSettings, int ecnNumber, string ecnFolderPath, ECN ecn) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string senderName = "ECN";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string emailTemplate = "TECNExpired.txt";
|
||||||
|
List<string> emailIst = MiscDMO.GetEmergencyTECNApprovalNotifyList(ecnNumber).Distinct().ToList();
|
||||||
|
string subject = "TECN Expiration Approved Notice - " + ecnNumber + " for " + ecn.Title + ", Expired:" + ecn.ExpirationDate;
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[5];
|
||||||
|
emailparams[0] = ecnNumber.ToString();
|
||||||
|
emailparams[1] = ecnNumber.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = "TECN";
|
||||||
|
emailparams[4] = ecn.ExpirationDate.Value.ToShortDateString();
|
||||||
|
|
||||||
|
if (IsITAR(ecn))
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, emailparams);
|
||||||
|
else
|
||||||
|
en.SendNotificationEmailWithAttachment(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, ecnFolderPath, emailparams);
|
||||||
|
|
||||||
|
emailSentList = string.Join(", ", emailIst.Distinct().ToArray());
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReAssignApproval(AppSettings appSettings, int issueID, string ecnTypeString, string email, ECN ecn) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = ecnTypeString;
|
||||||
|
string emailTemplate = "ECNReAssigned.txt";
|
||||||
|
string subject = ecnTypeString + " Re-Assignment";
|
||||||
|
|
||||||
|
subject = ecnTypeString + " Re-Assignment" + " - Email would be sent to " + email + " for Number " + ecn.ECNNumber + ", - " + ecn.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = issueID.ToString();
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = ecnTypeString;
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string AddEECNApproval(AppSettings appSettings, int ecnNumber, string emailSentList, string emailArray, ECN ecn) {
|
||||||
|
string senderName = "E-TECN";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string subject = "E-TECN Assignment";
|
||||||
|
string emailTemplate = "ECNAssigned.txt";
|
||||||
|
string[] emailIst = emailArray.Split(new char[] { '~' });
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
if (email.Length > 0) {
|
||||||
|
subject = "E-TECN Assignment notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = ecnNumber.ToString();
|
||||||
|
emailparams[1] = ecnNumber.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = "E-TECN";
|
||||||
|
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string AddAdditionalApproval(AppSettings appSettings, int issueID, string ecnTypeString, string emailSentList, string emailArray, ECN ecn) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = ecnTypeString;
|
||||||
|
string emailTemplate = "ECNAssigned.txt";
|
||||||
|
string subject = ecnTypeString + " Assignment";
|
||||||
|
string[] emailIst = emailArray.Split(new char[] { '~' });
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
if (email.Length > 0) {
|
||||||
|
subject = ecnTypeString + "Assignment notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = issueID.ToString();
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = ecnTypeString;
|
||||||
|
|
||||||
|
userEmail = email;
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReAssignApproverByAdmin(AppSettings appSettings, int issueID, string ecnTypeString, string email, ECN ecn) {
|
||||||
|
string subject;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = ecnTypeString;
|
||||||
|
string emailTemplate = "ECNReAssigned.txt";
|
||||||
|
|
||||||
|
subject = ecnTypeString + " Re-Assignment" + " - ECN #" + ecn.ECNNumber + ", - " + ecn.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = issueID.ToString();
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = ecnTypeString;
|
||||||
|
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyTECNExtensionRejectionToOrginator(AppSettings appSettings, int issueID, string ecnTypeString, List<string> emailIst, ECN ecn, string username) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = ecnTypeString;
|
||||||
|
string subject = ecnTypeString + " Rejection";
|
||||||
|
string emailTemplate = "TECNExtensionReject.txt";
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
subject = ecnTypeString + " Extension Rejection notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[5];
|
||||||
|
emailparams[0] = issueID.ToString();
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = username;
|
||||||
|
emailparams[4] = ecnTypeString;
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
return userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyRejectionToOrginator(AppSettings appSettings, int issueID, string ecnTypeString, string comments, List<string> emailIst, ECN ecn, string username) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = ecnTypeString;
|
||||||
|
string emailTemplate = "ECNReject.txt";
|
||||||
|
string subject = ecnTypeString + " Rejection";
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
subject = ecnTypeString + " Rejection notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[6];
|
||||||
|
emailparams[0] = issueID.ToString();
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = username;
|
||||||
|
emailparams[4] = ecnTypeString;
|
||||||
|
emailparams[5] = comments;
|
||||||
|
userEmail = email;
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
return userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyApprovers(AppSettings appSettings, int ecnNumber, string ecnTypeString, string emailSentList, ECN ecn, List<string> emailIst) {
|
||||||
|
string subject = string.Empty;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = ecnTypeString;
|
||||||
|
string emailTemplate = "ECNAssigned.txt";
|
||||||
|
|
||||||
|
subject = ecnTypeString + " Assignment notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = ecnNumber.ToString();
|
||||||
|
emailparams[1] = ecnNumber.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = ecnTypeString;
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyAdmin(AppSettings appSettings, int ecnNumber, string ecnTypeString, ECN ecn, int id) {
|
||||||
|
string emailSentList;
|
||||||
|
string subject = string.Empty;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = ecnTypeString;
|
||||||
|
string emailTemplate = "ECNApproved.txt";
|
||||||
|
string ecnCreatedByEmail = MiscDMO.GetEmail(id);
|
||||||
|
|
||||||
|
subject = ecnTypeString + " Approval notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = ecnNumber.ToString();
|
||||||
|
emailparams[1] = ecnNumber.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = ecnTypeString;
|
||||||
|
userEmail = ecnCreatedByEmail;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
emailSentList = ecnCreatedByEmail;
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifySubmitter(AppSettings appSettings, int ecnNumber, string ecnTypeString, ECN ecn) {
|
||||||
|
string emailSentList;
|
||||||
|
string subject = string.Empty;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = ecnTypeString;
|
||||||
|
int ecnCreatedById = ecn.OriginatorID;
|
||||||
|
string emailTemplate = "ECNApproved.txt";
|
||||||
|
string ecnCreatedByEmail = MiscDMO.GetEmail(ecnCreatedById);
|
||||||
|
|
||||||
|
subject = ecnTypeString + " Approval notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = ecnNumber.ToString();
|
||||||
|
emailparams[1] = ecnNumber.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = ecnTypeString;
|
||||||
|
userEmail = ecnCreatedByEmail;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
emailSentList = ecnCreatedByEmail;
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool CreateZip(AppSettings appSettings, ECNPdf ecn, string UserId) {
|
||||||
|
try {
|
||||||
|
string sourceDirectory = appSettings.AttachmentFolder + "ECN\\" + ecn.ECNNumber.ToString() + "\\";
|
||||||
|
string outputFullFilePath = "";
|
||||||
|
|
||||||
|
string outputFileName;
|
||||||
|
if (ecn.IsTECN) {
|
||||||
|
if (ecn.ExtensionDate != null)
|
||||||
|
outputFileName = TECN_PREFIX + ecn.ECNNumber.ToString() + "_Extension.zip";
|
||||||
|
else
|
||||||
|
outputFileName = TECN_PREFIX + ecn.ECNNumber.ToString() + ".zip";
|
||||||
|
|
||||||
|
outputFullFilePath = appSettings.AttachmentFolder + "\\ECNZipped\\" + outputFileName;
|
||||||
|
} else if (ecn.IsEmergencyTECN) // Transfer it to different folder , coz documentum does not need to have a Workflow Item created for Emergency TECN
|
||||||
|
{
|
||||||
|
outputFileName = ETECN_PREFIX + ecn.ECNNumber.ToString() + ".zip";
|
||||||
|
outputFullFilePath = appSettings.AttachmentFolder + "\\E-TECNZipped\\" + outputFileName;
|
||||||
|
} else {
|
||||||
|
outputFileName = ECN_PREFIX + ecn.ECNNumber.ToString() + ".zip";
|
||||||
|
outputFullFilePath = appSettings.AttachmentFolder + "\\ECNZipped\\" + outputFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
Zipper zip = new();
|
||||||
|
zip.CreateZip(outputFullFilePath, sourceDirectory);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = ecn.ECNNumber, UserID = UserId, DocumentType = ecn.IsECN ? "ECN" : (ecn.IsEmergencyTECN ? "E-TECN" : "TECN"), OperationType = "Error", Comments = ex.Message });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string AddEECNApproval(AppSettings appSettings, string userId, WorkflowDMO wfDMO, int ecnNumber, out byte step, string engUserIDs, string OpUserIDs, ECN ecn) {
|
||||||
|
string emailSentList = "";
|
||||||
|
step = 1;
|
||||||
|
string emailArray = "";
|
||||||
|
try {
|
||||||
|
emailArray = wfDMO.AddEECNApproval(ecnNumber, step, (int)GlobalVars.DocumentType.EECN, engUserIDs, OpUserIDs);
|
||||||
|
} catch (Exception e) {
|
||||||
|
string detailedException = "";
|
||||||
|
try {
|
||||||
|
detailedException = e.InnerException.ToString();
|
||||||
|
} catch {
|
||||||
|
detailedException = e.Message;
|
||||||
|
}
|
||||||
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + ecnNumber.ToString() + " Step:" + step + " " + " Userid:" + engUserIDs + " - " + OpUserIDs + " - " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
|
Functions.WriteEvent(appSettings, userId + "\r\n AddEECNApproval\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = userId, DocumentType = "E-TECN ", OperationType = "Error", Comments = "AddEECNApproval - " + exceptionString });
|
||||||
|
throw new Exception(e.Message);
|
||||||
|
}
|
||||||
|
emailSentList = AddEECNApproval(appSettings, ecnNumber, emailSentList, emailArray, ecn);
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string AttachSave(AppSettings appSettings, ECN_DMO ecnDMO, int ecnNumber, string returnString, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
|
||||||
|
string ecnFolderPath = appSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString();
|
||||||
|
|
||||||
|
DirectoryInfo di = new(ecnFolderPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
try {
|
||||||
|
di.Create();
|
||||||
|
} catch {
|
||||||
|
returnString = "Error creating ECN directory.";
|
||||||
|
}
|
||||||
|
if (returnString == "") {
|
||||||
|
var physicalPath = Path.Combine(ecnFolderPath, fileName);
|
||||||
|
if (!File.Exists(physicalPath)) {
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
ECNAttachment attach = new() {
|
||||||
|
ECNNumber = ecnNumber,
|
||||||
|
FileName = fileName,
|
||||||
|
UserID = userId,
|
||||||
|
};
|
||||||
|
if (File.Exists(physicalPath)) {
|
||||||
|
ecnDMO.InsertECNAttachment(attach);
|
||||||
|
} else {
|
||||||
|
returnString = "File was not uploaded to server.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
returnString = "Cannot have duplicate file names.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnString;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -22,6 +22,12 @@ public class EmailNotification {
|
|||||||
public EmailNotification(Models.AppSettings appSettings) =>
|
public EmailNotification(Models.AppSettings appSettings) =>
|
||||||
_AppSettings = appSettings;
|
_AppSettings = appSettings;
|
||||||
|
|
||||||
|
public EmailNotification(Models.AppSettings appSettings, string EmailHeaderSubject) {
|
||||||
|
_AppSettings = appSettings;
|
||||||
|
_subject = EmailHeaderSubject;
|
||||||
|
_TemplatesPath = appSettings.EmailTemplatesPath;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Constructor Function
|
/// The Constructor Function
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -52,7 +58,6 @@ public class EmailNotification {
|
|||||||
protected string ReadEmailFile(string FileName) {
|
protected string ReadEmailFile(string FileName) {
|
||||||
string retVal = null;
|
string retVal = null;
|
||||||
try {
|
try {
|
||||||
//setting the file name path
|
|
||||||
string path = _TemplatesPath + FileName;
|
string path = _TemplatesPath + FileName;
|
||||||
#if !NET8
|
#if !NET8
|
||||||
FileInfo TheFile = new FileInfo(System.Web.HttpContext.Current.Server.MapPath(path));
|
FileInfo TheFile = new FileInfo(System.Web.HttpContext.Current.Server.MapPath(path));
|
||||||
@ -88,12 +93,10 @@ public class EmailNotification {
|
|||||||
msg.IsBodyHtml = true;// email body will allow html elements
|
msg.IsBodyHtml = true;// email body will allow html elements
|
||||||
|
|
||||||
// setting the Sender Email ID
|
// setting the Sender Email ID
|
||||||
//msg.From = new MailAddress(SenderEmail, SenderName);
|
|
||||||
msg.From = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
|
msg.From = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
|
||||||
msg.Sender = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
|
msg.Sender = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
|
||||||
// adding the Recepient Email ID
|
// adding the Recepient Email ID
|
||||||
msg.To.Add(Recep);
|
msg.To.Add(Recep);
|
||||||
//msg.To.Add("Jonathan.Ouellette@infineon.com");
|
|
||||||
// add CC email ids if supplied.
|
// add CC email ids if supplied.
|
||||||
if (!string.IsNullOrEmpty(cc))
|
if (!string.IsNullOrEmpty(cc))
|
||||||
msg.CC.Add(cc);
|
msg.CC.Add(cc);
|
||||||
@ -150,7 +153,6 @@ public class EmailNotification {
|
|||||||
msg.IsBodyHtml = true;// email body will allow html elements
|
msg.IsBodyHtml = true;// email body will allow html elements
|
||||||
|
|
||||||
// setting the Sender Email ID
|
// setting the Sender Email ID
|
||||||
//msg.From = new MailAddress(SenderEmail, SenderName);
|
|
||||||
msg.From = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
|
msg.From = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
|
||||||
// adding the Recepient Email ID
|
// adding the Recepient Email ID
|
||||||
foreach (string recepient in RecepientList) {
|
foreach (string recepient in RecepientList) {
|
||||||
@ -480,9 +482,7 @@ public class EmailNotification {
|
|||||||
msg.Subject = subject;
|
msg.Subject = subject;
|
||||||
msg.Body = temp;
|
msg.Body = temp;
|
||||||
msg.Priority = importance;
|
msg.Priority = importance;
|
||||||
//#if(!DEBUG)
|
|
||||||
client.Send(msg);
|
client.Send(msg);
|
||||||
//#endif
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
@ -44,10 +44,6 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
public string LotDispo { get; set; }
|
public string LotDispo { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public IEnumerable<ExcelLotInfo> ReadData() {
|
public IEnumerable<ExcelLotInfo> ReadData() {
|
||||||
var r = new List<ExcelLotInfo>();
|
var r = new List<ExcelLotInfo>();
|
||||||
var excelData = new ExcelData(_path);
|
var excelData = new ExcelData(_path);
|
||||||
@ -78,7 +74,6 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
List<string> s = new List<string>();
|
List<string> s = new List<string>();
|
||||||
// We return the interface, so that
|
// We return the interface, so that
|
||||||
var excelData = new ExcelData(_path);
|
var excelData = new ExcelData(_path);
|
||||||
//var albums = excelData.getData("Sheet1");
|
|
||||||
var lotNos = excelData.getData();
|
var lotNos = excelData.getData();
|
||||||
foreach (var row in lotNos) {
|
foreach (var row in lotNos) {
|
||||||
string temValue = row[0].ToString();
|
string temValue = row[0].ToString();
|
||||||
@ -94,11 +89,6 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
/// <returns></returns>
|
|
||||||
public IEnumerable<DataRow> getData(bool firstRowIsColumnNames = true) {
|
public IEnumerable<DataRow> getData(bool firstRowIsColumnNames = true) {
|
||||||
var reader = this.getExcelReader();
|
var reader = this.getExcelReader();
|
||||||
reader.IsFirstRowAsColumnNames = firstRowIsColumnNames;
|
reader.IsFirstRowAsColumnNames = firstRowIsColumnNames;
|
||||||
|
@ -16,9 +16,6 @@ internal class FTPWrapper {
|
|||||||
_DestinationFileName = destinationFileName;
|
_DestinationFileName = destinationFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public void FTPToSPN() {
|
public void FTPToSPN() {
|
||||||
FTP ftpLib = new();
|
FTP ftpLib = new();
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ public static class Functions {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
public static void WriteEvent(AppSettings? appSettings, string logtext, EventLogEntryType eventType) {
|
public static void WriteEvent(AppSettings? appSettings, string logtext, EventLogEntryType eventType) {
|
||||||
//#if(!DEBUG)
|
|
||||||
#if !NET8
|
#if !NET8
|
||||||
EmailNotification? en = appSettings is null ? null : new EmailNotification(appSettings);
|
EmailNotification? en = appSettings is null ? null : new EmailNotification(appSettings);
|
||||||
#endif
|
#endif
|
||||||
@ -39,19 +38,16 @@ public static class Functions {
|
|||||||
// Write to the Event Log
|
// Write to the Event Log
|
||||||
ev.WriteEntry(logtext, eventType);
|
ev.WriteEntry(logtext, eventType);
|
||||||
|
|
||||||
////Send an email notification if appropriate
|
// Send an email notification if appropriate
|
||||||
////Don't attempt to send an email if the error is pertaining to an email problem
|
// Don't attempt to send an email if the error is pertaining to an email problem
|
||||||
if (!logtext.Contains("SendEmailNotification()")) {
|
if (!logtext.Contains("SendEmailNotification()")) {
|
||||||
// Only send email notifications for Error and Warning level events
|
// Only send email notifications for Error and Warning level events
|
||||||
#if !NET8
|
#if !NET8
|
||||||
if (appSettings is not null && eventType == System.Diagnostics.EventLogEntryType.Error)
|
if (appSettings is not null && eventType == System.Diagnostics.EventLogEntryType.Error)
|
||||||
en.SendNotificationEmailToAdmin(ev.Source + " - Error Notification", logtext, MailPriority.High);
|
en.SendNotificationEmailToAdmin(ev.Source + " - Error Notification", logtext, MailPriority.High);
|
||||||
#endif
|
#endif
|
||||||
//else if (eventType == System.Diagnostics.EventLogEntryType.Warning)
|
|
||||||
// SendEmailNotification(ErrorRecipient(), ev.Source + " Warning Event Logged", logtext, NORMAL_PRI);
|
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
//throw;
|
|
||||||
} finally {
|
} finally {
|
||||||
ev = null;
|
ev = null;
|
||||||
}
|
}
|
||||||
@ -70,7 +66,6 @@ public static class Functions {
|
|||||||
FileInfo[] existingFiles = new DirectoryInfo(oldFolderPath).GetFiles();
|
FileInfo[] existingFiles = new DirectoryInfo(oldFolderPath).GetFiles();
|
||||||
foreach (FileInfo file in existingFiles) {
|
foreach (FileInfo file in existingFiles) {
|
||||||
if (!file.Name.Contains("ECNApprovalLog_" + oldECNNumber.ToString()) && !file.Name.Contains("ECNForm_" + oldECNNumber.ToString()))
|
if (!file.Name.Contains("ECNApprovalLog_" + oldECNNumber.ToString()) && !file.Name.Contains("ECNForm_" + oldECNNumber.ToString()))
|
||||||
//var fileName = Path.GetFileName(file.FullName);
|
|
||||||
file.CopyTo(Path.Combine(newFolderPath, file.Name));
|
file.CopyTo(Path.Combine(newFolderPath, file.Name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
67
Fab2ApprovalSystem/Misc/HomeHelper.cs
Normal file
67
Fab2ApprovalSystem/Misc/HomeHelper.cs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
|
|
||||||
|
public class HomeHelper {
|
||||||
|
|
||||||
|
public static void NotifyApprover(AppSettings appSettings, string toEmail, string title, int issueId, string docType) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string senderName = docType;
|
||||||
|
string subject = string.Empty;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string emailTemplate = "ApprovalReminders.txt";
|
||||||
|
|
||||||
|
subject = docType + " Approval Reminder: " + title;
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = docType;
|
||||||
|
emailparams[1] = title;
|
||||||
|
emailparams[2] = issueId.ToString();
|
||||||
|
userEmail = toEmail;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, "jonathan.ouellette@infineon.com", subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void NotifyDelegation(AppSettings appSettings, DateTime startDate, DateTime endDate, LoginModel delegateFrom, LoginModel delegateTo, List<string> emailList) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "Mesa Approval";
|
||||||
|
string emailTemplate = "DelegationOn.txt";
|
||||||
|
string subject = "Mesa Approval Delegation Notification";
|
||||||
|
|
||||||
|
foreach (string email in emailList) {
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[5];
|
||||||
|
emailparams[0] = delegateFrom.FullName;
|
||||||
|
emailparams[1] = delegateTo.FullName;
|
||||||
|
emailparams[2] = startDate.ToString("yyyy-MM-dd");
|
||||||
|
emailparams[3] = endDate.ToString("yyyy-MM-dd");
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DelegateDocumentApproval(AppSettings appSettings, int issueID, string ecnTypeString, string title, string email) {
|
||||||
|
string subject;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = ecnTypeString;
|
||||||
|
string emailTemplate = "DelegateApproval.txt";
|
||||||
|
|
||||||
|
subject = ecnTypeString + " Delegation" + " - Email would be sent to " + email + " for Number " + issueID + ", - " + title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = issueID.ToString();
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = ecnTypeString;
|
||||||
|
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
167
Fab2ApprovalSystem/Misc/LotDispositionHelper.cs
Normal file
167
Fab2ApprovalSystem/Misc/LotDispositionHelper.cs
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
|
|
||||||
|
public class LotDispositionHelper {
|
||||||
|
|
||||||
|
public static string NotifyRejectionToOrginator(AppSettings appSettings, int issueID, string username, List<string> emailIst) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "LotDisposition";
|
||||||
|
string subject = "Lot Disposition Rejection";
|
||||||
|
string emailTemplate = "LotDispositionReject.txt";
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
subject = "Lot Disposition Rejection";
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = issueID.ToString();
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = username;
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
return userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyApprovers(AppSettings appSettings, int issueID, List<string> emailIst) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "LotDisposition";
|
||||||
|
string subject = "Lot Disposition Assignment";
|
||||||
|
string emailTemplate = "LotDispositionAssigned.txt";
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
subject = "Lot Disposition Assignment";
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[3];
|
||||||
|
emailparams[0] = issueID.ToString();
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string AddAdditionalApproval(AppSettings appSettings, int issueID, string emailSentList, string emailArray) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "LotDisposition";
|
||||||
|
string subject = "Lot Disposition Assignment";
|
||||||
|
string emailTemplate = "LotDispositionAssigned.txt";
|
||||||
|
|
||||||
|
string[] emailIst = emailArray.Split(new char[] { '~' });
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
if (email.Length > 0) {
|
||||||
|
subject = "Lot Disposition Assignment";
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[3];
|
||||||
|
emailparams[0] = issueID.ToString();
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReAssignApproverByAdmin(AppSettings appSettings, int issueID, string email) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "LotDisposition";
|
||||||
|
string subject = "Lot Disposition Re-Assignment";
|
||||||
|
string emailTemplate = "LotDispositionReAssigned.txt";
|
||||||
|
|
||||||
|
subject = "Lot Disposition Re-Assignment" + " - Email would be sent to " + email;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[3];
|
||||||
|
emailparams[0] = issueID.ToString();
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
userEmail = email;
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReAssignApproval(AppSettings appSettings, int issueID, string email) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "LotDisposition";
|
||||||
|
string subject = "Lot Disposition Re-Assignment";
|
||||||
|
string emailTemplate = "LotDispositionReAssigned.txt";
|
||||||
|
|
||||||
|
subject = "Lot Disposition Re-Assignment" + " - Email would be sent to " + email;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[3];
|
||||||
|
emailparams[0] = issueID.ToString();
|
||||||
|
emailparams[1] = issueID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AttachSave(AppSettings appSettings, LotDispositionDMO lotDispositionDMO, int issueID, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + "LotDisposition", fileName);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
Attachment attach = new() {
|
||||||
|
IssueID = issueID,
|
||||||
|
FileName = fileName,
|
||||||
|
UserID = userId,
|
||||||
|
};
|
||||||
|
lotDispositionDMO.InsertLotDispositionAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ExcelLotOpen(LotDispositionDMO lotDispositionDMO, int issueID, string userIdentityName, string lotTempPipeLine, string fullFileName, Stream stream) {
|
||||||
|
string physicalPath;
|
||||||
|
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
string fName = userIdentityName + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
|
||||||
|
|
||||||
|
physicalPath = Path.Combine(lotTempPipeLine, fName + "." + fileExtension);
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !NET8
|
||||||
|
ExcelData x = new ExcelData(physicalPath);
|
||||||
|
var lotNumbers = x.ReadData();
|
||||||
|
|
||||||
|
foreach (var lotInfo in lotNumbers) {
|
||||||
|
Lot l = new Lot();
|
||||||
|
l.LotNumber = lotInfo.LotNo;
|
||||||
|
l.IssueID = issueID;
|
||||||
|
if (l.LotStatusOptionID == 0)
|
||||||
|
l.LotStatusOption.LotStatusOptionID = (int)GlobalVars.LotStatusOption.Release;
|
||||||
|
|
||||||
|
lotDispositionDMO.InsertLot(l, true);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FileInfo f = new(physicalPath);
|
||||||
|
if (f.Exists)
|
||||||
|
f.Delete();
|
||||||
|
|
||||||
|
return physicalPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
469
Fab2ApprovalSystem/Misc/LotTravelerHelper.cs
Normal file
469
Fab2ApprovalSystem/Misc/LotTravelerHelper.cs
Normal file
@ -0,0 +1,469 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
|
|
||||||
|
public class LotTravelerHelper {
|
||||||
|
|
||||||
|
public static string NotifyRejectionToOrginator(AppSettings appSettings, string userId, int workRequestID, string username, List<string> emailIst, LTWorkRequest ltWR) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "Work Request";
|
||||||
|
string subject = "Work Request Rejection";
|
||||||
|
string emailTemplate = "WorkRequestReject.txt";
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
subject = "Work Request Rejection notice for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[5];
|
||||||
|
emailparams[0] = ltWR.SWRNumber.ToString();
|
||||||
|
emailparams[1] = workRequestID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = username;
|
||||||
|
emailparams[4] = "Work Request";
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
try {
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Lot Traveler Notify Rejection:" + email });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyApprovers(AppSettings appSettings, string userId, int workRequestID, string emailSentList, LTWorkRequest ltWR, List<string> emailIst) {
|
||||||
|
string senderName = "";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string subject = "Work Request Assignment";
|
||||||
|
string emailTemplate = "WorkRequestAssigned.txt";
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
subject = "Work Request Assignment notice for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = ltWR.SWRNumber.ToString();
|
||||||
|
emailparams[1] = workRequestID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = "Work Request";
|
||||||
|
userEmail = email;
|
||||||
|
#if (DEBUG)
|
||||||
|
userEmail = "rkotian1@irf.com";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
try {
|
||||||
|
emailSentList += email + ",";
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "WR Notify Approvers:" + email });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyApprovalOfWorkRequest(AppSettings appSettings, string userId, int workRequestID, string emailSentList, LTWorkRequest ltWR, List<string> emailIst) {
|
||||||
|
string senderName = "";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string subject = "Work Request Approval";
|
||||||
|
string emailTemplate = "WorkRequestApproval.txt";
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
subject = "Work Request Approval notice for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = ltWR.SWRNumber.ToString();
|
||||||
|
emailparams[1] = workRequestID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = "Work Request";
|
||||||
|
userEmail = email;
|
||||||
|
#if (DEBUG)
|
||||||
|
userEmail = "rkotian1@irf.com";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
try {
|
||||||
|
emailSentList += email + ",";
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Lot Traveler Approval Notification:" + email });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyfWorkRequestRevisionChange(AppSettings appSettings, string userId, int workRequestID, string emailSentList, LTWorkRequest ltWR, List<string> emailIst) {
|
||||||
|
string senderName = "";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string subject = "Work Request Revision Change";
|
||||||
|
string emailTemplate = "WorkRequestRevisionChange.txt";
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
subject = "Work Request Revision Change notice for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = ltWR.SWRNumber.ToString();
|
||||||
|
emailparams[1] = workRequestID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = "Work Request";
|
||||||
|
userEmail = email;
|
||||||
|
#if (DEBUG)
|
||||||
|
userEmail = "rkotian1@irf.com";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
try {
|
||||||
|
emailSentList += email + ",";
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "WR Revision Change Notification:" + email });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyLotTravelerRevisionChange(AppSettings appSettings, string userId, string emailSentList, LTLotTravelerHeaderViewModel data, List<string> emailIst) {
|
||||||
|
string senderName = "";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string subject = "Lot Traveler Revision Change";
|
||||||
|
string emailTemplate = "LotTravelerRevisionChange.txt";
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
subject = "Lot Traveler Revision for SWR# " + data.SWRNumber + ", Lot# " + data.LotNumber + " - " + data.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = data.SWRNumber.ToString();
|
||||||
|
emailparams[1] = data.LTWorkRequestID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = data.LotNumber;
|
||||||
|
userEmail = email;
|
||||||
|
#if (DEBUG)
|
||||||
|
userEmail = "rkotian1@irf.com";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
try {
|
||||||
|
emailSentList += email + ",";
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = data.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Lot Traveler Revision Notification:" + email });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NotifyLotTravelerCreation(AppSettings appSettings, string userId, string emailSentList, LTLotTravelerHeaderViewModel data, List<string> emailIst) {
|
||||||
|
string senderName = "";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string subject = "Lot Traveler Revision Change";
|
||||||
|
string emailTemplate = "LotTravelerCreation.txt";
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
subject = "Lot Traveler created for SWR# " + data.SWRNumber + ", Lot# " + data.LotNumber + " - " + data.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = data.SWRNumber.ToString();
|
||||||
|
emailparams[1] = data.LTWorkRequestID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = data.LotNumber;
|
||||||
|
userEmail = email;
|
||||||
|
#if (DEBUG)
|
||||||
|
userEmail = "rkotian1@irf.com";
|
||||||
|
#endif
|
||||||
|
try {
|
||||||
|
emailSentList += email + ",";
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = data.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Lot Traveler Creation Email Notification:" + email });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReAssignApproval(AppSettings appSettings, string userId, int workRequestID, string email, LTWorkRequest ltWR) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "Work Request";
|
||||||
|
string subject = "Work Request Re-Assignment";
|
||||||
|
string emailTemplate = "WorkRequestReAssigned.txt";
|
||||||
|
|
||||||
|
subject = "Work Request Re-Assignment" + " - Email would be sent to " + email + " for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = ltWR.SWRNumber.ToString();
|
||||||
|
emailparams[1] = workRequestID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = "Work Request";
|
||||||
|
userEmail = email;
|
||||||
|
try {
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
} catch {
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "ReAssign Approval Notification:" + email });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string AddAdditionalApproval(AppSettings appSettings, string userId, int workRequestID, string emailSentList, string emailArray, LTWorkRequest ltWR) {
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "Work Request";
|
||||||
|
string subject = "Work Request Assignment";
|
||||||
|
string emailTemplate = "WorkRequestAssigned.txt";
|
||||||
|
|
||||||
|
string[] emailIst = emailArray.Split(new char[] { '~' });
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
if (email.Length > 0) {
|
||||||
|
subject = "Work Request Assignment notice for Number " + workRequestID + ", - " + ltWR.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = ltWR.SWRNumber.ToString();
|
||||||
|
emailparams[1] = workRequestID.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = "Work Request";
|
||||||
|
|
||||||
|
userEmail = email;
|
||||||
|
try {
|
||||||
|
emailSentList += email + ",";
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Addtional Approver Notification:" + email });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReAssignApproverByAdmin(AppSettings appSettings, string userId, int workRequestID, string email, LTWorkRequest ltWR) {
|
||||||
|
string subject;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "Work Request";
|
||||||
|
string emailTemplate = "WorkRequestReAssigned.txt";
|
||||||
|
|
||||||
|
subject = "Work Request Re-Assignment" + " - Email would be sent to " + email + " for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = ltWR.SWRNumber.ToString();
|
||||||
|
emailparams[1] = workRequestID.ToString(); // goes into the link
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = "Work Request";
|
||||||
|
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
try {
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
} catch {
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "ReAssign Approver Notification:" + email });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void HoldStepAttachSave(AppSettings appSettings, LotTravelerDMO lotTravelerDMO, int holdStepID, int swrNo, string docType, string comments, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var SWRPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
||||||
|
di = new DirectoryInfo(SWRPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var SWR_RevPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
||||||
|
di = new DirectoryInfo(SWR_RevPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
LTWorkRequestAttachment attach = new() {
|
||||||
|
FileGUID = guid,
|
||||||
|
LTHoldStepID = holdStepID,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId,
|
||||||
|
DocType = docType,
|
||||||
|
Comments = comments
|
||||||
|
};
|
||||||
|
|
||||||
|
lotTravelerDMO.InsertLotHoldStepAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void HoldStepAttachSaveRev(AppSettings appSettings, LotTravelerDMO lotTravelerDMO, int holdStepID, int swrNo, string docType, string comments, bool newRevision, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var SWRPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
||||||
|
di = new DirectoryInfo(SWRPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var SWR_RevPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
||||||
|
di = new DirectoryInfo(SWR_RevPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
LTWorkRequestAttachment attach = new() {
|
||||||
|
FileGUID = guid,
|
||||||
|
LTHoldStepID = holdStepID,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId,
|
||||||
|
DocType = docType,
|
||||||
|
Comments = comments
|
||||||
|
};
|
||||||
|
if (newRevision)
|
||||||
|
lotTravelerDMO.InsertLotHoldStepAttachmentRevision(attach);
|
||||||
|
else
|
||||||
|
lotTravelerDMO.InsertLotHoldStepAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AttachSaveWorkRequestRevision(AppSettings appSettings, LotTravelerDMO lotTravelerDMO, int workRequestID, int swrNo, string docType, string attachComments, bool newRevision, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var SWRPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
||||||
|
di = new DirectoryInfo(SWRPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var SWR_RevPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
||||||
|
di = new DirectoryInfo(SWR_RevPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
LTWorkRequestAttachment attach = new() {
|
||||||
|
WorkRequestID = workRequestID,
|
||||||
|
FileGUID = guid,
|
||||||
|
LTHoldStepID = -1,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId,
|
||||||
|
DocType = docType,
|
||||||
|
Comments = attachComments
|
||||||
|
};
|
||||||
|
|
||||||
|
// InsertWorkRequestAttachment(attach);
|
||||||
|
if (newRevision)
|
||||||
|
lotTravelerDMO.InsertWorkRequestAttachmentRevision(attach);
|
||||||
|
else
|
||||||
|
lotTravelerDMO.InsertWorkRequestAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AttachSaveWorkRequest(AppSettings appSettings, LotTravelerDMO lotTravelerDMO, int workRequestID, int swrNo, string comments, string docType, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var SWRPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
||||||
|
di = new DirectoryInfo(SWRPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var SWR_RevPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
||||||
|
di = new DirectoryInfo(SWR_RevPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
LTWorkRequestAttachment attach = new() {
|
||||||
|
WorkRequestID = workRequestID,
|
||||||
|
FileGUID = guid,
|
||||||
|
LTHoldStepID = -1,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId,
|
||||||
|
DocType = docType,
|
||||||
|
Comments = comments
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
lotTravelerDMO.InsertWorkRequestAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void LotTravHoldStepAttachSaveRev(AppSettings appSettings, LotTravelerDMO lotTravelerDMO, int ltHoldStepID, int swrNo, string docType, int prevLotTravRevID, int newLotTravRevID, bool newRevision, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
DirectoryInfo di;
|
||||||
|
var SWRPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
||||||
|
di = new DirectoryInfo(SWRPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var SWR_RevPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
|
||||||
|
di = new DirectoryInfo(SWR_RevPhysicalPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
LTLotTravAttachment attach = new() {
|
||||||
|
FileGUID = guid,
|
||||||
|
LTLotTravHoldStepID = ltHoldStepID,
|
||||||
|
LotTravelerRevisionID = newLotTravRevID,
|
||||||
|
FileName = fileName,
|
||||||
|
UploadedByID = userId,
|
||||||
|
DocType = docType
|
||||||
|
};
|
||||||
|
if (newRevision) {
|
||||||
|
try {
|
||||||
|
lotTravelerDMO.InsertLotTravLotHoldStepAttachmentRevision(attach);
|
||||||
|
} catch {
|
||||||
|
// roll back the revision creation
|
||||||
|
lotTravelerDMO.RestoreLotTravToPrevRevision(prevLotTravRevID, newLotTravRevID);
|
||||||
|
throw new Exception("There was a problem while creating the revision, Please logout and log back and then retry. \n If the problem persist please contact the Site Administrator");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else
|
||||||
|
lotTravelerDMO.InsertLotTravLotHoldStepAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
320
Fab2ApprovalSystem/Misc/MRBHelper.cs
Normal file
320
Fab2ApprovalSystem/Misc/MRBHelper.cs
Normal file
@ -0,0 +1,320 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
|
|
||||||
|
public class MRBHelper {
|
||||||
|
|
||||||
|
public static string NotifyApprovers(AppSettings appSettings, int mrbNumber, List<string> emailIst) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string emailTemplate = "MRBAssigned.txt";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string subject = "MRB Assignment";
|
||||||
|
string senderName = "MRB";
|
||||||
|
|
||||||
|
foreach (string email in emailIst) {
|
||||||
|
subject = "MRB Assignment";
|
||||||
|
EmailNotification en = new(appSettings, subject, emailTemplate);
|
||||||
|
string[] emailparams = new string[3];
|
||||||
|
emailparams[0] = mrbNumber.ToString();
|
||||||
|
emailparams[1] = mrbNumber.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
userEmail = email;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
emailSentList += email + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailSentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ImportRemoveQDBFlag(AppSettings appSettings, MRB_DMO mrbDMO, string operation, out string physicalPath, string userIdentityName, string a, string b, string c, string fullFileName, Stream stream) {
|
||||||
|
IEnumerable<string> lotDataList = null;
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
physicalPath = Path.Combine(appSettings.LotTempPipeLine, guid + "." + fileExtension);
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !NET8
|
||||||
|
ExcelData x = new ExcelData(physicalPath);
|
||||||
|
lotDataList = x.ReadQDBFlagData();
|
||||||
|
|
||||||
|
foreach (string lotData in lotDataList) {
|
||||||
|
mrbDMO.InsertMRB_QDB_HoldFlag(guid, lotData, operation);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FileInfo f = new(physicalPath);
|
||||||
|
if (f.Exists)
|
||||||
|
f.Delete();
|
||||||
|
|
||||||
|
// Send the data to SPN
|
||||||
|
if (SendQDBFlagToSPN(appSettings, mrbDMO, guid, userIdentityName, a, b, c))
|
||||||
|
mrbDMO.UpdateMRB_QDB_HoldFlag(guid, true);
|
||||||
|
else {
|
||||||
|
mrbDMO.UpdateMRB_QDB_HoldFlag(guid, false);
|
||||||
|
return "Problems while uploading to SPN";
|
||||||
|
}
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool BatchFTP(AppSettings appSettings, string sourceFile, string destFile, string ftpLogDirectory, string userIdentityName, string a, string b, string c) {
|
||||||
|
FileInfo sourcefile = new(sourceFile);
|
||||||
|
|
||||||
|
try {
|
||||||
|
ProcessStartInfo psiFab1 = new();
|
||||||
|
Process procFab1 = new();
|
||||||
|
StringBuilder sb = new();
|
||||||
|
|
||||||
|
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||||
|
psiFab1.FileName = a;
|
||||||
|
} else {
|
||||||
|
psiFab1.FileName = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
psiFab1.Arguments = sourcefile.FullName + " " + destFile;
|
||||||
|
|
||||||
|
psiFab1.RedirectStandardOutput = true;
|
||||||
|
psiFab1.UseShellExecute = false;
|
||||||
|
psiFab1.WorkingDirectory = c;
|
||||||
|
|
||||||
|
procFab1.StartInfo = psiFab1;
|
||||||
|
procFab1.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data);
|
||||||
|
;
|
||||||
|
procFab1.Start();
|
||||||
|
procFab1.BeginOutputReadLine();
|
||||||
|
procFab1.WaitForExit(4000);
|
||||||
|
|
||||||
|
File.WriteAllText(Path.Combine(ftpLogDirectory, sourcefile.Name + ".txt"), sb.ToString());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
Functions.WriteEvent(appSettings, userIdentityName + "\r\n Approve\r\n" + e.Message.ToString(), EventLogEntryType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool SendQDBFlagToSPN(AppSettings appSettings, MRB_DMO mrbDMO, string guid, string userIdentityName, string a, string b, string c) {
|
||||||
|
StringBuilder output = new();
|
||||||
|
try {
|
||||||
|
IEnumerable<string> data = mrbDMO.GetMRB_QDB_HoldFlags(guid);
|
||||||
|
foreach (string tempData in data) {
|
||||||
|
output.Append(tempData.Trim() + Environment.NewLine);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (output.Length > 0) {
|
||||||
|
DateTime dt = DateTime.Now;
|
||||||
|
string newsourceFileName = "S" + dt.Day.ToString("00") + dt.Month.ToString("00") + dt.Year.ToString("00") + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00") + ".mrb";
|
||||||
|
string newDestFileName = "S" + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00") + ".mrb";
|
||||||
|
|
||||||
|
string outputFile = appSettings.HoldFlagDirectory + newsourceFileName;
|
||||||
|
|
||||||
|
File.WriteAllText(outputFile, output.ToString());
|
||||||
|
|
||||||
|
#if (DEBUG)
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
#endif
|
||||||
|
try {
|
||||||
|
if (BatchFTP(appSettings, outputFile, newDestFileName, appSettings.SPNMRBHoldFlagFTPLogDirectory, userIdentityName, a, b, c)) {
|
||||||
|
mrbDMO.UpdateMRB_QDB_HoldFlag(guid, true);
|
||||||
|
} else {
|
||||||
|
mrbDMO.UpdateMRB_QDB_HoldFlag(guid, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "MRB =" + guid.ToString() + " FTPToSPN(): FTP Upload Error " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = -1, UserID = userIdentityName, DocumentType = "MRB", OperationType = "Error", Comments = exceptionString });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "MRB =" + guid.ToString() + " SPN Hold Flag(SendToSPN) " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
|
Functions.WriteEvent(appSettings, userIdentityName + "\r\n Approve\r\n" + e.Message.ToString(), EventLogEntryType.Error);
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = -1, UserID = userIdentityName, DocumentType = "MRB", OperationType = "Error", Comments = exceptionString });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "GUID =" + guid.ToString() + " SPN Hold Flag(SendToSPN) " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
|
Functions.WriteEvent(appSettings, userIdentityName + "\r\n Approve\r\n" + e.Message.ToString(), EventLogEntryType.Error);
|
||||||
|
EventLogDMO.Add(new WinEventLog() { IssueID = -1, UserID = userIdentityName, DocumentType = "MRB", OperationType = "Error", Comments = exceptionString });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ImportAddQDBFlag(AppSettings appSettings, MRB_DMO mrbDMO, string operation, out string physicalPath, string userIdentityName, string a, string b, string c, string fullFileName, Stream stream) {
|
||||||
|
IEnumerable<string> lotDataList = null;
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
physicalPath = Path.Combine(appSettings.LotTempPipeLine, guid + "." + fileExtension);
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !NET8
|
||||||
|
ExcelData x = new ExcelData(physicalPath);
|
||||||
|
lotDataList = x.ReadQDBFlagData();
|
||||||
|
|
||||||
|
foreach (string lotData in lotDataList) {
|
||||||
|
mrbDMO.InsertMRB_QDB_HoldFlag(guid, lotData, operation);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FileInfo f = new(physicalPath);
|
||||||
|
if (f.Exists)
|
||||||
|
f.Delete();
|
||||||
|
|
||||||
|
if (SendQDBFlagToSPN(appSettings, mrbDMO, guid, userIdentityName, a, b, c))
|
||||||
|
mrbDMO.UpdateMRB_QDB_HoldFlag(guid, true);
|
||||||
|
else {
|
||||||
|
mrbDMO.UpdateMRB_QDB_HoldFlag(guid, false);
|
||||||
|
return "Problems while uploading to SPN";
|
||||||
|
}
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AttachSave(AppSettings appSettings, MRB_DMO mrbDMO, int mrbNumber, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
string physicalFileName;
|
||||||
|
string physicalPath;
|
||||||
|
|
||||||
|
// Check to see if this filename is in use
|
||||||
|
var attachments = mrbDMO.GetMRBAttachments(mrbNumber);
|
||||||
|
if (attachments.Count() > 0) {
|
||||||
|
if (attachments.Count(a => string.Equals(a.FileName, fileName, StringComparison.OrdinalIgnoreCase)) > 0) {
|
||||||
|
// This filename is used on this MRB
|
||||||
|
// So we want to delete those records so the new record replaces them
|
||||||
|
foreach (var a in attachments) {
|
||||||
|
mrbDMO.DeleteMRBAttachment(a.AttachmentID);
|
||||||
|
|
||||||
|
physicalFileName = a.Path;
|
||||||
|
if (string.IsNullOrEmpty(physicalFileName))
|
||||||
|
physicalFileName = a.FileName;
|
||||||
|
physicalPath = Path.Combine(appSettings.AttachmentFolder + "MRB", physicalFileName);
|
||||||
|
|
||||||
|
if (File.Exists(physicalPath))
|
||||||
|
File.Delete(physicalPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
physicalFileName = mrbNumber.ToString() + "_" + Guid.NewGuid().ToString() + Path.GetExtension(fileName);
|
||||||
|
physicalPath = Path.Combine(appSettings.AttachmentFolder + "MRB", physicalFileName);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
MRBAttachment attach = new() {
|
||||||
|
MRBNumber = mrbNumber,
|
||||||
|
FileName = fileName,
|
||||||
|
Path = physicalFileName,
|
||||||
|
#if (DEBUG)
|
||||||
|
UserID = 114,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (!DEBUG)
|
||||||
|
UserID = userId,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
mrbDMO.InsertMRBAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ExcelLotOpen(MRB_DMO mrbDMO, int mrbNumber, StringBuilder warnings, IEnumerable<Disposition> dispos, string userIdentityName, string lotTempPipeLine, string fullFileName, Stream stream) {
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
var fileExtension = Path.GetExtension(fullFileName);
|
||||||
|
string fName = userIdentityName + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
|
||||||
|
string physicalPath = Path.Combine(lotTempPipeLine, fName + "." + fileExtension);
|
||||||
|
|
||||||
|
#if !NET8
|
||||||
|
IEnumerable<ExcelData.ExcelLotInfo> lotNumbers;
|
||||||
|
|
||||||
|
try {
|
||||||
|
using (var fileStream = new FileStream(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
ExcelData x = new ExcelData(physicalPath);
|
||||||
|
lotNumbers = x.ReadData();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new Exception(String.Format("Invalid file format for {0}: {1}", fileName, ex.Message));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get Tool, Issue Start and End Date
|
||||||
|
|
||||||
|
MRB mrbInfo = mrbDMO.GetToolIssueStartEndDateData(mrbNumber, null);
|
||||||
|
|
||||||
|
foreach (var lotInfo in lotNumbers) {
|
||||||
|
if (lotInfo.LotDispo.Length == 1) {
|
||||||
|
if (dispos.Count(d => d.DispositionType.Trim().ToUpper() == lotInfo.LotDispo.Trim().ToUpper()) == 0) {
|
||||||
|
throw new Exception(String.Format("Invalid lot disposition {0} for lot no {1}",
|
||||||
|
lotInfo.LotDispo, lotInfo.LotNo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// RJK - 12/17
|
||||||
|
// Only find the child Splits when a Tool or a list of Tools is provided
|
||||||
|
if (!mrbInfo.ToolCSV.ToUpper().Equals("NA")) {
|
||||||
|
foreach (var lotInfo in lotNumbers) {
|
||||||
|
bool existingLotUpdated;
|
||||||
|
Lot l = new Lot();
|
||||||
|
l.LotNumber = lotInfo.LotNo;
|
||||||
|
if (lotInfo.LotDispo.Length == 1) {
|
||||||
|
l.DispoType = lotInfo.LotDispo[0];
|
||||||
|
}
|
||||||
|
l.MRBNumber = mrbNumber;
|
||||||
|
mrbDMO.InsertLot(l, true, out existingLotUpdated);
|
||||||
|
// cannot do the check below , because what if the parent lot had splits after the prior lot split analysis
|
||||||
|
if (!mrbDMO.InsertLotSplitsAffectedByIncident(mrbNumber, l.LotNumber, mrbInfo.ToolCSV, mrbInfo.IssueStartDate, mrbInfo.IssueEndDate)) {
|
||||||
|
warnings.AppendFormat("Lot number {0} is not affected by these tools and issue start/end time.\n Uploaded without Lot Genealogy tracing", l.LotNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not required - Will be using each lot's Insert Date time stamp,
|
||||||
|
// as lot could be added using search functionality
|
||||||
|
// UpdateLastLotSplitAnalysisTime(mrbNumber);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// RJK - 12/17
|
||||||
|
// Only find the child Splits when a Tool or a list of Tools is provided
|
||||||
|
foreach (var lotInfo in lotNumbers) {
|
||||||
|
bool existingLotUpdated;
|
||||||
|
Lot l = new Lot();
|
||||||
|
l.LotNumber = lotInfo.LotNo;
|
||||||
|
if (lotInfo.LotDispo.Length == 1) {
|
||||||
|
l.DispoType = lotInfo.LotDispo[0];
|
||||||
|
}
|
||||||
|
l.MRBNumber = mrbNumber;
|
||||||
|
// do not insert any new lots when importing from excel
|
||||||
|
mrbDMO.InsertLot(l, true, out existingLotUpdated);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FileInfo f = new(physicalPath);
|
||||||
|
if (f.Exists)
|
||||||
|
f.Delete();
|
||||||
|
|
||||||
|
return physicalPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
49
Fab2ApprovalSystem/Misc/PartsRequestHelper.cs
Normal file
49
Fab2ApprovalSystem/Misc/PartsRequestHelper.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
using System.IO;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
|
|
||||||
|
public class PartsRequestHelper {
|
||||||
|
|
||||||
|
public static void SendEmailNotification(AppSettings appSettings, string username, string subject, int prNumber, string toEmail, string emailTemplate) {
|
||||||
|
string senderName = "Parts Request";
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
string[] emailparams = new string[5];
|
||||||
|
emailparams[0] = prNumber.ToString();
|
||||||
|
emailparams[1] = prNumber.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
emailparams[3] = "Parts Request";
|
||||||
|
emailparams[4] = username;
|
||||||
|
string userEmail = toEmail;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AttachSave(AppSettings appSettings, PartsRequestDMO partsRequestDMO, int prNumber, int userId, string fullFileName, Stream stream) {
|
||||||
|
// Some browsers send file names with full path.
|
||||||
|
// We are only interested in the file name.
|
||||||
|
var fileName = Path.GetFileName(fullFileName);
|
||||||
|
|
||||||
|
string prFolderPath = appSettings.AttachmentFolder + "PartsRequest\\" + prNumber.ToString();
|
||||||
|
|
||||||
|
DirectoryInfo di = new(prFolderPath);
|
||||||
|
if (!di.Exists)
|
||||||
|
di.Create();
|
||||||
|
|
||||||
|
var physicalPath = Path.Combine(prFolderPath, fileName);
|
||||||
|
|
||||||
|
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
|
||||||
|
stream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
PartsRequestAttachment attach = new() {
|
||||||
|
PRNumber = prNumber,
|
||||||
|
FileName = fileName,
|
||||||
|
UserID = userId,
|
||||||
|
};
|
||||||
|
partsRequestDMO.InsertAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
26
Fab2ApprovalSystem/Misc/TrainingHelper.cs
Normal file
26
Fab2ApprovalSystem/Misc/TrainingHelper.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
|
|
||||||
|
public class TrainingHelper {
|
||||||
|
|
||||||
|
public static void NotifyTrainee(AppSettings appSettings, int userId, int assignmentId, int ecnId, string title, string recipient) {
|
||||||
|
string emailSentList = "";
|
||||||
|
string subject = string.Empty;
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
string senderName = "ECN Training";
|
||||||
|
string emailTemplate = "ECNTrainingAssigned.txt";
|
||||||
|
|
||||||
|
subject = "ECN# " + ecnId + " - Training Assignment Notice - " + title;
|
||||||
|
|
||||||
|
EmailNotification en = new(appSettings, subject);
|
||||||
|
userEmail = recipient;
|
||||||
|
string[] emailparams = new string[4];
|
||||||
|
emailparams[0] = assignmentId.ToString();
|
||||||
|
emailparams[1] = ecnId.ToString();
|
||||||
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
|
|
||||||
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -20,8 +20,6 @@ public class Zipper {
|
|||||||
|
|
||||||
zipStream.SetLevel(3); // 0-9, 9 being the highest level of compression
|
zipStream.SetLevel(3); // 0-9, 9 being the highest level of compression
|
||||||
|
|
||||||
//zipStream.Password = password; // optional. Null is the same as not setting. Required if using AES.
|
|
||||||
|
|
||||||
// This setting will strip the leading part of the folder path in the entries, to
|
// This setting will strip the leading part of the folder path in the entries, to
|
||||||
// make the entries relative to the starting folder.
|
// make the entries relative to the starting folder.
|
||||||
// To include the full path for each entry up to the drive root, assign folderOffset = 0.
|
// To include the full path for each entry up to the drive root, assign folderOffset = 0.
|
||||||
|
@ -57,15 +57,12 @@ public class FTP {
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
public FTP() {
|
public FTP() {
|
||||||
server = null;
|
server = null;
|
||||||
user = null;
|
user = null;
|
||||||
pass = null;
|
pass = null;
|
||||||
port = 21;
|
port = 21;
|
||||||
passive_mode = true; // #######################################
|
passive_mode = true;
|
||||||
main_sock = null;
|
main_sock = null;
|
||||||
main_ipEndPoint = null;
|
main_ipEndPoint = null;
|
||||||
listening_sock = null;
|
listening_sock = null;
|
||||||
@ -77,18 +74,13 @@ public class FTP {
|
|||||||
timeout = 10000; // 10 seconds
|
timeout = 10000; // 10 seconds
|
||||||
messages = "";
|
messages = "";
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="server">Server to connect to</param>
|
|
||||||
/// <param name="user">Account to login as</param>
|
|
||||||
/// <param name="pass">Account password</param>
|
|
||||||
public FTP(string server, string user, string pass) {
|
public FTP(string server, string user, string pass) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.pass = pass;
|
this.pass = pass;
|
||||||
port = 21;
|
port = 21;
|
||||||
passive_mode = true; // #######################################
|
passive_mode = true;
|
||||||
main_sock = null;
|
main_sock = null;
|
||||||
main_ipEndPoint = null;
|
main_ipEndPoint = null;
|
||||||
listening_sock = null;
|
listening_sock = null;
|
||||||
@ -100,19 +92,13 @@ public class FTP {
|
|||||||
timeout = 10000; // 10 seconds
|
timeout = 10000; // 10 seconds
|
||||||
messages = "";
|
messages = "";
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="server">Server to connect to</param>
|
|
||||||
/// <param name="port">Port server is listening on</param>
|
|
||||||
/// <param name="user">Account to login as</param>
|
|
||||||
/// <param name="pass">Account password</param>
|
|
||||||
public FTP(string server, int port, string user, string pass) {
|
public FTP(string server, int port, string user, string pass) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.pass = pass;
|
this.pass = pass;
|
||||||
this.port = port;
|
this.port = port;
|
||||||
passive_mode = true; // #######################################
|
passive_mode = true;
|
||||||
main_sock = null;
|
main_sock = null;
|
||||||
main_ipEndPoint = null;
|
main_ipEndPoint = null;
|
||||||
listening_sock = null;
|
listening_sock = null;
|
||||||
@ -275,7 +261,6 @@ public class FTP {
|
|||||||
messages = "";
|
messages = "";
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
//buf = GetLineFromBucket();
|
|
||||||
buf = GetLineFromBucket();
|
buf = GetLineFromBucket();
|
||||||
|
|
||||||
#if (FTP_DEBUG)
|
#if (FTP_DEBUG)
|
||||||
@ -589,9 +574,6 @@ public class FTP {
|
|||||||
// so the code doesn't hang if there is
|
// so the code doesn't hang if there is
|
||||||
// no data comming.
|
// no data comming.
|
||||||
if (msecs_passed > (timeout / 10)) {
|
if (msecs_passed > (timeout / 10)) {
|
||||||
//CloseDataSocket();
|
|
||||||
//throw new Exception("Timed out waiting on server to respond.");
|
|
||||||
|
|
||||||
// FILIPE MADUREIRA.
|
// FILIPE MADUREIRA.
|
||||||
// If there are no files to list it gives timeout.
|
// If there are no files to list it gives timeout.
|
||||||
// So I wait less time and if no data is received, means that there are no files
|
// So I wait less time and if no data is received, means that there are no files
|
||||||
@ -627,7 +609,6 @@ public class FTP {
|
|||||||
|
|
||||||
foreach (string f in List()) {
|
foreach (string f in List()) {
|
||||||
// FILIPE MADUREIRA
|
// FILIPE MADUREIRA
|
||||||
//In Windows servers it is identified by <DIR>
|
|
||||||
if ((f.Length > 0)) {
|
if ((f.Length > 0)) {
|
||||||
if ((f[0] != 'd') && (f.ToUpper().IndexOf("<DIR>") < 0))
|
if ((f[0] != 'd') && (f.ToUpper().IndexOf("<DIR>") < 0))
|
||||||
list.Add(f);
|
list.Add(f);
|
||||||
@ -636,6 +617,7 @@ public class FTP {
|
|||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a directory list only
|
/// Gets a directory list only
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -710,7 +692,7 @@ public class FTP {
|
|||||||
|
|
||||||
string pwd;
|
string pwd;
|
||||||
try {
|
try {
|
||||||
pwd = responseStr.Substring(responseStr.IndexOf("\"", 0) + 1);//5);
|
pwd = responseStr.Substring(responseStr.IndexOf("\"", 0) + 1);
|
||||||
pwd = pwd.Substring(0, pwd.LastIndexOf("\""));
|
pwd = pwd.Substring(0, pwd.LastIndexOf("\""));
|
||||||
pwd = pwd.Replace("\"\"", "\""); // directories with quotes in the name come out as "" from the server
|
pwd = pwd.Replace("\"\"", "\""); // directories with quotes in the name come out as "" from the server
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@ -719,6 +701,7 @@ public class FTP {
|
|||||||
|
|
||||||
return pwd;
|
return pwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Change to another directory on the ftp server
|
/// Change to another directory on the ftp server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -11,7 +11,6 @@ public class LoginModel {
|
|||||||
[Display(Name = "Login ID")]
|
[Display(Name = "Login ID")]
|
||||||
public string LoginID { get; set; }
|
public string LoginID { get; set; }
|
||||||
|
|
||||||
//[Required]
|
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Password")]
|
[Display(Name = "Password")]
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
@ -7,7 +7,7 @@ namespace Fab2ApprovalSystem.Models;
|
|||||||
|
|
||||||
public class AppSettings {
|
public class AppSettings {
|
||||||
|
|
||||||
internal AppSettings(string adminNotificationRecepient,
|
public AppSettings(string adminNotificationRecepient,
|
||||||
string? apiBaseUrl,
|
string? apiBaseUrl,
|
||||||
string attachmentFolder,
|
string attachmentFolder,
|
||||||
string? attachmentUrl,
|
string? attachmentUrl,
|
||||||
@ -15,7 +15,10 @@ public class AppSettings {
|
|||||||
string? company,
|
string? company,
|
||||||
string dBConnection,
|
string dBConnection,
|
||||||
string dbConnectionString,
|
string dbConnectionString,
|
||||||
|
string emailTemplatesPath,
|
||||||
string ftpPassword,
|
string ftpPassword,
|
||||||
|
string ftpSPNBatchFileName,
|
||||||
|
string ftpSPNBatchFileName_Test,
|
||||||
string ftpServer,
|
string ftpServer,
|
||||||
string ftpUser,
|
string ftpUser,
|
||||||
string holdFlagDirectory,
|
string holdFlagDirectory,
|
||||||
@ -25,18 +28,25 @@ public class AppSettings {
|
|||||||
bool isInfineonDomain,
|
bool isInfineonDomain,
|
||||||
string lotTempPipeLine,
|
string lotTempPipeLine,
|
||||||
string mesaTemplateFiles,
|
string mesaTemplateFiles,
|
||||||
|
string nDriveURL,
|
||||||
string naContainer,
|
string naContainer,
|
||||||
string naDomain,
|
string naDomain,
|
||||||
string nDriveURL,
|
|
||||||
string notificationSender,
|
string notificationSender,
|
||||||
string senderEmail,
|
string senderEmail,
|
||||||
string? smtpServer,
|
string? smtpServer,
|
||||||
|
string spnMRBHoldFlagDirectory,
|
||||||
string spnMRBHoldFlagFTPLogDirectory,
|
string spnMRBHoldFlagFTPLogDirectory,
|
||||||
|
string ssrSFolder,
|
||||||
|
string ssrSBindingsByConfiguration,
|
||||||
|
string ssrSBaseURL,
|
||||||
|
string ssrSDomain,
|
||||||
|
string ssrSUsername,
|
||||||
|
string ssrSPassword,
|
||||||
string testEmailRecipients,
|
string testEmailRecipients,
|
||||||
string urls,
|
string urls,
|
||||||
int userId,
|
int userId,
|
||||||
bool userIsAdmin,
|
bool userIsAdmin,
|
||||||
string wsrURL,
|
string wsr_URL,
|
||||||
string? workingDirectoryName) {
|
string? workingDirectoryName) {
|
||||||
AdminNotificationRecepient = adminNotificationRecepient;
|
AdminNotificationRecepient = adminNotificationRecepient;
|
||||||
ApiBaseUrl = apiBaseUrl;
|
ApiBaseUrl = apiBaseUrl;
|
||||||
@ -46,7 +56,10 @@ public class AppSettings {
|
|||||||
Company = company;
|
Company = company;
|
||||||
DBConnection = dBConnection;
|
DBConnection = dBConnection;
|
||||||
DBConnectionString = dbConnectionString;
|
DBConnectionString = dbConnectionString;
|
||||||
|
EmailTemplatesPath = emailTemplatesPath;
|
||||||
FTPPassword = ftpPassword;
|
FTPPassword = ftpPassword;
|
||||||
|
FTPSPNBatchFileName = ftpSPNBatchFileName;
|
||||||
|
FTPSPNBatchFileName_Test = ftpSPNBatchFileName_Test;
|
||||||
FTPServer = ftpServer;
|
FTPServer = ftpServer;
|
||||||
FTPUser = ftpUser;
|
FTPUser = ftpUser;
|
||||||
HoldFlagDirectory = holdFlagDirectory;
|
HoldFlagDirectory = holdFlagDirectory;
|
||||||
@ -56,18 +69,25 @@ public class AppSettings {
|
|||||||
IsInfineonDomain = isInfineonDomain;
|
IsInfineonDomain = isInfineonDomain;
|
||||||
LotTempPipeLine = lotTempPipeLine;
|
LotTempPipeLine = lotTempPipeLine;
|
||||||
MesaTemplateFiles = mesaTemplateFiles;
|
MesaTemplateFiles = mesaTemplateFiles;
|
||||||
|
NDriveURL = nDriveURL;
|
||||||
NAContainer = naContainer;
|
NAContainer = naContainer;
|
||||||
NADomain = naDomain;
|
NADomain = naDomain;
|
||||||
NDriveURL = nDriveURL;
|
|
||||||
NotificationSender = notificationSender;
|
NotificationSender = notificationSender;
|
||||||
SenderEmail = senderEmail;
|
SenderEmail = senderEmail;
|
||||||
SMTPServer = smtpServer;
|
SMTPServer = smtpServer;
|
||||||
|
SPNMRBHoldFlagDirectory = spnMRBHoldFlagDirectory;
|
||||||
SPNMRBHoldFlagFTPLogDirectory = spnMRBHoldFlagFTPLogDirectory;
|
SPNMRBHoldFlagFTPLogDirectory = spnMRBHoldFlagFTPLogDirectory;
|
||||||
TestEmailRecipients = testEmailRecipients;
|
TestEmailRecipients = testEmailRecipients;
|
||||||
|
SSRSFolder = ssrSFolder;
|
||||||
|
SSRSBindingsByConfiguration = ssrSBindingsByConfiguration;
|
||||||
|
SSRSBaseURL = ssrSBaseURL;
|
||||||
|
SSRSDomain = ssrSDomain;
|
||||||
|
SSRSUsername = ssrSUsername;
|
||||||
|
SSRSPassword = ssrSPassword;
|
||||||
URLs = urls;
|
URLs = urls;
|
||||||
UserId = userId;
|
UserId = userId;
|
||||||
UserIsAdmin = userIsAdmin;
|
UserIsAdmin = userIsAdmin;
|
||||||
WSR_URL = wsrURL;
|
WSR_URL = wsr_URL;
|
||||||
WorkingDirectoryName = workingDirectoryName;
|
WorkingDirectoryName = workingDirectoryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +99,10 @@ public class AppSettings {
|
|||||||
public string? Company { get; }
|
public string? Company { get; }
|
||||||
public string DBConnection { get; }
|
public string DBConnection { get; }
|
||||||
public string DBConnectionString { get; }
|
public string DBConnectionString { get; }
|
||||||
|
public string EmailTemplatesPath { get; }
|
||||||
public string FTPPassword { get; }
|
public string FTPPassword { get; }
|
||||||
|
public string FTPSPNBatchFileName { get; }
|
||||||
|
public string FTPSPNBatchFileName_Test { get; }
|
||||||
public string FTPServer { get; }
|
public string FTPServer { get; }
|
||||||
public string FTPUser { get; }
|
public string FTPUser { get; }
|
||||||
public string HoldFlagDirectory { get; }
|
public string HoldFlagDirectory { get; }
|
||||||
@ -95,7 +118,14 @@ public class AppSettings {
|
|||||||
public string NotificationSender { get; }
|
public string NotificationSender { get; }
|
||||||
public string SenderEmail { get; }
|
public string SenderEmail { get; }
|
||||||
public string? SMTPServer { get; }
|
public string? SMTPServer { get; }
|
||||||
|
public string SPNMRBHoldFlagDirectory { get; }
|
||||||
public string SPNMRBHoldFlagFTPLogDirectory { get; }
|
public string SPNMRBHoldFlagFTPLogDirectory { get; }
|
||||||
|
public string SSRSFolder { get; }
|
||||||
|
public string SSRSBindingsByConfiguration { get; }
|
||||||
|
public string SSRSBaseURL { get; }
|
||||||
|
public string SSRSDomain { get; }
|
||||||
|
public string SSRSUsername { get; }
|
||||||
|
public string SSRSPassword { get; }
|
||||||
public string TestEmailRecipients { get; }
|
public string TestEmailRecipients { get; }
|
||||||
public string URLs { get; }
|
public string URLs { get; }
|
||||||
public int UserId { get; }
|
public int UserId { get; }
|
||||||
@ -131,27 +161,62 @@ public class AppSettings {
|
|||||||
|
|
||||||
internal static AppSettings LoadConfigurationManager() {
|
internal static AppSettings LoadConfigurationManager() {
|
||||||
AppSettings result;
|
AppSettings result;
|
||||||
|
try {
|
||||||
int userId = 0;
|
int userId = 0;
|
||||||
string adminNotificationRecepient = ConfigurationManager.ConnectionStrings["Admin Notification Recepient"].ToString();
|
string adminNotificationRecepient = ConfigurationManager.AppSettings["Admin Notification Recepient"] ??
|
||||||
string attachmentFolder = ConfigurationManager.ConnectionStrings["AttachmentFolder"].ToString();
|
throw new ArgumentNullException("Admin Notification Recepient environment variable not found");
|
||||||
string ftpPassword = ConfigurationManager.ConnectionStrings["FTP Password"].ToString();
|
string attachmentFolder = ConfigurationManager.AppSettings["AttachmentFolder"] ??
|
||||||
string ftpServer = ConfigurationManager.ConnectionStrings["FTP Server"].ToString();
|
throw new ArgumentNullException("AttachmentFolder environment variable not found");
|
||||||
string ftpUser = ConfigurationManager.ConnectionStrings["FTP User"].ToString();
|
string emailTemplatesPath = ConfigurationManager.AppSettings["EmailTemplatesPath"] ??
|
||||||
string holdFlagDirectory = ConfigurationManager.ConnectionStrings["HoldFlagDirectory"].ToString();
|
throw new ArgumentNullException("EmailTemplatesPath environment variable not found");
|
||||||
string ifxContainer = ConfigurationManager.ConnectionStrings["IFXContainer"].ToString();
|
string ftpPassword = ConfigurationManager.AppSettings["FTP Password"] ??
|
||||||
string ifxDomain = ConfigurationManager.ConnectionStrings["IFXDomain"].ToString();
|
throw new ArgumentNullException("FTP Password environment variable not found");
|
||||||
string lotTempPipeLine = ConfigurationManager.ConnectionStrings["LotTempPipeLine"].ToString();
|
string ftpServer = ConfigurationManager.AppSettings["FTP Server"] ??
|
||||||
string naContainer = ConfigurationManager.ConnectionStrings["NAContainer"].ToString();
|
throw new ArgumentNullException("FTP Server environment variable not found");
|
||||||
string naDomain = ConfigurationManager.ConnectionStrings["NADomain"].ToString();
|
string ftpSPNBatchFileName = ConfigurationManager.AppSettings["FTPSPNBatchFileName"] ??
|
||||||
string notificationSender = ConfigurationManager.ConnectionStrings["Notification Sender"].ToString();
|
throw new ArgumentNullException("FTPSPNBatchFileName environment variable not found");
|
||||||
string spnMRBHoldFlagFTPLogDirectory = ConfigurationManager.ConnectionStrings["SPNMRBHoldFlagFTPLogDirectory"].ToString();
|
string ftpSPNBatchFileName_Test = ConfigurationManager.AppSettings["FTPSPNBatchFileName_Test"] ??
|
||||||
string testEmailRecipients = ConfigurationManager.ConnectionStrings["Test Email Recipients"].ToString();
|
throw new ArgumentNullException("FTPSPNBatchFileName_Test environment variable not found");
|
||||||
string? apiBaseUrl = ConfigurationManager.ConnectionStrings["FabApprovalApiBaseUrl"]?.ToString();
|
string ftpUser = ConfigurationManager.AppSettings["FTP User"] ??
|
||||||
string? attachmentUrl = ConfigurationManager.ConnectionStrings["AttachmentUrl"]?.ToString();
|
throw new ArgumentNullException("FTP User environment variable not found");
|
||||||
string? company = ConfigurationManager.ConnectionStrings["Company"]?.ToString();
|
string holdFlagDirectory = ConfigurationManager.AppSettings["HoldFlagDirectory"] ??
|
||||||
string? smtpServer = ConfigurationManager.ConnectionStrings["SMTP Server"]?.ToString();
|
throw new ArgumentNullException("HoldFlagDirectory environment variable not found");
|
||||||
string? urls = ConfigurationManager.ConnectionStrings["URLs"]?.ToString();
|
string ifxContainer = ConfigurationManager.AppSettings["IFXContainer"] ??
|
||||||
string? workingDirectoryName = ConfigurationManager.ConnectionStrings["WorkingDirectoryName"]?.ToString();
|
throw new ArgumentNullException("IFXContainer environment variable not found");
|
||||||
|
string ifxDomain = ConfigurationManager.AppSettings["IFXDomain"] ??
|
||||||
|
throw new ArgumentNullException("IFXDomain environment variable not found");
|
||||||
|
string lotTempPipeLine = ConfigurationManager.AppSettings["LotTempPipeLine"] ??
|
||||||
|
throw new ArgumentNullException("LotTempPipeLine environment variable not found");
|
||||||
|
string naContainer = ConfigurationManager.AppSettings["NAContainer"] ??
|
||||||
|
throw new ArgumentNullException("NAContainer environment variable not found");
|
||||||
|
string naDomain = ConfigurationManager.AppSettings["NADomain"] ??
|
||||||
|
throw new ArgumentNullException("NADomain environment variable not found");
|
||||||
|
string notificationSender = ConfigurationManager.AppSettings["Notification Sender"] ??
|
||||||
|
throw new ArgumentNullException("Notification Sender environment variable not found");
|
||||||
|
string spnMRBHoldFlagDirectory = ConfigurationManager.AppSettings["SPNMRBHoldFlagDirectory"] ??
|
||||||
|
throw new ArgumentNullException("SPNMRBHoldFlagDirectory environment variable not found");
|
||||||
|
string spnMRBHoldFlagFTPLogDirectory = ConfigurationManager.AppSettings["SPNMRBHoldFlagFTPLogDirectory"] ??
|
||||||
|
throw new ArgumentNullException("SPNMRBHoldFlagFTPLogDirectory environment variable not found");
|
||||||
|
string ssrSFolder = ConfigurationManager.AppSettings["SSRSFolder"] ??
|
||||||
|
throw new ArgumentNullException("SSRSFolder environment variable not found");
|
||||||
|
string ssrSBindingsByConfiguration = ConfigurationManager.AppSettings["SSRSBindingsByConfiguration"] ??
|
||||||
|
throw new ArgumentNullException("SSRSBindingsByConfiguration environment variable not found");
|
||||||
|
string ssrSBaseURL = ConfigurationManager.AppSettings["SSRSBaseURL"] ??
|
||||||
|
throw new ArgumentNullException("SSRSBaseURL environment variable not found");
|
||||||
|
string ssrSDomain = ConfigurationManager.AppSettings["SSRSDomain"] ??
|
||||||
|
throw new ArgumentNullException("SSRSDomain environment variable not found");
|
||||||
|
string ssrSUsername = ConfigurationManager.AppSettings["SSRSUsername"] ??
|
||||||
|
throw new ArgumentNullException("SSRSUsername environment variable not found");
|
||||||
|
string ssrSPassword = ConfigurationManager.AppSettings["SSRSPassword"] ??
|
||||||
|
throw new ArgumentNullException("SSRSPassword environment variable not found");
|
||||||
|
string testEmailRecipients = ConfigurationManager.AppSettings["Test Email Recipients"] ??
|
||||||
|
throw new ArgumentNullException("Test Email Recipients environment variable not found");
|
||||||
|
string? apiBaseUrl = ConfigurationManager.AppSettings["FabApprovalApiBaseUrl"]?.ToString();
|
||||||
|
string? attachmentUrl = ConfigurationManager.AppSettings["AttachmentUrl"]?.ToString();
|
||||||
|
string? company = ConfigurationManager.AppSettings["Company"]?.ToString();
|
||||||
|
string? smtpServer = ConfigurationManager.AppSettings["SMTP Server"]?.ToString();
|
||||||
|
string? urls = ConfigurationManager.AppSettings["URLs"]?.ToString();
|
||||||
|
string? workingDirectoryName = ConfigurationManager.AppSettings["WorkingDirectoryName"]?.ToString();
|
||||||
result = new(adminNotificationRecepient: adminNotificationRecepient,
|
result = new(adminNotificationRecepient: adminNotificationRecepient,
|
||||||
apiBaseUrl: apiBaseUrl,
|
apiBaseUrl: apiBaseUrl,
|
||||||
attachmentFolder: attachmentFolder,
|
attachmentFolder: attachmentFolder,
|
||||||
@ -160,8 +225,11 @@ public class AppSettings {
|
|||||||
company: company,
|
company: company,
|
||||||
dBConnection: Misc.GlobalVars.DBConnection,
|
dBConnection: Misc.GlobalVars.DBConnection,
|
||||||
dbConnectionString: Misc.GlobalVars.DB_CONNECTION_STRING,
|
dbConnectionString: Misc.GlobalVars.DB_CONNECTION_STRING,
|
||||||
|
emailTemplatesPath: emailTemplatesPath,
|
||||||
ftpPassword: ftpPassword,
|
ftpPassword: ftpPassword,
|
||||||
ftpServer: ftpServer,
|
ftpServer: ftpServer,
|
||||||
|
ftpSPNBatchFileName: ftpSPNBatchFileName,
|
||||||
|
ftpSPNBatchFileName_Test: ftpSPNBatchFileName_Test,
|
||||||
ftpUser: ftpUser,
|
ftpUser: ftpUser,
|
||||||
holdFlagDirectory: holdFlagDirectory,
|
holdFlagDirectory: holdFlagDirectory,
|
||||||
hostURL: Misc.GlobalVars.hostURL,
|
hostURL: Misc.GlobalVars.hostURL,
|
||||||
@ -176,14 +244,25 @@ public class AppSettings {
|
|||||||
notificationSender: notificationSender,
|
notificationSender: notificationSender,
|
||||||
senderEmail: Misc.GlobalVars.SENDER_EMAIL,
|
senderEmail: Misc.GlobalVars.SENDER_EMAIL,
|
||||||
smtpServer: smtpServer,
|
smtpServer: smtpServer,
|
||||||
|
spnMRBHoldFlagDirectory: spnMRBHoldFlagDirectory,
|
||||||
spnMRBHoldFlagFTPLogDirectory: spnMRBHoldFlagFTPLogDirectory,
|
spnMRBHoldFlagFTPLogDirectory: spnMRBHoldFlagFTPLogDirectory,
|
||||||
testEmailRecipients: testEmailRecipients,
|
testEmailRecipients: testEmailRecipients,
|
||||||
|
ssrSFolder: ssrSFolder,
|
||||||
|
ssrSBindingsByConfiguration: ssrSBindingsByConfiguration,
|
||||||
|
ssrSBaseURL: ssrSBaseURL,
|
||||||
|
ssrSDomain: ssrSDomain,
|
||||||
|
ssrSUsername: ssrSUsername,
|
||||||
|
ssrSPassword: ssrSPassword,
|
||||||
urls: urls,
|
urls: urls,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
userIsAdmin: Misc.GlobalVars.USER_ISADMIN,
|
userIsAdmin: Misc.GlobalVars.USER_ISADMIN,
|
||||||
wsrURL: Misc.GlobalVars.WSR_URL,
|
wsr_URL: Misc.GlobalVars.WSR_URL,
|
||||||
workingDirectoryName: workingDirectoryName);
|
workingDirectoryName: workingDirectoryName);
|
||||||
return result;
|
return result;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Misc.Functions.WriteEvent(null, "LoadConfigurationManager - \r\n" + ex.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -9,7 +9,6 @@ public class ApprovalLogHistory {
|
|||||||
public string Operation { get; set; }
|
public string Operation { get; set; }
|
||||||
public string SubRole { get; set; }
|
public string SubRole { get; set; }
|
||||||
|
|
||||||
//[Display(Name = "Operation Time")]
|
|
||||||
public DateTime OperationTime { get; set; }
|
public DateTime OperationTime { get; set; }
|
||||||
public string Comments { get; set; }
|
public string Comments { get; set; }
|
||||||
|
|
||||||
|
@ -70,8 +70,6 @@ public class Lot {
|
|||||||
[Display(Name = "Lot Dispos")]
|
[Display(Name = "Lot Dispos")]
|
||||||
public string OtherLotDispos { get; set; }
|
public string OtherLotDispos { get; set; }
|
||||||
|
|
||||||
//MRB Lot
|
|
||||||
//[CustomDispoTypeValidationAttribute(ErrorMessage = "The values can only either A or B or C or D")]
|
|
||||||
public char? DispoType { get; set; }
|
public char? DispoType { get; set; }
|
||||||
[Display(Name = "Lot Dispos")]
|
[Display(Name = "Lot Dispos")]
|
||||||
public string LotDispositionsLinkedToLot { get; set; }
|
public string LotDispositionsLinkedToLot { get; set; }
|
||||||
|
@ -33,7 +33,6 @@ public class ECN : object {
|
|||||||
public bool IsEmergencyTECN { get; set; }
|
public bool IsEmergencyTECN { get; set; }
|
||||||
|
|
||||||
[DataType(DataType.Date)]
|
[DataType(DataType.Date)]
|
||||||
//[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
|
||||||
public DateTime? ExpirationDate { get; set; }
|
public DateTime? ExpirationDate { get; set; }
|
||||||
|
|
||||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||||
@ -147,7 +146,6 @@ public class ECN : object {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
// Return true if the fields match:
|
// Return true if the fields match:
|
||||||
//return (IsECN == p.IsECN) && (IsEmergencyTECN == p.IsEmergencyTECN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,9 @@ namespace Fab2ApprovalSystem.Models;
|
|||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class LotDisposition {
|
public class LotDisposition {
|
||||||
//[Editable(false)]
|
|
||||||
[Display(Name = "Issue Number")]
|
[Display(Name = "Issue Number")]
|
||||||
public int IssueID { get; set; }
|
public int IssueID { get; set; }
|
||||||
//[Editable(false)]
|
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public bool PERequired { get; set; }
|
public bool PERequired { get; set; }
|
||||||
public string IssueDescription { get; set; }
|
public string IssueDescription { get; set; }
|
||||||
|
@ -63,9 +63,6 @@ public class MRB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public MRB() {
|
public MRB() {
|
||||||
PartGroupIDs = new List<int>();
|
PartGroupIDs = new List<int>();
|
||||||
ModuleIDs = new List<int>();
|
ModuleIDs = new List<int>();
|
||||||
@ -151,7 +148,6 @@ public class ContainmentActionObj {
|
|||||||
public int CurrentResponsibilityOwnerID { get; set; }
|
public int CurrentResponsibilityOwnerID { get; set; }
|
||||||
public string ResponsibilityOwner { get; set; }
|
public string ResponsibilityOwner { get; set; }
|
||||||
|
|
||||||
//[DataType(DataType.Date)]
|
|
||||||
public DateTime? ECD { get; set; }
|
public DateTime? ECD { get; set; }
|
||||||
|
|
||||||
[DataType(DataType.Date)]
|
[DataType(DataType.Date)]
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
namespace Fab2ApprovalSystem.Models;
|
namespace Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
public class WinEventLog {
|
public class WinEventLog {
|
||||||
//[Key]
|
|
||||||
|
|
||||||
public int SysDocumentID { get; set; }
|
public int SysDocumentID { get; set; }
|
||||||
public int IssueID { get; set; }
|
public int IssueID { get; set; }
|
||||||
|
@ -25,13 +25,6 @@ namespace Fab2ApprovalSystem.PdfGenerator {
|
|||||||
this.standardPdfRenderer = new StandardPdfRenderer();
|
this.standardPdfRenderer = new StandardPdfRenderer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <returns></returns>
|
|
||||||
protected ActionResult ViewPdf(string pageTitle, string viewName, object model) {
|
protected ActionResult ViewPdf(string pageTitle, string viewName, object model) {
|
||||||
// Render the view html to a string.
|
// Render the view html to a string.
|
||||||
string htmlText = this.htmlViewRenderer.RenderViewToString(this, viewName, model);
|
string htmlText = this.htmlViewRenderer.RenderViewToString(this, viewName, model);
|
||||||
@ -43,12 +36,6 @@ namespace Fab2ApprovalSystem.PdfGenerator {
|
|||||||
return new BinaryContentResult(buffer, "application/pdf");
|
return new BinaryContentResult(buffer, "application/pdf");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void SavePdf(string fileName, string viewName, object model) {
|
protected void SavePdf(string fileName, string viewName, object model) {
|
||||||
// Render the view html to a string.
|
// Render the view html to a string.
|
||||||
string htmlText = this.htmlViewRenderer.RenderViewToString(this, viewName, model);
|
string htmlText = this.htmlViewRenderer.RenderViewToString(this, viewName, model);
|
||||||
|
@ -24,9 +24,6 @@ public class FileUtilities<T> : Controller // <T> => System.Web.Mvc.FileContentR
|
|||||||
{
|
{
|
||||||
|
|
||||||
public T DownloadFilesFromServer<T>(string pathToFile) {
|
public T DownloadFilesFromServer<T>(string pathToFile) {
|
||||||
//string templatesPath = GlobalVars.CA_BlankFormsLocation;
|
|
||||||
//string fullName = Server.MapPath("~" + filePath);
|
|
||||||
|
|
||||||
byte[] fileBytes = GetFile(pathToFile);
|
byte[] fileBytes = GetFile(pathToFile);
|
||||||
var result = File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, pathToFile);
|
var result = File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, pathToFile);
|
||||||
return (T)Convert.ChangeType(result, typeof(T));
|
return (T)Convert.ChangeType(result, typeof(T));
|
||||||
|
@ -35,12 +35,6 @@ public class ChangeControlViewModel {
|
|||||||
public int PCR3ID { get; set; }
|
public int PCR3ID { get; set; }
|
||||||
public string PlanTitle { get; set; }
|
public string PlanTitle { get; set; }
|
||||||
public ChangeControlViewModel() {
|
public ChangeControlViewModel() {
|
||||||
//GenerationIDs = new List<int>();
|
|
||||||
//LogisticsIDs = new List<int>();
|
|
||||||
//ProcessIDs = new List<int>();
|
|
||||||
|
|
||||||
//ToolTypeIDs = new List<int>();
|
|
||||||
//PartNumberIDs = new List<string>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -37,7 +37,6 @@ public class ECNPdf {
|
|||||||
public bool IsEmergencyTECN { get; set; }
|
public bool IsEmergencyTECN { get; set; }
|
||||||
|
|
||||||
[DataType(DataType.Date)]
|
[DataType(DataType.Date)]
|
||||||
//[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
|
||||||
public DateTime? ExpirationDate { get; set; }
|
public DateTime? ExpirationDate { get; set; }
|
||||||
|
|
||||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
@ -1,30 +1,15 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||||
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
|
||||||
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
|
<DefineConstants>NET8</DefineConstants>
|
||||||
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
|
|
||||||
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(IsWindows)'=='true'">
|
|
||||||
<DefineConstants>Windows</DefineConstants>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(IsOSX)'=='true'">
|
|
||||||
<DefineConstants>OSX</DefineConstants>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(IsLinux)'=='true'">
|
|
||||||
<DefineConstants>Linux</DefineConstants>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
|
||||||
<DefineConstants>Debug</DefineConstants>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
|
||||||
<DefineConstants>Release</DefineConstants>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VSTestLogger>trx</VSTestLogger>
|
<VSTestLogger>trx</VSTestLogger>
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.Workers;
|
using Fab2ApprovalSystem.Workers;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.Utilities;
|
using Fab2ApprovalSystem.Utilities;
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
using Fab2ApprovalSystem.Utilities;
|
using Fab2ApprovalSystem.Utilities;
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ variables:
|
|||||||
buildConfiguration: "Release"
|
buildConfiguration: "Release"
|
||||||
targetFrameworkVersion: 'v4.8'
|
targetFrameworkVersion: 'v4.8'
|
||||||
coreVersion: 'na'
|
coreVersion: 'na'
|
||||||
nugetSource: 'https://eaf-prod.mes.infineon.com/v3/index.json'
|
|
||||||
assemblyTitle: 'Fab2ApprovalSystem'
|
assemblyTitle: 'Fab2ApprovalSystem'
|
||||||
architecture: 'x64'
|
architecture: 'x64'
|
||||||
|
|
||||||
@ -42,7 +41,6 @@ stages:
|
|||||||
echo Core version: $(CoreVersion)
|
echo Core version: $(CoreVersion)
|
||||||
echo Build configuration: $(BuildConfiguration)
|
echo Build configuration: $(BuildConfiguration)
|
||||||
echo Configuration: $(Configuration)
|
echo Configuration: $(Configuration)
|
||||||
echo Nuget source: $(NugetSource)
|
|
||||||
echo Target Framework version: $(TargetFrameworkVersion)
|
echo Target Framework version: $(TargetFrameworkVersion)
|
||||||
echo Assembly title: $(AssemblyTitle)
|
echo Assembly title: $(AssemblyTitle)
|
||||||
displayName: "Echo Check"
|
displayName: "Echo Check"
|
||||||
@ -79,12 +77,11 @@ stages:
|
|||||||
echo Core version: $(CoreVersion)
|
echo Core version: $(CoreVersion)
|
||||||
echo Build configuration: $(BuildConfiguration)
|
echo Build configuration: $(BuildConfiguration)
|
||||||
echo Configuration: $(Configuration)
|
echo Configuration: $(Configuration)
|
||||||
echo Nuget source: $(NugetSource)
|
|
||||||
echo Target Framework version: $(TargetFrameworkVersion)
|
echo Target Framework version: $(TargetFrameworkVersion)
|
||||||
echo Assembly title: $(AssemblyTitle)
|
echo Assembly title: $(AssemblyTitle)
|
||||||
displayName: "Echo Check"
|
displayName: "Echo Check"
|
||||||
|
|
||||||
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(BuildConfiguration);TargetFrameworkVersion=$(TargetFrameworkVersion) /p:RestoreSources=$(NugetSource) $(AssemblyTitle).csproj'
|
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(BuildConfiguration);TargetFrameworkVersion=$(TargetFrameworkVersion) $(AssemblyTitle).csproj'
|
||||||
workingDirectory: Fab2ApprovalSystem
|
workingDirectory: Fab2ApprovalSystem
|
||||||
displayName: "Framework Restore"
|
displayName: "Framework Restore"
|
||||||
|
|
||||||
@ -115,12 +112,11 @@ stages:
|
|||||||
echo Core version: $(CoreVersion)
|
echo Core version: $(CoreVersion)
|
||||||
echo Build configuration: $(BuildConfiguration)
|
echo Build configuration: $(BuildConfiguration)
|
||||||
echo Configuration: $(Configuration)
|
echo Configuration: $(Configuration)
|
||||||
echo Nuget source: $(NugetSource)
|
|
||||||
echo Target Framework version: $(TargetFrameworkVersion)
|
echo Target Framework version: $(TargetFrameworkVersion)
|
||||||
echo Assembly title: $(AssemblyTitle)
|
echo Assembly title: $(AssemblyTitle)
|
||||||
displayName: "Echo Check"
|
displayName: "Echo Check"
|
||||||
|
|
||||||
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(BuildConfiguration);TargetFrameworkVersion=$(TargetFrameworkVersion) /p:RestoreSources=$(NugetSource) $(AssemblyTitle).csproj'
|
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(BuildConfiguration);TargetFrameworkVersion=$(TargetFrameworkVersion) $(AssemblyTitle).csproj'
|
||||||
workingDirectory: Fab2ApprovalSystem
|
workingDirectory: Fab2ApprovalSystem
|
||||||
displayName: "Framework Restore"
|
displayName: "Framework Restore"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user