Ejemplo n.º 1
0
        void OnGetSubAccountPageListRequest(IMessage msg, SessionEventArgs e)
        {
            var pageListInfo = msg.Obj as PageListQueryInfo <UserSubAccountPageListQuery>;
            var state        = UserSubAccountOptState.Failed;
            Page <UserSubAccountDetails> page = null;

            if (e.Session.SessionId == null)
            {
                state = UserSubAccountOptState.InvalidOpt;
            }
            else
            {
                if (pageListInfo != null)
                {
                    try
                    {
                        var userId = (e.Session.SessionId as UserSessionIdMetaData).Id;
                        page  = _subAccountBll.GetPageList(userId, pageListInfo);
                        state = UserSubAccountOptState.Successed;
                    }
                    catch (Exception ex)
                    {
                        ErrorLog(msg.Header.Type, ex);
                    }
                }
            }

            e.Session.Send(new DataResponse <UserSubAccountOptState, Page <UserSubAccountDetails> >
            {
                State = state,
                Data  = page
            }, MessageType.GetSubAccountPageListResponse);
        }
Ejemplo n.º 2
0
        void LoadSubAccountPageList(int pageIndex, int pageSize)
        {
            if (_remoteDeskConnectState.Connected)
            {
                MessageBoxEx.Show(this, "当前正在远程操作挂机端,不允许刷新挂机端数据!",
                                  "刷新挂机端数据", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            _subAccountBll.GetPageList(new PageListQueryInfo <UserSubAccountPageListQuery>
            {
                PageIndex = pageIndex,
                PageSize  = pageSize,
                Query     = new UserSubAccountPageListQuery
                {
                    ProvinceName = scbProvince.Text,
                    CityName     = scbCity.Text,
                    DistrictName = scbDistrict.Text
                }
            }, response =>
            {
                string info = string.Empty;
                switch (response.State)
                {
                case UserSubAccountOptState.CannotConnectServer:
                    info = "服务器连接失败,未能获挂机端列表信息!";
                    break;

                case UserSubAccountOptState.Failed:
                    info = "服务器异常,获取挂机端列表信息失败!";
                    break;

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

                Invoke(() =>
                {
                    if (response.State != UserSubAccountOptState.Successed)
                    {
                        MessageBoxEx.Show(this, info, "获取挂机端列表信息",
                                          MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    sdgvSubAccountList.DataSource  = response.Data.List;
                    paginationSubAccount.Count     = response.Data.Info.Count;
                    paginationSubAccount.PageIndex = pageIndex;
                });
            });
        }