Exemple #1
0
        /// <summary>
        /// 执行查询命令
        /// </summary>
        protected override void ExecuteQueryCommand()
        {
            IsBusy        = true;
            IsLoadingList = true;
            Bills.Clear();

            Action action = () => CommunicateManager.Invoke <IAccountService>(service =>
            {
                string status = SelectedStatus == BillStatus.All ? null : (SelectedStatus == BillStatus.Paid ? "2" : "0");
                var result    = service.GetBill(StartTime, EndTime, status, (CurrentPageIndex - 1) * PageSize, PageSize);
                DispatcherHelper.UIDispatcher.Invoke(new Action(() =>
                {
                    TotalCount = result.TotalCount;
                }));

                if (result.List == null)
                {
                    return;
                }
                foreach (var item in result.List)
                {
                    DispatcherHelper.UIDispatcher.Invoke(new Action <BillListDto>(Bills.Add), item);
                }
            }, UIManager.ShowErr);

            Task.Factory.StartNew(action).ContinueWith(task =>
            {
                Action setBusyAction = () => { IsBusy = false; IsLoadingList = false; };
                DispatcherHelper.UIDispatcher.Invoke(setBusyAction);
            });
        }
		async Task ExecuteLoadUsersCommand()
		{
			if (IsBusy)
				return;

			IsBusy = true;

			try
			{
				Bills.Clear();
				var bills = await App.Database.GetCurrentBillsByUserIdAsync(SelectedUserId);

				foreach (var bill in bills)
				{
					Bills.Add(bill);
				}
			}
			catch (Exception e)
			{
				Debug.WriteLine(e);
			}
			finally
			{
				IsBusy = false;
			}
		}
Exemple #3
0
        private async Task LoadData()
        {
            var bills = await BudgetDatabase.GetBills();

            var data = (bills)
                       .Where(x => x.Date >= StartDate)
                       .Where(x => x.Date <= EndDate)
                       .Where(x => x.AccountId == BankAccount.AccountId)
                       .OrderBy(x => x.Date)
                       .Select(bill => bill).ToList();

            billList = new List <Bill>(data);
            Bills.Clear();
            foreach (var item in billList)
            {
                Bills.Add(new BillViewModel(item));
            }

            await UpdateCalculations();

            //var bal = await BudgetDatabase.GetLatestBalance(BankAccount.AccountID, StartDate);
            //StartingBalance = bal.Amount;
            //var billTotal = 0.0;
            //foreach (var bill in billList)
            //{
            //    billTotal += bill.Amount;
            //}

            //DateRangeTotal = billTotal;
            //EndingBalance = StartingBalance - DateRangeTotal;
        }
 public void ClearMockService()
 {
     AccountRecordIdGenerator = 1;
     Accounts.Clear();
     BillRecordIdGenerator = 1;
     Bills.Clear();
 }
Exemple #5
0
        public DateRangeEntryViewModel(DateTime start, DateTime end, BankAccount acct)
        {
            StartDate   = start;
            EndDate     = end;
            BankAccount = acct;
            Bills.Clear();

            var load = LoadData();

            Messenger.Register <UpdateBillMessage>(this, async x => await OnUpdateBillMessage(x.AccountId));
            Messenger.Register <ChangeBillMessage>(this, async x => await OnChangeBillMessage(x.AccountId));
        }
Exemple #6
0
        protected override void LoadFields(StreamReader reader)
        {
            List <Dictionary <string, string> > fieldlist = new List <Dictionary <string, string> > {
                new Dictionary <string, string>()
            };

            while (!reader.EndOfStream)
            {
                if (TryReadField(reader, out Pair <string, string> pair))
                {
                    fieldlist[fieldlist.Count - 1].Add(pair.First, pair.Second);

                    if (pair.First == BREAK)
                    {
                        fieldlist.Add(new Dictionary <string, string>());
                    }
                }
            }


            List <Bill_Production> bills = new List <Bill_Production>();

            for (int i = 0; i < fieldlist.Count - 1; i++)
            {
                var fields = fieldlist[i];

                if (TryCreateBill(fields, out Bill_Production productionBill))
                {
                    if (Bills.Count < BillStack.MaxCount)
                    {
                        bills.Add(productionBill);
                    }
                    else
                    {
                        Log.Warning("Work Table has too many bills. Bill for [" + productionBill.recipe.defName + "] will not be added.");
                    }
                }
            }


            if (bills.Count > 0 && !Append)
            {
                Bills.Clear();
            }
            foreach (Bill_Production bill in bills)
            {
                Bills.AddBill(bill);
            }
        }
        async Task ExecuteLoadItemsCommand()
        {
            IsBusy = true;

            try
            {
                Bills.Clear();
                var items = await DataStore.GetBillsAsync(true);

                foreach (var item in items)
                {
                    Bills.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        private async Task GetBills()
        {
            if (SelectedAccount != null)
            {
                //var billcall = await BudgetDatabase.GetBills();

                //var billData = billcall
                //    .Where(x => x.Date >= StartDate)
                //    .Where(x => x.Date <= EndDate)
                //    .Where(x => x.BankAccount.Nickname.Equals(SelectedAccount))
                //    .OrderBy(x => x.Date).ToList();

                var billData = await BudgetDatabase.GetBillsDateRangeForAccount(StartDate, EndDate, SelectedAccount);

                //var billData = billCall;
                Bills.Clear();
                foreach (var bill in billData)
                {
                    Bills.Add(new BillViewModel(bill));
                }

                await UpdateCalculations();
            }
        }
Exemple #9
0
        private async void Update()
        {
            var bills = await IoC.API.BillsByMemberAsync(_Member.ID);

            if (bills.Any())
            {
                Bills.Clear();
                for (var i = 0; i < 5; i++)
                {
                    Bills.Add(new BillViewModel(bills[i]));
                }
            }

            var votes = await IoC.API.VotesByMemberAsync(_Member.ID);

            if (votes.Any())
            {
                Votes.Clear();
                for (var i = 0; i < 5; i++)
                {
                    Votes.Add(new VoteViewModel(votes[i]));
                }
            }
        }
Exemple #10
0
        public ReturnPageViewModel(INavigationService navigationService,
                                   IGlobalService globalService,
                                   IDialogService dialogService,
                                   IAllocationService allocationService,
                                   IAdvanceReceiptService advanceReceiptService,
                                   IReceiptCashService receiptCashService,
                                   ICostContractService costContractService,
                                   ICostExpenditureService costExpenditureService,
                                   IInventoryService inventoryService,
                                   IPurchaseBillService purchaseBillService,
                                   IReturnReservationBillService returnReservationBillService,
                                   IReturnBillService returnBillService,
                                   ISaleReservationBillService saleReservationBillService,
                                   ISaleBillService saleBillService
                                   ) : base(navigationService, globalService, allocationService, advanceReceiptService, receiptCashService, costContractService, costExpenditureService, inventoryService, purchaseBillService, returnReservationBillService, returnBillService, saleReservationBillService, saleBillService, dialogService)
        {
            Title = "退货单";

            this.BillType = BillTypeEnum.ReturnBill;

            this.Load = ReactiveCommand.Create(async() =>
            {
                ItemTreshold = 1;
                PageCounter  = 0;

                try
                {
                    Bills?.Clear();
                    int?terminalId     = Filter.TerminalId;
                    int?businessUserId = Filter.BusinessUserId;
                    string billNumber  = Filter.SerchKey;
                    DateTime?startTime = Filter.StartTime ?? DateTime.Now;
                    DateTime?endTime   = Filter.EndTime ?? DateTime.Now;

                    int?makeuserId = Settings.UserId;
                    if (Filter.BusinessUserId == Settings.UserId)
                    {
                        businessUserId = 0;
                    }
                    int?wareHouseId     = 0;
                    string terminalName = "";
                    string remark       = "";
                    int?districtId      = 0;
                    int?deliveryUserId  = 0;
                    //获取未审核
                    bool?auditedStatus     = false;
                    bool?sortByAuditedTime = null;
                    bool?showReverse       = null;
                    bool?showReturn        = null;
                    bool?handleStatus      = null;
                    int?paymentMethodType  = null;
                    int?billSourceType     = null;

                    var pending = new List <ReturnBillModel>();


                    var result = await _returnBillService.GetReturnBillsAsync(makeuserId, terminalId, terminalName, businessUserId, deliveryUserId, wareHouseId, districtId, remark, billNumber, startTime, endTime, auditedStatus, sortByAuditedTime, showReverse, showReturn, paymentMethodType, billSourceType, handleStatus, 0, PageSize, this.ForceRefresh, new System.Threading.CancellationToken());

                    if (result != null)
                    {
                        pending = result?.Select(s =>
                        {
                            var sm    = s;
                            sm.IsLast = !(result.LastOrDefault()?.BillNumber == s.BillNumber);
                            return(sm);
                        }).Where(s => s.MakeUserId == Settings.UserId || s.BusinessUserId == Settings.UserId).ToList();
                    }
                    if (pending.Any())
                    {
                        Bills = new System.Collections.ObjectModel.ObservableCollection <ReturnBillModel>(pending);
                    }
                    UpdateTitle();
                }
                catch (Exception ex)
                {
                    Crashes.TrackError(ex);
                }
            });

            this.ItemTresholdReachedCommand = ReactiveCommand.Create(async() =>
            {
                int pageIdex = 0;
                if (Bills?.Count != 0)
                {
                    pageIdex = Bills.Count / (PageSize == 0 ? 1 : PageSize);
                }

                if (PageCounter < pageIdex)
                {
                    PageCounter = pageIdex;
                    using (var dig = UserDialogs.Instance.Loading("加载中..."))
                    {
                        try
                        {
                            int?terminalId     = Filter.TerminalId;
                            int?businessUserId = Filter.BusinessUserId;
                            string billNumber  = Filter.SerchKey;
                            DateTime?startTime = Filter.StartTime ?? DateTime.Now;
                            DateTime?endTime   = Filter.EndTime ?? DateTime.Now;

                            int?makeuserId = Settings.UserId;
                            if (Filter.BusinessUserId == Settings.UserId)
                            {
                                businessUserId = 0;
                            }
                            int?wareHouseId     = 0;
                            string terminalName = "";
                            string remark       = "";
                            int?districtId      = 0;
                            int?deliveryUserId  = 0;
                            //获取未审核
                            bool?auditedStatus     = false;
                            bool?sortByAuditedTime = null;
                            bool?showReverse       = null;
                            bool?showReturn        = null;
                            bool?handleStatus      = null;
                            int?paymentMethodType  = null;
                            int?billSourceType     = null;

                            var pending = new List <ReturnBillModel>();

                            var items = await _returnBillService.GetReturnBillsAsync(makeuserId, terminalId, terminalName, businessUserId, deliveryUserId, wareHouseId, districtId, remark, billNumber, startTime, endTime, auditedStatus, sortByAuditedTime, showReverse, showReturn, paymentMethodType, billSourceType, handleStatus, pageIdex, PageSize, this.ForceRefresh, new System.Threading.CancellationToken());
                            if (items != null)
                            {
                                foreach (var item in items)
                                {
                                    if (Bills.Count(s => s.Id == item.Id) == 0)
                                    {
                                        Bills.Add(item);
                                    }
                                }

                                foreach (var s in Bills)
                                {
                                    s.IsLast = !(Bills.LastOrDefault()?.BillNumber == s.BillNumber);
                                }
                            }
                            UpdateTitle();
                        }
                        catch (Exception ex)
                        {
                            Crashes.TrackError(ex);
                        }
                    }
                }
            }, this.WhenAny(x => x.Bills, x => x.GetValue().Count > 0));

            //选择单据
            this.SelectedCommand = ReactiveCommand.Create <ReturnBillModel>(async x =>
            {
                if (x != null)
                {
                    await NavigateAsync(nameof(ReturnBillPage), ("Bill", x), ("IsSubmitBill", true));
                }
            });

            //菜单选择
            this.SubscribeMenus((x) =>
            {
                //获取当前UTC时间
                DateTime dtime = DateTime.Now;
                switch (x)
                {
                case MenuEnum.TODAY:
                    {
                        Filter.StartTime = DateTime.Parse(dtime.ToString("yyyy-MM-dd 00:00:00"));
                        Filter.EndTime   = dtime;
                        ((ICommand)Load)?.Execute(null);
                    }
                    break;

                case MenuEnum.YESTDAY:
                    {
                        Filter.StartTime = dtime.AddDays(-1);
                        Filter.EndTime   = dtime;
                        ((ICommand)Load)?.Execute(null);
                    }
                    break;

                case MenuEnum.OTHER:
                    {
                        SelectDateRang();
                        ((ICommand)Load)?.Execute(null);
                    }
                    break;

                case MenuEnum.SUBMIT30:
                    {
                        Filter.StartTime = dtime.AddMonths(-1);
                        Filter.EndTime   = dtime;
                        ((ICommand)Load)?.Execute(null);
                    }
                    break;

                case Enums.MenuEnum.CLEARHISTORY:    //清空一个月历史单据
                    {
                        ClearHistory(() => _globalService.UpdateHistoryBillStatusAsync((int)this.BillType));
                        ((ICommand)Load)?.Execute(null);
                    }
                    break;
                }
            }, string.Format(Constants.MENU_VIEW_KEY, 3));

            this.BindBusyCommand(Load);
        }
Exemple #11
0
        public AllocationSummeryPageViewModel(INavigationService navigationService,
                                              IGlobalService globalService,
                                              IDialogService dialogService,
                                              IAllocationService allocationService,
                                              IAdvanceReceiptService advanceReceiptService,
                                              IReceiptCashService receiptCashService,
                                              ICostContractService costContractService,
                                              ICostExpenditureService costExpenditureService,
                                              IInventoryService inventoryService,
                                              IPurchaseBillService purchaseBillService,
                                              IReturnReservationBillService returnReservationBillService,
                                              IReturnBillService returnBillService,
                                              ISaleReservationBillService saleReservationBillService,

                                              ISaleBillService saleBillService
                                              ) : base(navigationService, globalService, allocationService, advanceReceiptService, receiptCashService, costContractService, costExpenditureService, inventoryService, purchaseBillService, returnReservationBillService, returnBillService, saleReservationBillService, saleBillService, dialogService)
        {
            Title = "调拨单";

            this.BillType = BillTypeEnum.AllocationBill;

            Filter.StartTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
            Filter.EndTime   = DateTime.Now;

            this.Load = ReactiveCommand.Create(async() =>
            {
                //重载时排它
                ItemTreshold = 1;
                PageCounter  = 0;
                try
                {
                    DateTime?startTime = Filter.StartTime;
                    DateTime?endTime   = Filter.EndTime;
                    int?businessUserId = Filter.BusinessUserId;
                    int?customerId     = Filter.TerminalId;
                    string billNumber  = Filter.SerchKey;

                    int?makeuserId = Settings.UserId;
                    if (businessUserId.HasValue && businessUserId > 0)
                    {
                        makeuserId = 0;
                    }

                    int?shipmentWareHouseId = 0;
                    int?incomeWareHouseId   = 0;
                    //获取已审核
                    bool?auditedStatus     = true;
                    bool?showReverse       = null;
                    bool?sortByAuditedTime = null;

                    //清除列表
                    Bills?.Clear();

                    var items = await _allocationService.GetAllocationsAsync(makeuserId,
                                                                             businessUserId ?? 0,
                                                                             shipmentWareHouseId,
                                                                             incomeWareHouseId,
                                                                             billNumber,
                                                                             "",
                                                                             auditedStatus,
                                                                             startTime,
                                                                             endTime,
                                                                             showReverse,
                                                                             sortByAuditedTime,
                                                                             0,
                                                                             PageSize,
                                                                             this.ForceRefresh,
                                                                             new System.Threading.CancellationToken());

                    if (items != null)
                    {
                        foreach (var item in items)
                        {
                            if (Bills.Count(s => s.Id == item.Id) == 0)
                            {
                                Bills.Add(item);
                            }
                        }

                        if (items.Count() == 0 || items.Count() == Bills.Count)
                        {
                            ItemTreshold = -1;
                        }

                        foreach (var s in Bills)
                        {
                            s.IsLast = !(Bills.LastOrDefault()?.BillNumber == s.BillNumber);
                        }


                        if (Bills.Count > 0)
                        {
                            this.Bills = new ObservableRangeCollection <AllocationBillModel>(Bills);
                        }
                        UpdateTitle();
                    }
                }
                catch (Exception ex)
                {
                    Crashes.TrackError(ex);
                }
            });
            //以增量方式加载数据
            this.ItemTresholdReachedCommand = ReactiveCommand.Create(async() =>
            {
                int pageIdex = 0;
                if (Bills?.Count != 0)
                {
                    pageIdex = Bills.Count / (PageSize == 0 ? 1 : PageSize);
                }

                if (PageCounter < pageIdex)
                {
                    PageCounter = pageIdex;
                    using (var dig = UserDialogs.Instance.Loading("加载中..."))
                    {
                        try
                        {
                            string billNumber  = Filter.SerchKey;
                            DateTime?startTime = Filter.StartTime;
                            DateTime?endTime   = Filter.EndTime;
                            int?businessUserId = Filter.BusinessUserId;
                            int?customerId     = Filter.TerminalId;

                            int?makeuserId = Settings.UserId;
                            if (businessUserId.HasValue && businessUserId > 0)
                            {
                                makeuserId = 0;
                            }

                            int?shipmentWareHouseId = 0;
                            int?incomeWareHouseId   = 0;
                            //获取已审核
                            bool?auditedStatus     = true;
                            bool?showReverse       = null;
                            bool?sortByAuditedTime = null;


                            var items = await _allocationService.GetAllocationsAsync(makeuserId, businessUserId ?? 0, shipmentWareHouseId, incomeWareHouseId, billNumber, "", auditedStatus, startTime, endTime, showReverse, sortByAuditedTime, pageIdex, PageSize, this.ForceRefresh, new System.Threading.CancellationToken());
                            if (items != null)
                            {
                                foreach (var item in items)
                                {
                                    if (Bills.Count(s => s.Id == item.Id) == 0)
                                    {
                                        Bills.Add(item);
                                    }
                                }

                                if (items.Count() == 0)
                                {
                                    ItemTreshold = -1;
                                }

                                foreach (var s in Bills)
                                {
                                    s.IsLast = !(Bills.LastOrDefault()?.BillNumber == s.BillNumber);
                                }
                                UpdateTitle();
                            }
                        }
                        catch (Exception ex)
                        {
                            Crashes.TrackError(ex);
                        }
                    }
                }
            }, this.WhenAny(x => x.Bills, x => x.GetValue().Count > 0));


            //选择单据
            this.WhenAnyValue(x => x.Selecter).Throttle(TimeSpan.FromMilliseconds(500))
            .Skip(1)
            .Where(x => x != null)
            .SubOnMainThread(async x =>
            {
                if (x != null)
                {
                    await NavigateAsync(nameof(AllocationBillPage), ("Bill", x));
                }
                this.Selecter = null;
            }).DisposeWith(DeactivateWith);

            //菜单选择
            this.SubscribeMenus((x) =>
            {
                //获取当前UTC时间
                DateTime dtime = DateTime.Now;
                switch (x)
                {
                case MenuEnum.TODAY:
                    {
                        Filter.StartTime = DateTime.Parse(dtime.ToString("yyyy-MM-dd 00:00:00"));
                        Filter.EndTime   = dtime;
                        ((ICommand)Load)?.Execute(null);
                    }
                    break;

                case MenuEnum.YESTDAY:
                    {
                        Filter.StartTime = dtime.AddDays(-1);
                        Filter.EndTime   = dtime;
                        ((ICommand)Load)?.Execute(null);
                    }
                    break;

                case MenuEnum.OTHER:
                    {
                        SelectDateRang();
                        ((ICommand)Load)?.Execute(null);
                    }
                    break;

                case MenuEnum.SUBMIT30:
                    {
                        Filter.StartTime = dtime.AddMonths(-1);
                        Filter.EndTime   = dtime;
                        ((ICommand)Load)?.Execute(null);
                    }
                    break;

                case Enums.MenuEnum.CLEARHISTORY:    //清空一个月历史单据
                    {
                        ClearHistory(() => _globalService.UpdateHistoryBillStatusAsync((int)this.BillType));
                        ((ICommand)Load)?.Execute(null);
                    }
                    break;
                }
            }, string.Format(Constants.MENU_KEY, 4));

            this.BindBusyCommand(Load);
        }
Exemple #12
0
        public InventoryReportViewPageViewModel(INavigationService navigationService,
                                                IGlobalService globalService,
                                                IDialogService dialogService,
                                                IAllocationService allocationService,
                                                IAdvanceReceiptService advanceReceiptService,
                                                IReceiptCashService receiptCashService,
                                                ICostContractService costContractService,
                                                ICostExpenditureService costExpenditureService,
                                                IInventoryService inventoryService,
                                                IPurchaseBillService purchaseBillService,
                                                IReturnReservationBillService returnReservationBillService,
                                                IReturnBillService returnBillService,
                                                ISaleReservationBillService saleReservationBillService,
                                                IWareHousesService wareHousesService,
                                                ISaleBillService saleBillService
                                                ) : base(navigationService, globalService, allocationService, advanceReceiptService, receiptCashService, costContractService, costExpenditureService, inventoryService, purchaseBillService, returnReservationBillService, returnBillService, saleReservationBillService, saleBillService, dialogService)
        {
            Title = "库存上报";

            _wareHousesService = wareHousesService;

            this.Load = ReactiveCommand.Create(async() =>
            {
                ItemTreshold = 1;
                PageCounter  = 0;

                try
                {
                    Bills?.Clear();
                    var pending = new List <InventoryReportSummaryModel>();

                    int?makeuserId     = Settings.UserId;
                    int?terminalId     = null;
                    int?businessUserId = null;
                    int?productId      = null;
                    int?channelId      = null;
                    int?rankId         = null;
                    int?districtId     = null;

                    string billNumber  = Filter.SerchKey;
                    DateTime?startTime = Filter.StartTime ?? DateTime.Now.AddMonths(-1);
                    DateTime?endTime   = Filter.EndTime ?? DateTime.Now;


                    var result = await _wareHousesService.GetInventoryReportAsync(makeuserId, businessUserId, terminalId, channelId, rankId, districtId, productId, startTime, endTime, 0, PageSize, this.ForceRefresh, new System.Threading.CancellationToken());


                    if (result != null)
                    {
                        pending = result?.Select(s =>
                        {
                            var sm    = s;
                            sm.IsLast = !(result?.LastOrDefault()?.BillNumber == s.BillNumber);
                            return(sm);
                        }).Where(s => s.MakeUserId == Settings.UserId || s.BusinessUserId == Settings.UserId).ToList();
                    }
                    if (pending.Any())
                    {
                        Bills = new System.Collections.ObjectModel.ObservableCollection <InventoryReportSummaryModel>(pending);
                    }


                    UpdateTitle();
                }
                catch (Exception ex)
                {
                    Crashes.TrackError(ex);
                }
            });


            this.ItemTresholdReachedCommand = ReactiveCommand.Create(async() =>
            {
                int pageIdex = 0;
                if (Bills?.Count != 0)
                {
                    pageIdex = Bills.Count / (PageSize == 0 ? 1 : PageSize);
                }

                if (PageCounter < pageIdex)
                {
                    PageCounter = pageIdex;
                    using (var dig = UserDialogs.Instance.Loading("加载中..."))
                    {
                        try
                        {
                            int?makeuserId     = Settings.UserId;
                            int?terminalId     = null;
                            int?businessUserId = null;
                            int?productId      = null;
                            int?channelId      = null;
                            int?rankId         = null;
                            int?districtId     = null;

                            string billNumber  = Filter.SerchKey;
                            DateTime?startTime = Filter.StartTime ?? DateTime.Now.AddMonths(-1);
                            DateTime?endTime   = Filter.EndTime ?? DateTime.Now;


                            var result = await _wareHousesService.GetInventoryReportAsync(makeuserId, businessUserId, terminalId, channelId, rankId, districtId, productId, startTime, endTime, 0, PageSize, this.ForceRefresh, new System.Threading.CancellationToken());

                            if (result != null)
                            {
                                foreach (var item in result)
                                {
                                    if ((item.MakeUserId == Settings.UserId || item.BusinessUserId == Settings.UserId) && Bills.Count(s => s.Id == item.Id) == 0)
                                    {
                                        Bills.Add(item);
                                    }
                                }

                                foreach (var s in Bills)
                                {
                                    s.IsLast = !(Bills.LastOrDefault()?.BillNumber == s.BillNumber);
                                }
                            }

                            UpdateTitle();
                        }
                        catch (Exception ex)
                        {
                            Crashes.TrackError(ex);
                        }
                    }
                }
            }, this.WhenAny(x => x.Bills, x => x.GetValue().Count > 0));

            this.BindBusyCommand(Load);
        }
        private void RefreshBillListItems()
        {
            switch (_SortOptions.GetLastOption())
            {
            case "Id":
                if (_SortOptions.GetDescending())
                {
                    _DBConnection.Bills = Bills.OrderByDescending(x => x.Id).ToList <DBConnection.Bill>();
                }
                else
                {
                    _DBConnection.Bills = Bills.OrderBy(x => x.Id).ToList <DBConnection.Bill>();
                }
                break;

            case "Category":
                if (_SortOptions.GetDescending())
                {
                    _DBConnection.Bills = Bills.OrderByDescending(x => x.Category).ToList <DBConnection.Bill>();
                }
                else
                {
                    _DBConnection.Bills = Bills.OrderBy(x => x.Category).ToList <DBConnection.Bill>();
                }
                break;

            case "DueDate":
                if (_SortOptions.GetDescending())
                {
                    _DBConnection.Bills = Bills.OrderByDescending(x => x.DueDate).ToList <DBConnection.Bill>();
                }
                else
                {
                    _DBConnection.Bills = Bills.OrderBy(x => x.DueDate).ToList <DBConnection.Bill>();
                }
                break;

            case "ForMonth":
                if (_SortOptions.GetDescending())
                {
                    _DBConnection.Bills = Bills.OrderByDescending(x => x.ForMonth).ToList <DBConnection.Bill>();
                }
                else
                {
                    _DBConnection.Bills = Bills.OrderBy(x => x.ForMonth).ToList <DBConnection.Bill>();
                }
                break;

            case "Amount":
                if (_SortOptions.GetDescending())
                {
                    _DBConnection.Bills = Bills.OrderByDescending(x => x.Amount).ToList <DBConnection.Bill>();
                }
                else
                {
                    _DBConnection.Bills = Bills.OrderBy(x => x.Amount).ToList <DBConnection.Bill>();
                }
                break;

            case "Paid":
                if (_SortOptions.GetDescending())
                {
                    _DBConnection.Bills = Bills.OrderByDescending(x => x.Paid).ToList <DBConnection.Bill>();
                }
                else
                {
                    _DBConnection.Bills = Bills.OrderBy(x => x.Paid).ToList <DBConnection.Bill>();
                }
                break;
            }

            _DBConnection.ReOrderMonthBills();

            Bills.Clear();
            MonthBills.Clear();

            foreach (DBConnection.Bill bill in _DBConnection.Bills)
            {
                Bills.Add(bill);
            }

            foreach (DBConnection.Bill bill in _DBConnection.MonthBills)
            {
                MonthBills.Add(bill);
            }
        }