コード例 #1
0
        void OnGetOrderRecordListRequest(IMessage msg, SessionEventArgs e)
        {
            var pageListInfo = msg.Obj as PageListQueryInfo <OrderRecordPageListQuery>;
            var state        = OrderRecordOptState.Failed;
            Page <OrderRecordDetails> page = null;

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

            e.Session.Send(new DataResponse <OrderRecordOptState, Page <OrderRecordDetails> >
            {
                State = state,
                Data  = page
            }, MessageType.GetOrderRecordListResponse);
        }
コード例 #2
0
ファイル: ViewOptMain.cs プロジェクト: zichengfeng/TaoShang
        internal void LoadOrderRecordPageList(int pageIndex, int pageSize,
                                              int?shopId = null, int?orderStateId = null)
        {
            if (_remoteDeskConnectState.Connected)
            {
                MessageBoxEx.Show(this, "当前正在远程操作挂机端,不允许刷新数据!",
                                  "刷新数据", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            _orderRecordBll.GetPageList(new PageListQueryInfo <OrderRecordPageListQuery>
            {
                PageIndex = pageIndex,
                PageSize  = pageSize,
                Query     = new OrderRecordPageListQuery
                {
                    ShopId       = shopId,
                    OrderStateId = orderStateId
                }
            }, response =>
            {
                string info = string.Empty;
                switch (response.State)
                {
                case OrderRecordOptState.CannotConnectServer:
                    info = "服务器连接失败,未能获刷单列表信息!";
                    break;

                case OrderRecordOptState.Failed:
                    info = "服务器异常,获取刷单列表信息失败!";
                    break;

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

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

                    _orderRecordControl.SdgvOrderRecordList
                    .DataSource = response.Data.List;
                    _orderRecordControl.PaginationOrderRecordList
                    .Count = response.Data.Info.Count;
                    _orderRecordControl.PaginationOrderRecordList.PageIndex = pageIndex;
                });
            });
        }