public RedirectToRouteResult DeletePOItem(string data) { string itemCode = data; List <POFullDetail> poFullDetailsList = (List <POFullDetail>)Session["newPOList"]; POFullDetail pod = new POFullDetail(); foreach (POFullDetail p in poFullDetailsList) { if (p.ItemCode == itemCode) { pod = p; } } poFullDetailsList.Remove(pod); using (SSISdbEntities e = new SSISdbEntities()) { //remove from list meant for already added items List <String> tempList = (List <String>)Session["tempList"]; tempList.Remove(pod.ItemCode); Session["tempList"] = tempList; } if (poFullDetailsList.Count == 0) { poFullDetailsList = new List <POFullDetail>(); } Session["newPOList"] = poFullDetailsList; return(RedirectToAction("CreatePO", "StorePurchase")); }
public RedirectToRouteResult EditPOQtyOrdered(string data, int index) { using (SSISdbEntities e = new SSISdbEntities()) { List <POFullDetail> poFullDetailList = (List <POFullDetail>)Session["POItems"]; POFullDetail item = poFullDetailList.ElementAt(index); item.QuantityOrdered = Int32.Parse(data); Session["POItems"] = poFullDetailList; return(RedirectToAction("Requisition", "Dept")); } }
public RedirectToRouteResult EditNewPOQty(string data, int index) { using (SSISdbEntities e = new SSISdbEntities()) { List <POFullDetail> poFullDetailsList = (List <POFullDetail>)Session["newPOList"]; POFullDetail item = poFullDetailsList.ElementAt(index); item.QuantityOrdered = Int32.Parse(data); Session["newAdjList"] = poFullDetailsList; return(RedirectToAction("Purchase", "Store")); } }
public RedirectToRouteResult EditNewPOSupplier(string data, int index) { using (SSISdbEntities e = new SSISdbEntities()) { List <POFullDetail> poFullDetailsList = (List <POFullDetail>)Session["newPOList"]; POFullDetail item = poFullDetailsList.ElementAt(index); item.CompanyName = data; SupplierPriceList spl = e.SupplierPriceLists.Where(y => y.SupplierCode == item.CompanyName).FirstOrDefault(); item.UnitCost = spl.UnitCost; Session["newAdjList"] = poFullDetailsList; return(RedirectToAction("Purchase", "Store")); } }
public RedirectToRouteResult AddPOItem(PODetail item2) { Item itemToAdd = new Item(); bool existingItem = false; using (SSISdbEntities m = new SSISdbEntities()) { // Get Item to add into Datatable string itemCode = Request.Form["SelectItemChose"].ToString(); List <POFullDetail> poFullDetailsList = (List <POFullDetail>)Session["newPOList"]; POFullDetail pod = new POFullDetail(); POFullDetail existingPoD = new POFullDetail(); pod.PONumber = (string)Session["newPoId"]; // Checking if Item is already in list foreach (POFullDetail p in poFullDetailsList.ToList()) { // Iterate through whole list to check for itemcode if (p.ItemCode == itemCode) { // Combine 2 same items (Adding new qty to exisiting qty) existingItem = true; // Create new item so that we can remove old qty & add back new qty existingPoD = p; existingPoD.QuantityOrdered += item2.QuantityOrdered; poFullDetailsList.Remove(p); poFullDetailsList.Add(existingPoD); } } // Execute when item is not in the list if (existingItem == false) { // Creating the new item with these itemToAdd = m.Items.Where(x => x.ItemCode == itemCode).FirstOrDefault(); pod.ItemCode = itemToAdd.ItemCode; pod.QuantityOrdered = item2.QuantityOrdered; pod.Description = itemToAdd.Description; pod.UoM = itemToAdd.UoM; pod.CompanyName = itemToAdd.Supplier1; //default ddl at supplier 1's pod.UnitCost = itemToAdd.AvgUnitCost; pod.Supplier1Code = itemToAdd.Supplier1; pod.Supplier2Code = itemToAdd.Supplier2; pod.Supplier3Code = itemToAdd.Supplier3; pod.Supplier1UnitCost = m.SupplierPriceLists.Where(x => x.SupplierCode == itemToAdd.Supplier1 && x.ItemCode == itemToAdd.ItemCode).Select(x => x.UnitCost).FirstOrDefault(); pod.Supplier2UnitCost = m.SupplierPriceLists.Where(x => x.SupplierCode == itemToAdd.Supplier2 && x.ItemCode == itemToAdd.ItemCode).Select(x => x.UnitCost).FirstOrDefault(); pod.Supplier3UnitCost = m.SupplierPriceLists.Where(x => x.SupplierCode == itemToAdd.Supplier3 && x.ItemCode == itemToAdd.ItemCode).Select(x => x.UnitCost).FirstOrDefault(); poFullDetailsList.Add(pod); } Session["newPOList"] = poFullDetailsList; //add to list meant for already added items List <String> tempList = (List <String>)Session["tempList"]; tempList.Add(itemToAdd.ItemCode); Session["tempList"] = tempList; return(RedirectToAction("Purchase", "Store")); } }