Added ability to delete Corrective Actions through the list page.

This commit is contained in:
Daniel Wathen
2023-02-13 15:12:18 -07:00
parent bf59afdc1b
commit 09543b8474
6 changed files with 27 additions and 10 deletions

Binary file not shown.

View File

@ -405,6 +405,9 @@ namespace Fab2ApprovalSystem.Controllers
ldDMO.DeleteLotDisposition(issue.IssueID); ldDMO.DeleteLotDisposition(issue.IssueID);
else if (dType == GlobalVars.DocumentType.ECN) else if (dType == GlobalVars.DocumentType.ECN)
ecnDMO.DeleteDocument(issue.IssueID, int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), "ECN"); ecnDMO.DeleteDocument(issue.IssueID, int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), "ECN");
else if (dType == GlobalVars.DocumentType.CorrectiveAction)
ldDMO.DeleteCADocument(issue.IssueID, int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), "Corrective Action");
return Json(new[] { issue }.ToDataSourceResult(request, ModelState)); return Json(new[] { issue }.ToDataSourceResult(request, ModelState));
} }

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration; using System.Configuration;
using System.Data; using System.Data;
@ -489,6 +489,16 @@ namespace Fab2ApprovalSystem.DMO
} }
public void DeleteCADocument(int CANo, int userID, string caTypeString)
{
var parameters = new DynamicParameters();
parameters.Add("@UserID", userID);
parameters.Add("@CANo", CANo);
parameters.Add("@CAType", caTypeString);
this.db.Execute("_8DDeleteCADocument", parameters, commandType: CommandType.StoredProcedure);
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -1413,4 +1423,4 @@ namespace Fab2ApprovalSystem.DMO
return fileName; return fileName;
} }
} }
} }

View File

@ -1,4 +1,4 @@
@{ @{
Layout = "_HomeLayout.cshtml"; Layout = "_HomeLayout.cshtml";
} }
@ -37,6 +37,7 @@
columns.Bound(l => l.PendingAIOwners).Width("100px").Title("Action Item Owners"); columns.Bound(l => l.PendingAIOwners).Width("100px").Title("Action Item Owners");
columns.Bound(l => l.D8DueDate).Format("{0:MM/dd/yy}").Width("100px"); columns.Bound(l => l.D8DueDate).Format("{0:MM/dd/yy}").Width("100px");
columns.Bound(l => l.ClosedDate).Format("{0:MM/dd/yy}").Width("100px"); columns.Bound(l => l.ClosedDate).Format("{0:MM/dd/yy}").Width("100px");
columns.Template(t => { }).HeaderTemplate("").ClientTemplate(@"<a href='javascript: void(0)' class='abutton delete' onclick='deleteRowCA(this)' title='button delete'>button delete</a>");
}) })
@ -68,14 +69,14 @@
.DataSource(dataSource => dataSource .DataSource(dataSource => dataSource
.Ajax() .Ajax()
.Model(model => .Model(model =>
{ {
model.Id(p => p.CANo); model.Id(p => p.CANo);
//model.Field(p => p.TotalCost).Editable(false); //model.Field(p => p.TotalCost).Editable(false);
}) })
.PageSize(50) .PageSize(50)
.Read(read => read.Action("GetCorrectiveActionList", "Home")) .Read(read => read.Action("GetCorrectiveActionList", "Home"))
//.Destroy(destroy => destroy.Action("DeleteItem", "Home")) .Destroy(destroy => destroy.Action("DeleteItem", "Home"))
) )
) )
</div> </div>
@ -93,5 +94,8 @@
return numStr; return numStr;
} }
function deleteRowCA(element) {
</script> grid = $("#CAList").data("kendoGrid");
grid.removeRow($(element).closest("tr"));
}
</script>