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
@ -11,7 +11,7 @@ public class BundleConfig {
|
||||
"~/Scripts/jquery-ui-{version}.js")
|
||||
);
|
||||
|
||||
//bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
|
||||
// bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
|
||||
// "~/Scripts/jquery.validate*"));
|
||||
|
||||
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
|
||||
|
@ -20,10 +20,5 @@ public class RouteConfig {
|
||||
// otherwise MVC generates the wrong form action url
|
||||
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
|
||||
// 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; }
|
||||
|
||||
//
|
||||
// GET: /Account/Login
|
||||
[AllowAnonymous]
|
||||
// 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)
|
||||
|
||||
bool isIFX = false;
|
||||
//domainProvider = Membership.Providers["NA_ADMembershipProvider"];
|
||||
//isLoginValid = domainProvider.ValidateUser(model.LoginID, model.Password);
|
||||
|
||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||
isLoginValid = true;
|
||||
} else {
|
||||
@ -136,9 +132,6 @@ public class AccountController : Controller {
|
||||
#if (!DEBUG)
|
||||
|
||||
bool isIFX = false;
|
||||
//domainProvider = Membership.Providers["NA_ADMembershipProvider"];
|
||||
//isLoginValid = domainProvider.ValidateUser(model.LoginID, model.Password);
|
||||
|
||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||
isLoginValid = true;
|
||||
} else {
|
||||
@ -220,7 +213,6 @@ public class AccountController : Controller {
|
||||
return new ChallengeResult(provider, Url.Action("LinkLoginCallback", "Account"), User.Identity.GetUserId());
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/LinkLoginCallback
|
||||
public async Task<ActionResult> LinkLoginCallback() {
|
||||
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.Misc;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
@ -6,12 +12,6 @@ using Fab2ApprovalSystem.ViewModels;
|
||||
using Kendo.Mvc.Extensions;
|
||||
using Kendo.Mvc.UI;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Fab2ApprovalSystem.Controllers;
|
||||
|
||||
[Authorize]
|
||||
@ -21,13 +21,8 @@ public class AdminController : Controller {
|
||||
UserAccountDMO userDMO = new UserAccountDMO();
|
||||
AdminDMO adminDMO = new AdminDMO();
|
||||
TrainingDMO trainingDMO = new TrainingDMO();
|
||||
LotDispositionDMO ldDMO;
|
||||
private readonly AppSettings _AppSettings;
|
||||
|
||||
public AdminController(AppSettings appSettings) {
|
||||
_AppSettings = appSettings;
|
||||
ldDMO = new LotDispositionDMO(appSettings);
|
||||
}
|
||||
LotDispositionDMO ldDMO = new LotDispositionDMO();
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
public ActionResult Index() {
|
||||
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||
@ -76,7 +71,7 @@ public class AdminController : Controller {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///OBSOLETE FUNCTION BELOW FOR THE KENDO TREEVIEW
|
||||
/// OBSOLETE FUNCTION BELOW FOR THE KENDO TREEVIEW
|
||||
/// </summary>
|
||||
private IEnumerable<TreeViewItemModel> GetRoles_SubRolesList() {
|
||||
List<Role> roles = adminDMO.GetSubRoles();
|
||||
@ -188,7 +183,6 @@ public class AdminController : Controller {
|
||||
return Content("");
|
||||
|
||||
// TODO - Send an email to the OOO person and to the Delegated person
|
||||
//return View();
|
||||
}
|
||||
|
||||
public void ExpireOOOStatus(int oooUserID) {
|
||||
@ -197,8 +191,6 @@ public class AdminController : Controller {
|
||||
}
|
||||
|
||||
public ActionResult ManageTrainingGroups() {
|
||||
//List<TrainingGroup> allGroups = GetTrainingGroups();
|
||||
//return View(allGroups);
|
||||
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||
ViewBag.AllGroups = GetTrainingGroups();
|
||||
return View();
|
||||
@ -314,19 +306,18 @@ public class AdminController : Controller {
|
||||
|
||||
public ActionResult AddToTrainingReport(int userId) {
|
||||
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 userValid = true;
|
||||
List<TrainingReportUser> existingUsers = adminDMO.GetTrainingReportUsers();
|
||||
foreach (var item in existingUsers) {
|
||||
if (item.UserId == userId) {
|
||||
userExists = true;
|
||||
}
|
||||
}
|
||||
//Check if user is valid
|
||||
// Check if user is valid
|
||||
var validUser = userDMO.GetUserByID(userId);
|
||||
|
||||
//Add to group
|
||||
// Add to group
|
||||
if (!userExists && validUser != null) {
|
||||
adminDMO.TrainingReportAddUser(userId);
|
||||
return Json("Success Added");
|
||||
@ -340,19 +331,18 @@ public class AdminController : Controller {
|
||||
|
||||
public ActionResult AddToTECNNotification(int userId) {
|
||||
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 userValid = true;
|
||||
List<TECNNotificationsUser> existingUsers = adminDMO.GetTECNNotificationUsers();
|
||||
foreach (var item in existingUsers) {
|
||||
if (item.UserId == userId) {
|
||||
userExists = true;
|
||||
}
|
||||
}
|
||||
//Check if user is valid
|
||||
// Check if user is valid
|
||||
var validUser = userDMO.GetUserByID(userId);
|
||||
|
||||
//Add to group
|
||||
// Add to group
|
||||
if (!userExists && validUser != null) {
|
||||
try {
|
||||
adminDMO.TECNExpirationAddUser(userId);
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
@ -21,15 +20,9 @@ namespace Fab2ApprovalSystem.Controllers;
|
||||
[SessionExpireFilter]
|
||||
public class AuditController : Controller {
|
||||
|
||||
AuditDMO auditDMO;
|
||||
CorrectiveActionDMO caDMO;
|
||||
private readonly AppSettings _AppSettings;
|
||||
|
||||
public AuditController(AppSettings appSettings) {
|
||||
_AppSettings = appSettings;
|
||||
auditDMO = new AuditDMO(appSettings);
|
||||
caDMO = new CorrectiveActionDMO(appSettings);
|
||||
}
|
||||
AuditDMO auditDMO = new AuditDMO(GlobalVars.AppSettings);
|
||||
CorrectiveActionDMO caDMO = new CorrectiveActionDMO();
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
// GET: Audit
|
||||
public ActionResult Index() {
|
||||
@ -136,7 +129,7 @@ public class AuditController : Controller {
|
||||
if (AuditReportFiles != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
foreach (var file in AuditReportFiles) {
|
||||
auditDMO.AuditReportAttachSave(auditNo, userId, file.FileName, file.InputStream);
|
||||
AuditHelper.AuditReportAttachSave(_AppSettings, auditDMO, auditNo, userId, file.FileName, file.InputStream);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
@ -159,7 +152,7 @@ public class AuditController : Controller {
|
||||
public FileResult DownloadAuditReportAttachment(string fileGuid, int auditNo) {
|
||||
try {
|
||||
string fileName, sDocument;
|
||||
List<string> results = auditDMO.GetFileNameAndDocument(fileGuid, auditNo);
|
||||
List<string> results = AuditHelper.GetFileNameAndDocument(_AppSettings, auditDMO, fileGuid, auditNo);
|
||||
fileName = results[0];
|
||||
sDocument = results[1];
|
||||
if (string.IsNullOrEmpty(sDocument)) {
|
||||
@ -170,7 +163,6 @@ public class AuditController : Controller {
|
||||
|
||||
if (!System.IO.File.Exists(sDocument)) {
|
||||
return null;
|
||||
//throw new Exception("File not found");
|
||||
}
|
||||
|
||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||
@ -270,7 +262,7 @@ public class AuditController : Controller {
|
||||
if (CAFindings_Attachemnt != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
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 {
|
||||
@ -282,8 +274,7 @@ public class AuditController : Controller {
|
||||
|
||||
public void NotifyActionItemOwner(int issueID, DateTime? dueDate, int? responsibleOwnerID) {
|
||||
try {
|
||||
string emailTemplatesPath = ConfigurationManager.AppSettings["EmailTemplatesPath"];
|
||||
string email = auditDMO.NotifyActionItemOwner(issueID, dueDate, responsibleOwnerID, emailTemplatesPath);
|
||||
string email = auditDMO.NotifyActionItemOwner(issueID, dueDate, responsibleOwnerID, _AppSettings.EmailTemplatesPath);
|
||||
|
||||
try {
|
||||
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();
|
||||
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 });
|
||||
//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.Misc;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
@ -6,14 +13,6 @@ using Fab2ApprovalSystem.ViewModels;
|
||||
using Kendo.Mvc.Extensions;
|
||||
using Kendo.Mvc.UI;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Services;
|
||||
|
||||
namespace Fab2ApprovalSystem.Controllers;
|
||||
|
||||
[Authorize]
|
||||
@ -21,13 +20,8 @@ namespace Fab2ApprovalSystem.Controllers;
|
||||
[SessionExpireFilter]
|
||||
public class ChangeControlController : Controller {
|
||||
|
||||
ChangeControlDMO ccDMO;
|
||||
private readonly AppSettings _AppSettings;
|
||||
|
||||
public ChangeControlController(AppSettings appSettings) {
|
||||
_AppSettings = appSettings;
|
||||
ccDMO = new ChangeControlDMO(appSettings);
|
||||
}
|
||||
ChangeControlDMO ccDMO = new ChangeControlDMO();
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
public ActionResult Index() {
|
||||
return View();
|
||||
@ -63,7 +57,7 @@ public class ChangeControlController : Controller {
|
||||
if (appUser != null) {
|
||||
ViewBag.IsApprover = "true";
|
||||
}
|
||||
//TODO locked functionality
|
||||
// TODO locked functionality
|
||||
|
||||
if (isITARCompliant == 0) // not ITAR Compliant
|
||||
{
|
||||
@ -82,8 +76,6 @@ public class ChangeControlController : Controller {
|
||||
ViewBag.Attendees = ccDMO.GetUsers();
|
||||
ViewBag.Generations = ccDMO.GetGenerations();
|
||||
ViewBag.PartNumbers = ccDMO.GetPartNumbers();
|
||||
//ViewBag.ToolTypes = ccDMO.GetToolTypes();
|
||||
//ViewBag.MeetingList = ccDMO.GetMeetingList(issueID);
|
||||
ViewBag.Processes = ccDMO.GetProcesses();
|
||||
ViewBag.Logistics = ccDMO.GetLogistics();
|
||||
ViewBag.AIResponsibles = ccDMO.GetActionItemResponsible();
|
||||
@ -97,7 +89,7 @@ public class ChangeControlController : Controller {
|
||||
int isITARCompliant = 1;
|
||||
ChangeControlViewModel cc = new ChangeControlViewModel();
|
||||
cc = ccDMO.GetChangeControlRead(issueID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
//TODO locked functionality
|
||||
// TODO locked functionality
|
||||
|
||||
if (isITARCompliant == 0) // not ITAR Compliant
|
||||
{
|
||||
@ -106,7 +98,6 @@ public class ChangeControlController : Controller {
|
||||
ViewBag.MeetingList = ccDMO.GetMeetingList(issueID);
|
||||
ViewBag.Generations = ccDMO.GetGenerations();
|
||||
ViewBag.PartNumbers = ccDMO.GetPartNumbers();
|
||||
//ViewBag.ToolTypes = ccDMO.GetToolTypes();
|
||||
ViewBag.Processes = ccDMO.GetProcesses();
|
||||
ViewBag.Logistics = ccDMO.GetLogistics();
|
||||
return View(cc);
|
||||
@ -153,7 +144,6 @@ public class ChangeControlController : Controller {
|
||||
ccDMO.UpdateCCAttachemnt(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -163,7 +153,6 @@ public class ChangeControlController : Controller {
|
||||
ccDMO.DeleteCCAttachemnt(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -180,7 +169,7 @@ public class ChangeControlController : Controller {
|
||||
if (files != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
foreach (var file in files) {
|
||||
ccDMO.AttachSaveCC(planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
ChangeControlHelper.AttachSaveCC(_AppSettings, ccDMO, planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
}
|
||||
}
|
||||
return Content("");
|
||||
@ -202,8 +191,6 @@ public class ChangeControlController : Controller {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
ccDMO.UpdateMeetingAttachmentAttrib(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -212,8 +199,6 @@ public class ChangeControlController : Controller {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
ccDMO.DeleteMeetingAttachemnt(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -231,7 +216,7 @@ public class ChangeControlController : Controller {
|
||||
if (files != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
foreach (var file in files) {
|
||||
ccDMO.AttachSaveMeeting(planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
ChangeControlHelper.AttachSaveMeeting(_AppSettings, ccDMO, planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
}
|
||||
}
|
||||
return Content("");
|
||||
@ -243,7 +228,7 @@ public class ChangeControlController : Controller {
|
||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||
|
||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "ChangeControl\\" + planNumber.ToString();
|
||||
var sDocument = Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||
var sDocument = System.IO.Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||
|
||||
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||
@ -254,7 +239,6 @@ public class ChangeControlController : Controller {
|
||||
|
||||
if (!System.IO.File.Exists(sDocument)) {
|
||||
return null;
|
||||
//throw new Exception("File not found");
|
||||
}
|
||||
|
||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||
@ -263,9 +247,7 @@ public class ChangeControlController : Controller {
|
||||
public ActionResult CreateMeeting(int planNumber) {
|
||||
try {
|
||||
int meetingID = ccDMO.InsertMeeting(planNumber);
|
||||
//return RedirectToAction("EditMeeting", new { meetingID = meetingID });
|
||||
return Content(meetingID.ToString());
|
||||
//return null;
|
||||
} catch (Exception e) {
|
||||
string detailedException = "";
|
||||
try {
|
||||
@ -285,7 +267,7 @@ public class ChangeControlController : Controller {
|
||||
CCMeeting meeting = new CCMeeting();
|
||||
meeting = ccDMO.GetMeetingRead(meetingID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
ViewBag.MeetingList = ccDMO.GetMeetingList(meeting.PlanNumber);
|
||||
//TODO locked functionality
|
||||
// TODO locked functionality
|
||||
List<ApproversListViewModel> userList = MiscDMO.GetApproversListByDocument(meeting.PlanNumber, meeting.CurrentStep, (int)GlobalVars.DocumentType.ChangeControl);
|
||||
ApproversListViewModel appUser = userList.Find(delegate (ApproversListViewModel al) { return al.UserID == (int)Session[GlobalVars.SESSION_USERID]; });
|
||||
if (appUser != null) {
|
||||
@ -345,7 +327,7 @@ public class ChangeControlController : Controller {
|
||||
meeting = ccDMO.GetMeetingRead(meetingID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
ViewBag.MeetingList = ccDMO.GetMeetingList(meeting.PlanNumber);
|
||||
ViewBag.PCRValues = ccDMO.GetPCRValues();
|
||||
//TODO locked functionality
|
||||
// TODO locked functionality
|
||||
List<ApproversListViewModel> userList = MiscDMO.GetApproversListByDocument(meeting.PlanNumber, meeting.CurrentStep, (int)GlobalVars.DocumentType.ChangeControl);
|
||||
ApproversListViewModel appUser = userList.Find(delegate (ApproversListViewModel al) { return al.UserID == (int)Session[GlobalVars.SESSION_USERID]; });
|
||||
if (appUser != null) {
|
||||
@ -375,7 +357,7 @@ public class ChangeControlController : Controller {
|
||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||
|
||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "ChangeControl\\" + planNumber.ToString();
|
||||
var sDocument = Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||
var sDocument = System.IO.Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||
|
||||
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||
@ -386,7 +368,6 @@ public class ChangeControlController : Controller {
|
||||
|
||||
if (!System.IO.File.Exists(sDocument)) {
|
||||
return null;
|
||||
//throw new Exception("File not found");
|
||||
}
|
||||
|
||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||
@ -410,8 +391,6 @@ public class ChangeControlController : Controller {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
ccDMO.DeleteDecisionSummary(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -448,7 +427,6 @@ public class ChangeControlController : Controller {
|
||||
|
||||
public void InsertNewMeetingAttendee(string attendeeName, string jobTitle, string siteName) {
|
||||
try {
|
||||
//ccDMO.InsertNewMeetingAttendee(meetingId, attendeeName, jobTitle, siteName);
|
||||
} catch (Exception e) {
|
||||
string detailedException = "";
|
||||
try {
|
||||
@ -456,10 +434,6 @@ public class ChangeControlController : Controller {
|
||||
} catch {
|
||||
detailedException = e.Message;
|
||||
}
|
||||
//string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + docid.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||
//Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n UpdateMeetingAttendee - Change Control\r\n" + docid.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||
//EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = @User.Identity.Name, DocumentType = "Change Control", OperationType = "Error", Comments = "UpdateMeetingAttendee - " + exceptionString });
|
||||
//throw new Exception(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -479,8 +453,6 @@ public class ChangeControlController : Controller {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = @User.Identity.Name, DocumentType = "Change Control", OperationType = "Error", Comments = "UpdateMeetingAttendee - " + exceptionString });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
//return Content("");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@ -501,8 +473,6 @@ public class ChangeControlController : Controller {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = docid, UserID = @User.Identity.Name, DocumentType = "Change Control", OperationType = "Error", Comments = "UpdateMeetingAttendee - " + exceptionString });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
//return Content("");
|
||||
}
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
@ -510,8 +480,6 @@ public class ChangeControlController : Controller {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
ccDMO.DeleteMeetingAttendee(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -530,8 +498,6 @@ public class ChangeControlController : Controller {
|
||||
}
|
||||
|
||||
return Content("1");
|
||||
|
||||
//return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
public ActionResult GetMeetingActionItems([DataSourceRequest] DataSourceRequest request, int meetingID) {
|
||||
@ -546,17 +512,6 @@ public class ChangeControlController : Controller {
|
||||
return Json(ccDMO.GetMeetingActionItems_All(planNumber).ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
//public ActionResult InsertMeetingActionItem([DataSourceRequest] DataSourceRequest request, CCMeetingActionItem model)
|
||||
//{
|
||||
// if (model != null && ModelState.IsValid)
|
||||
// {
|
||||
// ccDMO.InsertMeetingActionItem(model);
|
||||
// }
|
||||
|
||||
// return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
//}
|
||||
|
||||
public ActionResult InsertPCRBActionItem(CCPCRBActionItem model) {
|
||||
try {
|
||||
if (model != null) {
|
||||
@ -597,8 +552,6 @@ public class ChangeControlController : Controller {
|
||||
}
|
||||
|
||||
return Content("1");
|
||||
|
||||
//return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
public ActionResult UpdatePCRBActionItem(CCPCRBActionItem model) {
|
||||
@ -658,8 +611,6 @@ public class ChangeControlController : Controller {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
ccDMO.DeleteMeetingActionItem(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -667,8 +618,6 @@ public class ChangeControlController : Controller {
|
||||
if (model != null && ModelState.IsValid) {
|
||||
ccDMO.DeletePCRBActionItem(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
@ -713,7 +662,7 @@ public class ChangeControlController : Controller {
|
||||
if (AIfiles != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
foreach (var file in AIfiles) {
|
||||
ccDMO.AttachSaveActionItem(planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
ChangeControlHelper.AttachSaveActionItem(_AppSettings, ccDMO, planNumber, attachID, userId, file.FileName, file.InputStream);
|
||||
}
|
||||
}
|
||||
return Content("");
|
||||
@ -725,7 +674,7 @@ public class ChangeControlController : Controller {
|
||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||
|
||||
string ecnFolderPath = _AppSettings.AttachmentFolder + "ChangeControl\\" + planNumber.ToString();
|
||||
var sDocument = Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||
var sDocument = System.IO.Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
||||
|
||||
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||
@ -736,7 +685,6 @@ public class ChangeControlController : Controller {
|
||||
|
||||
if (!System.IO.File.Exists(sDocument)) {
|
||||
return null;
|
||||
//throw new Exception("File not found");
|
||||
}
|
||||
|
||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||
@ -760,9 +708,6 @@ public class ChangeControlController : Controller {
|
||||
}
|
||||
|
||||
public JsonResult GetAllUsersList() {
|
||||
//var userList = ldDMO.GetApprovedApproversList(issueID, currentStep);
|
||||
//return Json(userList, JsonRequestBehavior.AllowGet);
|
||||
|
||||
UserAccountDMO userDMO = new UserAccountDMO();
|
||||
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||
|
@ -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.Misc;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
@ -7,14 +14,6 @@ using Fab2ApprovalSystem.ViewModels;
|
||||
using Kendo.Mvc.Extensions;
|
||||
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;
|
||||
|
||||
[Authorize]
|
||||
@ -22,19 +21,13 @@ namespace Fab2ApprovalSystem.Controllers;
|
||||
[SessionExpireFilter]
|
||||
public class CorrectiveActionController : Controller {
|
||||
|
||||
AuditDMO auditDMO;
|
||||
CorrectiveActionDMO caDMO;
|
||||
AuditDMO auditDMO = new AuditDMO(GlobalVars.AppSettings);
|
||||
CorrectiveActionDMO caDMO = new CorrectiveActionDMO();
|
||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
UserAccountDMO userDMO = new UserAccountDMO();
|
||||
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() {
|
||||
return View();
|
||||
}
|
||||
@ -141,10 +134,10 @@ public class CorrectiveActionController : Controller {
|
||||
} else {
|
||||
ViewBag.ECNList = caDMO.GetECNList();
|
||||
if (ca.Status == 1 || ca.Status == 2 || ca.Status == 11) {
|
||||
//Pulling in the user list which includes inactive users.
|
||||
// Pulling in the user list which includes inactive users.
|
||||
ViewBag.UserList = caDMO.GetAllUserList();
|
||||
} else {
|
||||
//Pulling in the user list which only includes active users.
|
||||
// Pulling in the user list which only includes active users.
|
||||
ViewBag.UserList = caDMO.GetUserList();
|
||||
}
|
||||
ViewBag.CASourceList = caDMO.GetCASourceList();
|
||||
@ -177,13 +170,10 @@ public class CorrectiveActionController : Controller {
|
||||
return Content("User is not authorized to save the CA.");
|
||||
}
|
||||
try {
|
||||
if (model.TriggerApproval) {
|
||||
//model.FollowUpDate = DateTime.Now.AddMonths(6);
|
||||
}
|
||||
caDMO.UpdateCorrectiveAction(model);
|
||||
|
||||
if ((model.D1AssigneeID != model.CurrentD1AssigneeID && model.CASubmitted) || (model.CASubmitted && !caPrevious.CASubmitted)) {
|
||||
//Set Due Dates here:
|
||||
// Set Due Dates here:
|
||||
DateTime? D3DueDate = null;
|
||||
DateTime? D5D7DueDate = null;
|
||||
|
||||
@ -208,7 +198,6 @@ public class CorrectiveActionController : Controller {
|
||||
NotifySectionApprover(model.CANo, model.QAID, model.SectionApproval);
|
||||
|
||||
NotifySectionApprover(model.CANo, model.RequestorID, model.SectionApproval);
|
||||
//NotifyApprovers(model.CANo, 1);
|
||||
return Content("Successfully Saved...Approval initiated!");
|
||||
}
|
||||
if (model.TriggerApproval) {
|
||||
@ -292,7 +281,7 @@ public class CorrectiveActionController : Controller {
|
||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||
|
||||
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;
|
||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||
@ -303,7 +292,6 @@ public class CorrectiveActionController : Controller {
|
||||
|
||||
if (!System.IO.File.Exists(sDocument)) {
|
||||
return null;
|
||||
//throw new Exception("File not found");
|
||||
}
|
||||
|
||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||
@ -314,8 +302,6 @@ public class CorrectiveActionController : Controller {
|
||||
}
|
||||
|
||||
public ActionResult DownloadTemplatesFiles() {
|
||||
//string templatesPath = GlobalVars.CA_BlankFormsLocation;
|
||||
//string fullName = Server.MapPath("~" + filePath);
|
||||
string fileName = "5Why_Is_Is_Not_Fishbone.pptx";
|
||||
string pathToFile = GlobalVars.MesaTemplateFiles + "\\5Why_Is_Is_Not_Fishbone.pptx";
|
||||
byte[] fileBytes = fileUtilities.GetFile(pathToFile);
|
||||
@ -328,7 +314,7 @@ public class CorrectiveActionController : Controller {
|
||||
if (files != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
foreach (var file in files) {
|
||||
caDMO.AttachSave(caNo, userId, file.FileName, file.InputStream);
|
||||
CorrectiveActionHelper.AttachSave(_AppSettings, caDMO, caNo, userId, file.FileName, file.InputStream);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
@ -374,7 +360,7 @@ public class CorrectiveActionController : Controller {
|
||||
if (D4Files != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
foreach (var file in D4Files) {
|
||||
caDMO.D4FilesAttachSave(caNo, userId, file.FileName, file.InputStream);
|
||||
CorrectiveActionHelper.D4FilesAttachSave(_AppSettings, caDMO, caNo, userId, file.FileName, file.InputStream);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
@ -394,10 +380,6 @@ public class CorrectiveActionController : Controller {
|
||||
} catch (Exception e) {
|
||||
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("");
|
||||
}
|
||||
|
||||
@ -413,7 +395,7 @@ public class CorrectiveActionController : Controller {
|
||||
NotifyActionItemOwner(data.CANo, data.ECD, data.ResponsibilityOwnerID, "CorrectiveActionAIAssigned.txt");
|
||||
}
|
||||
if (data.IsImplemented && previousData.ImplementedDate == null) {
|
||||
//Notify completion to Assignee and Requestor
|
||||
// Notify completion to Assignee and Requestor
|
||||
NotifyActionItemCompletion(data.CANo, data.ECD, caData.D1AssigneeID, "CorrectiveActionAICompleted.txt");
|
||||
NotifyActionItemCompletion(data.CANo, data.ECD, caData.RequestorID, "CorrectiveActionAICompleted.txt");
|
||||
NotifyActionItemCompletion(data.CANo, data.ECD, caData.QAID, "CorrectiveActionAICompleted.txt");
|
||||
@ -443,7 +425,7 @@ public class CorrectiveActionController : Controller {
|
||||
if (D5D6CA_Attachemnt != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
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 {
|
||||
@ -498,7 +480,7 @@ public class CorrectiveActionController : Controller {
|
||||
if (D7PA_Attachemnt != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
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 {
|
||||
@ -520,9 +502,6 @@ public class CorrectiveActionController : Controller {
|
||||
}
|
||||
|
||||
public JsonResult GetAllUsersList() {
|
||||
//var userList = ldDMO.GetApprovedApproversList(issueID, currentStep);
|
||||
//return Json(userList, JsonRequestBehavior.AllowGet);
|
||||
|
||||
UserAccountDMO userDMO = new UserAccountDMO();
|
||||
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||
@ -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 });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
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);
|
||||
CorrectiveActionHelper.ReAssignApproverByAdmin(_AppSettings, issueID, email);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
||||
} 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 });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
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);
|
||||
CorrectiveActionHelper.ReAssignApproval(_AppSettings, issueID, email);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
||||
} catch { }
|
||||
@ -629,30 +574,9 @@ public class CorrectiveActionController : Controller {
|
||||
}
|
||||
|
||||
public void NotifyRejectionToAssignee(int issueID, string comments) {
|
||||
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
|
||||
List<string> emailIst = caDMO.GetRejectionAssigneeEmailList(@issueID).Distinct().ToList();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
string userEmail = CorrectiveActionHelper.NotifyRejectionToAssignee(_AppSettings, issueID, comments, username, emailIst);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Rejection: " + userEmail });
|
||||
} catch { }
|
||||
@ -666,21 +590,15 @@ 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);
|
||||
|
||||
//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) {
|
||||
//Set to complete
|
||||
// Set to complete
|
||||
DateTime followUpDate = caDMO.SetCAComplete(issueID);
|
||||
//Notify completion and send follow up date
|
||||
// Notify completion and send follow up date
|
||||
NotifyCompletionOf8D(issueID, followUpDate);
|
||||
|
||||
}
|
||||
if (lastApprover && lastStep) {
|
||||
//Notify re the closure of the 8D
|
||||
// Notify re the closure of the 8D
|
||||
NotifyClosureOf8D(issueID);
|
||||
|
||||
}
|
||||
@ -701,25 +619,7 @@ public class CorrectiveActionController : Controller {
|
||||
public void NotifySectionApprover(int issueID, int userId, string section) {
|
||||
try {
|
||||
string userEmail = userDMO.GetUserEmailByID(userId);
|
||||
|
||||
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);
|
||||
|
||||
CorrectiveActionHelper.NotifySectionApprover(_AppSettings, issueID, section, userEmail);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " });
|
||||
} catch { }
|
||||
@ -736,34 +636,11 @@ public class CorrectiveActionController : Controller {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyApprovers(int issueID, byte currentStep) {
|
||||
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();
|
||||
|
||||
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 + ",";
|
||||
}
|
||||
|
||||
string emailSentList = CorrectiveActionHelper.NotifyApprovers(_AppSettings, issueID, emailIst);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
||||
} catch { }
|
||||
@ -780,6 +657,7 @@ public class CorrectiveActionController : Controller {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
#region Additional Approvers
|
||||
|
||||
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 });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
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 + ",";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
emailSentList = CorrectiveActionHelper.AddAdditionalApproval(_AppSettings, issueID, emailSentList, emailArray);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Additonal Approver: " + emailSentList });
|
||||
} catch { }
|
||||
@ -834,38 +686,17 @@ public class CorrectiveActionController : Controller {
|
||||
#endregion
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public ActionResult GetSectionApprovalLog([DataSourceRequest] DataSourceRequest request, int caNo) {
|
||||
//return Json(ldDMO.GetApproversList(issueID, step).ToDataSourceResult(request));
|
||||
return Json(caDMO.GetCASectionApprovalLog(caNo).ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
public void NotifyRequestor(int issueID, DateTime? dueDate, int? responsibleOwnerID, string template) {
|
||||
try {
|
||||
string emailSentList = "";
|
||||
|
||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
||||
string email = MiscDMO.GetEmail(responsibleOwnerID);
|
||||
|
||||
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 + ",";
|
||||
|
||||
CorrectiveActionHelper.NotifyRequestor(_AppSettings, issueID, dueDate, template, email);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 8D Item" + ":" + email });
|
||||
} 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();
|
||||
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 });
|
||||
//throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyAssignee(int issueID, int? responsibleOwnerID, string template, DateTime? D3DueDate, DateTime? D5D7DueDate) {
|
||||
try {
|
||||
string emailSentList = "";
|
||||
|
||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
||||
string email = MiscDMO.GetEmail(responsibleOwnerID);
|
||||
|
||||
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 + ",";
|
||||
|
||||
CorrectiveActionHelper.NotifyAssignee(_AppSettings, issueID, template, D3DueDate, D5D7DueDate, email);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 8D Item" + ":" + email });
|
||||
} 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();
|
||||
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 });
|
||||
//throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyActionItemOwner(int issueID, DateTime? dueDate, int? responsibleOwnerID, string template) {
|
||||
try {
|
||||
string emailSentList = "";
|
||||
|
||||
//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 + ",";
|
||||
|
||||
string email = CorrectiveActionHelper.NotifyActionItemOwner(_AppSettings, issueID, dueDate, responsibleOwnerID, template);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 8D Item" + ":" + email });
|
||||
} 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();
|
||||
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 });
|
||||
//throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyActionItemCompletion(int issueID, DateTime? dueDate, int? recipientId, string template) {
|
||||
try {
|
||||
string emailSentList = "";
|
||||
|
||||
//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 + ",";
|
||||
|
||||
string email = CorrectiveActionHelper.NotifyActionItemCompletion(_AppSettings, issueID, dueDate, recipientId, template);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 8D Item" + ":" + email });
|
||||
} 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();
|
||||
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 });
|
||||
//throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyClosureOf8D(int issueID) {
|
||||
try {
|
||||
string emailSentList = "";
|
||||
|
||||
//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 + ",";
|
||||
}
|
||||
|
||||
string emailSentList = CorrectiveActionHelper.NotifyClosureOf8D(_AppSettings, issueID);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Closure of 8D Item" + ":" + emailSentList });
|
||||
} 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();
|
||||
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 });
|
||||
//throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyCompletionOf8D(int issueID, DateTime? followUpDate) {
|
||||
try {
|
||||
string emailSentList = "";
|
||||
|
||||
//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 + ",";
|
||||
}
|
||||
|
||||
string emailSentList = CorrectiveActionHelper.NotifyCompletionOf8D(_AppSettings, issueID, followUpDate);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Closure of 8D Item" + ":" + emailSentList });
|
||||
} 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();
|
||||
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 });
|
||||
//throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public void StartSectionApproval(int issueID, string dSection) {
|
||||
try {
|
||||
CorrectiveAction ca = caDMO.GetCAItem(issueID, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
|
||||
int requestorId = ca.RequestorID;
|
||||
int qaId = ca.QAID;
|
||||
//int userID = (int)Session[GlobalVars.SESSION_USERID];
|
||||
|
||||
caDMO.StartSectionApproval(issueID, requestorId, dSection);
|
||||
NotifySectionApprover(issueID, requestorId, dSection);
|
||||
@ -1133,7 +852,7 @@ public class CorrectiveActionController : Controller {
|
||||
NotifyForD5D6D7Validation(issueID, caItem.RequestorID, dSection);
|
||||
NotifyForD5D6D7Validation(issueID, caItem.QAID, dSection);
|
||||
|
||||
//Notify AI owners of pending action items
|
||||
// Notify AI owners of pending action items
|
||||
List<D5D6CorrectivetAction> actionItems = caDMO.GetD5D6CorrectivetActions(issueID).ToList();
|
||||
foreach (var item in actionItems) {
|
||||
NotifyActionItemOwner(issueID, item.ECD, item.CurrentResponsibilityOwnerID, "CorrectiveActionAIAssigned.txt");
|
||||
@ -1143,7 +862,7 @@ public class CorrectiveActionController : Controller {
|
||||
NotifyUsersDSectionApproved(issueID, caItem.RequestorID, dSection);
|
||||
NotifyUsersDSectionApproved(issueID, caItem.QAID, dSection);
|
||||
}
|
||||
//TODO Notify Requestor for approval
|
||||
// TODO Notify Requestor for approval
|
||||
return Content("Successfully Saved, Last Approver");
|
||||
} else {
|
||||
return Content("Successfully Saved, More Approvers");
|
||||
@ -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);
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "Approve - " + exceptionString });
|
||||
return Content(e.Message);
|
||||
//return Content(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
@ -1170,7 +888,7 @@ public class CorrectiveActionController : Controller {
|
||||
int userID = (int)Session[GlobalVars.SESSION_USERID];
|
||||
CorrectiveAction ca = caDMO.GetCAItem(issueID, userID);
|
||||
caDMO.RejectSection(issueID, userID, dSection, comments);
|
||||
//Notify Rejection to assignee and requestor
|
||||
// Notify Rejection to assignee and requestor
|
||||
int assigneeId = ca.D1AssigneeID;
|
||||
int requestorId = ca.RequestorID;
|
||||
int qaId = ca.QAID;
|
||||
@ -1195,30 +913,8 @@ public class CorrectiveActionController : Controller {
|
||||
public void NotifySectionRejection(int issueID, int recipientUserId, int loggedInUserId, string section, string comment) {
|
||||
try {
|
||||
LoginModel recipient = userDMO.GetUserByID(recipientUserId);
|
||||
string recipientEmail = recipient.Email;
|
||||
|
||||
LoginModel loggedInUser = userDMO.GetUserByID(loggedInUserId);
|
||||
|
||||
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);
|
||||
|
||||
CorrectiveActionHelper.NotifySectionRejection(_AppSettings, issueID, section, comment, recipient, loggedInUser);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " });
|
||||
} catch { }
|
||||
@ -1235,28 +931,11 @@ public class CorrectiveActionController : Controller {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyForD5D6D7Validation(int issueID, int userId, string dSection) {
|
||||
try {
|
||||
string userEmail = userDMO.GetUserEmailByID(userId);
|
||||
|
||||
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);
|
||||
|
||||
CorrectiveActionHelper.NotifyForD5D6D7Validation(_AppSettings, issueID, dSection, userEmail);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " });
|
||||
} catch { }
|
||||
@ -1277,25 +956,7 @@ public class CorrectiveActionController : Controller {
|
||||
public void NotifyUsersDSectionApproved(int issueID, int userId, string dSection) {
|
||||
try {
|
||||
string userEmail = userDMO.GetUserEmailByID(userId);
|
||||
|
||||
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);
|
||||
|
||||
CorrectiveActionHelper.NotifyUsersDSectionApproved(_AppSettings, issueID, dSection, userEmail);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Approvers for Step " });
|
||||
} catch { }
|
||||
@ -1312,6 +973,7 @@ public class CorrectiveActionController : Controller {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime SetD3DueDate(int caNo) {
|
||||
DateTime d3DueDate = caDMO.SetCAD3DueDate(caNo);
|
||||
|
||||
@ -1331,30 +993,7 @@ public class CorrectiveActionController : Controller {
|
||||
LoginModel user = userDMO.GetUserByID(assigneeID);
|
||||
|
||||
try {
|
||||
string emailTemplate = "D3D5D7Due.txt";
|
||||
//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);
|
||||
CorrectiveActionHelper.ProcessCARDueDates(_AppSettings, dueCA, ca, user);
|
||||
caDMO.SetD3D5D7NotificationDate(dueCA.CANo, dueCA.ItemDue);
|
||||
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 = "*")]
|
||||
public class HomeController : Controller {
|
||||
|
||||
MRB_DMO mrbDMO;
|
||||
PartsRequestDMO prDMO;
|
||||
LotDispositionDMO ldDMO;
|
||||
MRB_DMO mrbDMO = new MRB_DMO(GlobalVars.AppSettings);
|
||||
PartsRequestDMO prDMO = new PartsRequestDMO();
|
||||
LotDispositionDMO ldDMO = new LotDispositionDMO();
|
||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||
ECN_DMO ecnDMO = new ECN_DMO();
|
||||
UserUtilities userDMO = new UserUtilities();
|
||||
UserAccountDMO originalUserDMO = new UserAccountDMO();
|
||||
TrainingDMO trainingDMO = new TrainingDMO();
|
||||
MiscDMO miscDMO = new MiscDMO();
|
||||
private readonly AppSettings _AppSettings;
|
||||
|
||||
public HomeController(AppSettings appSettings) {
|
||||
_AppSettings = appSettings;
|
||||
ldDMO = new LotDispositionDMO(appSettings);
|
||||
mrbDMO = new MRB_DMO(appSettings);
|
||||
prDMO = new PartsRequestDMO(appSettings);
|
||||
}
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
public ActionResult Index(string tabName) {
|
||||
ViewBag.ActiveTabName = tabName;
|
||||
@ -113,7 +106,6 @@ public class HomeController : Controller {
|
||||
|
||||
public ActionResult GetDocuments([DataSourceRequest] DataSourceRequest request, string tabName) {
|
||||
ViewBag.ActiveTabName = tabName;
|
||||
//IEnumerable<IssuesViewModel> data = ldDMO.GetLotDispositions();
|
||||
IEnumerable<IssuesViewModel> data = ldDMO.GetDocuments();
|
||||
return Json(data.ToDataSourceResult(request));
|
||||
}
|
||||
@ -198,7 +190,7 @@ public class HomeController : Controller {
|
||||
}
|
||||
|
||||
public ActionResult GetLotList([DataSourceRequest] DataSourceRequest request, int workRequestID) {
|
||||
LotTravelerDMO LotTravDMO = new LotTravelerDMO(_AppSettings);
|
||||
LotTravelerDMO LotTravDMO = new LotTravelerDMO();
|
||||
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 });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
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);
|
||||
HomeHelper.DelegateDocumentApproval(_AppSettings, issueID, ecnTypeString, title, email);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Delegated to Approver: " + email });
|
||||
} catch { }
|
||||
@ -398,31 +373,11 @@ public class HomeController : Controller {
|
||||
List<string> emailList = new List<string>();
|
||||
emailList.Add(delegateFrom.Email);
|
||||
emailList.Add(delegateTo.Email);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
HomeHelper.NotifyDelegation(_AppSettings, startDate, endDate, delegateFrom, delegateTo, emailList);
|
||||
try {
|
||||
//EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Rejection: " + userEmail });
|
||||
} catch { }
|
||||
}
|
||||
|
||||
public bool ProcessOoO() {
|
||||
|
||||
try {
|
||||
@ -444,7 +399,7 @@ public class HomeController : Controller {
|
||||
}
|
||||
public bool ApprovalsReminderNotifications() {
|
||||
try {
|
||||
//Get list of approvals
|
||||
// Get list of approvals
|
||||
List<ApproveListModel> approveList = miscDMO.GetApprovalReminderList();
|
||||
|
||||
foreach (var item in approveList) {
|
||||
@ -453,7 +408,7 @@ public class HomeController : Controller {
|
||||
} catch (Exception e) {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = item.ApprovalKey, UserID = "SYSTEM", DocumentType = "Approval Reminders", OperationType = "Email", Comments = e.Message });
|
||||
}
|
||||
//We want to update the last notification anyway so we don't continue trying on something that may be failing.
|
||||
// We want to update the last notification anyway so we don't continue trying on something that may be failing.
|
||||
miscDMO.UpdateApprovalNotifyDate(item.ApprovalKey);
|
||||
}
|
||||
// List<ApproveListModel> approveList = miscDMO.
|
||||
@ -464,45 +419,12 @@ public class HomeController : Controller {
|
||||
}
|
||||
public void NotifyApprover(string toEmail, string title, int issueId, string docType) {
|
||||
try {
|
||||
string emailSentList = "";
|
||||
//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;
|
||||
HomeHelper.NotifyApprover(_AppSettings, toEmail, title, issueId, docType);
|
||||
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueId, UserID = @User.Identity.Name, DocumentType = docType, OperationType = "Email", Comments = "Approval reminders" });
|
||||
} 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) {
|
||||
string detailedException = "";
|
||||
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.Models;
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
@ -6,17 +16,6 @@ using Fab2ApprovalSystem.ViewModels;
|
||||
using Kendo.Mvc.Extensions;
|
||||
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;
|
||||
|
||||
[Authorize]
|
||||
@ -24,19 +23,12 @@ namespace Fab2ApprovalSystem.Controllers;
|
||||
[SessionExpireFilter]
|
||||
public class LotDispositionController : Controller {
|
||||
|
||||
LotDispositionDMO ldDMO;
|
||||
LotDispositionDMO ldDMO = new LotDispositionDMO();
|
||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||
private readonly AppSettings _AppSettings;
|
||||
|
||||
public LotDispositionController(AppSettings appSettings) {
|
||||
_AppSettings = appSettings;
|
||||
ldDMO = new LotDispositionDMO(appSettings);
|
||||
}
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
// GET: /LotDisposition/Create
|
||||
public ActionResult Create() {
|
||||
//excel.FileName = "";
|
||||
//var lot =
|
||||
LotDisposition lotDispo = new LotDisposition();
|
||||
try {
|
||||
// insert a records to get the issueID
|
||||
@ -67,14 +59,6 @@ public class LotDispositionController : Controller {
|
||||
lot.LotStatusOption.LotStatusOptionID = l.LotStatusOptionID;
|
||||
lot.LotStatusOption.LotStatusOption = l.LotStatusOptionName;
|
||||
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) {
|
||||
string detailedException = "";
|
||||
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) {
|
||||
@ -145,7 +112,6 @@ public class LotDispositionController : Controller {
|
||||
return Json(issueWEL, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /LotDisposition/Edit/5
|
||||
public ActionResult Edit(int issueID) {
|
||||
int isITARCompliant = 1;
|
||||
@ -162,7 +128,6 @@ public class LotDispositionController : Controller {
|
||||
}
|
||||
if (lotDispo.CurrentStep == 1) {
|
||||
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]; });
|
||||
if (approver == null)
|
||||
ViewBag.IsApprover = "false";
|
||||
@ -170,7 +135,6 @@ public class LotDispositionController : Controller {
|
||||
ViewBag.IsApprover = "true";
|
||||
|
||||
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 });
|
||||
} else {
|
||||
if ((ViewBag.IsApprover == "true" || (bool)Session[GlobalVars.IS_ADMIN])
|
||||
@ -194,7 +158,7 @@ public class LotDispositionController : Controller {
|
||||
}
|
||||
} else if (lotDispo.CurrentStep > 1) {
|
||||
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]; });
|
||||
if (approver == null) {
|
||||
ViewBag.IsApprover = "false";
|
||||
@ -208,14 +172,6 @@ public class LotDispositionController : Controller {
|
||||
return RedirectToAction("ReadOnly", new { issueID = issueID });
|
||||
} 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])
|
||||
|| (int)Session[GlobalVars.SESSION_USERID] == lotDispo.OriginatorID) {
|
||||
return RedirectToAction("EditStep", new { issueID = issueID });
|
||||
@ -257,7 +213,6 @@ public class LotDispositionController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /LotDisposition/Edit/5
|
||||
|
||||
[HttpPost]
|
||||
@ -320,19 +275,6 @@ public class LotDispositionController : Controller {
|
||||
|
||||
// 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])) {
|
||||
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 View(lotDispo);
|
||||
} catch (Exception e) {
|
||||
string detailedException = "";
|
||||
try {
|
||||
@ -366,7 +307,6 @@ public class LotDispositionController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /LotDisposition/Delete/5
|
||||
public ActionResult Delete(int id) {
|
||||
return View();
|
||||
@ -387,7 +327,6 @@ public class LotDispositionController : Controller {
|
||||
public void PopulateLotStatusOptions() {
|
||||
var lotStatusOptions = ldDMO.GetLotStatusOptions();
|
||||
ViewData["LotStatusOptions"] = lotStatusOptions;
|
||||
//ViewData["DefaultLotStatusOptions"] = lotStatusOptions.First();
|
||||
}
|
||||
|
||||
public ActionResult EditingCustom_Read([DataSourceRequest] DataSourceRequest request, int issueID) {
|
||||
@ -397,7 +336,6 @@ public class LotDispositionController : Controller {
|
||||
/// <summary>
|
||||
/// Updates the lot tables
|
||||
/// </summary>
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
public ActionResult EditingCustom_Update([DataSourceRequest] DataSourceRequest request, Lot lot) {
|
||||
|
||||
@ -442,26 +380,19 @@ public class LotDispositionController : Controller {
|
||||
|
||||
}
|
||||
} 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));
|
||||
}
|
||||
|
||||
//[AcceptVerbs(HttpVerbs.Post)]
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteAttachment(int attachmentID, string fileName) {
|
||||
try {
|
||||
if (ModelState.IsValid) {
|
||||
ldDMO.DeleteLotDispoAttachment(attachmentID);
|
||||
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
||||
var physicalPath = Path.Combine(_AppSettings.AttachmentFolder + "LotDisposition", fileName);
|
||||
var physicalPath = System.IO.Path.Combine(_AppSettings.AttachmentFolder + "LotDisposition", fileName);
|
||||
|
||||
FileInfo f = new FileInfo(physicalPath);
|
||||
System.IO.FileInfo f = new System.IO.FileInfo(physicalPath);
|
||||
|
||||
if (f.Exists)
|
||||
f.Delete();
|
||||
@ -491,20 +422,16 @@ public class LotDispositionController : Controller {
|
||||
if (files != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
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("");
|
||||
}
|
||||
|
||||
public JsonResult SearchLots(string searchText, string searchBy) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -546,7 +473,7 @@ public class LotDispositionController : Controller {
|
||||
byte currentValue = (byte)pi.GetValue(sl, null);
|
||||
if (currentValue == (int)GlobalVars.LotStatusOption.Release || currentValue == (int)GlobalVars.LotStatusOption.CloseToQDB) {
|
||||
releaseCount++;
|
||||
//required to update the lot status option
|
||||
// required to update the lot status option
|
||||
if (currentValue == (int)GlobalVars.LotStatusOption.CloseToQDB)
|
||||
closeToQDBCount++;
|
||||
} else if (currentValue == (int)GlobalVars.LotStatusOption.Scrap)
|
||||
@ -586,8 +513,6 @@ public class LotDispositionController : Controller {
|
||||
sl.IssueID = issueID;
|
||||
foreach (PropertyInfo pi in sl.GetType().GetProperties()) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -616,8 +541,6 @@ public class LotDispositionController : Controller {
|
||||
sl.IssueID = issueID;
|
||||
foreach (PropertyInfo pi in sl.GetType().GetProperties()) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -727,14 +650,10 @@ public class LotDispositionController : Controller {
|
||||
/// Get a list of Approvers and the status
|
||||
/// </summary>
|
||||
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));
|
||||
}
|
||||
|
||||
public JsonResult GetAllUsersList() {
|
||||
//var userList = ldDMO.GetApprovedApproversList(issueID, currentStep);
|
||||
//return Json(userList, JsonRequestBehavior.AllowGet);
|
||||
|
||||
UserAccountDMO userDMO = new UserAccountDMO();
|
||||
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||
@ -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 });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
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);
|
||||
LotDispositionHelper.ReAssignApproval(_AppSettings, issueID, email);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
||||
} 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 });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
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);
|
||||
LotDispositionHelper.ReAssignApproverByAdmin(_AppSettings, issueID, email);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
||||
} 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 });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
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 + ",";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
emailSentList = LotDispositionHelper.AddAdditionalApproval(_AppSettings, issueID, emailSentList, emailArray);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "Additonal Approver: " + emailSentList });
|
||||
} catch { }
|
||||
@ -879,32 +738,8 @@ public class LotDispositionController : Controller {
|
||||
|
||||
public void NotifyApprovers(int issueID, byte currentStep) {
|
||||
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();
|
||||
|
||||
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 + ",";
|
||||
}
|
||||
|
||||
string emailSentList = LotDispositionHelper.NotifyApprovers(_AppSettings, issueID, emailIst);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
||||
} catch { }
|
||||
@ -924,29 +759,9 @@ public class LotDispositionController : Controller {
|
||||
|
||||
public void NotifyRejectionToOrginator(int issueID) {
|
||||
|
||||
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
|
||||
List<string> emailIst = ldDMO.GetRejectionOrginatorEmailList(@issueID).Distinct().ToList();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
string userEmail = LotDispositionHelper.NotifyRejectionToOrginator(_AppSettings, issueID, username, emailIst);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Lot Disposition", OperationType = "Email", Comments = "Rejection: " + userEmail });
|
||||
} catch { }
|
||||
@ -970,7 +785,6 @@ public class LotDispositionController : Controller {
|
||||
}
|
||||
|
||||
public ActionResult GetComments([DataSourceRequest] DataSourceRequest request, int issueID) {
|
||||
//return Json(ldDMO.GetApproversList(issueID, step).ToDataSourceResult(request));
|
||||
return Json(ldDMO.GetComments(issueID).ToDataSourceResult(request));
|
||||
}
|
||||
|
||||
@ -996,14 +810,13 @@ public class LotDispositionController : Controller {
|
||||
var physicalPath = "";
|
||||
try {
|
||||
string userIdentityName = @User.Identity.Name;
|
||||
string lotTempPipeLine = ConfigurationManager.AppSettings["LotTempPipeLine"].ToString();
|
||||
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("");
|
||||
} catch {
|
||||
FileInfo f = new FileInfo(physicalPath);
|
||||
System.IO.FileInfo f = new System.IO.FileInfo(physicalPath);
|
||||
if (f.Exists)
|
||||
f.Delete();
|
||||
|
||||
@ -1027,11 +840,10 @@ public class LotDispositionController : Controller {
|
||||
}
|
||||
|
||||
public FileResult DownloadFile(string attachmentID) {
|
||||
//fileName = "ECNForm_71132.pdf";
|
||||
|
||||
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;
|
||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||
// 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)) {
|
||||
return null;
|
||||
//throw new Exception("File not found");
|
||||
}
|
||||
|
||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
@ -23,15 +22,10 @@ namespace Fab2ApprovalSystem.Controllers;
|
||||
[SessionExpireFilter]
|
||||
public class LotTravelerController : PdfViewController {
|
||||
|
||||
LotTravelerDMO LotTravDMO;
|
||||
LotTravelerDMO LotTravDMO = new LotTravelerDMO();
|
||||
string docTypeString = "LotTraveler";
|
||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||
private readonly AppSettings _AppSettings;
|
||||
|
||||
public LotTravelerController(AppSettings appSettings) {
|
||||
_AppSettings = appSettings;
|
||||
LotTravDMO = new LotTravelerDMO(appSettings);
|
||||
}
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
public ActionResult CreateWorkRequest() {
|
||||
LTWorkRequest workRequest = new LTWorkRequest();
|
||||
@ -122,7 +116,6 @@ public class LotTravelerController : PdfViewController {
|
||||
if (Session["CreateNewRevision"].ToString() == "true") {
|
||||
ViewBag.NewRevision = "false";
|
||||
Session["CreateNewRevision"] = "false";
|
||||
//Session["CurrentlyOnSamePage"] = "true";
|
||||
model.OriginatorID = (int)Session[GlobalVars.SESSION_USERID];
|
||||
int newRequestID = LotTravDMO.CreateWorkRequestRevision(model, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
// TODO
|
||||
@ -131,7 +124,6 @@ public class LotTravelerController : PdfViewController {
|
||||
|
||||
return Content(newRequestID.ToString());
|
||||
} else {
|
||||
// model.OriginatorID = (int)Session[GlobalVars.SESSION_USERID];
|
||||
LotTravDMO.UpdateWorkRequest(model, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
return Content("");
|
||||
}
|
||||
@ -176,7 +168,6 @@ public class LotTravelerController : PdfViewController {
|
||||
else
|
||||
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]) {
|
||||
return RedirectToAction("WorkRequestReadOnly", new { issueID = issueID });
|
||||
}
|
||||
@ -200,10 +191,6 @@ public class LotTravelerController : PdfViewController {
|
||||
LTWorkRequest workRequest = new LTWorkRequest();
|
||||
workRequest = LotTravDMO.GetLTWorkRequestItemForRead(workRequestID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
|
||||
//if (workRequest.IsCurrentRevision)
|
||||
//{
|
||||
// return RedirectToAction("Edit", new { issueID = workRequestID });
|
||||
//}
|
||||
return Content("");
|
||||
}
|
||||
|
||||
@ -301,7 +288,6 @@ public class LotTravelerController : PdfViewController {
|
||||
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
} catch (Exception ex) {
|
||||
//throw new Exception(ex.Message);
|
||||
return this.Json(new DataSourceResult {
|
||||
Errors = ex.Message
|
||||
});
|
||||
@ -315,10 +301,8 @@ public class LotTravelerController : PdfViewController {
|
||||
LotTravDMO.UpdateMaterialDetail(model, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
} catch (Exception ex) {
|
||||
//throw new Exception(ex.Message);
|
||||
return this.Json(new DataSourceResult {
|
||||
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());
|
||||
}
|
||||
|
||||
@ -385,10 +367,6 @@ public class LotTravelerController : PdfViewController {
|
||||
|
||||
}
|
||||
} 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));
|
||||
@ -415,8 +393,6 @@ public class LotTravelerController : PdfViewController {
|
||||
}
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
//return Json(new[] { modelMaterialDetail }.ToDataSourceResult(request, ModelState));
|
||||
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());
|
||||
}
|
||||
|
||||
@ -482,8 +456,6 @@ public class LotTravelerController : PdfViewController {
|
||||
}
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
//return Json(new[] { modelMaterialDetail }.ToDataSourceResult(request, ModelState));
|
||||
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());
|
||||
}
|
||||
|
||||
@ -528,7 +498,6 @@ public class LotTravelerController : PdfViewController {
|
||||
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
//throw new Exception(ex.Message);
|
||||
return this.Json(new DataSourceResult {
|
||||
Errors = ex.Message
|
||||
});
|
||||
@ -558,16 +527,10 @@ public class LotTravelerController : PdfViewController {
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
@ -598,13 +561,9 @@ public class LotTravelerController : PdfViewController {
|
||||
LotTravDMO.UpdateWorkRequestAttachment(model);
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ActionResult UpdateWorkRequestAttachmentRevision(LTWorkRequest model) {
|
||||
var wrAttachmentDetail = model.WorkRequestAttachment;
|
||||
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());
|
||||
}
|
||||
|
||||
@ -671,8 +628,6 @@ public class LotTravelerController : PdfViewController {
|
||||
}
|
||||
}
|
||||
|
||||
//lot.LotStatusOptionID = lot.LotStatusOption.LotStatusOptionID;
|
||||
//return Json(new[] { modelMaterialDetail }.ToDataSourceResult(request, ModelState));
|
||||
return Content(newWorkRequestID.ToString());
|
||||
}
|
||||
|
||||
@ -681,7 +636,7 @@ public class LotTravelerController : PdfViewController {
|
||||
if (files != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
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("");
|
||||
@ -707,7 +662,7 @@ public class LotTravelerController : PdfViewController {
|
||||
if (files != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
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("");
|
||||
@ -719,7 +674,7 @@ public class LotTravelerController : PdfViewController {
|
||||
if (HoldStepAttachment != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
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) {
|
||||
@ -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 });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
//var model = ldDMO.GetLotDispoAttachments(issueID);
|
||||
|
||||
return Content("");
|
||||
}
|
||||
|
||||
@ -754,7 +706,7 @@ public class LotTravelerController : PdfViewController {
|
||||
if (HoldStepAttachment != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
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) {
|
||||
@ -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 });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
//var model = ldDMO.GetLotDispoAttachments(issueID);
|
||||
|
||||
return Content("");
|
||||
}
|
||||
|
||||
@ -819,7 +768,6 @@ public class LotTravelerController : PdfViewController {
|
||||
} else
|
||||
return Content("Invalid");
|
||||
|
||||
//return View(ltWR);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
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) {
|
||||
currentStep++;
|
||||
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);
|
||||
}
|
||||
|
||||
@ -883,42 +823,12 @@ public class LotTravelerController : PdfViewController {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO ======================================
|
||||
|
||||
public void NotifyRejectionToOrginator(int workRequestID) {
|
||||
List<string> emailIst = LotTravDMO.GetRejectionOrginatorEmailList(workRequestID).Distinct().ToList();
|
||||
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]);
|
||||
|
||||
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 });
|
||||
}
|
||||
}
|
||||
|
||||
string userEmail = LotTravelerHelper.NotifyRejectionToOrginator(_AppSettings, @User.Identity.Name, workRequestID, username, emailIst, ltWR);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Rejection: " + userEmail });
|
||||
} catch { }
|
||||
@ -930,36 +840,7 @@ public class LotTravelerController : PdfViewController {
|
||||
LTWorkRequest ltWR = LotTravDMO.GetLTWorkRequestItemForRead(workRequestID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
|
||||
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(workRequestID, currentStep, documentType).Distinct().ToList();
|
||||
|
||||
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 });
|
||||
}
|
||||
}
|
||||
|
||||
emailSentList = LotTravelerHelper.NotifyApprovers(_AppSettings, @User.Identity.Name, workRequestID, emailSentList, ltWR, emailIst);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
||||
} catch { }
|
||||
@ -971,35 +852,7 @@ public class LotTravelerController : PdfViewController {
|
||||
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();
|
||||
|
||||
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 });
|
||||
}
|
||||
}
|
||||
emailSentList = LotTravelerHelper.NotifyApprovalOfWorkRequest(_AppSettings, @User.Identity.Name, workRequestID, emailSentList, ltWR, emailIst);
|
||||
|
||||
try {
|
||||
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);
|
||||
|
||||
List<string> emailIst = MiscDMO.GetWorkRequestRevisionNotifyList((int)GlobalVars.NotificationType.WorkRequest, workRequestID, currentUserID).Distinct().ToList();
|
||||
|
||||
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 });
|
||||
}
|
||||
}
|
||||
|
||||
emailSentList = LotTravelerHelper.NotifyfWorkRequestRevisionChange(_AppSettings, @User.Identity.Name, workRequestID, emailSentList, ltWR, emailIst);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Work Request Revision Change for :" + emailSentList });
|
||||
} catch { }
|
||||
@ -1050,39 +874,10 @@ public class LotTravelerController : PdfViewController {
|
||||
|
||||
public void NotifyLotTravelerRevisionChange(int ltLotID, int revisionNumber) {
|
||||
string emailSentList = "";
|
||||
var data = LotTravDMO.GetLotTravelerHeaderForReadOnly(ltLotID, revisionNumber);
|
||||
LTLotTravelerHeaderViewModel data = LotTravDMO.GetLotTravelerHeaderForReadOnly(ltLotID, revisionNumber);
|
||||
int currentUserID = (int)Session[GlobalVars.SESSION_USERID];
|
||||
List<string> emailIst = MiscDMO.GetLotTravelerCreationAndRevisionNotifyList(ltLotID, data.LTWorkRequestID, currentUserID).Distinct().ToList();
|
||||
|
||||
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 });
|
||||
}
|
||||
}
|
||||
|
||||
emailSentList = LotTravelerHelper.NotifyLotTravelerRevisionChange(_AppSettings, @User.Identity.Name, emailSentList, data, emailIst);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = data.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Email", Comments = "Lot Traveler Revision Change Notification:" + emailSentList });
|
||||
} catch { }
|
||||
@ -1090,36 +885,10 @@ public class LotTravelerController : PdfViewController {
|
||||
|
||||
public void NotifyLotTravelerCreation(int ltLotID, int revisionNumber) {
|
||||
string emailSentList = "";
|
||||
var data = LotTravDMO.GetLotTravelerHeaderForReadOnly(ltLotID, revisionNumber);
|
||||
LTLotTravelerHeaderViewModel data = LotTravDMO.GetLotTravelerHeaderForReadOnly(ltLotID, revisionNumber);
|
||||
int currentUserID = (int)Session[GlobalVars.SESSION_USERID];
|
||||
List<string> emailIst = MiscDMO.GetLotTravelerCreationAndRevisionNotifyList(ltLotID, data.LTWorkRequestID, currentUserID).Distinct().ToList();
|
||||
|
||||
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 });
|
||||
}
|
||||
}
|
||||
|
||||
emailSentList = LotTravelerHelper.NotifyLotTravelerCreation(_AppSettings, @User.Identity.Name, emailSentList, data, emailIst);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = data.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Lot Traveler", OperationType = "Email", Comments = "Lot Traveler Revision Change Notification:" + emailSentList });
|
||||
} catch { }
|
||||
@ -1137,16 +906,13 @@ public class LotTravelerController : PdfViewController {
|
||||
try {
|
||||
LotTravDMO.ReleaseLockOnLotTravelerUpdateDoc((int)Session[GlobalVars.SESSION_USERID], lotID);
|
||||
} catch {
|
||||
//TODO
|
||||
// TODO
|
||||
// unlock the current revision of the Lot traveler
|
||||
LotTravDMO.ReleaseLockOnLotTravelerUpdateDoc(-1, lotID);
|
||||
}
|
||||
}
|
||||
|
||||
public JsonResult GetAllUsersList() {
|
||||
//var userList = ldDMO.GetApprovedApproversList(issueID, currentStep);
|
||||
//return Json(userList, JsonRequestBehavior.AllowGet);
|
||||
|
||||
UserAccountDMO userDMO = new UserAccountDMO();
|
||||
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||
@ -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 });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
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 });
|
||||
}
|
||||
|
||||
LotTravelerHelper.ReAssignApproverByAdmin(_AppSettings, @User.Identity.Name, workRequestID, email, ltWR);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
||||
} 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 });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
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 });
|
||||
}
|
||||
LotTravelerHelper.ReAssignApproval(_AppSettings, @User.Identity.Name, workRequestID, email, ltWR);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "ReAssign Approver: " + email });
|
||||
} 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 });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
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 });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
emailSentList = LotTravelerHelper.AddAdditionalApproval(_AppSettings, @User.Identity.Name, workRequestID, emailSentList, emailArray, ltWR);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = @User.Identity.Name, DocumentType = "Work Request", OperationType = "Email", Comments = "Additonal Approver: " + emailSentList });
|
||||
} catch { }
|
||||
@ -1325,9 +1003,6 @@ public class LotTravelerController : PdfViewController {
|
||||
|
||||
public JsonResult SearchLots(string searchText, string searchBy) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1355,12 +1030,10 @@ public class LotTravelerController : PdfViewController {
|
||||
public JsonResult GetLotTravelerHeader(int ltLotID) {
|
||||
LTLotTravelerHeaderViewModel data = new LTLotTravelerHeaderViewModel();
|
||||
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);
|
||||
}
|
||||
|
||||
public ActionResult GetLotTravRevisions(int ltLotID) {
|
||||
//return Json(LotTravDMO.GetLotTravRevisions(ltLotID).ToDataSourceResult(request));
|
||||
return Json(LotTravDMO.GetLotTravRevisions(ltLotID), JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
@ -1394,9 +1067,6 @@ public class LotTravelerController : PdfViewController {
|
||||
return View(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// /
|
||||
/// </summary>
|
||||
public ActionResult LotTravelerReadonly(int ltLotID, int revisionNumber) {
|
||||
LTLotTravelerHeaderViewModel data = new LTLotTravelerHeaderViewModel();
|
||||
data = LotTravDMO.GetLotTravelerHeaderForReadOnly(ltLotID, revisionNumber);
|
||||
@ -1459,14 +1129,6 @@ public class LotTravelerController : PdfViewController {
|
||||
if (Session["CreateLotTravNewRevision"].ToString() == "true") {
|
||||
// Create a new Revision
|
||||
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]);
|
||||
|
||||
try {
|
||||
@ -1514,7 +1176,7 @@ public class LotTravelerController : PdfViewController {
|
||||
|
||||
LotTravDMO.InsertLotTravelerHoldStep(ltHoldStepObj, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
} catch {
|
||||
//roll back the revision creation
|
||||
// roll back the revision creation
|
||||
LotTravDMO.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");
|
||||
}
|
||||
@ -1540,7 +1202,6 @@ public class LotTravelerController : PdfViewController {
|
||||
int prevLotTravRevID = ltHoldStepObj.LotTravelerRevisionID;
|
||||
int newLotTravRevID = -1;
|
||||
try {
|
||||
//int newLotTravRevisionAttribID = 0;
|
||||
if (Session["CreateLotTravNewRevision"].ToString() == "true") {
|
||||
// Create a new Revision
|
||||
Session["CreateLotTravNewRevision"] = "false";
|
||||
@ -1549,7 +1210,7 @@ public class LotTravelerController : PdfViewController {
|
||||
try {
|
||||
LotTravDMO.DeleteLotTravHoldStepRevision(ltHoldStepObj.ID);
|
||||
} catch {
|
||||
//roll back the revision creation
|
||||
// roll back the revision creation
|
||||
LotTravDMO.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");
|
||||
}
|
||||
@ -1573,7 +1234,6 @@ public class LotTravelerController : PdfViewController {
|
||||
|
||||
///
|
||||
public ActionResult DisplayLotTravlerPdf(int ltLotID, int revisionNumber) {
|
||||
//DateTime? expDt;
|
||||
LotTravelerPdf traveler = new LotTravelerPdf();
|
||||
try {
|
||||
traveler = LotTravDMO.GetLotTravlerPdf(ltLotID, revisionNumber);
|
||||
@ -1624,7 +1284,7 @@ public class LotTravelerController : PdfViewController {
|
||||
if (LotTravHoldStepAttachment != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
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
|
||||
@ -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 });
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
|
||||
//var model = ldDMO.GetLotDispoAttachments(issueID);
|
||||
|
||||
return Content("");
|
||||
}
|
||||
|
||||
@ -1668,7 +1325,7 @@ public class LotTravelerController : PdfViewController {
|
||||
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
|
||||
|
||||
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;
|
||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||
@ -1679,7 +1336,6 @@ public class LotTravelerController : PdfViewController {
|
||||
|
||||
if (!System.IO.File.Exists(sDocument)) {
|
||||
return null;
|
||||
//throw new Exception("File not found");
|
||||
}
|
||||
|
||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||
|
@ -1,17 +1,8 @@
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Misc;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
|
||||
using Kendo.Mvc.Extensions;
|
||||
using Kendo.Mvc.UI;
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.Dynamic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
@ -19,6 +10,14 @@ using System.Web;
|
||||
using System.Web.Mvc;
|
||||
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;
|
||||
|
||||
[Authorize]
|
||||
@ -26,29 +25,21 @@ namespace Fab2ApprovalSystem.Controllers;
|
||||
[SessionExpireFilter]
|
||||
public class MRBController : Controller {
|
||||
|
||||
MRB_DMO mrbDMO;
|
||||
MRB_DMO mrbDMO = new MRB_DMO(GlobalVars.AppSettings);
|
||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||
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/
|
||||
public ActionResult Index() {
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /MRB/Details/5
|
||||
public ActionResult Details(int id) {
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /MRB/Create
|
||||
public ActionResult Create() {
|
||||
MRB mrb = new MRB();
|
||||
@ -60,15 +51,6 @@ public class MRBController : Controller {
|
||||
try {
|
||||
PopulateCloseToQDB();
|
||||
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) {
|
||||
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);
|
||||
@ -79,7 +61,6 @@ public class MRBController : Controller {
|
||||
return RedirectToAction("Edit", new { IssueID = mrb.MRBNumber });
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /MRB/Create
|
||||
[HttpPost]
|
||||
public ActionResult Create(FormCollection collection) {
|
||||
@ -92,7 +73,6 @@ public class MRBController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /MRB/Edit/5
|
||||
public ActionResult Edit(int issueID) {
|
||||
string jwt = Session["JWT"].ToString();
|
||||
@ -106,7 +86,6 @@ public class MRBController : Controller {
|
||||
return Redirect(mrbUrl);
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /MRB/Edit/5
|
||||
[HttpPost]
|
||||
public void Edit(MRB mrb) {
|
||||
@ -132,13 +111,11 @@ public class MRBController : Controller {
|
||||
return Redirect(mrbUrl);
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /MRB/Delete/5
|
||||
public ActionResult Delete(int id) {
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /MRB/Delete/5
|
||||
[HttpPost]
|
||||
public ActionResult Delete(int id, FormCollection collection) {
|
||||
@ -152,7 +129,6 @@ public class MRBController : Controller {
|
||||
}
|
||||
|
||||
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>();
|
||||
return Json(lotlist, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
@ -169,46 +145,8 @@ public class MRBController : Controller {
|
||||
/// <summary>
|
||||
/// Updates the lot tables
|
||||
/// </summary>
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
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) {
|
||||
mrbDMO.UpdateMRBLot(lot);
|
||||
}
|
||||
@ -219,7 +157,6 @@ public class MRBController : Controller {
|
||||
/// <summary>
|
||||
/// Deletes record from the lot table
|
||||
/// </summary>
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
public ActionResult DeleteMRBLot([DataSourceRequest] DataSourceRequest request, Lot lot) {
|
||||
try {
|
||||
@ -271,17 +208,7 @@ public class MRBController : Controller {
|
||||
l.LotNumber = lotNumber;
|
||||
l.MRBNumber = mrbNumber;
|
||||
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());
|
||||
@ -317,9 +244,9 @@ public class MRBController : Controller {
|
||||
mrbDMO.DeleteMRBAttachment(attachmentID);
|
||||
|
||||
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)
|
||||
f.Delete();
|
||||
@ -340,12 +267,9 @@ public class MRBController : Controller {
|
||||
if (files != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
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 });
|
||||
}
|
||||
|
||||
@ -357,10 +281,8 @@ public class MRBController : Controller {
|
||||
try {
|
||||
string userIdentityName = @User.Identity.Name;
|
||||
var dispos = mrbDMO.GetDispositions(mrbNumber);
|
||||
string lotTempPipeLine = ConfigurationManager.AppSettings["LotTempPipeLine"].ToString();
|
||||
|
||||
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());
|
||||
@ -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);
|
||||
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)
|
||||
f.Delete();
|
||||
|
||||
@ -385,16 +307,15 @@ public class MRBController : Controller {
|
||||
}
|
||||
|
||||
public ActionResult ImportAddQDBFlag(IEnumerable<HttpPostedFileBase> AddQDBFlag, string operation) {
|
||||
//string path = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName"]);
|
||||
var physicalPath = "";
|
||||
try {
|
||||
string message;
|
||||
string c = Server.MapPath("/FTPBatch/");
|
||||
string userIdentityName = @User.Identity.Name;
|
||||
string b = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName"]);
|
||||
string a = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName_Test"]);
|
||||
string b = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName);
|
||||
string a = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName_Test);
|
||||
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))
|
||||
continue;
|
||||
return Content(message);
|
||||
@ -402,7 +323,7 @@ public class MRBController : Controller {
|
||||
|
||||
return Content("");
|
||||
} catch {
|
||||
FileInfo f = new FileInfo(physicalPath);
|
||||
System.IO.FileInfo f = new System.IO.FileInfo(physicalPath);
|
||||
if (f.Exists)
|
||||
f.Delete();
|
||||
|
||||
@ -416,10 +337,10 @@ public class MRBController : Controller {
|
||||
string message;
|
||||
string c = Server.MapPath("/FTPBatch/");
|
||||
string userIdentityName = @User.Identity.Name;
|
||||
string b = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName"]);
|
||||
string a = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName_Test"]);
|
||||
string b = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName);
|
||||
string a = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName_Test);
|
||||
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))
|
||||
continue;
|
||||
return Content(message);
|
||||
@ -427,7 +348,7 @@ public class MRBController : Controller {
|
||||
|
||||
return Content("");
|
||||
} catch {
|
||||
FileInfo f = new FileInfo(physicalPath);
|
||||
System.IO.FileInfo f = new System.IO.FileInfo(physicalPath);
|
||||
if (f.Exists)
|
||||
f.Delete();
|
||||
|
||||
@ -503,38 +424,13 @@ public class MRBController : Controller {
|
||||
List<CloseToQDBOptionViewModel> options = new List<CloseToQDBOptionViewModel>();
|
||||
options.Add(new CloseToQDBOptionViewModel { CloseToQDBOptionID = 0, CloseToQDBOption = "No" });
|
||||
options.Add(new CloseToQDBOptionViewModel { CloseToQDBOptionID = 1, CloseToQDBOption = "Yes" });
|
||||
//options.Add(new CloseToQDBOptionViewModel{CloseToQDBOption= "No"});
|
||||
//options.Add(new CloseToQDBOptionViewModel {CloseToQDBOption = "Yes" });
|
||||
|
||||
ViewData["CloseToQDBOptions"] = options;
|
||||
}
|
||||
|
||||
public void NotifyApprovers(int mrbNumber, byte currentStep) {
|
||||
string emailSentList = "";
|
||||
|
||||
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(mrbNumber, currentStep, (int)GlobalVars.DocumentType.MRB).Distinct().ToList();
|
||||
|
||||
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 + ",";
|
||||
}
|
||||
|
||||
string emailSentList = MRBHelper.NotifyApprovers(_AppSettings, mrbNumber, emailIst);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = mrbNumber, UserID = @User.Identity.Name, DocumentType = "MRB", OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
||||
} catch { }
|
||||
@ -575,15 +471,6 @@ public class MRBController : Controller {
|
||||
int waferCount = 0;
|
||||
int dieCount = 0;
|
||||
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);
|
||||
}
|
||||
|
||||
@ -601,7 +488,7 @@ public class MRBController : Controller {
|
||||
|
||||
var mrbLotInfo = mrbDMO.GetLotsToFindNewChildLots(mrbNumber);
|
||||
foreach (Lot lot in mrbLotInfo) {
|
||||
//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,)
|
||||
mrbDMO.ChildLotsUpdateInSPNWithNewDispoType(lot, mrbInfo);
|
||||
|
||||
}
|
||||
@ -614,11 +501,10 @@ public class MRBController : Controller {
|
||||
try {
|
||||
string c = Server.MapPath("/FTPBatch/");
|
||||
string userIdentityName = @User.Identity.Name;
|
||||
string b = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName"]);
|
||||
string a = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName_Test"]);
|
||||
string b = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName);
|
||||
string a = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName_Test);
|
||||
IEnumerable<string> data = mrbDMO.GetMRBHoldLots(mrbNumber);
|
||||
foreach (string tempData in data) {
|
||||
//output = new StringBuilder();
|
||||
if (tempData != null)
|
||||
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 newDestFileName = "S" + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00");
|
||||
|
||||
//string outputFile = @"C:\Websites\SPNLotHoldFlag\" + newsourceFileName;
|
||||
string ftpLogDirectory = ConfigurationManager.AppSettings["SPNMRBHoldFlagFTPLogDirectory"].ToString();
|
||||
string outputFile = ConfigurationManager.AppSettings["SPNMRBHoldFlagDirectory"].ToString() + newsourceFileName;
|
||||
string outputFile = _AppSettings.SPNMRBHoldFlagDirectory + newsourceFileName;
|
||||
|
||||
System.IO.File.WriteAllText(outputFile, output.ToString());
|
||||
|
||||
@ -640,26 +524,17 @@ public class MRBController : Controller {
|
||||
Thread.Sleep(1000);
|
||||
#endif
|
||||
try {
|
||||
//#if (!DEBUG)
|
||||
//FTPWrapper spfSPN = new FTPWrapper(outputFile, newDestFileName);
|
||||
//spfSPN.FTPToSPN();
|
||||
|
||||
if (mrbDMO.BatchFTP(outputFile, newDestFileName, ftpLogDirectory, userIdentityName, a, b, c)) {
|
||||
//TODO
|
||||
if (MRBHelper.BatchFTP(_AppSettings, outputFile, newDestFileName, _AppSettings.SPNMRBHoldFlagFTPLogDirectory, userIdentityName, a, b, c)) {
|
||||
// TODO
|
||||
mrbDMO.LogHoldFlagSentToSPNHistory(mrbNumber);
|
||||
}
|
||||
|
||||
//#endif
|
||||
} 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();
|
||||
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 false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//return true;
|
||||
} 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();
|
||||
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) {
|
||||
FileInfo sourcefile = new FileInfo(sourceFile);
|
||||
//FileInfo sourcefile = new FileInfo(@"C:\Websites\ECNViewerAckResultToSPN\S15122017102017.ecn");
|
||||
|
||||
System.IO.FileInfo sourcefile = new System.IO.FileInfo(sourceFile);
|
||||
try {
|
||||
//Functions.WriteEvent("HR Emp", "SPNData - Start Send(): FTPing " + sourceFile + " to SPN server.", System.Diagnostics.EventLogEntryType.Information);
|
||||
|
||||
ProcessStartInfo psiFab1 = new ProcessStartInfo();
|
||||
//psiFab1.FileName = ConfigurationManager.AppSettings["FTPSPNBatchFileName"];
|
||||
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 {
|
||||
psiFab1.FileName = Server.MapPath("/FTPBatch/" + ConfigurationManager.AppSettings["FTPSPNBatchFileName"]);
|
||||
psiFab1.FileName = Server.MapPath("/FTPBatch/" + _AppSettings.FTPSPNBatchFileName);
|
||||
}
|
||||
|
||||
psiFab1.Arguments = sourcefile.FullName + " " + destFile;
|
||||
@ -697,8 +568,6 @@ public class MRBController : Controller {
|
||||
Process procFab1 = new Process();
|
||||
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, @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) {
|
||||
//fileName = "ECNForm_71132.pdf";
|
||||
|
||||
var attachment = mrbDMO.GetMRBAttachment(Convert.ToInt32(attachmentID));
|
||||
|
||||
if (attachment == null)
|
||||
@ -718,7 +585,7 @@ public class MRBController : Controller {
|
||||
if (String.IsNullOrEmpty(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;
|
||||
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||
// 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)) {
|
||||
return null;
|
||||
//throw new Exception("File not found");
|
||||
}
|
||||
|
||||
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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Misc;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
namespace Fab2ApprovalSystem.Controllers;
|
||||
|
||||
[Authorize]
|
||||
@ -17,13 +17,8 @@ public class ManagerController : Controller {
|
||||
UserAccountDMO userDMO = new UserAccountDMO();
|
||||
AdminDMO adminDMO = new AdminDMO();
|
||||
TrainingDMO trainingDMO = new TrainingDMO();
|
||||
LotDispositionDMO ldDMO;
|
||||
private readonly AppSettings _AppSettings;
|
||||
|
||||
public ManagerController(AppSettings appSettings) {
|
||||
_AppSettings = appSettings;
|
||||
ldDMO = new LotDispositionDMO(appSettings);
|
||||
}
|
||||
LotDispositionDMO ldDMO = new LotDispositionDMO();
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
public ActionResult Index() {
|
||||
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.Models;
|
||||
|
||||
using Kendo.Mvc.Extensions;
|
||||
using Kendo.Mvc.UI;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Fab2ApprovalSystem.Controllers;
|
||||
|
||||
[Authorize]
|
||||
@ -20,15 +20,13 @@ public class PartsRequestController : Controller {
|
||||
|
||||
|
||||
const int WorkflowNumber = 1;
|
||||
PartsRequestDMO prDMO;
|
||||
PartsRequestDMO prDMO = new PartsRequestDMO();
|
||||
UserAccountDMO userDMO = new UserAccountDMO();
|
||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
public PartsRequestController(AppSettings appSettings) {
|
||||
_AppSettings = appSettings;
|
||||
public PartsRequestController() {
|
||||
ViewBag.ShowReAssignApprovers = false;
|
||||
prDMO = new PartsRequestDMO(appSettings);
|
||||
}
|
||||
|
||||
protected ActionResult HandleValidationError(string msg) {
|
||||
@ -248,7 +246,7 @@ public class PartsRequestController : Controller {
|
||||
if (files != null) {
|
||||
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||
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) {
|
||||
var pr = prDMO.Get(prNumber);
|
||||
|
||||
if (pr == null)
|
||||
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),
|
||||
prNumber: prNumber,
|
||||
toEmail: email,
|
||||
@ -463,11 +447,12 @@ public class PartsRequestController : Controller {
|
||||
|
||||
var u = userDMO.GetUserByID(pr.RequestorID);
|
||||
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email))) {
|
||||
SendEmailNotification(
|
||||
subject: String.Format("Parts Request Completion notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
||||
prNumber: prNumber,
|
||||
toEmail: u.Email,
|
||||
emailTemplate: "PRCompleted.txt");
|
||||
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),
|
||||
prNumber: prNumber,
|
||||
toEmail: u.Email,
|
||||
emailTemplate: "PRCompleted.txt");
|
||||
|
||||
EventLogDMO.Add(new WinEventLog() {
|
||||
IssueID = prNumber,
|
||||
@ -487,11 +472,12 @@ public class PartsRequestController : Controller {
|
||||
|
||||
var u = userDMO.GetUserByID(pr.OriginatorID);
|
||||
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email))) {
|
||||
SendEmailNotification(
|
||||
subject: String.Format("Parts Request Rejection notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
||||
prNumber: prNumber,
|
||||
toEmail: u.Email,
|
||||
emailTemplate: "PRReject.txt");
|
||||
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),
|
||||
prNumber: prNumber,
|
||||
toEmail: u.Email,
|
||||
emailTemplate: "PRReject.txt");
|
||||
|
||||
EventLogDMO.Add(new WinEventLog() {
|
||||
IssueID = prNumber,
|
||||
@ -517,11 +503,12 @@ public class PartsRequestController : Controller {
|
||||
|
||||
foreach (string email in emailList) {
|
||||
try {
|
||||
SendEmailNotification(
|
||||
subject: String.Format("Parts Request Assignment notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
||||
prNumber: prNumber,
|
||||
toEmail: email,
|
||||
emailTemplate: "PRAssigned.txt");
|
||||
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),
|
||||
prNumber: prNumber,
|
||||
toEmail: email,
|
||||
emailTemplate: "PRAssigned.txt");
|
||||
} catch (Exception ex) {
|
||||
HandleException(prNumber, ex, "email=" + email);
|
||||
}
|
||||
@ -569,7 +556,8 @@ public class PartsRequestController : Controller {
|
||||
if (pr == null)
|
||||
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),
|
||||
prNumber: prNumber,
|
||||
toEmail: email,
|
||||
|
@ -1,19 +1,22 @@
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Misc;
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Misc;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
|
||||
namespace Fab2ApprovalSystem.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[SessionExpireFilter]
|
||||
public class ReportsController : Controller {
|
||||
|
||||
public const String specialNullString = "~NULL~";
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
// GET: Export
|
||||
public ActionResult Index() {
|
||||
@ -84,14 +87,14 @@ public class ReportsController : Controller {
|
||||
|
||||
public SSRSHelper.SSRSClient SetupSSRSHelperClient() {
|
||||
var useCfgForBindings = false;
|
||||
if (String.Equals(System.Configuration.ConfigurationManager.AppSettings["SSRSBindingsByConfiguration"], "true", StringComparison.OrdinalIgnoreCase))
|
||||
if (String.Equals(_AppSettings.SSRSBindingsByConfiguration, "true", StringComparison.OrdinalIgnoreCase))
|
||||
useCfgForBindings = true;
|
||||
|
||||
var c = new SSRSHelper.SSRSClient(
|
||||
Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSBaseURL"]),
|
||||
Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSDomain"]),
|
||||
Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSUsername"]),
|
||||
Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSPassword"]),
|
||||
Convert.ToString(_AppSettings.SSRSBaseURL),
|
||||
Convert.ToString(_AppSettings.SSRSDomain),
|
||||
Convert.ToString(_AppSettings.SSRSUsername),
|
||||
Convert.ToString(_AppSettings.SSRSPassword),
|
||||
useCfgForBindings);
|
||||
c.Initialize();
|
||||
|
||||
@ -99,7 +102,7 @@ public class ReportsController : Controller {
|
||||
}
|
||||
|
||||
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("/"))
|
||||
folderName = folderName.TrimEnd('/');
|
||||
if (!String.IsNullOrWhiteSpace(docType))
|
||||
@ -181,7 +184,7 @@ public class ReportsController : Controller {
|
||||
|
||||
protected String MakeFilename(String reportName) {
|
||||
String r = "";
|
||||
var invalidChars = System.IO.Path.GetInvalidFileNameChars();
|
||||
char[] invalidChars = System.IO.Path.GetInvalidFileNameChars();
|
||||
foreach (char c in reportName) {
|
||||
if (invalidChars.Contains(c))
|
||||
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.Misc;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
@ -6,12 +12,6 @@ using Fab2ApprovalSystem.ViewModels;
|
||||
|
||||
using Kendo.Mvc.Extensions;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Fab2ApprovalSystem.Controllers;
|
||||
|
||||
[Authorize]
|
||||
@ -22,7 +22,7 @@ public class TrainingController : Controller {
|
||||
AdminDMO adminDMO = new AdminDMO();
|
||||
TrainingDMO trainingDMO = new TrainingDMO();
|
||||
ECN_DMO ecnDMO = new ECN_DMO();
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
// GET: Training
|
||||
public ActionResult Index() {
|
||||
@ -32,7 +32,7 @@ public class TrainingController : Controller {
|
||||
public int Create(int ecnId) {
|
||||
ECN_DMO ecnDMO = new ECN_DMO();
|
||||
|
||||
//Delete old training if exists
|
||||
// Delete old training if exists
|
||||
int oldTrainingId = trainingDMO.GetTrainingId(ecnId);
|
||||
if (oldTrainingId != null && oldTrainingId != 0) {
|
||||
trainingDMO.DeleteTraining(oldTrainingId);
|
||||
@ -57,34 +57,34 @@ public class TrainingController : Controller {
|
||||
}
|
||||
public ActionResult AddUserToTrainingAdHoc(int trainingId, int traineeId, int ecnId) {
|
||||
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||
//Get ECN
|
||||
// Get ECN
|
||||
ECN ecn = ecnDMO.GetECN(ecnId);
|
||||
|
||||
//Get User
|
||||
// Get User
|
||||
LoginModel user = userDMO.GetUserByID(traineeId);
|
||||
|
||||
//Get Training
|
||||
// Get Training
|
||||
Training training = trainingDMO.GetTraining(trainingId);
|
||||
if (ecn != null) {
|
||||
if (user != null) {
|
||||
if (training != null) {
|
||||
if (!trainingDMO.IsUserAssigned(traineeId, trainingId)) {
|
||||
if (training.DeletedDate == null && !ecn.Deleted) {
|
||||
//Both the ECN and training still exist
|
||||
// Both the ECN and training still exist
|
||||
if (training.CompletedDate != null) {
|
||||
//Training is completed and now we need to re-open it.
|
||||
// Training is completed and now we need to re-open it.
|
||||
trainingDMO.reOpenTraining(trainingId);
|
||||
int assignmentId = trainingDMO.CreateAssignment(trainingId, traineeId);
|
||||
NotifyTrainee(traineeId, assignmentId, ecnId, ecn.Title);
|
||||
return Content("Success");
|
||||
} else {
|
||||
//training is still open, just add a user and notify
|
||||
// training is still open, just add a user and notify
|
||||
int assignmentId = trainingDMO.CreateAssignment(trainingId, traineeId);
|
||||
NotifyTrainee(traineeId, assignmentId, ecnId, ecn.Title);
|
||||
return Content("Success");
|
||||
}
|
||||
} else {
|
||||
//Ecn or training task have been deleted.
|
||||
// Ecn or training task have been deleted.
|
||||
return Content("Training or ECN has been deleted.");
|
||||
}
|
||||
} else {
|
||||
@ -116,9 +116,9 @@ public class TrainingController : Controller {
|
||||
if (training != null) {
|
||||
if (training.DeletedDate == null && !ecn.Deleted) {
|
||||
if (training.CompletedDate != null) {
|
||||
//Training is completed and now we need to re-open it.
|
||||
// Training is completed and now we need to re-open it.
|
||||
foreach (int id in groupMemberIds) {
|
||||
//Check to make sure user doesn't have an active assignment for this training
|
||||
// Check to make sure user doesn't have an active assignment for this training
|
||||
if (!trainingDMO.IsUserAssigned(id, trainingId)) {
|
||||
usersAdded++;
|
||||
int assignmentId = trainingDMO.CreateAssignment(trainingId, id);
|
||||
@ -129,9 +129,9 @@ public class TrainingController : Controller {
|
||||
trainingDMO.reOpenTraining(trainingId);
|
||||
}
|
||||
} else {
|
||||
//training is still open, just add a users and notify
|
||||
// training is still open, just add a users and notify
|
||||
foreach (int id in groupMemberIds) {
|
||||
//Check to make sure user doesn't have an active assignment for this training
|
||||
// Check to make sure user doesn't have an active assignment for this training
|
||||
if (!trainingDMO.IsUserAssigned(id, trainingId)) {
|
||||
usersAdded++;
|
||||
int assignmentId = trainingDMO.CreateAssignment(trainingId, id);
|
||||
@ -178,28 +178,8 @@ public class TrainingController : Controller {
|
||||
|
||||
public void NotifyTrainee(int userId, int assignmentId, int ecnId, string title) {
|
||||
try {
|
||||
string emailSentList = "";
|
||||
string recipient = userDMO.GetUserEmailByID(userId);
|
||||
|
||||
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);
|
||||
TrainingHelper.NotifyTrainee(_AppSettings, userId, assignmentId, ecnId, title, recipient);
|
||||
} catch (Exception e) {
|
||||
string detailedException = "";
|
||||
try {
|
||||
@ -220,13 +200,12 @@ public class TrainingController : Controller {
|
||||
|
||||
public ActionResult ViewTrainingDocsPartial(int trainingAssignmentId) {
|
||||
ViewBag.trainingAssignmentId = trainingAssignmentId;
|
||||
//IEnumerable<TrainingDocAck> attachments = ecnDMO.GetECNAttachments(ecnNumber);
|
||||
IEnumerable<TrainingDocAck> attachments = trainingDMO.GetAssignedDocs(trainingAssignmentId);
|
||||
return PartialView(attachments);
|
||||
}
|
||||
|
||||
public ActionResult AcknowledgeDocument(int trainingAssignmentID, int trainingDocAckID) {
|
||||
//Check to see if acknowledgement is valid(Security Feature to protect data integrity)
|
||||
// Check to see if acknowledgement is valid(Security Feature to protect data integrity)
|
||||
if (trainingDMO.CheckValidDocAck(trainingDocAckID)) {
|
||||
trainingDMO.AcknowledgeDocument(trainingDocAckID);
|
||||
bool isFinishedTrainingAssignment = trainingDMO.CheckTrainingAssignmentStatus(trainingAssignmentID);
|
||||
@ -272,7 +251,7 @@ public class TrainingController : Controller {
|
||||
public ActionResult TrainingReportsView(int? filterType, string filterValue) {
|
||||
ViewBag.TrainingGroups = adminDMO.GetTrainingGroups();
|
||||
IEnumerable<Training> trainingList = trainingDMO.GetAllTrainings();
|
||||
//Group Filter
|
||||
// Group Filter
|
||||
if (filterType == 1 && filterValue != "") {
|
||||
ViewBag.GroupFilter = filterValue;
|
||||
List<Training> filteredTraining = new List<Training>();
|
||||
@ -287,27 +266,27 @@ public class TrainingController : Controller {
|
||||
trainingList = filteredTraining;
|
||||
return PartialView(trainingList);
|
||||
}
|
||||
//Status Filter
|
||||
// Status Filter
|
||||
if (filterType == 2 && filterValue != "") {
|
||||
List<Training> filteredTraining = new List<Training>();
|
||||
switch (filterValue) {
|
||||
case "1":
|
||||
//Completed
|
||||
// Completed
|
||||
filteredTraining = (from a in trainingList where a.Status == true && a.Deleted != true select a).ToList();
|
||||
break;
|
||||
case "2":
|
||||
//In Progress
|
||||
// In Progress
|
||||
filteredTraining = (from a in trainingList where a.Status != true && a.Deleted != true select a).ToList();
|
||||
break;
|
||||
case "3":
|
||||
//Cancelled
|
||||
// Cancelled
|
||||
filteredTraining = (from a in trainingList where a.Deleted == true select a).ToList();
|
||||
break;
|
||||
}
|
||||
trainingList = filteredTraining;
|
||||
return PartialView(trainingList);
|
||||
}
|
||||
//Default return all.
|
||||
// Default return all.
|
||||
else {
|
||||
return PartialView(trainingList);
|
||||
}
|
||||
@ -323,9 +302,8 @@ public class TrainingController : Controller {
|
||||
ViewBag.ECNTitle = ECNTitle;
|
||||
ViewBag.trainingID = trainingID;
|
||||
IEnumerable<TrainingAssignment> trainingAssignments = trainingDMO.GetAllTrainingAssignments(trainingID);
|
||||
//Calculate Percent Complete:
|
||||
// Calculate Percent Complete:
|
||||
float percentComplete = 0;
|
||||
//float assignmentCount = trainingAssignments.Count();
|
||||
float assignmentCount = (from a in trainingAssignments where a.Deleted != true select a).Count();
|
||||
float totalCompleted = 0;
|
||||
foreach (TrainingAssignment assignment in trainingAssignments) {
|
||||
@ -351,15 +329,15 @@ public class TrainingController : Controller {
|
||||
List<TrainingAssignment> filteredTraining = new List<TrainingAssignment>();
|
||||
switch (statusFilter) {
|
||||
case "1":
|
||||
//Completed
|
||||
// Completed
|
||||
filteredTraining = (from a in trainingAssignments where a.status == true && a.Deleted != true select a).ToList();
|
||||
break;
|
||||
case "2":
|
||||
//In Progress
|
||||
// In Progress
|
||||
filteredTraining = (from a in trainingAssignments where a.status != true && a.Deleted != true select a).ToList();
|
||||
break;
|
||||
case "3":
|
||||
//Cancelled
|
||||
// Cancelled
|
||||
filteredTraining = (from a in trainingAssignments where a.Deleted == true select a).ToList();
|
||||
break;
|
||||
default:
|
||||
@ -367,7 +345,6 @@ public class TrainingController : Controller {
|
||||
break;
|
||||
}
|
||||
trainingAssignments = filteredTraining;
|
||||
//return PartialView(trainingList);
|
||||
}
|
||||
|
||||
return PartialView(trainingAssignments);
|
||||
@ -427,7 +404,7 @@ public class TrainingController : Controller {
|
||||
IEnumerable<Training> AllTrainings = trainingDMO.GetTrainings();
|
||||
ViewBag.TrainingGroups = adminDMO.GetTrainingGroups();
|
||||
ViewBag.AllGroups = trainingDMO.GetTrainingGroups();
|
||||
//Group Filter
|
||||
// Group Filter
|
||||
if (filterType == 1 && filterValue != "") {
|
||||
ViewBag.GroupFilter = filterValue;
|
||||
List<Training> filteredTraining = new List<Training>();
|
||||
@ -455,8 +432,8 @@ public class TrainingController : Controller {
|
||||
trainingDMO.DeleteTrainingAssignment(assignmentId);
|
||||
trainingDMO.DeleteTrainingDocAck(assignmentId);
|
||||
|
||||
//Below checks and updates the training status
|
||||
//TO-DO Put this in its own method.
|
||||
// Below checks and updates the training status
|
||||
// TO-DO Put this in its own method.
|
||||
bool isFinishedTrainingAssignment = trainingDMO.CheckTrainingAssignmentStatus(assignmentId);
|
||||
|
||||
if (isFinishedTrainingAssignment) {
|
||||
@ -479,12 +456,11 @@ public class TrainingController : Controller {
|
||||
public ActionResult ManuallyExecuteECNTraining(int ecnId, int[] trainingGroupsIn) {
|
||||
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||
List<int> newTrainingGroupIds = new List<int>(trainingGroupsIn);
|
||||
//Get ECN
|
||||
ECN ecn = ecnDMO.GetECN(ecnId);
|
||||
if (ecn != null) {
|
||||
if (ecn.CloseDate != null) {
|
||||
if (newTrainingGroupIds.Count > 0) {
|
||||
//Check each assigned group id and see if it's already saved to the ECN
|
||||
// Check each assigned group id and see if it's already saved to the ECN
|
||||
List<int> assignedTrainingGroups = trainingDMO.GetECNAssignedTrainingGroups(ecnId);
|
||||
IEnumerable<int> onlyNewTrainingIds = newTrainingGroupIds.Except(assignedTrainingGroups);
|
||||
try {
|
||||
@ -539,15 +515,14 @@ public class TrainingController : Controller {
|
||||
emailBody += "Please ensure the following users complete their training assignments. ";
|
||||
emailBody += "Dates in red font identify past due training tasks.</p><br />";
|
||||
emailBody += "<style>table,th,td{border: 1px solid black;}</style>";
|
||||
//Get all users set up to receive the training report email.
|
||||
// Get all users set up to receive the training report email.
|
||||
List<TrainingReportUser> trainingReportUsers = adminDMO.GetTrainingReportUsers();
|
||||
List<string> emailList = new List<string>();
|
||||
foreach (TrainingReportUser user in trainingReportUsers) {
|
||||
string userEmail = userDMO.GetUserByID(user.UserId).Email;
|
||||
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();
|
||||
|
||||
foreach (Training training in openTrainings) {
|
||||
|
@ -5,22 +5,17 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
using Fab2ApprovalSystem.Misc;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
namespace Fab2ApprovalSystem.Controllers;
|
||||
|
||||
public class WebAPIController : ApiController {
|
||||
public TrainingController trainingFunctions = new TrainingController();
|
||||
public CorrectiveActionController carFunctions;
|
||||
public CorrectiveActionController carFunctions = new CorrectiveActionController();
|
||||
public AccountController accountFunctions = new AccountController();
|
||||
public HomeController homeFunctions;
|
||||
private readonly AppSettings _AppSettings;
|
||||
|
||||
public WebAPIController(AppSettings appSettings) {
|
||||
_AppSettings = appSettings;
|
||||
carFunctions = new CorrectiveActionController(appSettings);
|
||||
homeFunctions = new HomeController(appSettings);
|
||||
}
|
||||
public HomeController homeFunctions = new HomeController();
|
||||
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
|
||||
|
||||
public string Get() {
|
||||
return "Welcome To Web API";
|
||||
|
@ -1,33 +1,29 @@
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
using Kendo.Mvc.Extensions;
|
||||
using Kendo.Mvc.UI;
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
using Kendo.Mvc.Extensions;
|
||||
using Kendo.Mvc.UI;
|
||||
|
||||
namespace Fab2ApprovalSystem.Controllers;
|
||||
|
||||
public class WorkflowController : Controller {
|
||||
//
|
||||
|
||||
//
|
||||
// GET: /Workflow/Details/5
|
||||
public ActionResult Details(int id) {
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Workflow/Create
|
||||
public ActionResult Create() {
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Workflow/Create
|
||||
[HttpPost]
|
||||
public ActionResult Create(FormCollection collection) {
|
||||
@ -40,13 +36,11 @@ public class WorkflowController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Workflow/Edit/5
|
||||
public ActionResult Edit(int id) {
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Workflow/Edit/5
|
||||
[HttpPost]
|
||||
public ActionResult Edit(int id, FormCollection collection) {
|
||||
@ -59,13 +53,11 @@ public class WorkflowController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Workflow/Delete/5
|
||||
public ActionResult Delete(int id) {
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Workflow/Delete/5
|
||||
[HttpPost]
|
||||
public ActionResult Delete(int id, FormCollection collection) {
|
||||
|
@ -71,8 +71,6 @@ public class AdminDMO {
|
||||
if (!lookup.TryGetValue(parent.RoleID, out role)) {
|
||||
lookup.Add(parent.RoleID, role = parent);
|
||||
}
|
||||
//if (role.RoleID == null)
|
||||
// role.SubRoles = new List<SubRole>();
|
||||
role.SubRoles.Add(child);
|
||||
return role;
|
||||
},
|
||||
@ -80,7 +78,7 @@ public class AdminDMO {
|
||||
|
||||
return data;
|
||||
}
|
||||
///
|
||||
|
||||
public List<UserSubRoles> GetUserSubRoles(int userId) {
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@UserId", userId);
|
||||
@ -130,14 +128,17 @@ public class AdminDMO {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
public List<TrainingReportUser> GetTrainingReportUsers() {
|
||||
List<TrainingReportUser> CurrentReportUsers = (from a in FabApprovalDB.TrainingReportUsers select a).ToList();
|
||||
return CurrentReportUsers;
|
||||
}
|
||||
#else
|
||||
public List<TrainingReportUser> GetTrainingReportUsers() => throw new NotImplementedException();
|
||||
public List<TrainingReportUser> GetTrainingReportUsers() =>
|
||||
throw new NotImplementedException();
|
||||
#endif
|
||||
|
||||
#if !NET8
|
||||
public List<TECNNotificationsUser> GetTECNNotificationUsers() {
|
||||
List<TECNNotificationsUser> currentTECNNotificationUsers = (from a in FabApprovalDB.TECNNotificationsUsers select a).ToList();
|
||||
@ -164,8 +165,6 @@ public class AdminDMO {
|
||||
|
||||
public void TrainingReportDeleteUser(int userId) {
|
||||
DynamicParameters parameters = new();
|
||||
|
||||
parameters = new DynamicParameters();
|
||||
parameters.Add("@UserID", userId);
|
||||
|
||||
db.Execute("DeleteUserFromTrainingReport", parameters, commandType: CommandType.StoredProcedure);
|
||||
@ -174,25 +173,14 @@ public class AdminDMO {
|
||||
|
||||
public void TECNExpirationDeleteUser(int userId) {
|
||||
DynamicParameters parameters = new();
|
||||
|
||||
parameters = new DynamicParameters();
|
||||
parameters.Add("@UserID", userId);
|
||||
|
||||
db.Execute("DeleteUserFromTECNReport", parameters, commandType: CommandType.StoredProcedure);
|
||||
return;
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
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;
|
||||
List<TrainingGroup> GroupsToReturn = TrainingGroups.ToList();
|
||||
|
||||
@ -201,16 +189,14 @@ public class AdminDMO {
|
||||
|
||||
public void AddNewTrainingGroup(string groupName) {
|
||||
TrainingGroup existing = null;
|
||||
//Check to see that the group name doesn't exist.
|
||||
// Check to see that the group name doesn't exist.
|
||||
try {
|
||||
existing = (from a in FabApprovalDB.TrainingGroups where a.TrainingGroupName == groupName select a).FirstOrDefault();
|
||||
} catch {
|
||||
// string test = "";
|
||||
}
|
||||
|
||||
|
||||
if (existing == null) {
|
||||
//string sql = new StringBuilder();
|
||||
string sql = "INSERT INTO TrainingGroups (TrainingGroupName) " + "VALUES ('" + groupName + "') ";
|
||||
|
||||
this.db.Open();
|
||||
@ -234,6 +220,7 @@ public class AdminDMO {
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET8
|
||||
public List<TrainingGroupMember> GetTrainingGroupMembers(int GroupID) {
|
||||
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.");
|
||||
}
|
||||
|
||||
|
||||
//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
|
||||
public void DeleteFromGroup(int userId, int groupId) {
|
||||
DynamicParameters parameters = new();
|
||||
|
||||
parameters = new DynamicParameters();
|
||||
parameters.Add("@GroupID", groupId);
|
||||
parameters.Add("@UserID", userId);
|
||||
|
||||
@ -298,35 +261,35 @@ public class AdminDMO {
|
||||
public void DeleteUser(UserAccountDMO userDMO, TrainingDMO trainingDMO, LoginModel loginModel) {
|
||||
if (loginModel != null) {
|
||||
userDMO.DeleteUser(loginModel);
|
||||
//Remove open trainings
|
||||
//Get a list of all user assigned trainings.
|
||||
// Remove open trainings
|
||||
// Get a list of all user assigned trainings.
|
||||
List<TrainingAssignment> trainingAssignments = trainingDMO.GetTrainingAssignmentsByUserID(loginModel.UserID);
|
||||
|
||||
//Go Through that list.
|
||||
// Go Through that list.
|
||||
foreach (var trainingAssignment in trainingAssignments) {
|
||||
//Delete Any document acknowledgements.
|
||||
// Delete Any document acknowledgements.
|
||||
trainingDMO.DeleteTrainingDocAck(trainingAssignment.ID);
|
||||
//Delete the training assignment itself
|
||||
// Delete the training assignment itself
|
||||
trainingDMO.DeleteTrainingAssignment(trainingAssignment.ID);
|
||||
//Check the parent Training task to set to to complete if applicable.
|
||||
// Check the parent Training task to set to to complete if applicable.
|
||||
if (trainingDMO.CheckTrainingStatus(trainingAssignment.ID)) {
|
||||
int TrainingID = trainingAssignment.TrainingID;
|
||||
//Set Training status to complete
|
||||
// Set Training status to complete
|
||||
trainingDMO.UpdateTrainingStatus(TrainingID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Remove user from any Training Groups
|
||||
// Remove user from any Training Groups
|
||||
DeleteUserFromAllTrainingGroups(loginModel.UserID);
|
||||
|
||||
//Remove User from training report notifications
|
||||
// Remove User from training report notifications
|
||||
TrainingReportDeleteUser(loginModel.UserID);
|
||||
//Remove user from TECN Expiration Notifications
|
||||
// Remove user from TECN Expiration Notifications
|
||||
TECNExpirationDeleteUser(loginModel.UserID);
|
||||
//Get user subroles
|
||||
// Get user subroles
|
||||
List<UserSubRoles> userSubRoles = GetUserSubRoles(loginModel.UserID);
|
||||
//Delete user from any subroles
|
||||
// Delete user from any subroles
|
||||
foreach (var userSubRole in userSubRoles) {
|
||||
DeleteUserRoles(userSubRole.SubRoleID, loginModel.UserID.ToString());
|
||||
}
|
||||
|
@ -17,8 +17,6 @@ using System.Transactions;
|
||||
using Fab2ApprovalSystem.Misc;
|
||||
using Fab2ApprovalSystem.Utilities;
|
||||
|
||||
using System.IO;
|
||||
|
||||
namespace Fab2ApprovalSystem.DMO;
|
||||
|
||||
public class AuditDMO {
|
||||
@ -31,8 +29,6 @@ public class AuditDMO {
|
||||
|
||||
public Audit InsertAudit(Audit audit) {
|
||||
DynamicParameters parameters = new();
|
||||
|
||||
parameters = new DynamicParameters();
|
||||
parameters.Add("@AuditNo", value: audit.AuditNo, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||
parameters.Add("@OriginatorID", audit.OriginatorID);
|
||||
|
||||
@ -45,14 +41,11 @@ public class AuditDMO {
|
||||
public Audit GetAuditItem(int auditNo, int userID) {
|
||||
Audit audit = new();
|
||||
|
||||
//isITAR = 2;
|
||||
// isITAR = 2;
|
||||
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@AuditNo", value: auditNo);
|
||||
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)) {
|
||||
audit = multipleResultItems.Read<Audit>().SingleOrDefault();
|
||||
@ -76,29 +69,15 @@ public class AuditDMO {
|
||||
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;
|
||||
}
|
||||
|
||||
public Audit GetAuditItemReadOnly(int auditNo, int userID) {
|
||||
Audit audit = new();
|
||||
|
||||
//isITAR = 2;
|
||||
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@AuditNo", value: auditNo);
|
||||
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)) {
|
||||
audit = multipleResultItems.Read<Audit>().SingleOrDefault();
|
||||
@ -164,11 +143,9 @@ public class AuditDMO {
|
||||
try {
|
||||
parameters.Add("AuditNo", audit.AuditNo);
|
||||
parameters.Add("Title", audit.AuditTitle);
|
||||
//parameters.Add("AuditTypeID", audit.AuditTypeID);
|
||||
parameters.Add("AuditDate", audit.AuditDate);
|
||||
parameters.Add("AuditStatus", audit.AuditStatus);
|
||||
parameters.Add("AuditScore", audit.AuditScore);
|
||||
//parameters.Add("AuditedAreaID", audit.AuditedAreaID);
|
||||
parameters.Add("Auditees", audit.Auditees);
|
||||
db.Execute("_8DUpdateAudit", param: parameters, commandType: CommandType.StoredProcedure);
|
||||
|
||||
@ -218,31 +195,6 @@ public class AuditDMO {
|
||||
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) {
|
||||
@ -450,7 +402,7 @@ public class AuditDMO {
|
||||
}
|
||||
|
||||
audit = GetAuditItem(issueID, userId);
|
||||
//transform audit users from string to list, delimited by a comma.
|
||||
// transform audit users from string to list, delimited by a comma.
|
||||
if (audit.Auditees == null) {
|
||||
result.AuditeeNames = new List<string>();
|
||||
} else {
|
||||
@ -468,7 +420,7 @@ public class AuditDMO {
|
||||
result.IsAdmin = true;
|
||||
}
|
||||
if ((audit.RecordLockIndicator && audit.RecordLockedBy != userId)
|
||||
|| audit.AuditStatus != 0) //open
|
||||
|| audit.AuditStatus != 0) // open
|
||||
{
|
||||
result.RedirectToAction = true;
|
||||
}
|
||||
@ -486,33 +438,16 @@ public class AuditDMO {
|
||||
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) {
|
||||
Audit audit = new();
|
||||
InsertAuditFindingsItem(data);
|
||||
audit = GetAuditItem(data.AuditNo, userID);
|
||||
|
||||
//Transfer Finding Details to CA
|
||||
// Transfer Finding Details to CA
|
||||
if (data.CANo != 0) {
|
||||
CorrectiveAction ca = caDMO.GetCAItem(data.CANo, userID);
|
||||
ca.CATitle = data.Title;
|
||||
ca.CASourceID = 1;//Audit
|
||||
ca.CASourceID = 1; // Audit
|
||||
caDMO.UpdateCorrectiveAction(ca);
|
||||
}
|
||||
|
||||
@ -524,11 +459,11 @@ public class AuditDMO {
|
||||
UpdateAuditFindingsItem(data);
|
||||
audit = GetAuditItem(data.AuditNo, userID);
|
||||
|
||||
//Transfer Finding Details to CA
|
||||
// Transfer Finding Details to CA
|
||||
if (data.CANo != 0) {
|
||||
CorrectiveAction ca = caDMO.GetCAItem(data.CANo, userID);
|
||||
ca.CATitle = data.Title;
|
||||
ca.CASourceID = 1;//Audit
|
||||
ca.CASourceID = 1; // Audit
|
||||
caDMO.UpdateCorrectiveAction(ca);
|
||||
}
|
||||
|
||||
@ -542,72 +477,9 @@ public class AuditDMO {
|
||||
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) {
|
||||
string emailSentList = "";
|
||||
|
||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
||||
string email = MiscDMO.GetEmail(responsibleOwnerID);
|
||||
|
||||
string emailTemplate = "CorrectiveActionFindingAssigned.txt";
|
||||
|
@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Transactions;
|
||||
|
||||
@ -16,12 +15,8 @@ namespace Fab2ApprovalSystem.DMO;
|
||||
|
||||
public class ChangeControlDMO {
|
||||
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||
|
||||
public ChangeControlDMO(AppSettings appSettings) =>
|
||||
_AppSettings = appSettings;
|
||||
|
||||
internal ChangeControlViewModel InsertChangeControl(ChangeControlViewModel cc) {
|
||||
DynamicParameters parameters = new();
|
||||
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("@UserID", userID);
|
||||
//parameters.Add("@UserID", GlobalVars.USER_ID);
|
||||
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)) {
|
||||
ccItem = multipleResultItems.Read<ChangeControlViewModel>().SingleOrDefault();
|
||||
|
||||
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();
|
||||
//if (ccItem != null && logis != null)
|
||||
//{
|
||||
// if (logis.Count > 0)
|
||||
// ccItem.LogisticsIDs.AddRange(logis);
|
||||
//}
|
||||
|
||||
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;
|
||||
}
|
||||
@ -87,49 +54,14 @@ public class ChangeControlDMO {
|
||||
parameters.Add("@planNumber", planNumber);
|
||||
|
||||
parameters.Add("@UserID", userID);
|
||||
//parameters.Add("@UserID", GlobalVars.USER_ID);
|
||||
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)) {
|
||||
ccItem = multipleResultItems.Read<ChangeControlViewModel>().SingleOrDefault();
|
||||
|
||||
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();
|
||||
//if (ccItem != null && logis != null)
|
||||
//{
|
||||
// if (logis.Count > 0)
|
||||
// ccItem.LogisticsIDs.AddRange(logis);
|
||||
//}
|
||||
|
||||
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");
|
||||
|
||||
}
|
||||
@ -147,13 +79,6 @@ public class ChangeControlDMO {
|
||||
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() {
|
||||
DynamicParameters parameters = new();
|
||||
return db.Query<CCProcess>("CCGetProcesses", commandType: CommandType.StoredProcedure).ToList();
|
||||
@ -175,73 +100,12 @@ public class ChangeControlDMO {
|
||||
parameters.Add("@IsMedical", model.IsMedical);
|
||||
parameters.Add("@IsRadHard", model.IsRadHard);
|
||||
parameters.Add("@Notes", model.Notes);
|
||||
//parameters.Add("@PartNumbers", model.PartNumbers);
|
||||
parameters.Add("@IsAutomotive", model.IsAutomotive);
|
||||
//parameters.Add("@ToolTypes", model.ToolTypes);
|
||||
parameters.Add("@Title", model.Title);
|
||||
parameters.Add("@ReasonForChange", model.ReasonForChange);
|
||||
parameters.Add("@ChangeDescription", model.ChangeDescription);
|
||||
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();
|
||||
} catch (Exception ex) {
|
||||
transaction.Dispose();
|
||||
@ -330,7 +194,6 @@ public class ChangeControlDMO {
|
||||
parameters.Add("@UserID", userID);
|
||||
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)) {
|
||||
ccMeeting = multipleResultItems.Read<CCMeeting>().SingleOrDefault();
|
||||
List<string> pcrvalues = multipleResultItems.Read<string>().ToList();
|
||||
@ -351,7 +214,6 @@ public class ChangeControlDMO {
|
||||
parameters.Add("@UserID", userID);
|
||||
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)) {
|
||||
ccMeeting = multipleResultItems.Read<CCMeeting>().SingleOrDefault();
|
||||
List<string> pcrvalues = multipleResultItems.Read<string>().ToList();
|
||||
@ -376,7 +238,6 @@ public class ChangeControlDMO {
|
||||
int result = 0;
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@MeetingID", meeting.MeetingID);
|
||||
//parameters.Add("@PCRB", meeting.PCRB.ToUpper() == "SELECT" ? null : meeting.PCRB);
|
||||
parameters.Add("@Decision", meeting.Decision);
|
||||
parameters.Add("@MeetingDate", meeting.MeetingDate);
|
||||
parameters.Add("@Notes", meeting.Notes);
|
||||
@ -526,9 +387,6 @@ public class ChangeControlDMO {
|
||||
parameters.Add("@Site", siteName);
|
||||
db.Execute("CCInsertNewMeetingAttendee", parameters, commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
/// <summary>
|
||||
/// /
|
||||
/// </summary>
|
||||
|
||||
internal void UpdateMeetingAttendee(int id, string attendeeName, string jobTitle, string siteName) {
|
||||
DynamicParameters parameters = new();
|
||||
@ -538,9 +396,6 @@ public class ChangeControlDMO {
|
||||
parameters.Add("@Site", siteName);
|
||||
db.Execute("CCUpdateMeetingAttendee", parameters, commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
/// <summary>
|
||||
/// /
|
||||
/// </summary>
|
||||
|
||||
internal void UpdatePCRBAttendee(int id, int attendeeID, string jobTitle, string siteName) {
|
||||
DynamicParameters parameters = new();
|
||||
@ -593,10 +448,6 @@ public class ChangeControlDMO {
|
||||
db.Execute("CCUpdateMeetingActionItem_All", parameters, commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// /
|
||||
/// </summary>
|
||||
|
||||
internal void InsertMeetingActionItem(CCMeetingActionItem meetingActionItem) {
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@MeetingID", meetingActionItem.MeetingID);
|
||||
@ -626,10 +477,6 @@ public class ChangeControlDMO {
|
||||
db.Execute("CCInsertPCRBActionItem", parameters, commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// /
|
||||
/// </summary>
|
||||
|
||||
internal void UpdateMeetingActionItem(CCMeetingActionItem meetingActionItem) {
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@ID", meetingActionItem.ID);
|
||||
@ -659,20 +506,6 @@ public class ChangeControlDMO {
|
||||
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) {
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@ID", meetingAttendee.ID);
|
||||
@ -730,9 +563,6 @@ public class ChangeControlDMO {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
internal List<UserList> GetUsers() {
|
||||
DynamicParameters parameters = new();
|
||||
return db.Query<UserList>("CCGetUsers", commandType: CommandType.StoredProcedure).ToList();
|
||||
@ -778,97 +608,4 @@ public class ChangeControlDMO {
|
||||
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.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Transactions;
|
||||
|
||||
@ -16,17 +15,12 @@ namespace Fab2ApprovalSystem.DMO;
|
||||
|
||||
public class CorrectiveActionDMO {
|
||||
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly WorkflowDMO wfDMO = new();
|
||||
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||
|
||||
public CorrectiveActionDMO(AppSettings appSettings) =>
|
||||
_AppSettings = appSettings;
|
||||
|
||||
public CorrectiveAction InsertCA(CorrectiveAction ca) {
|
||||
DynamicParameters parameters = new();
|
||||
|
||||
parameters = new DynamicParameters();
|
||||
parameters.Add("@CANo", value: ca.CANo, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||
parameters.Add("@RequestorID", ca.RequestorID);
|
||||
|
||||
@ -151,8 +145,6 @@ public class CorrectiveActionDMO {
|
||||
public CorrectiveAction GetCAItem(int caNo, int userID) {
|
||||
CorrectiveAction ca = new();
|
||||
|
||||
//isITAR = 2;
|
||||
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@CANo", value: caNo);
|
||||
parameters.Add("@UserID", userID);
|
||||
@ -185,8 +177,6 @@ public class CorrectiveActionDMO {
|
||||
public CorrectiveAction GetCAItemReadOnly(int caNo, int userID) {
|
||||
CorrectiveAction ca = new();
|
||||
|
||||
//isITAR = 2;
|
||||
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@CANo", value: caNo);
|
||||
parameters.Add("@UserID", userID);
|
||||
@ -512,8 +502,6 @@ public class CorrectiveActionDMO {
|
||||
}
|
||||
|
||||
public void StartSectionApproval(int issueID, int userID, string DSection) {
|
||||
//string subRoles = wfDMO.GetSubRoleItems(issueID, (int)GlobalVars.DocumentType.CorrectiveActionSection);
|
||||
|
||||
// bubble the error
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@CANo", issueID);
|
||||
@ -524,8 +512,6 @@ public class CorrectiveActionDMO {
|
||||
}
|
||||
|
||||
public void ApproveSection(int issueID, int userID, string DSection) {
|
||||
//string subRoles = wfDMO.GetSubRoleItems(issueID, (int)GlobalVars.DocumentType.CorrectiveActionSection);
|
||||
|
||||
// bubble the error
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@UserID", userID);
|
||||
@ -550,8 +536,6 @@ public class CorrectiveActionDMO {
|
||||
}
|
||||
|
||||
public void RejectSection(int issueID, int userID, string DSection, string comments) {
|
||||
//string subRoles = wfDMO.GetSubRoleItems(issueID, (int)GlobalVars.DocumentType.CorrectiveActionSection);
|
||||
|
||||
// bubble the error
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@UserID", userID);
|
||||
@ -643,131 +627,4 @@ public class CorrectiveActionDMO {
|
||||
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.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Transactions;
|
||||
@ -21,8 +20,6 @@ public class ECN_DMO {
|
||||
|
||||
internal ECN InsertECN(ECN ecn) {
|
||||
DynamicParameters parameters = new();
|
||||
|
||||
parameters = new DynamicParameters();
|
||||
parameters.Add("@ECNNumber", value: ecn.ECNNumber, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||
parameters.Add("@OriginatorID", ecn.OriginatorID);
|
||||
|
||||
@ -33,12 +30,6 @@ public class ECN_DMO {
|
||||
}
|
||||
|
||||
internal void UpdateECN(ECN ecn) {
|
||||
//ECN temp = GetECN(ecn.ECNNumber);
|
||||
//if (temp.Equals(ecn))
|
||||
//{
|
||||
// string s = "good to go...";
|
||||
//}
|
||||
|
||||
DynamicParameters parameters = new();
|
||||
using (TransactionScope transanction = new()) {
|
||||
parameters = new DynamicParameters();
|
||||
@ -82,7 +73,7 @@ public class ECN_DMO {
|
||||
parameters.Add("@FIChangeRequired", ecn.FIChangeRequired);
|
||||
parameters.Add("@NumberOfLotsAffected", ecn.NumberOfLotsAffected);
|
||||
parameters.Add("@RecipeChange", ecn.RecipeChange);
|
||||
//RJK ITAR/EC
|
||||
// RJK ITAR/EC
|
||||
parameters.Add("@IsDocEC", ecn.IsDocEC);
|
||||
db.Execute("ECNUpdate", parameters, commandType: CommandType.StoredProcedure);
|
||||
|
||||
@ -203,11 +194,8 @@ public class ECN_DMO {
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@ECNNumber", value: ecnNumber);
|
||||
parameters.Add("@UserID", userID);
|
||||
//parameters.Add("@UserID", GlobalVars.USER_ID);
|
||||
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)) {
|
||||
ecnItem = multipleResultItems.Read<ECN>().SingleOrDefault();
|
||||
|
||||
@ -285,11 +273,8 @@ public class ECN_DMO {
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@ECNNumber", value: ecnNumber);
|
||||
parameters.Add("@UserID", userID);
|
||||
//parameters.Add("@UserID", GlobalVars.USER_ID);
|
||||
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)) {
|
||||
ecnItem = multipleResultItems.Read<ECN>().SingleOrDefault();
|
||||
|
||||
@ -347,25 +332,11 @@ public class ECN_DMO {
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@ECNNumber", value: ecnNumber);
|
||||
|
||||
//StringBuilder query = new StringBuilder("ECNGetItem");
|
||||
|
||||
using (var multipleResultItems = db.QueryMultiple("ECNGetPdfItem", parameters, commandType: CommandType.StoredProcedure)) {
|
||||
ecnItem = multipleResultItems.Read<ECNPdf>().SingleOrDefault();
|
||||
|
||||
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();
|
||||
//if (ecnItem != null && modules != null)
|
||||
//{
|
||||
// if (modules.Count > 0)
|
||||
// ecnItem.AffectedModules.AddRange(modules);
|
||||
//}
|
||||
|
||||
List<string> attachments = multipleResultItems.Read<string>().ToList();
|
||||
if (ecnItem != null && attachments != null) {
|
||||
if (attachments.Count > 0)
|
||||
@ -426,17 +397,6 @@ public class ECN_DMO {
|
||||
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() {
|
||||
DynamicParameters parameters = new();
|
||||
|
||||
@ -540,7 +500,6 @@ public class ECN_DMO {
|
||||
db.Execute("ECNReSubmitForApproval", parameters, commandType: CommandType.StoredProcedure);
|
||||
|
||||
appoverCount = parameters.Get<int>("@AppoverCount");
|
||||
//allowedITAR = parameters.Get<int>("@AllowedITAR");
|
||||
newECNNumber = parameters.Get<int>("@NewECNNumber");
|
||||
return appoverCount;
|
||||
}
|
||||
@ -751,42 +710,4 @@ public class ECN_DMO {
|
||||
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.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
@ -18,16 +16,11 @@ namespace Fab2ApprovalSystem.DMO;
|
||||
|
||||
public class LotDispositionDMO {
|
||||
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly WorkflowDMO wfDMO = new();
|
||||
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||
|
||||
public LotDispositionDMO(AppSettings appSettings) =>
|
||||
_AppSettings = appSettings;
|
||||
|
||||
public IEnumerable<IssuesViewModel> GetTaskList(int userID) {
|
||||
// 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();
|
||||
parameters.Add("@UserID", userID);
|
||||
@ -121,7 +114,6 @@ public class LotDispositionDMO {
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@IssueID", value: issueID);
|
||||
parameters.Add("@UserID", userID);
|
||||
//parameters.Add("@UserID", GlobalVars.USER_ID);
|
||||
parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||
|
||||
using (var multipleResultItems = db.QueryMultiple("GetLotDispositionItem", parameters, commandType: CommandType.StoredProcedure)) {
|
||||
@ -149,7 +141,6 @@ public class LotDispositionDMO {
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@IssueID", value: issueID);
|
||||
parameters.Add("@UserID", userID);
|
||||
//parameters.Add("@UserID", GlobalVars.USER_ID);
|
||||
parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||
|
||||
using (var multipleResultItems = db.QueryMultiple("GetLotDispositionItemForRead", parameters, commandType: CommandType.StoredProcedure)) {
|
||||
@ -168,7 +159,6 @@ public class LotDispositionDMO {
|
||||
|
||||
public int GetRHLotCount(int 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();
|
||||
}
|
||||
|
||||
@ -200,35 +190,6 @@ public class LotDispositionDMO {
|
||||
|
||||
// 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
|
||||
List<int> lotDispDepIDs = lotDispo.DepartmentIDs;
|
||||
|
||||
@ -443,123 +404,10 @@ public class LotDispositionDMO {
|
||||
lot.ScrapCount = 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);
|
||||
}
|
||||
|
||||
/// <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
|
||||
|
||||
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
|
||||
|
||||
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();
|
||||
parameters.Add("@IssueID", issueID, DbType.Int32);
|
||||
@ -786,7 +554,7 @@ public class LotDispositionDMO {
|
||||
}
|
||||
|
||||
public void UpdateLotStatus(ScrapLot lotStatus) {
|
||||
//if all the wafers in a lot is either "RELEASE" or "SCRAP" from the "SELECT WAFERS SCREEN" set the Lot Status Option accodingly for the particula lot
|
||||
// if all the wafers in a lot is either "RELEASE" or "SCRAP" from the "SELECT WAFERS SCREEN" set the Lot Status Option accodingly for the particula lot
|
||||
int tempLotStatus;
|
||||
if ((lotStatus.ReleaseCount == lotStatus.WaferCount || lotStatus.ScrapCount == lotStatus.WaferCount) && (lotStatus.ReleaseCount > 0 || lotStatus.WaferCount > 0)) {
|
||||
// set the LotStatus appropriately because the entire lot either is set to "RELEASE" or "SCRAP"'
|
||||
@ -951,16 +719,12 @@ public class LotDispositionDMO {
|
||||
totalReleaseCost += releaseCost;
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
return new LotDispositionLotSummaryViewModel() {
|
||||
LotCount = lotCount,
|
||||
ReleaseCost = string.Format("{0:C}", totalReleaseCost),
|
||||
//Math.Round(totalReleaseCost, 2).ToString(,
|
||||
ReleaseWaferCount = totalWaferReleaseCount,
|
||||
ReleaseDieCount = totalDieReleaseCount,
|
||||
ScrapCost = string.Format("{0:C}", totalScrapCost),
|
||||
//Math.Round(totalScrapCost, 2),
|
||||
ScrapWaferCount = totalWaferScrapCount,
|
||||
ScrapDieCount = totalDieScrapCount
|
||||
|
||||
@ -1036,61 +800,4 @@ public class LotDispositionDMO {
|
||||
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.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Transactions;
|
||||
@ -17,13 +16,9 @@ namespace Fab2ApprovalSystem.DMO;
|
||||
|
||||
public class LotTravelerDMO {
|
||||
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||
private readonly WorkflowDMO wfDMO = new();
|
||||
|
||||
public LotTravelerDMO(AppSettings appSettings) =>
|
||||
_AppSettings = appSettings;
|
||||
|
||||
/// <returns></returns>
|
||||
///
|
||||
internal LTWorkRequest InsertWorkRequest(LTWorkRequest workRequest) {
|
||||
@ -59,9 +54,6 @@ public class LotTravelerDMO {
|
||||
workRequestItem.ModuleIDs.AddRange(modules);
|
||||
}
|
||||
|
||||
//var holdsteps = multipleResultItems.Read<LTHoldStep>().SingleOrDefault();
|
||||
//workRequestItem.LTHoldStep = holdsteps;
|
||||
|
||||
isITAR = parameters.Get<int>("@IsITAR");
|
||||
|
||||
}
|
||||
@ -121,9 +113,6 @@ public class LotTravelerDMO {
|
||||
workRequestItem.ModuleIDs.AddRange(modules);
|
||||
}
|
||||
|
||||
//var holdsteps = multipleResultItems.Read<LTHoldStep>().SingleOrDefault();
|
||||
//workRequestItem.LTHoldStep = holdsteps;
|
||||
|
||||
isITAR = parameters.Get<int>("@IsITAR");
|
||||
|
||||
}
|
||||
@ -149,7 +138,6 @@ public class LotTravelerDMO {
|
||||
parameters.Add("@AllocationToUse", data.AllocationToUse);
|
||||
parameters.Add("@PredictedCyleTime", data.PredictedCyleTime);
|
||||
parameters.Add("@DeptChargedForRawWafers", data.ChargeDepartment);
|
||||
//parameters.Add("@EstimatedBinCLoseDate", data.EstimatedBinCLoseDate);
|
||||
parameters.Add("@TotalQty", data.TotalQty);
|
||||
parameters.Add("@WIPArea", data.WIPArea);
|
||||
parameters.Add("@LotStartDate", data.LotStartDate);
|
||||
@ -422,11 +410,6 @@ public class LotTravelerDMO {
|
||||
|
||||
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) {
|
||||
@ -443,8 +426,6 @@ public class LotTravelerDMO {
|
||||
|
||||
db.Execute("LTUpdateHoldStep", parameters, commandType: CommandType.StoredProcedure);
|
||||
|
||||
//int id = parameters.Get<int>("@LTHoldStepID");
|
||||
//model.ID = id;
|
||||
}
|
||||
|
||||
internal void InsertHoldStepRevision(LTHoldStep model) {
|
||||
@ -470,7 +451,6 @@ public class LotTravelerDMO {
|
||||
int result = 0;
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@LTHoldStepID", model.ID, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||
//parameters.Add("@BaseFlow", model.BaseFlow);
|
||||
parameters.Add("@BaseFlowLocation", model.Location);
|
||||
parameters.Add("@BaseFlowOperationSeq", model.OperSequence);
|
||||
parameters.Add("@BaseFlowOperation", model.Operation);
|
||||
@ -478,16 +458,8 @@ public class LotTravelerDMO {
|
||||
parameters.Add("@ChangeInstruction", model.ChangeInstructions);
|
||||
parameters.Add("@LTWorkRequestID", model.LTWorkRequestID);
|
||||
parameters.Add("@UpdatedBy", model.UpdatedBy);
|
||||
//parameters.Add("@Result", result, direction: ParameterDirection.InputOutput);
|
||||
|
||||
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) {
|
||||
@ -524,7 +496,6 @@ public class LotTravelerDMO {
|
||||
}
|
||||
|
||||
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();
|
||||
parameters.Add("@HoldStepID", holdStepID);
|
||||
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) {
|
||||
//var holdStepAttachments = this.db.Query<LTWorkRequestAttachment>("SELECT * FROM LTWorkRequestAttachment WHERE HoldStepID = @HoldStep ORDER BY UploadDateTime", new { holdStep }, commandType: CommandType.Text).ToList();
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@LTHoldStepID", ltHoldStepID);
|
||||
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) {
|
||||
//var holdStepAttachments = this.db.Query<LTWorkRequestAttachment>("SELECT * FROM LTWorkRequestAttachment WHERE HoldStepID = @HoldStep ORDER BY UploadDateTime", new { holdStep }, commandType: CommandType.Text).ToList();
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@WorkRequestID", workRequestID);
|
||||
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);
|
||||
|
||||
//int lotID = parameters.Get<int>("@LotID");
|
||||
if (parameters.Get<int>("@WRWithExistingLot") != 0) {
|
||||
lot.WRWithExistingLot = parameters.Get<int>("@WRWithExistingLot");
|
||||
}
|
||||
|
||||
//return lotID;
|
||||
}
|
||||
|
||||
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("WHERE WR.SWRNumber = @SWRNumber ORDER BY LotNumber ");
|
||||
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;
|
||||
}
|
||||
|
||||
@ -999,7 +965,6 @@ public class LotTravelerDMO {
|
||||
|
||||
}
|
||||
|
||||
//var data = this.db.Query<LotTravelerPdf>("LTGetLotTravelerForPDF", parameters, commandType: CommandType.StoredProcedure).Single();
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -1088,220 +1053,4 @@ public class LotTravelerDMO {
|
||||
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.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Transactions;
|
||||
|
||||
using Dapper;
|
||||
@ -28,8 +25,6 @@ public class MRB_DMO {
|
||||
|
||||
internal MRB InsertMRB(MRB mrb) {
|
||||
DynamicParameters parameters = new();
|
||||
|
||||
parameters = new DynamicParameters();
|
||||
parameters.Add("@MRBNumber", value: mrb.MRBNumber, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||
parameters.Add("@OriginatorID", mrb.OriginatorID);
|
||||
|
||||
@ -116,28 +111,12 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
internal MRB GetMRBItem(int mrbNumber, out int isITAR, int userID) {
|
||||
//IsITAR
|
||||
// IsITAR
|
||||
// 0 = false
|
||||
// 1 = true
|
||||
// 2 = not required
|
||||
@ -208,10 +187,6 @@ public class MRB_DMO {
|
||||
}
|
||||
|
||||
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();
|
||||
List<Disposition> disposition = db.Query<Disposition, CloseToQDBOptionViewModel, Disposition>
|
||||
(
|
||||
@ -266,8 +241,6 @@ public class MRB_DMO {
|
||||
}
|
||||
|
||||
internal IEnumerable<MRBHoldFlagReport> GetMRBHoldFlagReport(int mrbNumber) {
|
||||
//db.Open();
|
||||
|
||||
string sql = "SELECT * FROM MRBHoldFlagReport WHERE MRBNumber = @MRBNumber ORDER BY LotNo";
|
||||
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) {
|
||||
//db.Open();
|
||||
|
||||
string sql = "SELECT * FROM MRBLotsToBeSentToSPN WHERE MRBNumber = @MRBNumber ORDER BY LotNumber";
|
||||
List<MRBLotsTobeSentToSPN> data = db.Query<MRBLotsTobeSentToSPN>(sql, new { MRBNumber = mrbNumber }).ToList();
|
||||
|
||||
@ -284,7 +255,6 @@ public class MRB_DMO {
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
internal MRB GetToolIssueStartEndDateData(int mrbNumber, IDbTransaction dbTrans = null) {
|
||||
@ -322,17 +292,6 @@ public class MRB_DMO {
|
||||
var analysisTime = DateTime.Now;
|
||||
|
||||
// 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
|
||||
|
||||
DateTime? incidentTime = null;
|
||||
@ -340,7 +299,6 @@ public class MRB_DMO {
|
||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||
incidentTime = db.Query<DateTime?>(
|
||||
"SELECT MIN(OutTime) FROM WO_RECORD_MJ " +
|
||||
//"SELECT MIN(OutTime) FROM vFAB2SPN_WO_RECORD " +
|
||||
"WHERE WO_LOT_NO = @LotNo " +
|
||||
"AND WO_STATION_ID IN @Tools " +
|
||||
"AND (InTime BETWEEN @StartDate AND @EndDate " +
|
||||
@ -377,14 +335,12 @@ public class MRB_DMO {
|
||||
string parmsXML =
|
||||
new System.Xml.Linq.XElement("IssueStartDate", issueStartDate).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();
|
||||
IEnumerable<LotSplitAnalysisResult> analysisResults = null;
|
||||
|
||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||
analysisResults = db.Query<LotSplitAnalysisResult>(
|
||||
"AnalyzeLotAncestry_TEST",
|
||||
//"AnalyzeLotAncestry",
|
||||
new {
|
||||
LotNo = incidentLotNo,
|
||||
IncidentTime = incidentTime,
|
||||
@ -524,15 +480,11 @@ public class MRB_DMO {
|
||||
/// </summary>
|
||||
|
||||
internal bool ChildLotsUpdateInSPNWithNewDispoType(Lot parentLot, MRB mrb) {
|
||||
//db.Open();
|
||||
|
||||
//var dbTrans = db.BeginTransaction();
|
||||
var analysisTime = DateTime.Now;
|
||||
DateTime? incidentTime = null;
|
||||
//var tools = ((string)mrb.ToolCSV).Split(',');
|
||||
|
||||
//This is the "time", when the lot was first uploaded into the system
|
||||
//Get the child lots that were split after this datetime
|
||||
// This is the "time", when the lot was first uploaded into the system
|
||||
// Get the child lots that were split after this datetime
|
||||
|
||||
incidentTime = db.Query<DateTime?>(
|
||||
"SELECT InsertDateTimeStamp FROM MRBLot " +
|
||||
@ -583,10 +535,6 @@ public class MRB_DMO {
|
||||
db.Open();
|
||||
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();
|
||||
try {
|
||||
// insert lots
|
||||
@ -744,31 +692,9 @@ public class MRB_DMO {
|
||||
|
||||
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,)
|
||||
//MRB mrbInfo = GetToolIssueStartEndDateData(lot.MRBNumber, dbTrans);
|
||||
// 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);
|
||||
|
||||
//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();
|
||||
|
||||
} catch {
|
||||
@ -817,18 +743,6 @@ public class MRB_DMO {
|
||||
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) {
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@AttachmentID", attachmentID);
|
||||
@ -846,11 +760,6 @@ public class MRB_DMO {
|
||||
}
|
||||
|
||||
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();
|
||||
parameters.Add("@MRBNumber", mrbNumber);
|
||||
|
||||
@ -864,7 +773,6 @@ public class MRB_DMO {
|
||||
parameters.Add("@ContainmentActionID", model.ContainmentActionID, DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||
parameters.Add("@MRBNumber", model.MRBNumber);
|
||||
parameters.Add("@ContainmentAction", model.ContainmentAction);
|
||||
//parameters.Add("@ResponsibilityOwner", model.ResponsibilityOwner);
|
||||
parameters.Add("@ResponsibilityOwnerID", model.ResponsibilityOwnerID);
|
||||
parameters.Add("@ECD", model.ECD);
|
||||
parameters.Add("@ImplementedDate", model.ImplementedDate);
|
||||
@ -880,7 +788,6 @@ public class MRB_DMO {
|
||||
parameters.Add("@ContainmentActionID", model.ContainmentActionID);
|
||||
parameters.Add("@ContainmentAction", model.ContainmentAction);
|
||||
parameters.Add("@ResponsibilityOwnerID", model.ResponsibilityOwnerID);
|
||||
//parameters.Add("@ResponsibilityOwner", model.ResponsibilityOwner);
|
||||
parameters.Add("@ECD", model.ECD);
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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) =>
|
||||
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) {
|
||||
string[] tempData = data.Split(new char[] { '~' });
|
||||
|
||||
@ -981,12 +873,6 @@ public class MRB_DMO {
|
||||
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() {
|
||||
DynamicParameters parameters = new();
|
||||
List<CAUserList> userList = db.Query<CAUserList>("_8DGetUserList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||
@ -1013,319 +899,4 @@ public class MRB_DMO {
|
||||
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 = "";
|
||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||
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 + "%' ";
|
||||
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";
|
||||
@ -73,13 +72,6 @@ public class MiscDMO {
|
||||
sql.Append("SELECT PartNumber + '~' + SiliconPart + '~' + ProcessFlow + '~' + PartDescription AS WIPPartData ");
|
||||
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();
|
||||
db.Close();
|
||||
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("WHERE WP_Lot_No = @LotNumber ");
|
||||
|
||||
//var tempLotNumber = lot.LotNumber.Substring(0, 9);
|
||||
var tempLotNumber = "";
|
||||
if (lot.LotNumber.IndexOf('/') >= 0) {
|
||||
tempLotNumber = lot.LotNumber.Substring(0, lot.LotNumber.IndexOf('/'));
|
||||
@ -113,7 +104,7 @@ public class MiscDMO {
|
||||
// The data is returned from a view which is a combination from various sources and at times when the
|
||||
// Lot is at the QDB location, which is extracted out of SAP, it also shows up at the 6600 location in SPN.
|
||||
// There is a duplication.
|
||||
//if the result returns 2 records , QDB overrides the other location (6600)
|
||||
// if the result returns 2 records , QDB overrides the other location (6600)
|
||||
if (lot.Location == "QDB" && lotInfoColumn.WP_CURRENT_LOCATION == "6600")
|
||||
lot.Location = "QDB";
|
||||
else
|
||||
@ -130,14 +121,13 @@ public class MiscDMO {
|
||||
} catch { } // ignore the error
|
||||
|
||||
try {
|
||||
//lot.Gen = double.Parse(temp[2].Substring(1, temp[2].Length - 1));
|
||||
if (lot.Description.StartsWith("MA,"))
|
||||
lot.Gen = temp[2];
|
||||
else
|
||||
lot.Gen = temp[2].Substring(1, temp[2].Length - 1);
|
||||
} catch { }// ignore the error
|
||||
try {
|
||||
//lot.Hexsize = double.Parse(temp[6]);
|
||||
// lot.Hexsize = double.Parse(temp[6]);
|
||||
lot.Hexsize = temp[6];
|
||||
} catch { }// ignore the error
|
||||
|
||||
@ -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.
|
||||
//if (lot.DieCost > 0)
|
||||
// lot.Location = "QDB";
|
||||
|
||||
if (lotInfoColumn.MP_QUALITY_CODE != null)
|
||||
lot.QualityCode = lotInfoColumn.MP_QUALITY_CODE.Trim();
|
||||
@ -193,12 +181,8 @@ public class MiscDMO {
|
||||
}
|
||||
|
||||
db.Close();
|
||||
//return lotStatusOption;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// /
|
||||
/// </summary>
|
||||
public static IEnumerable<UserProfile> GetUserList() {
|
||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||
|
||||
@ -358,14 +342,6 @@ public class MiscDMO {
|
||||
public static void GetLTLotInformation(LTLot lot) {
|
||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||
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("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("WHERE WP_LOT_NO = @LotNumber ");
|
||||
|
||||
//var tempLotNumber = lot.LotNumber.Substring(0, 9);
|
||||
|
||||
var tempLotNumber = "";
|
||||
if (lot.LotNumber.IndexOf('/') >= 0) {
|
||||
tempLotNumber = lot.LotNumber.Substring(0, lot.LotNumber.IndexOf('/'));
|
||||
@ -437,7 +411,6 @@ public class MiscDMO {
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@ApprovalId", approvalId);
|
||||
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.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using Dapper;
|
||||
@ -13,12 +12,8 @@ namespace Fab2ApprovalSystem.DMO;
|
||||
|
||||
public class PartsRequestDMO {
|
||||
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||
|
||||
public PartsRequestDMO(AppSettings appSettings) =>
|
||||
_AppSettings = appSettings;
|
||||
|
||||
public IEnumerable<PartsRequestList> GetPartsRequestList() {
|
||||
List<PartsRequestList> r = db.Query<PartsRequestList>("PartsRequestGetList", commandType: CommandType.StoredProcedure).ToList();
|
||||
return r;
|
||||
@ -114,28 +109,4 @@ public class PartsRequestDMO {
|
||||
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) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,6 @@ public class TrainingDMO {
|
||||
|
||||
public int Create(int issueId) {
|
||||
DynamicParameters parameters = new();
|
||||
|
||||
parameters = new DynamicParameters();
|
||||
parameters.Add("@TrainingId", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||
parameters.Add("@ECNNumber", issueId);
|
||||
|
||||
@ -32,9 +30,6 @@ public class TrainingDMO {
|
||||
|
||||
public int CreateAssignment(int trainingId, int userId) {
|
||||
DynamicParameters parameters = new();
|
||||
|
||||
parameters = new DynamicParameters();
|
||||
//parameters.Add("@TrainingId", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||
parameters.Add("@TrainingID", trainingId);
|
||||
parameters.Add("@UserID", userId);
|
||||
parameters.Add("@AssignmentID", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||
@ -147,9 +142,6 @@ public class TrainingDMO {
|
||||
public void AddTrainingGroupToECN(int ECNNumber, int groupId) {
|
||||
#if !NET8
|
||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||
//ECNTrainingBy ecnTraining = new ECNTrainingBy();
|
||||
//ecnTraining.AcknowledgementTrainingByID = groupId;
|
||||
//ecnTraining.ECNNumber = ECNNumber;
|
||||
|
||||
var parameters = new DynamicParameters();
|
||||
parameters.Add("@ECNNumber", ECNNumber);
|
||||
@ -157,7 +149,6 @@ public class TrainingDMO {
|
||||
|
||||
this.db.Execute("ECNInsertTrainingBy", parameters, commandType: CommandType.StoredProcedure);
|
||||
|
||||
//db.ECNTrainingBies.Add(ecnTraining);
|
||||
#else
|
||||
throw new NotImplementedException();
|
||||
#endif
|
||||
@ -166,16 +157,11 @@ public class TrainingDMO {
|
||||
public void SetTrainingFlag(int ECNNumber) {
|
||||
#if !NET8
|
||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||
//ECNTrainingBy ecnTraining = new ECNTrainingBy();
|
||||
//ecnTraining.AcknowledgementTrainingByID = groupId;
|
||||
//ecnTraining.ECNNumber = ECNNumber;
|
||||
|
||||
var parameters = new DynamicParameters();
|
||||
parameters.Add("@ECNNumber", ECNNumber);
|
||||
|
||||
this.db.Execute("ECNSetTrainingFlag", parameters, commandType: CommandType.StoredProcedure);
|
||||
|
||||
//db.ECNTrainingBies.Add(ecnTraining);
|
||||
#else
|
||||
throw new NotImplementedException();
|
||||
#endif
|
||||
@ -235,10 +221,7 @@ public class TrainingDMO {
|
||||
|
||||
public void AcknowledgeDocument(int trainingDocAckID) {
|
||||
DynamicParameters parameters = new();
|
||||
|
||||
parameters = new DynamicParameters();
|
||||
parameters.Add("@TrainingDocAckID", trainingDocAckID);
|
||||
//parameters.Add("@AttachmentID", attachmentID);
|
||||
|
||||
db.Execute("TrainingAcknowledgeDocument", parameters, commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
@ -337,7 +320,7 @@ public class TrainingDMO {
|
||||
#if !NET8
|
||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||
bool isFinished = true;
|
||||
//TrainingDocAck docsAssigned = null;
|
||||
// TrainingDocAck docsAssigned = null;
|
||||
|
||||
var docsAssigned = from a in db.TrainingDocAcks where a.TrainingAssignmentID == trainingAssignmentID && a.Deleted != true select a;
|
||||
|
||||
@ -447,7 +430,6 @@ public class TrainingDMO {
|
||||
foreach (TrainingAssignment trainingAssignment in trainingAssignments) {
|
||||
DeleteTrainingAssignment(trainingAssignment.ID);
|
||||
DeleteTrainingDocAck(trainingAssignment.ID);
|
||||
//db.SaveChanges();
|
||||
}
|
||||
#else
|
||||
throw new NotImplementedException();
|
||||
@ -461,9 +443,9 @@ public class TrainingDMO {
|
||||
var userAssignments = (from a in db.TrainingAssignments where a.UserID == userId select a).ToList();
|
||||
|
||||
foreach (var item in userAssignments) {
|
||||
//get document assignments
|
||||
// get document assignments
|
||||
var docAssignments = (from a in db.TrainingDocAcks where a.TrainingAssignmentID == item.TrainingID select a).ToList();
|
||||
//delete each docAssignment
|
||||
// delete each docAssignment
|
||||
foreach (var docAssignment in docAssignments) {
|
||||
DeleteTrainingDocAck(docAssignment.ID);
|
||||
}
|
||||
@ -479,15 +461,15 @@ public class TrainingDMO {
|
||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||
TrainingDocAck ack = (from a in db.TrainingDocAcks where a.ID == docAckId select a).FirstOrDefault();
|
||||
|
||||
//TODO Check the user is valid
|
||||
// TODO Check the user is valid
|
||||
|
||||
//Check that the assignment exists
|
||||
// Check that the assignment exists
|
||||
if (ack != null) {
|
||||
//Check that the assignment isn't deleted
|
||||
// Check that the assignment isn't deleted
|
||||
if (ack.Deleted == true) {
|
||||
return false;
|
||||
}
|
||||
//Check that the assignment isn't completed
|
||||
// Check that the assignment isn't completed
|
||||
else if (ack.Reviewed == true) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -17,11 +17,6 @@ public class UserAccountDMO {
|
||||
|
||||
public IEnumerable<LoginModel> GetAllUsers() {
|
||||
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("FROM Users U LEFT JOIN Users U1 ON U.DelegatedTo = U1.UserID ");
|
||||
sql.Append("ORDER BY FirstName ");
|
||||
@ -31,11 +26,6 @@ public class UserAccountDMO {
|
||||
|
||||
public IEnumerable<LoginModel> GetAllActiveUsers() {
|
||||
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("FROM Users U LEFT JOIN Users U1 ON U.DelegatedTo = U1.UserID ");
|
||||
sql.Append("WHERE U.IsActive = 1 ");
|
||||
@ -45,9 +35,6 @@ public class UserAccountDMO {
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
public LoginModel GetUserByID(int userID) {
|
||||
@ -79,7 +66,6 @@ public class UserAccountDMO {
|
||||
|
||||
internal void DeleteUser(LoginModel model) {
|
||||
string sql;
|
||||
//sql = "DELETE Users WHERE UserID = @UserID";
|
||||
sql = "UPDATE Users SET IsActive = 0 WHERE UserID = @UserID";
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@UserID", model.UserID);
|
||||
@ -88,8 +74,6 @@ public class UserAccountDMO {
|
||||
}
|
||||
|
||||
internal void InsertUser(LoginModel model) {
|
||||
//string sql;
|
||||
//sql = "INSERT Users (LoginID, FirstName, LastName, IsAdmin) VALUES (@LoginID, @FirstName, @LastName, @IsAdmin )";
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@UserID", model.UserID, DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||
parameters.Add("@LoginID", model.LoginID);
|
||||
|
@ -15,18 +15,6 @@ namespace Fab2ApprovalSystem.DMO;
|
||||
public class WorkflowDMO {
|
||||
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) {
|
||||
List<string> subRoleItems = 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
|
||||
*/
|
||||
|
||||
//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.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 -
|
||||
// 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
|
||||
// Per Hans, do not include directors if PE required is checked
|
||||
@ -300,7 +279,6 @@ public class WorkflowDMO {
|
||||
int recordCount = 0;
|
||||
// EMERGENCY TECNS ==============================================================================================
|
||||
if (GlobalVars.DocumentType.EECN == (GlobalVars.DocumentType)documentType) {
|
||||
//subRoleItems.Add("'QA Pre Approver'");
|
||||
qryString.Clear();
|
||||
qryString.Append("SELECT DISTINCT SRC.SubRoleCategoryItem FROM DocumentType D ");
|
||||
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 SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID ");
|
||||
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();
|
||||
foreach (var dataRow in dataRows) {
|
||||
subRoleItems.Add("'" + dataRow.SubRoleCategoryItem.ToString() + "'");
|
||||
}
|
||||
//subRoleItems.Add("'QA Final Approver'");
|
||||
} //===============================================================================================================
|
||||
else {
|
||||
} else {
|
||||
subRoleItems.Add("'QA Pre Approver'");
|
||||
// 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.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();
|
||||
@ -346,13 +312,6 @@ public class WorkflowDMO {
|
||||
recordCount = db.Query<int>(qryString.ToString(), new { ECNNumber = ecnNumber }).Single();
|
||||
if (recordCount > 0) {
|
||||
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
|
||||
@ -361,13 +320,6 @@ public class WorkflowDMO {
|
||||
recordCount = db.Query<int>(qryString.ToString(), new { ECNNumber = ecnNumber }).Single();
|
||||
if (recordCount > 0) {
|
||||
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
|
||||
@ -376,13 +328,6 @@ public class WorkflowDMO {
|
||||
recordCount = db.Query<int>(qryString.ToString(), new { ECNNumber = ecnNumber }).Single();
|
||||
if (recordCount > 0) {
|
||||
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
|
||||
@ -392,21 +337,12 @@ public class WorkflowDMO {
|
||||
if (recordCount > 0) {
|
||||
subRoleItems.Add("'NewPartFlow'");
|
||||
subRoleItems.Add("'SPN-Execution'");
|
||||
//subRoleItems.Add("'TestProgram'");
|
||||
subRoleItems.Add("'Metrology Change'");
|
||||
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("'Training Notification'");
|
||||
//=======================================================================================================================
|
||||
|
||||
// Execution level========================================================================================================
|
||||
// Get the "SPN" SubRole
|
||||
@ -414,15 +350,6 @@ public class WorkflowDMO {
|
||||
qryString.Append("SELECT COUNT(*) FROM ECN WHERE ECNNumber= @ECNNumber AND (SPNChangeRequired = 1) ");
|
||||
recordCount = db.Query<int>(qryString.ToString(), new { ECNNumber = ecnNumber }).Single();
|
||||
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
|
||||
@ -622,11 +549,9 @@ public class WorkflowDMO {
|
||||
|
||||
public string ReAssignApproval(int issueID, int assignedFromUser, int assignedToUser, byte step, int docType) {
|
||||
string email = "";
|
||||
//string emailArray = "";
|
||||
string emailIDArray = "";
|
||||
|
||||
DynamicParameters parameters = new();
|
||||
;
|
||||
email = "";
|
||||
parameters = new DynamicParameters();
|
||||
parameters.Add("@IssueID", issueID);
|
||||
@ -644,11 +569,9 @@ public class WorkflowDMO {
|
||||
|
||||
public string DelegateDocumentApproval(int issueID, int delegateFromUser, int delegateToUser) {
|
||||
string email = "";
|
||||
//string emailArray = "";
|
||||
string emailID = "";
|
||||
|
||||
DynamicParameters parameters = new();
|
||||
;
|
||||
email = "";
|
||||
parameters = new DynamicParameters();
|
||||
parameters.Add("@IssueID", issueID);
|
||||
@ -664,13 +587,11 @@ public class WorkflowDMO {
|
||||
|
||||
public string AddAdditionalApproval(int issueID, string userIDs, byte step, int documentType) {
|
||||
string email = "";
|
||||
//string emailArray = "";
|
||||
string emailIDArray = "";
|
||||
|
||||
string[] arrayOfUsers = userIDs.Split(new char[] { '~' });
|
||||
|
||||
DynamicParameters parameters = new();
|
||||
;
|
||||
for (int i = 0; i < arrayOfUsers.Length; i++) {
|
||||
email = "";
|
||||
parameters = new DynamicParameters();
|
||||
@ -689,14 +610,12 @@ public class WorkflowDMO {
|
||||
|
||||
public string AddEECNApproval(int ecnNumber, byte step, int documentType, string engUserIDs, string opUserIDs) {
|
||||
string email = "";
|
||||
//string emailArray = "";
|
||||
string emailIDArray = "";
|
||||
|
||||
string[] arrayOfUsers = engUserIDs.Split(new char[] { '~' });
|
||||
|
||||
//Engineering SubRole
|
||||
// Engineering SubRole
|
||||
DynamicParameters parameters = new();
|
||||
;
|
||||
for (int i = 0; i < arrayOfUsers.Length; i++) {
|
||||
email = "";
|
||||
parameters = new DynamicParameters();
|
||||
@ -714,7 +633,6 @@ public class WorkflowDMO {
|
||||
// Operations SubRole
|
||||
arrayOfUsers = opUserIDs.Split(new char[] { '~' });
|
||||
parameters = new DynamicParameters();
|
||||
;
|
||||
for (int i = 0; i < arrayOfUsers.Length; i++) {
|
||||
email = "";
|
||||
parameters = new DynamicParameters();
|
||||
|
@ -275,16 +275,26 @@
|
||||
<Compile Include="DMO\WorkflowDMO.cs" />
|
||||
<Compile Include="Jobs\OOOTrainingReportJob.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\Documentum.cs" />
|
||||
<Compile Include="Misc\ECNHelper.cs" />
|
||||
<Compile Include="Misc\EmailNotification.cs" />
|
||||
<Compile Include="Misc\ExcelData.cs" />
|
||||
<Compile Include="Misc\ftplib.cs" />
|
||||
<Compile Include="Misc\FTPWrapper.cs" />
|
||||
<Compile Include="Misc\Functions.cs" />
|
||||
<Compile Include="Misc\GlobalVars.cs" />
|
||||
<Compile Include="Misc\HomeHelper.cs" />
|
||||
<Compile Include="Misc\LotDispositionHelper.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\TrainingHelper.cs" />
|
||||
<Compile Include="Misc\UserProfileDTO.cs" />
|
||||
<Compile Include="Misc\Zipper.cs" />
|
||||
<Compile Include="Models\AccountViewModels.cs" />
|
||||
|
@ -63,7 +63,7 @@ public class MvcApplication : System.Web.HttpApplication {
|
||||
protected void Application_EndRequest() {
|
||||
var context = new HttpContextWrapper(Context);
|
||||
|
||||
//Do a direct 401 unauthorized
|
||||
// Do a direct 401 unauthorized
|
||||
if (Context.Response.StatusCode == 301 && context.Request.IsAjaxRequest()) {
|
||||
Context.Response.Clear();
|
||||
Context.Response.StatusCode = 401;
|
||||
@ -79,11 +79,11 @@ public class MvcApplication : System.Web.HttpApplication {
|
||||
}
|
||||
|
||||
protected void Session_End(object sender, EventArgs e) {
|
||||
//FormsAuthentication.SignOut();
|
||||
// FormsAuthentication.SignOut();
|
||||
try {
|
||||
Session[GlobalVars.SESSION_USERNAME] = "";
|
||||
Session[GlobalVars.SESSION_USERID] = "";
|
||||
Session[GlobalVars.IS_ADMIN] = "";
|
||||
Session[GlobalVars.IS_ADMIN] = null;
|
||||
} catch (Exception ex) {
|
||||
Functions.WriteEvent(null, @User.Identity.Name + "\r\n Session Closed - \r\n" + ex.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
||||
}
|
||||
|
@ -23,15 +23,15 @@ public class OOOTrainingReportJob : IJob {
|
||||
emailBody += "<p>The following contains open training assignments in the Mesa Approval system for out of office users.";
|
||||
emailBody += " Please ensure they complete their training assignments promptly upon their return.</p><br />";
|
||||
emailBody += "<style>table,th,td{border: 1px solid black;}</style>";
|
||||
//Get all users set up to receive the training report email.
|
||||
// Get all users set up to receive the training report email.
|
||||
List<TrainingReportUser> trainingReportUsers = adminDMO.GetTrainingReportUsers();
|
||||
List<string> emailList = new();
|
||||
foreach (TrainingReportUser user in trainingReportUsers) {
|
||||
string userEmail = userDMO.GetUserByID(user.UserId).Email;
|
||||
emailList.Add(userEmail);
|
||||
}
|
||||
//emailList.Add("Chase.Tucker@infineon.com");
|
||||
//Get a list of open trainings
|
||||
// emailList.Add("Chase.Tucker@infineon.com");
|
||||
// Get a list of open trainings
|
||||
List<Training> openTrainings = trainingDMO.GetAllOpenTrainings();
|
||||
|
||||
foreach (Training training in openTrainings) {
|
||||
|
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) =>
|
||||
_AppSettings = appSettings;
|
||||
|
||||
public EmailNotification(Models.AppSettings appSettings, string EmailHeaderSubject) {
|
||||
_AppSettings = appSettings;
|
||||
_subject = EmailHeaderSubject;
|
||||
_TemplatesPath = appSettings.EmailTemplatesPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Constructor Function
|
||||
/// </summary>
|
||||
@ -52,16 +58,15 @@ public class EmailNotification {
|
||||
protected string ReadEmailFile(string FileName) {
|
||||
string retVal = null;
|
||||
try {
|
||||
//setting the file name path
|
||||
string path = _TemplatesPath + FileName;
|
||||
#if !NET8
|
||||
FileInfo TheFile = new FileInfo(System.Web.HttpContext.Current.Server.MapPath(path));
|
||||
|
||||
//check if the file exists in the location.
|
||||
// check if the file exists in the location.
|
||||
if (!TheFile.Exists)
|
||||
throw new Exception("Could Not Find the file : " + FileName + " in the location " + _TemplatesPath); // throw an exception here.
|
||||
|
||||
//start reading the file. i have used Encoding 1256 to support arabic text also.
|
||||
// start reading the file. i have used Encoding 1256 to support arabic text also.
|
||||
StreamReader sr = new StreamReader(System.Web.HttpContext.Current.Server.MapPath(@path), System.Text.Encoding.GetEncoding(1256));
|
||||
retVal = sr.ReadToEnd(); // getting the entire text from the file.
|
||||
sr.Close();
|
||||
@ -88,21 +93,19 @@ public class EmailNotification {
|
||||
msg.IsBodyHtml = true;// email body will allow html elements
|
||||
|
||||
// setting the Sender Email ID
|
||||
//msg.From = new MailAddress(SenderEmail, SenderName);
|
||||
msg.From = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
|
||||
msg.Sender = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
|
||||
// adding the Recepient Email ID
|
||||
msg.To.Add(Recep);
|
||||
//msg.To.Add("Jonathan.Ouellette@infineon.com");
|
||||
// add CC email ids if supplied.
|
||||
if (!string.IsNullOrEmpty(cc))
|
||||
msg.CC.Add(cc);
|
||||
|
||||
//setting email subject and body
|
||||
// setting email subject and body
|
||||
msg.Subject = email_title;
|
||||
msg.Body = email_body;
|
||||
|
||||
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||
// create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||
SmtpClient SmtpMail = new("mailrelay-internal.infineon.com");
|
||||
|
||||
// sending the message.
|
||||
@ -130,12 +133,12 @@ public class EmailNotification {
|
||||
if (!string.IsNullOrEmpty(cc))
|
||||
msg.CC.Add(cc);
|
||||
|
||||
//setting email subject and body
|
||||
// setting email subject and body
|
||||
msg.Subject = email_title;
|
||||
msg.Body = email_body;
|
||||
msg.Attachments.Add(new Attachment(attachmentPath));
|
||||
|
||||
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||
// create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||
SmtpClient SmtpMail = new();
|
||||
#if(!DEBUG)
|
||||
// sending the message.
|
||||
@ -150,7 +153,6 @@ public class EmailNotification {
|
||||
msg.IsBodyHtml = true;// email body will allow html elements
|
||||
|
||||
// setting the Sender Email ID
|
||||
//msg.From = new MailAddress(SenderEmail, SenderName);
|
||||
msg.From = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
|
||||
// adding the Recepient Email ID
|
||||
foreach (string recepient in RecepientList) {
|
||||
@ -161,11 +163,11 @@ public class EmailNotification {
|
||||
if (!string.IsNullOrEmpty(cc))
|
||||
msg.CC.Add(cc);
|
||||
|
||||
//setting email subject and body
|
||||
// setting email subject and body
|
||||
msg.Subject = email_title;
|
||||
msg.Body = email_body;
|
||||
|
||||
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||
// create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||
SmtpClient SmtpMail = new();
|
||||
|
||||
// sending the message.
|
||||
@ -196,12 +198,12 @@ public class EmailNotification {
|
||||
if (!string.IsNullOrEmpty(cc))
|
||||
msg.CC.Add(cc);
|
||||
|
||||
//setting email subject and body
|
||||
// setting email subject and body
|
||||
msg.Subject = email_title;
|
||||
msg.Body = email_body;
|
||||
msg.Attachments.Add(new Attachment(attachmentPath));
|
||||
|
||||
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||
// create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||
SmtpClient SmtpMail = new();
|
||||
|
||||
// sending the message.
|
||||
@ -223,14 +225,14 @@ public class EmailNotification {
|
||||
if (!string.IsNullOrEmpty(cc))
|
||||
msg.CC.Add(cc);
|
||||
|
||||
//setting email subject and body
|
||||
// setting email subject and body
|
||||
msg.Subject = email_title;
|
||||
msg.Body = email_body;
|
||||
foreach (string attachment in attachments) {
|
||||
msg.Attachments.Add(new Attachment(attachment));
|
||||
}
|
||||
|
||||
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||
// create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||
SmtpClient SmtpMail = new();
|
||||
#if(!DEBUG)
|
||||
// sending the message.
|
||||
@ -256,7 +258,7 @@ public class EmailNotification {
|
||||
if (!string.IsNullOrEmpty(cc))
|
||||
msg.CC.Add(cc);
|
||||
|
||||
//setting email subject and body
|
||||
// setting email subject and body
|
||||
msg.Subject = email_title;
|
||||
msg.Body = email_body;
|
||||
|
||||
@ -264,7 +266,7 @@ public class EmailNotification {
|
||||
msg.Attachments.Add(new Attachment(attachment));
|
||||
}
|
||||
|
||||
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||
// create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||
SmtpClient SmtpMail = new();
|
||||
|
||||
// sending the message.
|
||||
@ -285,16 +287,16 @@ public class EmailNotification {
|
||||
public string SendNotificationEmail(string EmailTemplateFile, string SenderEmail, string SenderName, string RecepientEmail, string CC, string Subject, params string[] Args) {
|
||||
string retVal = null;
|
||||
|
||||
//reading the file
|
||||
// reading the file
|
||||
string FileContents = ReadEmailFile(EmailTemplateFile);
|
||||
|
||||
string emailBody = FileContents;
|
||||
|
||||
//setting formatting the string
|
||||
// setting formatting the string
|
||||
retVal = string.Format(emailBody, Args);
|
||||
|
||||
try {
|
||||
//check if we are in debug mode or not. to send email
|
||||
// check if we are in debug mode or not. to send email
|
||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||
SendEmail(SenderEmail, SenderName, GetTestRecipientsList(), CC, (!string.IsNullOrEmpty(Subject) ? Subject + " for: " + RecepientEmail : _subject), retVal);
|
||||
} else {
|
||||
@ -316,16 +318,16 @@ public class EmailNotification {
|
||||
public string SendNotificationEmailWithAttachment(string EmailTemplateFile, string SenderEmail, string SenderName, string RecepientEmail, string CC, string Subject, string attachmentPath, params string[] Args) {
|
||||
string retVal = null;
|
||||
|
||||
//reading the file
|
||||
// reading the file
|
||||
string FileContents = ReadEmailFile(EmailTemplateFile);
|
||||
|
||||
string emailBody = FileContents;
|
||||
|
||||
//setting formatting the string
|
||||
// setting formatting the string
|
||||
retVal = string.Format(emailBody, Args);
|
||||
|
||||
try {
|
||||
//check if we are in debug mode or not. to send email
|
||||
// check if we are in debug mode or not. to send email
|
||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||
SendEmailWithAttachment(SenderEmail, SenderName, GetTestRecipientsList(), CC, (!string.IsNullOrEmpty(Subject) ? " TESTING ONLY -IGNORE : " + Subject + RecepientEmail : _subject), retVal, attachmentPath);
|
||||
} else {
|
||||
@ -343,16 +345,16 @@ public class EmailNotification {
|
||||
public string SendNotificationEmailWithAttachment(string EmailTemplateFile, string SenderEmail, string SenderName, List<string> RecepientEmail, string CC, string Subject, string attachmentPath, params string[] Args) {
|
||||
string retVal = null;
|
||||
|
||||
//reading the file
|
||||
// reading the file
|
||||
string FileContents = ReadEmailFile(EmailTemplateFile);
|
||||
|
||||
string emailBody = FileContents;
|
||||
|
||||
//setting formatting the string
|
||||
// setting formatting the string
|
||||
retVal = string.Format(emailBody, Args);
|
||||
|
||||
try {
|
||||
//check if we are in debug mode or not. to send email
|
||||
// check if we are in debug mode or not. to send email
|
||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||
foreach (string email in RecepientEmail) {
|
||||
Subject += email + ";";
|
||||
@ -375,16 +377,16 @@ public class EmailNotification {
|
||||
public string SendNotificationEmailWithAttachments(string EmailTemplateFile, string SenderEmail, string SenderName, string RecepientEmail, string CC, string Subject, List<string> attachments, params string[] Args) {
|
||||
string retVal = null;
|
||||
|
||||
//reading the file
|
||||
// reading the file
|
||||
string FileContents = ReadEmailFile(EmailTemplateFile);
|
||||
|
||||
string emailBody = FileContents;
|
||||
|
||||
//setting formatting the string
|
||||
// setting formatting the string
|
||||
retVal = string.Format(emailBody, Args);
|
||||
|
||||
try {
|
||||
//check if we are in debug mode or not. to send email
|
||||
// check if we are in debug mode or not. to send email
|
||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||
SendEmailWithAttachments(SenderEmail, SenderName, GetTestRecipientsList(), CC, (!string.IsNullOrEmpty(Subject) ? " TESTING ONLY -IGNORE : " + Subject + RecepientEmail : _subject), retVal, attachments);
|
||||
} else {
|
||||
@ -402,16 +404,16 @@ public class EmailNotification {
|
||||
public string SendNotificationEmailWithAttachments(string EmailTemplateFile, string SenderEmail, string SenderName, List<string> RecepientEmail, string CC, string Subject, List<string> attachments, params string[] Args) {
|
||||
string retVal = null;
|
||||
|
||||
//reading the file
|
||||
// reading the file
|
||||
string FileContents = ReadEmailFile(EmailTemplateFile);
|
||||
|
||||
string emailBody = FileContents;
|
||||
|
||||
//setting formatting the string
|
||||
// setting formatting the string
|
||||
retVal = string.Format(emailBody, Args);
|
||||
|
||||
try {
|
||||
//check if we are in debug mode or not. to send email
|
||||
// check if we are in debug mode or not. to send email
|
||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||
foreach (string email in RecepientEmail) {
|
||||
Subject += email + ";";
|
||||
@ -434,16 +436,16 @@ public class EmailNotification {
|
||||
public string SendNotificationEmail(string EmailTemplateFile, string SenderEmail, string SenderName, List<string> RecepientEmail, string CC, string Subject, params string[] Args) {
|
||||
string retVal = null;
|
||||
|
||||
//reading the file
|
||||
// reading the file
|
||||
string FileContents = ReadEmailFile(EmailTemplateFile);
|
||||
|
||||
string emailBody = FileContents;
|
||||
|
||||
//setting formatting the string
|
||||
// setting formatting the string
|
||||
retVal = string.Format(emailBody, Args);
|
||||
|
||||
try {
|
||||
//check if we are in debug mode or not. to send email
|
||||
// check if we are in debug mode or not. to send email
|
||||
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
|
||||
foreach (string email in RecepientEmail) {
|
||||
Subject += email + ";";
|
||||
@ -480,9 +482,7 @@ public class EmailNotification {
|
||||
msg.Subject = subject;
|
||||
msg.Body = temp;
|
||||
msg.Priority = importance;
|
||||
//#if(!DEBUG)
|
||||
client.Send(msg);
|
||||
//#endif
|
||||
} catch (Exception ex) {
|
||||
throw;
|
||||
}
|
||||
|
@ -44,10 +44,6 @@ namespace Fab2ApprovalSystem.Misc {
|
||||
public string LotDispo { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<ExcelLotInfo> ReadData() {
|
||||
var r = new List<ExcelLotInfo>();
|
||||
var excelData = new ExcelData(_path);
|
||||
@ -78,7 +74,6 @@ namespace Fab2ApprovalSystem.Misc {
|
||||
List<string> s = new List<string>();
|
||||
// We return the interface, so that
|
||||
var excelData = new ExcelData(_path);
|
||||
//var albums = excelData.getData("Sheet1");
|
||||
var lotNos = excelData.getData();
|
||||
foreach (var row in lotNos) {
|
||||
string temValue = row[0].ToString();
|
||||
@ -94,11 +89,6 @@ namespace Fab2ApprovalSystem.Misc {
|
||||
return s;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
/// <returns></returns>
|
||||
public IEnumerable<DataRow> getData(bool firstRowIsColumnNames = true) {
|
||||
var reader = this.getExcelReader();
|
||||
reader.IsFirstRowAsColumnNames = firstRowIsColumnNames;
|
||||
|
@ -16,13 +16,10 @@ internal class FTPWrapper {
|
||||
_DestinationFileName = destinationFileName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void FTPToSPN() {
|
||||
FTP ftpLib = new();
|
||||
|
||||
//Connect to the FTP server
|
||||
// Connect to the FTP server
|
||||
try {
|
||||
ftpLib.Connect(_AppSettings.FTPServer, _AppSettings.FTPUser, _AppSettings.FTPPassword);
|
||||
} catch (Exception ec) {
|
||||
@ -30,7 +27,7 @@ internal class FTPWrapper {
|
||||
": " + ec.Message, System.Diagnostics.EventLogEntryType.Error);
|
||||
}
|
||||
|
||||
//Upload the file
|
||||
// Upload the file
|
||||
try {
|
||||
int pct = 0;
|
||||
ftpLib.OpenUpload(_OutputFile, _DestinationFileName);
|
||||
|
@ -28,7 +28,6 @@ public static class Functions {
|
||||
/// </summary>
|
||||
|
||||
public static void WriteEvent(AppSettings? appSettings, string logtext, EventLogEntryType eventType) {
|
||||
//#if(!DEBUG)
|
||||
#if !NET8
|
||||
EmailNotification? en = appSettings is null ? null : new EmailNotification(appSettings);
|
||||
#endif
|
||||
@ -36,22 +35,19 @@ public static class Functions {
|
||||
ev.Source = "Fab Approval System";
|
||||
|
||||
try {
|
||||
//Write to the Event Log
|
||||
// Write to the Event Log
|
||||
ev.WriteEntry(logtext, eventType);
|
||||
|
||||
////Send an email notification if appropriate
|
||||
////Don't attempt to send an email if the error is pertaining to an email problem
|
||||
// Send an email notification if appropriate
|
||||
// Don't attempt to send an email if the error is pertaining to an email problem
|
||||
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 (appSettings is not null && eventType == System.Diagnostics.EventLogEntryType.Error)
|
||||
en.SendNotificationEmailToAdmin(ev.Source + " - Error Notification", logtext, MailPriority.High);
|
||||
#endif
|
||||
//else if (eventType == System.Diagnostics.EventLogEntryType.Warning)
|
||||
// SendEmailNotification(ErrorRecipient(), ev.Source + " Warning Event Logged", logtext, NORMAL_PRI);
|
||||
}
|
||||
} catch {
|
||||
//throw;
|
||||
} finally {
|
||||
ev = null;
|
||||
}
|
||||
@ -70,7 +66,6 @@ public static class Functions {
|
||||
FileInfo[] existingFiles = new DirectoryInfo(oldFolderPath).GetFiles();
|
||||
foreach (FileInfo file in existingFiles) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -53,10 +53,10 @@ public static class GlobalVars {
|
||||
Pending = 0,
|
||||
Approved = 1,
|
||||
Denied = 2,
|
||||
Waiting = 3, //waiting on other approver to approve first
|
||||
Skipped = 4, //set to this state if the original approval is no longer needed.
|
||||
ReAssigned = 5, //set to this state if current approver got reassigned
|
||||
Terminated = 6, //future use
|
||||
Waiting = 3, // waiting on other approver to approve first
|
||||
Skipped = 4, // set to this state if the original approval is no longer needed.
|
||||
ReAssigned = 5, // set to this state if current approver got reassigned
|
||||
Terminated = 6, // future use
|
||||
Closed = 7,
|
||||
Recalled = 8
|
||||
|
||||
|
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);
|
||||
}
|
||||
|
||||
}
|
@ -18,9 +18,7 @@ public class Zipper {
|
||||
FileStream fsOut = File.Create(outPathname);
|
||||
ZipOutputStream zipStream = new(fsOut);
|
||||
|
||||
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.
|
||||
zipStream.SetLevel(3); // 0-9, 9 being the highest level of compression
|
||||
|
||||
// This setting will strip the leading part of the folder path in the entries, to
|
||||
// make the entries relative to the starting folder.
|
||||
|
@ -57,15 +57,12 @@ public class FTP {
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public FTP() {
|
||||
server = null;
|
||||
user = null;
|
||||
pass = null;
|
||||
port = 21;
|
||||
passive_mode = true; // #######################################
|
||||
passive_mode = true;
|
||||
main_sock = null;
|
||||
main_ipEndPoint = null;
|
||||
listening_sock = null;
|
||||
@ -77,18 +74,13 @@ public class FTP {
|
||||
timeout = 10000; // 10 seconds
|
||||
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) {
|
||||
this.server = server;
|
||||
this.user = user;
|
||||
this.pass = pass;
|
||||
port = 21;
|
||||
passive_mode = true; // #######################################
|
||||
passive_mode = true;
|
||||
main_sock = null;
|
||||
main_ipEndPoint = null;
|
||||
listening_sock = null;
|
||||
@ -100,19 +92,13 @@ public class FTP {
|
||||
timeout = 10000; // 10 seconds
|
||||
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) {
|
||||
this.server = server;
|
||||
this.user = user;
|
||||
this.pass = pass;
|
||||
this.port = port;
|
||||
passive_mode = true; // #######################################
|
||||
passive_mode = true;
|
||||
main_sock = null;
|
||||
main_ipEndPoint = null;
|
||||
listening_sock = null;
|
||||
@ -275,7 +261,6 @@ public class FTP {
|
||||
messages = "";
|
||||
|
||||
while (true) {
|
||||
//buf = GetLineFromBucket();
|
||||
buf = GetLineFromBucket();
|
||||
|
||||
#if (FTP_DEBUG)
|
||||
@ -570,8 +555,8 @@ public class FTP {
|
||||
SendCommand("LIST");
|
||||
ReadResponse();
|
||||
|
||||
//FILIPE MADUREIRA.
|
||||
//Added response 125
|
||||
// FILIPE MADUREIRA.
|
||||
// Added response 125
|
||||
switch (response) {
|
||||
case 125:
|
||||
case 150:
|
||||
@ -589,13 +574,10 @@ public class FTP {
|
||||
// so the code doesn't hang if there is
|
||||
// no data comming.
|
||||
if (msecs_passed > (timeout / 10)) {
|
||||
//CloseDataSocket();
|
||||
//throw new Exception("Timed out waiting on server to respond.");
|
||||
|
||||
//FILIPE MADUREIRA.
|
||||
//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
|
||||
break;//Maybe there are no files
|
||||
// FILIPE MADUREIRA.
|
||||
// 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
|
||||
break; // Maybe there are no files
|
||||
}
|
||||
}
|
||||
|
||||
@ -626,8 +608,7 @@ public class FTP {
|
||||
ArrayList list = new();
|
||||
|
||||
foreach (string f in List()) {
|
||||
//FILIPE MADUREIRA
|
||||
//In Windows servers it is identified by <DIR>
|
||||
// FILIPE MADUREIRA
|
||||
if ((f.Length > 0)) {
|
||||
if ((f[0] != 'd') && (f.ToUpper().IndexOf("<DIR>") < 0))
|
||||
list.Add(f);
|
||||
@ -636,6 +617,7 @@ public class FTP {
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a directory list only
|
||||
/// </summary>
|
||||
@ -644,8 +626,8 @@ public class FTP {
|
||||
ArrayList list = new();
|
||||
|
||||
foreach (string f in List()) {
|
||||
//FILIPE MADUREIRA
|
||||
//In Windows servers it is identified by <DIR>
|
||||
// FILIPE MADUREIRA
|
||||
// In Windows servers it is identified by <DIR>
|
||||
if (f.Length > 0) {
|
||||
if ((f[0] == 'd') || (f.ToUpper().IndexOf("<DIR>") >= 0))
|
||||
list.Add(f);
|
||||
@ -685,7 +667,7 @@ public class FTP {
|
||||
if (input.Length < 14)
|
||||
throw new ArgumentException("Input Value for ConvertFTPDateToDateTime method was too short.");
|
||||
|
||||
//YYYYMMDDhhmmss":
|
||||
// YYYYMMDDhhmmss":
|
||||
int year = Convert.ToInt16(input.Substring(0, 4));
|
||||
int month = Convert.ToInt16(input.Substring(4, 2));
|
||||
int day = Convert.ToInt16(input.Substring(6, 2));
|
||||
@ -700,7 +682,7 @@ public class FTP {
|
||||
/// </summary>
|
||||
/// <returns>The working directory</returns>
|
||||
public string GetWorkingDirectory() {
|
||||
//PWD - print working directory
|
||||
// PWD - print working directory
|
||||
Connect();
|
||||
SendCommand("PWD");
|
||||
ReadResponse();
|
||||
@ -710,7 +692,7 @@ public class FTP {
|
||||
|
||||
string pwd;
|
||||
try {
|
||||
pwd = responseStr.Substring(responseStr.IndexOf("\"", 0) + 1);//5);
|
||||
pwd = responseStr.Substring(responseStr.IndexOf("\"", 0) + 1);
|
||||
pwd = pwd.Substring(0, pwd.LastIndexOf("\""));
|
||||
pwd = pwd.Replace("\"\"", "\""); // directories with quotes in the name come out as "" from the server
|
||||
} catch (Exception ex) {
|
||||
@ -719,6 +701,7 @@ public class FTP {
|
||||
|
||||
return pwd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change to another directory on the ftp server
|
||||
/// </summary>
|
||||
|
@ -11,7 +11,6 @@ public class LoginModel {
|
||||
[Display(Name = "Login ID")]
|
||||
public string LoginID { get; set; }
|
||||
|
||||
//[Required]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Password")]
|
||||
public string Password { get; set; }
|
||||
|
@ -7,37 +7,47 @@ namespace Fab2ApprovalSystem.Models;
|
||||
|
||||
public class AppSettings {
|
||||
|
||||
internal AppSettings(string adminNotificationRecepient,
|
||||
string? apiBaseUrl,
|
||||
string attachmentFolder,
|
||||
string? attachmentUrl,
|
||||
string caBlankFormsLocation,
|
||||
string? company,
|
||||
string dBConnection,
|
||||
string dbConnectionString,
|
||||
string ftpPassword,
|
||||
string ftpServer,
|
||||
string ftpUser,
|
||||
string holdFlagDirectory,
|
||||
string hostURL,
|
||||
string ifxContainer,
|
||||
string ifxDomain,
|
||||
bool isInfineonDomain,
|
||||
string lotTempPipeLine,
|
||||
string mesaTemplateFiles,
|
||||
string naContainer,
|
||||
string naDomain,
|
||||
string nDriveURL,
|
||||
string notificationSender,
|
||||
string senderEmail,
|
||||
string? smtpServer,
|
||||
string spnMRBHoldFlagFTPLogDirectory,
|
||||
string testEmailRecipients,
|
||||
string urls,
|
||||
int userId,
|
||||
bool userIsAdmin,
|
||||
string wsrURL,
|
||||
string? workingDirectoryName) {
|
||||
public AppSettings(string adminNotificationRecepient,
|
||||
string? apiBaseUrl,
|
||||
string attachmentFolder,
|
||||
string? attachmentUrl,
|
||||
string caBlankFormsLocation,
|
||||
string? company,
|
||||
string dBConnection,
|
||||
string dbConnectionString,
|
||||
string emailTemplatesPath,
|
||||
string ftpPassword,
|
||||
string ftpSPNBatchFileName,
|
||||
string ftpSPNBatchFileName_Test,
|
||||
string ftpServer,
|
||||
string ftpUser,
|
||||
string holdFlagDirectory,
|
||||
string hostURL,
|
||||
string ifxContainer,
|
||||
string ifxDomain,
|
||||
bool isInfineonDomain,
|
||||
string lotTempPipeLine,
|
||||
string mesaTemplateFiles,
|
||||
string nDriveURL,
|
||||
string naContainer,
|
||||
string naDomain,
|
||||
string notificationSender,
|
||||
string senderEmail,
|
||||
string? smtpServer,
|
||||
string spnMRBHoldFlagDirectory,
|
||||
string spnMRBHoldFlagFTPLogDirectory,
|
||||
string ssrSFolder,
|
||||
string ssrSBindingsByConfiguration,
|
||||
string ssrSBaseURL,
|
||||
string ssrSDomain,
|
||||
string ssrSUsername,
|
||||
string ssrSPassword,
|
||||
string testEmailRecipients,
|
||||
string urls,
|
||||
int userId,
|
||||
bool userIsAdmin,
|
||||
string wsr_URL,
|
||||
string? workingDirectoryName) {
|
||||
AdminNotificationRecepient = adminNotificationRecepient;
|
||||
ApiBaseUrl = apiBaseUrl;
|
||||
AttachmentFolder = attachmentFolder;
|
||||
@ -46,7 +56,10 @@ public class AppSettings {
|
||||
Company = company;
|
||||
DBConnection = dBConnection;
|
||||
DBConnectionString = dbConnectionString;
|
||||
EmailTemplatesPath = emailTemplatesPath;
|
||||
FTPPassword = ftpPassword;
|
||||
FTPSPNBatchFileName = ftpSPNBatchFileName;
|
||||
FTPSPNBatchFileName_Test = ftpSPNBatchFileName_Test;
|
||||
FTPServer = ftpServer;
|
||||
FTPUser = ftpUser;
|
||||
HoldFlagDirectory = holdFlagDirectory;
|
||||
@ -56,18 +69,25 @@ public class AppSettings {
|
||||
IsInfineonDomain = isInfineonDomain;
|
||||
LotTempPipeLine = lotTempPipeLine;
|
||||
MesaTemplateFiles = mesaTemplateFiles;
|
||||
NDriveURL = nDriveURL;
|
||||
NAContainer = naContainer;
|
||||
NADomain = naDomain;
|
||||
NDriveURL = nDriveURL;
|
||||
NotificationSender = notificationSender;
|
||||
SenderEmail = senderEmail;
|
||||
SMTPServer = smtpServer;
|
||||
SPNMRBHoldFlagDirectory = spnMRBHoldFlagDirectory;
|
||||
SPNMRBHoldFlagFTPLogDirectory = spnMRBHoldFlagFTPLogDirectory;
|
||||
TestEmailRecipients = testEmailRecipients;
|
||||
SSRSFolder = ssrSFolder;
|
||||
SSRSBindingsByConfiguration = ssrSBindingsByConfiguration;
|
||||
SSRSBaseURL = ssrSBaseURL;
|
||||
SSRSDomain = ssrSDomain;
|
||||
SSRSUsername = ssrSUsername;
|
||||
SSRSPassword = ssrSPassword;
|
||||
URLs = urls;
|
||||
UserId = userId;
|
||||
UserIsAdmin = userIsAdmin;
|
||||
WSR_URL = wsrURL;
|
||||
WSR_URL = wsr_URL;
|
||||
WorkingDirectoryName = workingDirectoryName;
|
||||
}
|
||||
|
||||
@ -79,7 +99,10 @@ public class AppSettings {
|
||||
public string? Company { get; }
|
||||
public string DBConnection { get; }
|
||||
public string DBConnectionString { get; }
|
||||
public string EmailTemplatesPath { get; }
|
||||
public string FTPPassword { get; }
|
||||
public string FTPSPNBatchFileName { get; }
|
||||
public string FTPSPNBatchFileName_Test { get; }
|
||||
public string FTPServer { get; }
|
||||
public string FTPUser { get; }
|
||||
public string HoldFlagDirectory { get; }
|
||||
@ -95,7 +118,14 @@ public class AppSettings {
|
||||
public string NotificationSender { get; }
|
||||
public string SenderEmail { get; }
|
||||
public string? SMTPServer { get; }
|
||||
public string SPNMRBHoldFlagDirectory { 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 URLs { get; }
|
||||
public int UserId { get; }
|
||||
@ -131,59 +161,108 @@ public class AppSettings {
|
||||
|
||||
internal static AppSettings LoadConfigurationManager() {
|
||||
AppSettings result;
|
||||
int userId = 0;
|
||||
string adminNotificationRecepient = ConfigurationManager.ConnectionStrings["Admin Notification Recepient"].ToString();
|
||||
string attachmentFolder = ConfigurationManager.ConnectionStrings["AttachmentFolder"].ToString();
|
||||
string ftpPassword = ConfigurationManager.ConnectionStrings["FTP Password"].ToString();
|
||||
string ftpServer = ConfigurationManager.ConnectionStrings["FTP Server"].ToString();
|
||||
string ftpUser = ConfigurationManager.ConnectionStrings["FTP User"].ToString();
|
||||
string holdFlagDirectory = ConfigurationManager.ConnectionStrings["HoldFlagDirectory"].ToString();
|
||||
string ifxContainer = ConfigurationManager.ConnectionStrings["IFXContainer"].ToString();
|
||||
string ifxDomain = ConfigurationManager.ConnectionStrings["IFXDomain"].ToString();
|
||||
string lotTempPipeLine = ConfigurationManager.ConnectionStrings["LotTempPipeLine"].ToString();
|
||||
string naContainer = ConfigurationManager.ConnectionStrings["NAContainer"].ToString();
|
||||
string naDomain = ConfigurationManager.ConnectionStrings["NADomain"].ToString();
|
||||
string notificationSender = ConfigurationManager.ConnectionStrings["Notification Sender"].ToString();
|
||||
string spnMRBHoldFlagFTPLogDirectory = ConfigurationManager.ConnectionStrings["SPNMRBHoldFlagFTPLogDirectory"].ToString();
|
||||
string testEmailRecipients = ConfigurationManager.ConnectionStrings["Test Email Recipients"].ToString();
|
||||
string? apiBaseUrl = ConfigurationManager.ConnectionStrings["FabApprovalApiBaseUrl"]?.ToString();
|
||||
string? attachmentUrl = ConfigurationManager.ConnectionStrings["AttachmentUrl"]?.ToString();
|
||||
string? company = ConfigurationManager.ConnectionStrings["Company"]?.ToString();
|
||||
string? smtpServer = ConfigurationManager.ConnectionStrings["SMTP Server"]?.ToString();
|
||||
string? urls = ConfigurationManager.ConnectionStrings["URLs"]?.ToString();
|
||||
string? workingDirectoryName = ConfigurationManager.ConnectionStrings["WorkingDirectoryName"]?.ToString();
|
||||
result = new(adminNotificationRecepient: adminNotificationRecepient,
|
||||
apiBaseUrl: apiBaseUrl,
|
||||
attachmentFolder: attachmentFolder,
|
||||
attachmentUrl: attachmentUrl,
|
||||
caBlankFormsLocation: Misc.GlobalVars.CA_BlankFormsLocation,
|
||||
company: company,
|
||||
dBConnection: Misc.GlobalVars.DBConnection,
|
||||
dbConnectionString: Misc.GlobalVars.DB_CONNECTION_STRING,
|
||||
ftpPassword: ftpPassword,
|
||||
ftpServer: ftpServer,
|
||||
ftpUser: ftpUser,
|
||||
holdFlagDirectory: holdFlagDirectory,
|
||||
hostURL: Misc.GlobalVars.hostURL,
|
||||
ifxContainer: ifxContainer,
|
||||
ifxDomain: ifxDomain,
|
||||
isInfineonDomain: Misc.GlobalVars.IS_INFINEON_DOMAIN,
|
||||
lotTempPipeLine: lotTempPipeLine,
|
||||
mesaTemplateFiles: Misc.GlobalVars.MesaTemplateFiles,
|
||||
naContainer: naContainer,
|
||||
naDomain: naDomain,
|
||||
nDriveURL: Misc.GlobalVars.NDriveURL,
|
||||
notificationSender: notificationSender,
|
||||
senderEmail: Misc.GlobalVars.SENDER_EMAIL,
|
||||
smtpServer: smtpServer,
|
||||
spnMRBHoldFlagFTPLogDirectory: spnMRBHoldFlagFTPLogDirectory,
|
||||
testEmailRecipients: testEmailRecipients,
|
||||
urls: urls,
|
||||
userId: userId,
|
||||
userIsAdmin: Misc.GlobalVars.USER_ISADMIN,
|
||||
wsrURL: Misc.GlobalVars.WSR_URL,
|
||||
workingDirectoryName: workingDirectoryName);
|
||||
return result;
|
||||
try {
|
||||
int userId = 0;
|
||||
string adminNotificationRecepient = ConfigurationManager.AppSettings["Admin Notification Recepient"] ??
|
||||
throw new ArgumentNullException("Admin Notification Recepient environment variable not found");
|
||||
string attachmentFolder = ConfigurationManager.AppSettings["AttachmentFolder"] ??
|
||||
throw new ArgumentNullException("AttachmentFolder environment variable not found");
|
||||
string emailTemplatesPath = ConfigurationManager.AppSettings["EmailTemplatesPath"] ??
|
||||
throw new ArgumentNullException("EmailTemplatesPath environment variable not found");
|
||||
string ftpPassword = ConfigurationManager.AppSettings["FTP Password"] ??
|
||||
throw new ArgumentNullException("FTP Password environment variable not found");
|
||||
string ftpServer = ConfigurationManager.AppSettings["FTP Server"] ??
|
||||
throw new ArgumentNullException("FTP Server environment variable not found");
|
||||
string ftpSPNBatchFileName = ConfigurationManager.AppSettings["FTPSPNBatchFileName"] ??
|
||||
throw new ArgumentNullException("FTPSPNBatchFileName environment variable not found");
|
||||
string ftpSPNBatchFileName_Test = ConfigurationManager.AppSettings["FTPSPNBatchFileName_Test"] ??
|
||||
throw new ArgumentNullException("FTPSPNBatchFileName_Test environment variable not found");
|
||||
string ftpUser = ConfigurationManager.AppSettings["FTP User"] ??
|
||||
throw new ArgumentNullException("FTP User environment variable not found");
|
||||
string holdFlagDirectory = ConfigurationManager.AppSettings["HoldFlagDirectory"] ??
|
||||
throw new ArgumentNullException("HoldFlagDirectory environment variable not found");
|
||||
string ifxContainer = ConfigurationManager.AppSettings["IFXContainer"] ??
|
||||
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,
|
||||
apiBaseUrl: apiBaseUrl,
|
||||
attachmentFolder: attachmentFolder,
|
||||
attachmentUrl: attachmentUrl,
|
||||
caBlankFormsLocation: Misc.GlobalVars.CA_BlankFormsLocation,
|
||||
company: company,
|
||||
dBConnection: Misc.GlobalVars.DBConnection,
|
||||
dbConnectionString: Misc.GlobalVars.DB_CONNECTION_STRING,
|
||||
emailTemplatesPath: emailTemplatesPath,
|
||||
ftpPassword: ftpPassword,
|
||||
ftpServer: ftpServer,
|
||||
ftpSPNBatchFileName: ftpSPNBatchFileName,
|
||||
ftpSPNBatchFileName_Test: ftpSPNBatchFileName_Test,
|
||||
ftpUser: ftpUser,
|
||||
holdFlagDirectory: holdFlagDirectory,
|
||||
hostURL: Misc.GlobalVars.hostURL,
|
||||
ifxContainer: ifxContainer,
|
||||
ifxDomain: ifxDomain,
|
||||
isInfineonDomain: Misc.GlobalVars.IS_INFINEON_DOMAIN,
|
||||
lotTempPipeLine: lotTempPipeLine,
|
||||
mesaTemplateFiles: Misc.GlobalVars.MesaTemplateFiles,
|
||||
naContainer: naContainer,
|
||||
naDomain: naDomain,
|
||||
nDriveURL: Misc.GlobalVars.NDriveURL,
|
||||
notificationSender: notificationSender,
|
||||
senderEmail: Misc.GlobalVars.SENDER_EMAIL,
|
||||
smtpServer: smtpServer,
|
||||
spnMRBHoldFlagDirectory: spnMRBHoldFlagDirectory,
|
||||
spnMRBHoldFlagFTPLogDirectory: spnMRBHoldFlagFTPLogDirectory,
|
||||
testEmailRecipients: testEmailRecipients,
|
||||
ssrSFolder: ssrSFolder,
|
||||
ssrSBindingsByConfiguration: ssrSBindingsByConfiguration,
|
||||
ssrSBaseURL: ssrSBaseURL,
|
||||
ssrSDomain: ssrSDomain,
|
||||
ssrSUsername: ssrSUsername,
|
||||
ssrSPassword: ssrSPassword,
|
||||
urls: urls,
|
||||
userId: userId,
|
||||
userIsAdmin: Misc.GlobalVars.USER_ISADMIN,
|
||||
wsr_URL: Misc.GlobalVars.WSR_URL,
|
||||
workingDirectoryName: workingDirectoryName);
|
||||
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 SubRole { get; set; }
|
||||
|
||||
//[Display(Name = "Operation Time")]
|
||||
public DateTime OperationTime { get; set; }
|
||||
public string Comments { get; set; }
|
||||
|
||||
|
@ -70,8 +70,6 @@ public class Lot {
|
||||
[Display(Name = "Lot Dispos")]
|
||||
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; }
|
||||
[Display(Name = "Lot Dispos")]
|
||||
public string LotDispositionsLinkedToLot { get; set; }
|
||||
|
@ -33,7 +33,6 @@ public class ECN : object {
|
||||
public bool IsEmergencyTECN { get; set; }
|
||||
|
||||
[DataType(DataType.Date)]
|
||||
//[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||
public DateTime? ExpirationDate { get; set; }
|
||||
|
||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||
@ -147,7 +146,6 @@ public class ECN : object {
|
||||
|
||||
return false;
|
||||
// Return true if the fields match:
|
||||
//return (IsECN == p.IsECN) && (IsEmergencyTECN == p.IsEmergencyTECN);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,10 +12,9 @@ namespace Fab2ApprovalSystem.Models;
|
||||
|
||||
[Serializable]
|
||||
public class LotDisposition {
|
||||
//[Editable(false)]
|
||||
|
||||
[Display(Name = "Issue Number")]
|
||||
public int IssueID { get; set; }
|
||||
//[Editable(false)]
|
||||
public string Title { get; set; }
|
||||
public bool PERequired { get; set; }
|
||||
public string IssueDescription { get; set; }
|
||||
@ -32,7 +31,7 @@ public class LotDisposition {
|
||||
public byte CurrentStep { get; set; }
|
||||
// Extra field Defined for Scraping wafer for a given lot
|
||||
public Lot Lot { get; set; }
|
||||
//Extra field defined for Attachments
|
||||
// Extra field defined for Attachments
|
||||
public Attachment DocumentAttachment { get; set; }
|
||||
|
||||
// important!!make sure the id of the control matches the name of the field in the model it is being binded to,
|
||||
@ -58,7 +57,7 @@ public class LotDisposition {
|
||||
DepartmentIDs = new List<int>();
|
||||
Lot = new Lot();
|
||||
DocumentAttachment = new Attachment();
|
||||
//Lots = new List<Lot>();
|
||||
// Lots = new List<Lot>();
|
||||
Attachments = new List<Attachment>();
|
||||
Approvals = new List<Approval>();
|
||||
ScrapLots = new List<ScrapLot>();
|
||||
|
@ -63,9 +63,6 @@ public class MRB {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public MRB() {
|
||||
PartGroupIDs = new List<int>();
|
||||
ModuleIDs = new List<int>();
|
||||
@ -106,7 +103,7 @@ public class Disposition {
|
||||
public string DispositionName { get; set; }
|
||||
public string DispositionNotes { get; set; }
|
||||
|
||||
//Duplicated as the CloseToQDBOptionID is being used in the dropdown in the Grid kept the old code
|
||||
// Duplicated as the CloseToQDBOptionID is being used in the dropdown in the Grid kept the old code
|
||||
public int CloseToQDBOption_ID { get; set; }
|
||||
|
||||
[UIHint("CloseToQDBTemplate")]
|
||||
@ -151,7 +148,6 @@ public class ContainmentActionObj {
|
||||
public int CurrentResponsibilityOwnerID { get; set; }
|
||||
public string ResponsibilityOwner { get; set; }
|
||||
|
||||
//[DataType(DataType.Date)]
|
||||
public DateTime? ECD { get; set; }
|
||||
|
||||
[DataType(DataType.Date)]
|
||||
|
@ -1,7 +1,6 @@
|
||||
namespace Fab2ApprovalSystem.Models;
|
||||
|
||||
public class WinEventLog {
|
||||
//[Key]
|
||||
|
||||
public int SysDocumentID { get; set; }
|
||||
public int IssueID { get; set; }
|
||||
|
@ -25,13 +25,6 @@ namespace Fab2ApprovalSystem.PdfGenerator {
|
||||
this.standardPdfRenderer = new StandardPdfRenderer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
|
||||
|
||||
/// <returns></returns>
|
||||
protected ActionResult ViewPdf(string pageTitle, string viewName, object model) {
|
||||
// Render the view html to a string.
|
||||
string htmlText = this.htmlViewRenderer.RenderViewToString(this, viewName, model);
|
||||
@ -43,12 +36,6 @@ namespace Fab2ApprovalSystem.PdfGenerator {
|
||||
return new BinaryContentResult(buffer, "application/pdf");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
|
||||
|
||||
protected void SavePdf(string fileName, string viewName, object model) {
|
||||
// Render the view html to a string.
|
||||
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) {
|
||||
//string templatesPath = GlobalVars.CA_BlankFormsLocation;
|
||||
//string fullName = Server.MapPath("~" + filePath);
|
||||
|
||||
byte[] fileBytes = GetFile(pathToFile);
|
||||
var result = File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, pathToFile);
|
||||
return (T)Convert.ChangeType(result, typeof(T));
|
||||
|
@ -35,12 +35,6 @@ public class ChangeControlViewModel {
|
||||
public int PCR3ID { get; set; }
|
||||
public string PlanTitle { get; set; }
|
||||
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; }
|
||||
|
||||
[DataType(DataType.Date)]
|
||||
//[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||
public DateTime? ExpirationDate { get; set; }
|
||||
|
||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||
|
@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
|
@ -1,3 +1,7 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
|
@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
|
@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
using Fab2ApprovalSystem.ViewModels;
|
||||
|
@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
|
@ -1,30 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
<Nullable>enable</Nullable>
|
||||
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
|
||||
<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 Condition="'$(TargetFramework)' == 'net8.0'">
|
||||
<DefineConstants>NET8</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VSTestLogger>trx</VSTestLogger>
|
||||
|
@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
using Fab2ApprovalSystem.DMO;
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
using Fab2ApprovalSystem.Workers;
|
||||
|
@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
using Fab2ApprovalSystem.Models;
|
||||
|
||||
using Fab2ApprovalSystem.Utilities;
|
||||
|
@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Fab2ApprovalSystem.Models;
|
||||
using Fab2ApprovalSystem.Utilities;
|
||||
|
||||
|
@ -17,7 +17,6 @@ variables:
|
||||
buildConfiguration: "Release"
|
||||
targetFrameworkVersion: 'v4.8'
|
||||
coreVersion: 'na'
|
||||
nugetSource: 'https://eaf-prod.mes.infineon.com/v3/index.json'
|
||||
assemblyTitle: 'Fab2ApprovalSystem'
|
||||
architecture: 'x64'
|
||||
|
||||
@ -42,7 +41,6 @@ stages:
|
||||
echo Core version: $(CoreVersion)
|
||||
echo Build configuration: $(BuildConfiguration)
|
||||
echo Configuration: $(Configuration)
|
||||
echo Nuget source: $(NugetSource)
|
||||
echo Target Framework version: $(TargetFrameworkVersion)
|
||||
echo Assembly title: $(AssemblyTitle)
|
||||
displayName: "Echo Check"
|
||||
@ -79,12 +77,11 @@ stages:
|
||||
echo Core version: $(CoreVersion)
|
||||
echo Build configuration: $(BuildConfiguration)
|
||||
echo Configuration: $(Configuration)
|
||||
echo Nuget source: $(NugetSource)
|
||||
echo Target Framework version: $(TargetFrameworkVersion)
|
||||
echo Assembly title: $(AssemblyTitle)
|
||||
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
|
||||
displayName: "Framework Restore"
|
||||
|
||||
@ -115,12 +112,11 @@ stages:
|
||||
echo Core version: $(CoreVersion)
|
||||
echo Build configuration: $(BuildConfiguration)
|
||||
echo Configuration: $(Configuration)
|
||||
echo Nuget source: $(NugetSource)
|
||||
echo Target Framework version: $(TargetFrameworkVersion)
|
||||
echo Assembly title: $(AssemblyTitle)
|
||||
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
|
||||
displayName: "Framework Restore"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user