public AccountRecordQueryOption()
 {
     AccountType = new AccountType { ParentTypeId = 0, TypeId = 0 };
     UserId = 0;
     PageIndex = 1;
     PageSize = 10;
     BeginTime = DateTime.MinValue;
     EndTime = DateTime.MaxValue;
     SortName = string.Empty;
     SortDir = SortDir.DESC;
     ShowAccessorial = false;
 }
Example #2
0
        /// <summary>
        /// 查询消费记录
        /// </summary>
        private void QueryRecords()
        {
            if (this.CurrQueryOperation != null && !this.CurrQueryOperation.IsComplete)
            {
                return;
            }

            if (_accountType == null)
            {
                _accountType = AccountBookContext.Instance.DefaultAccountType;
            }

            var option = new AccountRecordQueryOption
            {
                AccountType = _accountType.Clone(),
                UserId = _consumer == null ? AccountBookContext.Instance.DefaultConsumer.UserId : _consumer.UserId,
                PageIndex = 0,
                PageSize = int.MaxValue,
                BeginTime = _beginDate.HasValue ? _beginDate.Value : DateTime.MinValue,
                EndTime = _endDate.HasValue ? _endDate.Value.AddDays(1) : DateTime.MaxValue,
                KeyWord = _keyword,
                AccountCategory = _accountCategory,
                ShowAccessorial = _showAccessorial
            };

            if (_statisticsType == StatisticsType.AmountInfo)
            {
                if (_statisticsRange == "Month")
                {
                    // 获取服务端消费记录数据
                    this.CurrQueryOperation = ContextFactory.RecordsContext.GetConsumeAmountByMonth(option, result =>
                    {
                        if (result.IsCanceled)
                        {
                            return;
                        }

                        if (result.HasError)
                        {
                            ErrorWindow.CreateNew(result.Error);
                        }
                        else
                        {
                            _dataInfos = result.Value;
                            DrawChart(_dataInfos, _renderAs);
                        }

                    }, null);
                }
                else
                {
                    // 获取服务端消费记录数据
                    this.CurrQueryOperation = ContextFactory.RecordsContext.GetConsumeAmountByYear(option, result =>
                    {
                        if (result.IsCanceled)
                        {
                            return;
                        }

                        if (result.HasError)
                        {
                            ErrorWindow.CreateNew(result.Error);
                        }
                        else
                        {
                            _dataInfos = result.Value;
                            DrawChart(_dataInfos, _renderAs);
                        }

                    }, null);
                }
            }
            else if(_statisticsType == StatisticsType.AccountType)
            {
                this.CurrQueryOperation = ContextFactory.RecordsContext.GetAccountTypeInfo(option, 2, result =>
                {
                    if (result.IsCanceled)
                    {
                        return;
                    }

                    if (result.HasError)
                    {
                        ErrorWindow.CreateNew(result.Error);
                    }
                    else
                    {
                        _dataInfos = result.Value;
                        DrawChart(_dataInfos, _renderAs);
                    }
                }, null);
            }
        }
Example #3
0
        private void QueryPanelQueryConditionChanged(object sender, Silverlight.Events.QueryConditionChangedEventArgs e)
        {
            _beginDate = e.BeginTime;
            _endDate = e.EndTime;
            _accountType = e.AccountType;
            _consumer = e.Consumer;
            _keyword = e.Keyword;
            _accountCategory = e.AccountCategory;
            _showAccessorial = e.ShowAccessorial;

            QueryRecords();
        }
Example #4
0
        /// <summary>
        /// 查询消费记录
        /// </summary>
        private void QueryRecords()
        {
            if (this.CurrQueryOperation != null && !this.CurrQueryOperation.IsComplete)
            {
                return;
            }

            if (_accountType == null)
            {
                _accountType = AccountBookContext.Instance.DefaultAccountType;
            }

            var option = new AccountRecordQueryOption
            {
                AccountType = _accountType.Clone(),
                UserId = _consumer == null ? AccountBookContext.Instance.DefaultConsumer.UserId : _consumer.UserId,
                PageIndex = RecordsPager.PageIndex == -1 ? 0 : RecordsPager.PageIndex,
                PageSize = RecordsPager.PageSize,
                BeginTime = _begigDate.HasValue ? _begigDate.Value : DateTime.MinValue,
                EndTime = _endDate.HasValue ? _endDate.Value.AddDays(1) : DateTime.MaxValue,
                SortName = _sortName,
                SortDir = _sortDir,
                KeyWord = _keyword,
                AccountCategory = _accountCategory,
                ShowAccessorial = _showAccessorial
            };

            if (_accountCategory == AccountCategory.Expense)
            {
                BtnCreateExpenseRecord.Visibility = Visibility.Visible;
                BtnCreateIncomeRecord.Visibility = Visibility.Collapsed;
            }
            else if (_accountCategory == AccountCategory.Income)
            {
                BtnCreateExpenseRecord.Visibility = Visibility.Collapsed;
                BtnCreateIncomeRecord.Visibility = Visibility.Visible;
            }
            else
            {
                BtnCreateExpenseRecord.Visibility = Visibility.Visible;
                BtnCreateIncomeRecord.Visibility = Visibility.Visible;
            }

            // 获取服务端消费记录数据
            this.CurrQueryOperation = ContextFactory.RecordsContext.GetConsumeRecordList(option, operation =>
            {
                if (operation.IsCanceled)
                {
                    return;
                }

                this.RecordsGrid.ItemsSource = operation.Value.Records;
                TotalMoney.Text = operation.Value.TotalMoney.ToString();

                if (operation.Value.TotalCount != RecordsPager.ItemCount)
                {
                    _recordsCounts.Clear();
                    for (int count = 0; count < operation.Value.TotalCount; count++)
                    {
                        _recordsCounts.Add(count);
                    }
                    var pcv = new PagedCollectionView(_recordsCounts);
                    this.RecordsPager.Source = pcv;
                    this.RecordsPager.PageIndex = _currPageIndex;
                }
            }, null);
        }
Example #5
0
        private void QueryPanelQueryConditionChanged(object sender, QueryConditionChangedEventArgs e)
        {
            _begigDate = e.BeginTime;
            _endDate = e.EndTime;
            _consumer = e.Consumer;
            _accountType = e.AccountType;
            _keyword = e.Keyword;
            _showAccessorial = e.ShowAccessorial;
            if(e.AccountCategory != _accountCategory)
            {
                _accountCategory = e.AccountCategory;
                RecordsPager.PageIndex = 0;
            }

            QueryRecords();
        }