public void Setup() { using (var container = NestedContainer) { var _inventoryService = Using<IInventoryRepository>(container); ; IConfigService _configService = Using<IConfigService>(container); Products.Clear(); var def = new ItnLineItemProductLookupItem {ProductId = Guid.Empty, ProductDesc = "--Please select a product--"}; Products.Add(def); Product = def; var tempL = new ObservableCollection<ItnLineItemProductLookupItem>(); _inventoryService.GetByWareHouseId(_configService.Load().CostCentreId) .Where(n => n.Balance > 0) .ToList() .ForEach(n => tempL.Add(new ItnLineItemProductLookupItem { ProductId = n.Product.Id, ProductDesc = n.Product.Description, ProductCode = n.Product.ProductCode })); tempL.OrderBy(n => n.ProductDesc).ToList().ForEach(n => Products.Add(n)); } }
private void ProductDropDownOpened() { using (var c = NestedContainer) { var selectedId = Using<IItemsLookUp>(c).IssueInventory(SalesmanId); if (selectedId != Guid.Empty) { var product = Using<IProductRepository>(c).GetById(selectedId); if (product != null) { Product = new ItnLineItemProductLookupItem() { ProductId = product.Id, ProductCode = product.ProductCode, ProductDesc = product.Description }; } } } }