예제 #1
0
        public virtual async Task RenderListAsync(AccountRecord page, int pageIndex = 1)
        {
            try
            {
                var rows     = 20;
                var gteTime  = Convert.ToDateTime(page.DpStartTime.Text);
                var lteTime  = Convert.ToDateTime(page.DpEndTime.Text);
                var type     = (EnumAccountRecordType)Convert.ToInt32(((ComboBoxItem)page.CmbType.SelectedValue).Tag.ToString());
                var response = await _onMainHostRequestPlugins.QueryAccountRecorrdAsync(new AccountRecordRequest()
                {
                    Page        = pageIndex,
                    Rows        = rows,
                    Type        = (int)type,
                    GteTime     = gteTime,
                    LteTime     = lteTime,
                    AccessToken = AccountCache.Persist.AccessToken
                });

                if (response != null && response.Code == Application.Enums.ApiCodeEnums.ERROR_NOLOGIN)
                {
                    _onTipRender.ExecuteTip(page.BodyPanel, "登陆失效,请退出重新登陆");
                    _onRedirectRender.RedirectLogin();
                    return;
                }

                var resp = response.Data;
                #region 数据绑定

                _onControlRender.ThreadExecuteUI(() =>
                {
                    _onControlRender.BindFrameworkElement(page.DataGridOrderList, resp?.Data?.ToList() ?? null);

                    if ((resp?.Data?.Count() ?? 0) <= 0)
                    {
                        page.SpPager.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        page.SpPager.Visibility = Visibility.Visible;
                    }

                    var sump                    = Convert.ToInt32(resp.TotalCount) % rows;
                    var totalPage               = Convert.ToInt32(resp?.TotalCount ?? 0) / rows + (sump > 0 ? 1 : 0);
                    page.labTotalPage.Content   = $"/{totalPage}";
                    page.labCurrentPage.Content = $"{pageIndex}";

                    page.labPrePage.Tag        = $"{pageIndex - 1}";
                    page.labPrePage.IsEnabled  = pageIndex > 1;
                    page.labNextPage.Tag       = $"{pageIndex + 1}";
                    page.labNextPage.IsEnabled = (pageIndex + 1) <= totalPage;
                    page.txbJumb.Tag           = totalPage;
                });
                #endregion
            }
            catch (Exception ex)
            {
                TextHelper.Error("RenderList 异常", ex);
                _onTipRender.ExecuteTip(page.BodyPanel, "查询异常[0001]");
            }
        }
예제 #2
0
        public virtual async Task RenderAccountAsync(Main main)
        {
            try
            {
                var acccountResponse = await _onMainHostRequestPlugins.QueryAccountAsync(AccountCache.Persist.AccessToken);

                if (acccountResponse.Code == Application.Enums.ApiCodeEnums.ERROR_NOLOGIN)
                {
                    _onTipRender.ExecuteTip(main.BodyPanel, "登陆失效,请退出重新登陆");
                    _onRedirectRender.RedirectLogin();
                    return;
                }
                var data = acccountResponse?.Data ?? null;
                AccountCache.Persist.IsMember = data?.IsMember ?? false;
                _onControlRender.ThreadExecuteUI(() =>
                {
                    var suspensionMain = AutofacManage.GetService <SuspensionMain>();
                    suspensionMain.labPayMoney.Content = $"¥{(acccountResponse.Data?.Balance ?? 0)}";
                    data.RealName             = string.IsNullOrWhiteSpace(data.RealName) ? "未实名认证" : data.RealName;
                    main.labStoreName.Content = data.RealName;
                    main.StoreBox.DataContext = data;
                });
            }
            catch (Exception ex)
            {
                TextHelper.Error($"RenderAccountAsync 异常 message:{ex.Message}", ex);
            }
        }
예제 #3
0
        public virtual async Task RenderAccountAsync(Account account)
        {
            try
            {
                var acccountResponse = await _onMainHostRequestPlugins.QueryAccountAsync(AccountCache.Persist.AccessToken);

                if (acccountResponse.Code == Application.Enums.ApiCodeEnums.ERROR_NOLOGIN)
                {
                    _onTipRender.ExecuteTip(account.BodyPanel, "登陆失效,请退出重新登陆");
                    _onRedirectRender.RedirectLogin();
                    return;
                }
                var data = acccountResponse?.Data ?? null;
                _onControlRender.ThreadExecuteUI(() =>
                {
                    if (!string.IsNullOrWhiteSpace(data.AlipayAccount))
                    {
                        account.tbAlipayAccount.IsReadOnly = true;
                    }
                    if (!string.IsNullOrWhiteSpace(data.RealName))
                    {
                        account.tbAlipayName.IsReadOnly = true;
                    }
                    var handleFee = $"提现手续费{AccountCache.Persist.SystemSettings.HandleFee * 100}%";
                    if (AccountCache.Persist.SystemSettings.HandleFee >= 1)
                    {
                        handleFee = $"提现手续费{AccountCache.Persist.SystemSettings.HandleFee}元";
                    }
                    account.lbHandler.Content     = handleFee;
                    account.BodyPanel.DataContext = data;
                });
            }
            catch (Exception ex)
            {
                TextHelper.Error($"RenderAccountAsync 异常 message:{ex.Message}", ex);
            }
        }
예제 #4
0
        public virtual async Task RenderListAsync(Product page)
        {
            try
            {
                var listResponse = await _onMainHostRequestPlugins.GetProductListAsync(AccountCache.Persist.AccessToken);

                if (listResponse.Code == Application.Enums.ApiCodeEnums.ERROR_NOLOGIN)
                {
                    _onTipRender.ExecuteTip(page.BodyPanel, "登陆失效,请退出重新登陆");
                    _onRedirectRender.RedirectLogin();
                    return;
                }
                var data = listResponse.Data;
                _onControlRender.ThreadExecuteUI(() =>
                {
                    for (var i = 0; i < data.Count; i++)
                    {
                        if (i == 0)
                        {
                            data[i].Color = "#818184";
                        }
                        if (i == 1)
                        {
                            data[i].Color = "#708e9e";
                        }
                        if (i == 2)
                        {
                            data[i].Color = "#a9a98d";
                        }
                        if (i == 3)
                        {
                            data[i].Color = "#8aa48d";
                        }
                        if (i == 4)
                        {
                            data[i].Color = "#7f698c";
                        }
                    }
                    page.DataGridProductList.ItemsSource = listResponse.Data;
                });
            }
            catch (Exception ex)
            {
                TextHelper.Error("RenderListAsync 异常", ex);
                _onTipRender.ExecuteTip(page.BodyPanel, "查询异常[0001]");
            }
        }