Exemple #1
0
        /// <summary>
        /// 记录支付宝返回信息到数据库
        /// </summary>
        /// <param name="info"></param>
        /// <param name="jysj"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        private int LogAlipayRetInfo(AlipayReplyInfo info, DateTime jysj, out string msg)
        {
            OracleConnection connection = new OracleConnection(WebConfigParameter.ConnectionHisString);
            OracleDataReader dr         = null;

            int ret = -1;

            msg = "";

            long count = 0;

            try
            {
                string sql = _builder.AlipayShtzCountSql(info.tradeno);
                dr = DbHelperOra.ExecuteReader(sql, connection);

                if (dr.Read())
                {
                    count = !dr.IsDBNull(0) ? dr.GetInt64(0) : 0;
                }

                if (count > 0)
                {
                    msg = "已经交易记录,无需插入";
                    ret = 38;
                    return(ret);
                }

                //记录支付宝返回记录
                ret = WriteAlipayRetInfoToDB(info, jysj, out msg);
                if (ret != 0)
                {
                    msg += "记录日志失败";
                    ret  = 39;
                }

                return(ret);
            }
            catch (Exception ex)
            {
                msg = GetExceptionInfo(ex);
                return(-1);
            }
            finally
            {
                if (null != dr)
                {
                    dr.Close();
                }

                if (null != connection && connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
            }
        }