private void StoreChanged() { using (var container = NestedContainer) { var selected = Using<IAgriItemsLookUp>(container).SelectStore(); SelectedStore = selected; if (selected == null) { SelectedStore = new Store(Guid.Empty) { Name = "--Select Store---" }; SelectedStoreName = "--Select Store---"; var query = new QueryCommoditySupplierInventory(); if (SelectedCommoditySupplier.Id != Guid.Empty) { query.CommoditySupplierId = SelectedCommoditySupplier.Id; } QueryCommoditySupplierInventoryLevel = query; IsSet = true; LoadCommoditySupplierInventoryList(IsSet); } else { SelectedStoreName = SelectedStore.Name; var query = new QueryCommoditySupplierInventory(); query.StoreId = selected.Id; if (SelectedCommoditySupplier.Id != Guid.Empty) { query.CommoditySupplierId = SelectedCommoditySupplier.Id; } QueryCommoditySupplierInventoryLevel = query; IsSet = true; LoadCommoditySupplierInventoryList(IsSet); } } }
private void LoadCommoditySupplierInventoryList(bool isSet) { using (var c = ObjectFactory.Container.GetNestedContainer()) { var query = new QueryCommoditySupplierInventory(); query.Skip = ItemsPerPage * (CurrentPage - 1); query.Take = ItemsPerPage; if(isSet) { query = QueryCommoditySupplierInventoryLevel; } //else //{ // query.Skip = 0; // query.Take = 5; //} var rawList = c.GetInstance<ICommoditySupplierInventoryRepository>().Query(query); var data = rawList.Data.OfType<CommoditySupplierInventoryLevel>(); WarehouseInventoryLevelsList.Clear(); RowNumber=1; //rawList.ForEach(n => WarehouseInventoryLevelsList.Add(Map(n))); _pagedCommoditySupplierInventoryLevel = new PagenatedList<CommoditySupplierInventoryLevel>(data.AsQueryable(), CurrentPage, ItemsPerPage, rawList.Count, true); _pagedCommoditySupplierInventoryLevel.ForEach(n => WarehouseInventoryLevelsList.Add(Map(n))); UpdatePagenationControl(); } }