public async Task <ApproverResponse> GetApproverInfo(ApproverRequest approverRequest)
        {
            var result = new ApproverResponse();

            if (approverRequest == null)
            {
                result.code    = -1;
                result.message = "请检查入参";
                _ = Task.Run(() =>
                {
                    CommonHelper.TxtLog("统计审批人出参", JsonConvert.SerializeObject(result));
                });
                return(result);
            }
            try
            {
                CommonHelper.TxtLog("统计审批人入参", JsonConvert.SerializeObject(approverRequest));
                var mainData = new List <Approver>();
                if (approverRequest.Page == 0 || approverRequest.Limit == 0)
                {
                    approverRequest.Page  = 1;
                    approverRequest.Limit = 10;
                }
                var amountpage  = approverRequest.Page;
                var amountlimit = approverRequest.Limit;
                //判断选择的单据类型
                switch (approverRequest.LinkDetailName)
                {
                case "全部流程":
                    //全部单据
                    mainData = await GetAllApproverAsync(approverRequest);

                    break;

                default:
                    //根据流程名获取人
                    mainData = await GetApproverByNameAsync(approverRequest);

                    break;
                }
                //超出时间限制
                if (approverRequest.OverDayCount != 0)
                {
                    mainData = mainData.Where(o => o.AvgTimeSpanTime.TotalSeconds >= approverRequest.OverDayCount * 24 * 60 * 60).ToList();
                }

                var totals = mainData.Count();
                mainData       = mainData.Skip((amountpage - 1) * amountlimit).Take(amountlimit).ToList();
                result.code    = 0;
                result.message = "获取数据成功";
                result.data    = new ApproverData
                {
                    Total = totals,
                    Items = mainData
                };
                return(result);
            }
            catch (Exception ex)
            {
                result.code    = -1;
                result.message = "获取数据失败" + ex.Message;
                _ = Task.Run(() =>
                {
                    CommonHelper.TxtLog("统计审批人出参", JsonConvert.SerializeObject(result));
                    CommonHelper.TxtLog("异常错误信息", JsonConvert.SerializeObject(ex));
                });
                return(result);
            }
        }
Beispiel #2
0
        private void Ta_ProcessCompleted(object sender, EventArgs e)
        {
            try
            {
                EMVTerminalProcessingOutcome tpo = (EMVTerminalProcessingOutcome)(e as TerminalProcessingOutcomeEventArgs).TerminalProcessingOutcome;
                if (tpo == null)//error occurred, error displayed via Ta_ExceptionOccured
                {
                    return;
                }


                if (tpo.UIRequestOnOutcomePresent)
                {
                    SetStatusLabel(string.Format("{0}\n{1}", tpo.UserInterfaceRequest.MessageIdentifier, tpo.UserInterfaceRequest.Status));
                }

                TLV dataRecord        = tpo.DataRecord;
                TLV discretionaryData = tpo.DiscretionaryData;

                if (dataRecord != null)
                {
                    int           depth = 0;
                    StringBuilder sb    = new StringBuilder();
                    sb.AppendLine(dataRecord.ToPrintString(ref depth));
                    depth = 0;
                    if (discretionaryData != null)
                    {
                        sb.AppendLine(discretionaryData.ToPrintString(ref depth));
                    }
                    SetCardDetailsLabel(sb.ToString());

                    if (dataRecord.Children.Get(EMVTagsEnum.TRANSACTION_TYPE_9C_KRN.Tag).Value[0] == (byte)TransactionTypeEnum.Refund)
                    {
                        SetStatusLabel("Refund Processed");
                    }
                    else
                    {
                        if (((dataRecord.Children.Get(EMVTagsEnum.CRYPTOGRAM_INFORMATION_DATA_9F27_KRN.Tag).Value[0] & 0xC0) >> 6) == (byte)ACTypeEnum.ARQC)
                        {
                            if (tpo.CVM == KernelCVMEnum.ONLINE_PIN)
                            {
                                ContentDialogResult pinResult = ContentDialogResult.None;
                                Task.Run(async() => pinResult = await CapturePin()).Wait();
                                if (pinResult != ContentDialogResult.Primary)
                                {
                                    SetStatusLabel("Pin Capture Cancelled - Cancelling transaction");
                                    SetProcessButtonEnabled(true);
                                    return;
                                }
                            }
                            SetCancelButtonEnabled(false);//need to change online request to run in a thread than can be cancelled, else we have to disable the button
                            ApproverResponse onlineResponse = onlineApprover.DoOnlineAuth(
                                new ApproverRequest()
                            {
                                DataRecord        = dataRecord,
                                DiscretionaryData = discretionaryData,
                                DefaultCurrency   = ta.GetDefaultTLV(EMVTagsEnum.TRANSACTION_CURRENCY_CODE_5F2A_KRN.Tag),
                                TCPClientStream   = tcpClientStream
                            });
                            SetStatusLabel(onlineResponse.ResponseMessage);
                        }
                        if (((dataRecord.Children.Get(EMVTagsEnum.CRYPTOGRAM_INFORMATION_DATA_9F27_KRN.Tag).Value[0] & 0xC0) >> 6) == (byte)ACTypeEnum.TC)
                        {
                            SetCancelButtonEnabled(false);//need to change online request to run in a thread than can be cancelled, else we have to disable the button
                            ApproverResponse onlineResponse = onlineApprover.DoAdvice(
                                new ApproverRequest()
                            {
                                DataRecord        = dataRecord,
                                DiscretionaryData = discretionaryData,
                                DefaultCurrency   = ta.GetDefaultTLV(EMVTagsEnum.TRANSACTION_CURRENCY_CODE_5F2A_KRN.Tag),
                                TCPClientStream   = tcpClientStream
                            }, true);
                            SetStatusLabel(onlineResponse.ResponseMessage);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ta.CancelTransactionRequest();
                SetStatusLabel(ex.Message);
            }
            finally
            {
                SetProcessButtonEnabled(true);
                SetCancelButtonEnabled(true);
            }
        }