void OnGetGetConfirmReceiptInfoRequest(IMessage msg, SessionEventArgs e) { var state = OrderRecordOptState.Failed; OrderRecordConfirmReceiptInfo info = null; if (e.Session.SessionId != null) { OrderRecord orderRecord = msg.Obj as OrderRecord; try { if (orderRecord != null) { info = _orderRecordBll.GetConfirmReceiptInfo( orderRecord.UserId, (e.Session.SessionId as UserSessionIdMetaData).Id, orderRecord.ClientUserSubAccountId); state = OrderRecordOptState.Successed; } } catch (Exception ex) { ErrorLog(msg.Header.Type, ex); } } else { state = OrderRecordOptState.InvalidOpt; } e.Session.Send(new DataResponse <OrderRecordOptState, OrderRecordConfirmReceiptInfo> { State = state, Data = info }, MessageType.GetGetConfirmReceiptInfoResponse); }
void sbtnConfirmReceiptClick(object sender, EventArgs e) { if (!_remoteDeskState.Connected) { MessageBoxEx.Show(this, "只有远程用户可以确认收货!", "确认收货", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (_remoteDeskState.RemoteInfo == null) { MessageBoxEx.Show(this, "获取远程用户信息失败!", "确认收货", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } _orderRecordBll.GetConfirmReceiptInfo(new OrderRecord { UserId = _remoteDeskState.RemoteInfo.UserId, ClientUserSubAccountId = _remoteDeskState.RemoteInfo.SubAccountId }, 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; } if (response.Data == null || string.IsNullOrEmpty(response.Data.OrderNum)) { MessageBoxEx.Show(this, "没有需要确认收货的订单。", "确认收货", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var result = MessageBoxEx.Show(this, string.Format( " 请登录小号:{0} {2}{2} 核对订单号:{1} {2}{2} 进行确认收货!", response.Data.ClientUserSubAccount, response.Data.OrderNum, Environment.NewLine), "确认收货", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result == DialogResult.Cancel) { return; } _remoteDeskState.ConfirmReceiptInfo = response.Data; var view = _viewFactory.GetView <ViewECommercePlatformSelect>(); view.ShowDialog(this); var viewConfirmReceipt = _viewFactory.GetView <ViewConfirmReceipt>(); viewConfirmReceipt.ECommercePlatform = view.ECommercePlatform; viewConfirmReceipt.ConfirmReceiptInfo = _remoteDeskState.ConfirmReceiptInfo; viewConfirmReceipt.Show(this); }); }); }