public static RetrievalForm getRetrivalData(string productNum) { RetrievalForm rf = new RetrievalForm(); Product p = ProductDAO.getSearchProductbyid(productNum); rf.productDescription = p.Description.ToString(); rf.availableQty = Convert.ToInt32(p.Stock.TotalInventoryBalance); rf.needeQty = ConsolidatedRequisitionListEFFacade.getNeededQty(productNum); List <string> depList = ConsolidatedRequisitionListEFFacade.getAllDepInvolved(productNum); List <int> qtyList = ConsolidatedRequisitionListEFFacade.getQtyNeedeOfDep(depList, productNum); rf.departments = depList; rf.depNeededQty = qtyList; List <int> tempDistList = new List <int>(); int tempStock = rf.availableQty; for (int i = 0; i < depList.Count(); i++) { if (tempStock < rf.depNeededQty[i]) { tempDistList.Add(tempStock); tempStock = 0; } if (tempStock > rf.depNeededQty[i]) { tempDistList.Add(rf.depNeededQty[i]); tempStock = tempStock - rf.depNeededQty[i]; } } rf.depAvailQty = tempDistList; return(rf); }
public RetrievalFormWCF getRetrievalForm(string itemnumber) { RetrievalForm rf = RetreiveStationaryController.getRetrivalData(itemnumber); RetrievalFormWCF rfwcf = new RetrievalFormWCF(); rfwcf.NeededQty = rf.needeQty; rfwcf.AvailableQty = rf.availableQty; rfwcf.Departments = rf.departments.ToArray <string>(); rfwcf.DepNeededQty = rf.depNeededQty.ToArray <int>(); rfwcf.DepAvailQt = rf.depAvailQty.ToArray <int>(); return(rfwcf); }