Exemplo n.º 1
0
        public void GetPageListResponse(DataResponse <
                                            UserSubAccountOptState, Page <UserSubAccountDetails> > pageListResponse)
        {
            if (_getPageListResponse != null)
            {
                if (pageListResponse.State == UserSubAccountOptState.Successed)
                {
                    var list = pageListResponse.Data.List == null ? null :
                               pageListResponse.Data.List.Select <UserSubAccountDetails, UserSubAccountPageListVM>(details =>
                    {
                        var vm = new UserSubAccountPageListVM
                        {
                            Id               = details.Id,
                            TaoBaoAccount    = details.TaoBaoAccount,
                            HomePage         = details.HomePage,
                            Level            = details.Level,
                            ConsumptionLevel = details.ConsumptionLevel,
                            Province         = details.Province,
                            City             = details.City,
                            District         = details.District,
                            Age              = details.Age,
                            Sex              = details.Sex,
                            UpperLimitAmount = details.UpperLimitAmount,
                            UpperLimitNumber = details.UpperLimitNumber,
                            Commission       = details.Commission,
                            ShippingAddress  = details.ShippingAddress,
                            IsRealName       = details.IsRealName,
                            IsBindingMobile  = details.IsBindingMobile,
                            UserId           = details.UserId,
                            UserAccount      = details.User.Account,
                            DayOrderCount    = details.DayOrderCount,
                            MonthOrderCount  = details.MonthOrderCount,
                            OrderTypeDetails = details.OrderTypeDetails
                        };

                        if (details.UserLoginState != null)
                        {
                            vm.ClientLogin = details.UserLoginState.ClientLogin;
                            vm.IpAddress   = details.UserLoginState.ClientLastLoginIpAddress;
                        }

                        return(vm);
                    }).ToList();

                    _getPageListResponse(new DataResponse <UserSubAccountOptState, Page <UserSubAccountPageListVM> >
                    {
                        State = pageListResponse.State,
                        Data  = new Page <UserSubAccountPageListVM>
                        {
                            Info = pageListResponse.Data.Info,
                            List = list
                        }
                    });
                    return;
                }

                _getPageListResponse(new DataResponse <UserSubAccountOptState, Page <UserSubAccountPageListVM> >
                {
                    State = pageListResponse.State
                });
            }
        }
Exemplo n.º 2
0
        internal void OnRemoteOperationRequest(
            UserSubAccountPageListVM model,
            ConnectOptFrom connectOptFrom = ConnectOptFrom.ClientList)
        {
            _remoteDeskConnectState.ConnectOptFrom = connectOptFrom;

            DataGridViewRow selectedRow;

            if (connectOptFrom == ConnectOptFrom.ClientList)
            {
                selectedRow = sdgvSubAccountList.SelectedRows[0];
                selectedRow.Cells[9].Value  = "正在连接";
                selectedRow.Cells[10].Value = "断开连接";
            }
            else
            {
                selectedRow = _orderRecordControl.SdgvOrderRecordList.SelectedRows[0];
                selectedRow.Cells[8].Value = "正在连接";
                selectedRow.Cells[9].Value = "断开连接";
            }

            _remoteDeskConnectState.SelectedRow  = selectedRow;
            _remoteDeskConnectState.ConnectModel = model;

            tsslRemoteConnectInfo.Text =
                string.Format("请求连接 [{0}] ...", model.UserAccount);

            _remoteOperationBll.RequestConnectToClient(
                model.UserId, model.Id, model.TaoBaoAccount, response =>
            {
                string info = string.Empty;
                switch (response.State)
                {
                case RemoteOperationState.CannotConnectServer:
                    info = "服务器连接失败,未能获取挂机端远程连接信息";
                    break;

                case RemoteOperationState.Failed:
                    info = "服务器异常,获取挂机端远程连接信息失败!";
                    break;

                case RemoteOperationState.NotAuditShop:
                    info = "没有通过审核的店铺,不允许刷单!";
                    break;

                case RemoteOperationState.ClientOffline:
                    info = "挂机端没有登录,不允许刷单!";
                    break;

                case RemoteOperationState.Goldless:
                    info = "金币不足,不允许刷单!";
                    break;

                case RemoteOperationState.ToClientOffline:
                    info = "该挂机端已离线!";
                    break;

                case RemoteOperationState.ToClientBusy:
                    info = "该挂机端已有其他会员连接!";
                    break;

                case RemoteOperationState.ToClientRemoteDesktopServiceError:
                    info = "该挂机端远程桌面服务出现错误!";
                    break;

                case RemoteOperationState.InvalidOpt:
                    info = "非法操作!与服务器连接断开,请稍后重试!";
                    break;
                }

                Invoke(() =>
                {
                    if (response.State != RemoteOperationState.Successed)
                    {
                        MessageBoxEx.Show(this, info, "获取挂机端远程连接信息",
                                          MessageBoxButtons.OK, MessageBoxIcon.Information);

                        if (connectOptFrom == ConnectOptFrom.ClientList)
                        {
                            selectedRow.Cells[9].Value  = null;
                            selectedRow.Cells[10].Value = null;
                        }
                        else
                        {
                            selectedRow.Cells[8].Value = null;
                            selectedRow.Cells[9].Value = null;
                        }

                        _remoteDeskConnectState.Connected      = false;
                        _remoteDeskConnectState.ConnectModel   = null;
                        _remoteDeskConnectState.ConnectOptFrom = ConnectOptFrom.ClientList;
                        tsslRemoteConnectInfo.Text             = "未连接";
                        return;
                    }

                    var sourceFile = Path.Combine(Application.StartupPath, @"remotedesk\anydesk\anydesk.exe");
                    if (!File.Exists(sourceFile))
                    {
                        MessageBoxEx.Show(this, info, "远程桌面软件丢失,不能进行远程连接!",
                                          MessageBoxButtons.OK, MessageBoxIcon.Information);
                        if (connectOptFrom == ConnectOptFrom.ClientList)
                        {
                            selectedRow.Cells[9].Value  = null;
                            selectedRow.Cells[10].Value = null;
                        }
                        else
                        {
                            selectedRow.Cells[8].Value = null;
                            selectedRow.Cells[9].Value = null;
                        }

                        _remoteDeskConnectState.Connected      = false;
                        _remoteDeskConnectState.ConnectModel   = null;
                        _remoteDeskConnectState.ConnectOptFrom = ConnectOptFrom.ClientList;
                        tsslRemoteConnectInfo.Text             = "未连接";
                        return;
                    }

                    Interlocked.Exchange(ref _remoteDeskpCheckTimerCallbackState, 0);
                    _remoteDeskConnectState.IsShowOrderRecordView = false;
                    _remoteDeskConnectState.TimerState            = TimerState.CheckRemoteDeskConnectOpen;
                    _remoteDeskCheckTimer.Change(2000, 2000);
                    tsslRemoteConnectInfo.Text =
                        string.Format("开始连接 [{0}] ...", model.UserAccount);
                    AnyDesk.Connect(sourceFile, response.Data.RemoteId, response.Data.RemotePassword);
                });
            });
        }