Пример #1
0
        /// <summary>
        /// 执行查询命令
        /// </summary>
        protected override void ExecuteQueryCommand()
        {
            IsLoadingList = IsBusy = true;
            BalanceDetails.Clear();

            Action action = () => CommunicateManager.Invoke <IAccountService>(service =>
            {
                var result = service.GetScoreAccountDetails(StartTime, EndTime, (CurrentPageIndex - 1) * PageSize, PageSize, OutTradeNo);
                DispatcherHelper.UIDispatcher.Invoke(new Action(() =>
                {
                    TotalCount = result.TotalCount;
                }));

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

            Task.Factory.StartNew(action).ContinueWith(task =>
            {
                Action setBusyAction = () => { IsLoadingList = IsBusy = false; };
                DispatcherHelper.UIDispatcher.Invoke(setBusyAction);
            });
        }
Пример #2
0
        /// <summary>
        /// 执行查询命令
        /// </summary>
        protected override void ExecuteQueryCommand()
        {
            //if (StartTime == null)
            //{
            //    UIManager.ShowMessage("请选择开始时间");
            //    return;
            //}
            //if (EndTime == null)
            //{
            //    UIManager.ShowMessage("请选择结束时间");
            //    return;
            //}

            //TimeSpan ts = EndTime.Value - StartTime.Value;
            //if (ts.Days > 92)
            //{
            //    UIManager.ShowMessage("导出的日期间隔最大为3个月时间");
            //    return;
            //}

            _isQueryList = IsBusy = true;
            BalanceDetails.Clear();

            Action action = () => CommunicateManager.Invoke <IAccountService>(service =>
            {
                var result = service.GetReadyAccountDetails(StartTime, EndTime, OutTradeNo, null, (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 <BalanceDetailDto>(BalanceDetails.Add), item);
                }
            }, UIManager.ShowErr);

            Task.Factory.StartNew(action).ContinueWith(task =>
            {
                Action setBusyAction = () => { _isQueryList = IsBusy = false; };
                DispatcherHelper.UIDispatcher.Invoke(setBusyAction);
            });
        }