protected async virtual void ListOrders() { await Task.Factory.StartNew(() => { Application.Current.Dispatcher.BeginInvoke( new Action(delegate { if (SelectedOrderStatus != DocumentStatus.Confirmed) ShowApproveSelectedButton = Visibility.Collapsed; using (var container = NestedContainer) { OrdersSummaryList.Clear(); if (isUnconfirmedTab) { var orderSaveAndContinueService = Using<IOrderSaveAndContinueService>( container); var item =orderSaveAndContinueService.Query( StartDate, EndDate, SelectedOrderType); IPagenatedList<OrderSaveAndContinueLater> ItemList = new PagenatedList<OrderSaveAndContinueLater>( item.AsQueryable(), CurrentPage, ItemsPerPage, item.Count()); ItemList.Select(Map).ToList(). ForEach( OrdersSummaryList.Add); } else { //var orders = Using<IMainOrderRepository>( // container) // .GetMainOrderSummariyList(StartDate, EndDate, // SelectedOrderType, // SelectedOrderStatus, // SearchText); var orders = Using<IMainOrderRepository>(container). PagedDocumentList(CurrentPage, ItemsPerPage, StartDate, EndDate, SelectedOrderType, SelectedOrderStatus, SearchText); if (orders != null && orders.Any()) { PagedDocumentList = new PagenatedList<MainOrderSummary>( orders.AsQueryable(), CurrentPage, ItemsPerPage, orders.TotalItemCount,true); PagedDocumentList.Select(Map).ToList(). ForEach( OrdersSummaryList.Add); UpdatePagenationControl(); } } } })); }); }
private void LoadWeighingScalesList() { Application.Current.Dispatcher.BeginInvoke( new Action( delegate { using (var c = NestedContainer) { var list = Using<IEquipmentRepository>(c).GetAll(ShowInactive).OfType<WeighScale>() .Where(n => (n.Name.ToLower().Contains(SearchText.ToLower()) || n.Code.ToLower().Contains(SearchText.ToLower()))); list = list.OrderBy(n => n.Name).ThenBy(n => n.Code); _pagedList = new PagenatedList<WeighScale>(list.AsQueryable(), CurrentPage, ItemsPerPage, list.Count()); WeighingScalesList.Clear(); var devices = from equipment in XElement.Load(@"ScalePrinterAssetsDB.xml").Elements("Equipment") select equipment; _pagedList.Select( (scale, i) => Map(scale, i, devices.FirstOrDefault(n => Guid.Parse(n.Element("Id").Value) == scale.Id))) .ToList().ForEach(WeighingScalesList.Add); UpdatePagenationControl(); } })); }
protected override void Load(bool isFirstLoad = false) { Application.Current.Dispatcher.BeginInvoke( new Action( delegate { if (isFirstLoad) Setup(); using (var c = NestedContainer) { var rawList = Using<IVehicleRepository>(c).GetAll(ShowInactive).OfType<Vehicle>() .Where(n => n.Code.ToLower().Contains(SearchText.ToLower()) || n.Name.ToLower().Contains(SearchText.ToLower()) || n.Make.ToLower().Contains(SearchText.ToLower()) || n.Model.ToLower().Contains(SearchText.ToLower()) || n.Description.ToLower().Contains(SearchText.ToLower()) ); rawList = rawList.OrderBy(n => n.Name).ThenBy(n => n.Code); _pagedList = new PagenatedList<Vehicle>(rawList.AsQueryable(), CurrentPage, ItemsPerPage, rawList.Count()); VehiclesList.Clear(); _pagedList.Select((n, i) => Map(n, i + 1)).ToList().ForEach( n => VehiclesList.Add(n)); UpdatePagenationControl(); } })); }
void LoadContainersList() { Application.Current.Dispatcher.BeginInvoke( new Action( delegate { using (var c = NestedContainer) { var list = Using<IEquipmentRepository>(c).GetAll(ShowInactive).OfType<SourcingContainer>() .Where(n => (n.Name.ToLower().Contains(SearchText.ToLower()) || n.Code.ToLower().Contains(SearchText.ToLower()))); if (SelectedContainerType != null && SelectedContainerType.Id != Guid.Empty) list = list.Where(n => n.ContainerType.Id == SelectedContainerType.Id); list = list.OrderBy(n => n.Name).ThenBy(n => n.Code); _pagedList = new PagenatedList<SourcingContainer>(list.AsQueryable(), CurrentPage, ItemsPerPage, list.Count()); ContainersList.Clear(); _pagedList.Select(Map).ToList().ForEach(ContainersList.Add); UpdatePagenationControl(); } })); }
protected override void Load(bool isFirstLoad = false) { Application.Current.Dispatcher.BeginInvoke( new Action( delegate { if (isFirstLoad) Setup(); using (var c = NestedContainer) { var rawList = Using<ICommoditySupplierRepository>(c).GetAll(ShowInactive); //.Where(n => n.CostCentreCode.ToLower().Contains(SearchText.ToLower()) || // n.Name.ToLower().Contains(SearchText.ToLower())); //var rawVmList =new List<VMCommoditySupplier>(); //foreach(var commoditySupplier in rawList) //{ // rawVmList.Add(new VMCommoditySupplier // { // SupplierId=commoditySupplier.Id, // AccountName=commoditySupplier.Name, // }); //} rawList = rawList.OrderBy(n => n.Name).ThenBy(n => n.CostCentreCode); _pagedCommodityOwners = new PagenatedList<CommoditySupplier>(rawList.OfType<CommoditySupplier>().AsQueryable(), CurrentPage, ItemsPerPage, rawList.Count()); CommodityOwnersList.Clear(); _pagedCommodityOwners.Select((n, i) => Map(n, i + 1)).ToList().ForEach( n => CommodityOwnersList.Add(n)); UpdatePagenationControl(); } })); }
protected override void Load(bool isFirstLoad = false) { Application.Current.Dispatcher.BeginInvoke( new Action( delegate { if (isFirstLoad) Setup(); using (var c = NestedContainer) { var query = new QueryCommoditySupplier(); query.Skip = ItemsPerPage*(CurrentPage-1); query.Take = ItemsPerPage; query.ShowInactive = ShowInactive; if (!string.IsNullOrWhiteSpace(SearchText)) query.Name = SearchText; var rawList = Using<ICommoditySupplierRepository>(c).Query(query); var data = rawList.Data.OfType<CommoditySupplier>(); _pagedCommoditySuppliers = new PagenatedList<CommoditySupplier>(data.AsQueryable(), CurrentPage, ItemsPerPage, rawList.Count,true); CommoditySuppliersList.Clear(); int rownumber = 0; _pagedCommoditySuppliers.Select((n, i) => Map(n, i + 1)).ToList().ForEach( n => { if (n != null) CommoditySuppliersList.Add(new VMCommoditySupplier { SupplierId = n.CommoditySupplier.Id, CostCenterCode = n.CommoditySupplier.CostCentreCode ?? "", Name = n.CommoditySupplier.Name??"", AccountName = n.CommoditySupplier.AccountName??"", AccountNo = n.CommoditySupplier.AccountNo??"", Bank =n.CommoditySupplier.BankId!=Guid.Empty? Using<IBankRepository>(c).GetById(n.CommoditySupplier.BankId).Name:"", BankBranch =n.CommoditySupplier.BankBranchId!=Guid.Empty? Using<IBankBranchRepository>(c).GetById( n.CommoditySupplier.BankBranchId).Name:"", Status=n.CommoditySupplier._Status, Action=n.CommoditySupplier._Status==EntityStatus.Active?"Deactivate":"Activate", RowNumber=++rownumber }); }); UpdatePagenationControl(); } })); }
private void LoadContainerTypesList() { using (var c = NestedContainer) { var list = Using<IContainerTypeRepository>(c).GetAll(ShowInactive) .Where(n => n.Name.ToLower().Contains(SearchText.ToLower()) || n.Code.ToLower().Contains(SearchText.ToLower())) .OrderBy(n => n.Name).ThenBy(n => n.Code); _pagedList = new PagenatedList<ContainerType>(list.AsQueryable(), CurrentPage, ItemsPerPage, list.Count()); ContainerTypesList.Clear(); _pagedList.Select(Map).ToList().ForEach(ContainerTypesList.Add); UpdatePagenationControl(); } }