public ActionResult EditDisbursementList() { string deptId = ""; List <ItemRequest> new_list = new List <ItemRequest>(); DisbursementDAO disbursementDAO = new DisbursementDAO(); foreach (string key in Request.Form.AllKeys) { if (Convert.ToString(key) == "deptId") { deptId = Convert.ToString(Request[key]); } else { ItemRequest item = new ItemRequest(); item.ItemId = Convert.ToString(key); item.ActualQty = Convert.ToInt32(Request[key]); new_list.Add(item); } } List <ItemRequest> old_list = disbursementDAO.GetDisburseItemsForRep(deptId); List <ItemRequest> list = new List <ItemRequest>(); foreach (var item in new_list) { foreach (var row in old_list) { if (item.ItemId == row.ItemId) { if (row.ActualQty - item.ActualQty != 0) { item.ActualQty = row.ActualQty - item.ActualQty; list.Add(item); } } } } int clerkId = (int)Session["userid"]; disbursementDAO.UpdateDisbursement(deptId, clerkId, list); return(RedirectToAction("ViewDisbursementList", "StoreClerk")); }
public ActionResult EditDisbursementList(string dept_id, string dept_name) { DisbursementDAO disbursementDAO = new DisbursementDAO(); CollectionPointDAO collectionPointDAO = new CollectionPointDAO(); CollectionPoint collectionPoint = collectionPointDAO.GetCollectionPointByDeptID(dept_id); List <ItemRequest> itemList = disbursementDAO.GetDisburseItemsForRep(dept_id); DisbursementVM disbursement = new DisbursementVM(); disbursement.DeptName = dept_name; disbursement.DeptId = dept_id; disbursement.CollectionPointName = collectionPoint.Name; disbursement.ItemList = itemList; return(View(disbursement)); }