public void CpsUpdateRunningTest()
 {
     using (var client = new TuboAllianceClient())
     {
         var model = new CpsUpdateRunningRequest();
         model.OutBizNo      = "";
         model.TransactionNo = "";
         model.Status        = "";
         model.Reason        = "";
         var result = client.CpsUpdateRunningAsync(model);
         Assert.IsNotNull(result.Result);
     }
 }
        /// <summary>
        /// CPS支付流水修改状态接口
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <int> CpsUpdateRunningDal(CpsUpdateRunningRequest request)
        {
            int resultRow = 0;

            try
            {
                using (var dbHelper = DbHelper.CreateDbHelper())
                {
                    var sqlCpsUpdateRunning = @"UPDATE [Activity].[dbo].[Cps_CommissionFlowRecord] WITH(ROWLOCK)
                                                           SET [Status] = @Status
                                                              ,[Reason] = @Reason
                                                              ,[UpdateTime] =GETDATE()";

                    if (!string.IsNullOrWhiteSpace(request.TransactionNo))
                    {
                        sqlCpsUpdateRunning += "  ,[TransactionNo] = @TransactionNo";
                    }


                    sqlCpsUpdateRunning += " WHERE CommissionFlowRecordNo = @CommissionFlowRecordNo AND IsDelete=0";


                    using (var cmd = new SqlCommand(sqlCpsUpdateRunning))
                    {
                        cmd.CommandType = CommandType.Text;

                        if (!string.IsNullOrWhiteSpace(request.TransactionNo))
                        {
                            cmd.Parameters.AddWithValue("@TransactionNo", request.TransactionNo);
                        }
                        cmd.Parameters.AddWithValue("@STATUS", request.Status);
                        cmd.Parameters.AddWithValue("@Reason", request.Reason);
                        cmd.Parameters.AddWithValue("@CommissionFlowRecordNo", request.OutBizNo);
                        resultRow = Convert.ToInt32(await dbHelper.ExecuteNonQueryAsync(cmd));
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error($"CpsUpdateRunningDal佣金流水状态修改接口异常:{ex.Message};堆栈信息:{ex.StackTrace}");
            }

            return(resultRow);
        }
        /// <summary>
        /// CPS支付流水修改状态接口
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <CpsUpdateRunningResponse> CpsUpdateRunningManager(CpsUpdateRunningRequest request)
        {
            var resultModule = new CpsUpdateRunningResponse();

            resultModule.Success = false;

            try
            {
                var resultRow = await DalTuboAlliance.CpsUpdateRunningDal(request);

                if (resultRow > 0)
                {
                    resultModule.Success = true;
                }
            }
            catch (Exception ex)
            {
                Logger.Error($"CpsUpdateRunningManagerCPS佣金流水状态修改接口异常:{ex.Message};堆栈信息:{ex.StackTrace}");
                resultModule.ErrorMessage = ex.Message;
            }

            return(resultModule);
        }
 /// <summary>
 /// CPS支付流水修改状态接口
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public async Task <OperationResult <CpsUpdateRunningResponse> > CpsUpdateRunningAsync(CpsUpdateRunningRequest request)
 {
     if (request == null || string.IsNullOrEmpty(request.OutBizNo) ||
         string.IsNullOrEmpty(request.Status))
     {
         return(OperationResult.FromError <CpsUpdateRunningResponse>
                    (nameof(Resource.ParameterError), Resource.ParameterError));
     }
     else
     {
         return(OperationResult.FromResult(await TuboAllianceManager.CpsUpdateRunningManager(request)));
     }
 }