/// <summary> ///Created by Michael Takrama ///2017/03/02 /// Parses the lots into a View Model for Datagrid /// </summary> private void ParseLotsIntoViewModel() { _productManager = new ProductManager(); _supplierManager = new SupplierManager(); _locationManager = new LocationManager(); try { _manageStockViewModels.Clear(); foreach (var a in _productLotList) { var manageStockViewModel = new ManageStockViewModel { ProductId = a.ProductId, ProductName = _productManager.RetrieveProductById((int)a.ProductId).Name, SupplierId = a.SupplierId, SupplierName = _supplierManager.RetrieveSupplierBySupplierID((int)a.SupplierId).FarmName, LocationDesc = _locationManager.RetrieveLocationByID((int)a.LocationId).Description, Quantity = a.Quantity, AvailableQuantity = a.AvailableQuantity, ProductLotId = a.ProductLotId }; if (manageStockViewModel.AvailableQuantity != 0 || _checkBoxOverride) { _manageStockViewModels.Add(manageStockViewModel); } } } catch (Exception ex) { if (null != ex.InnerException) { MessageBox.Show(ex.Message + "\n\n" + ex.InnerException.Message); } else { MessageBox.Show("Catastrophic Error: " + ex.Message); } } }