public void GlobalStockTest() { int mediID = 2; var stockList = reportDao.GlobaStock(); var reportView = from m in stockList where m.ItemID == mediID select m; int mediQuantity = reportView.First().Quantity; var selectedMediList = from m in reportDao.Packages where m.MedicalID == mediID select m; var totalValue = selectedMediList.Count() * 100; Assert.AreEqual(mediQuantity, totalValue); }
public DistributionCenterStockGUIView GenerateGlobalStock() { ICollection <DistributionCenterStockView> stockReport = reportDao.GlobaStock(); DistributionCenterStockGUIView GUIView = new DistributionCenterStockGUIView(); int totalItems = 0; double totalValue = 0; foreach (DistributionCenterStockView item in stockReport) { Medication med = medicationDao.GetMedication(item.ItemID); item.ItemName = med.Description; item.Total = (item.Quantity * med.Value.Value); totalItems += item.Quantity; totalValue += item.Total; } GUIView.Items = stockReport; GUIView.TotalQuantity = totalItems; GUIView.TotalValue = totalValue; return(GUIView); }