public Response GetTransLog(string token, [FromBody] TransLogParam param)
        {
            Response response = new Response();

            if (string.IsNullOrEmpty(token) || !token.Equals(_token))
            {
                response.code    = "404";
                response.message = "Invild token";
            }
            else
            {
                var data = RechargeHelper.GetTransLog(param);
                if (data == null)
                {
                    response.code    = "500";
                    response.message = "Get data failed";
                }
                else
                {
                    response.code    = "200";
                    response.content = data;
                }
            }
            return(response);
        }
        /// <summary>
        /// 取得交易记录
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public static List <TransLog> GetTransLog(TransLogParam param)
        {
            RechargeFactory factory = new RechargeFactory();

            try
            {
                if (param == null)
                {
                    throw new Exception("Param is null");
                }
                List <TransLog> lstTLog = factory.GetTransLog(param);
                if (lstTLog == null || lstTLog.Count == 0)
                {
                    throw new Exception("DAL.WeChat.RechargeFactory.GetTransLog()==null");
                }
                return(lstTLog);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(new Log()
                {
                    message = ex.Message
                }, "GetTransLog");
                return(null);
            }
        }
示例#3
0
        /// <summary>
        /// 取得交易历史记录
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List <TransLog> GetTransLog(TransLogParam param)
        {
            //List<TransLog> lstTransLog = new List<TransLog>();

            //CCMastFactory ccmf = new CCMastFactory();
            //// Table CCMast
            //CCMast ccm = ccmf.GetCCMastInfo(param.costCenterCode);
            //// Table SqlMast
            //SingleField ccObj = new SingleField();
            //ccObj.code = param.costCenterCode;
            //List<SingleField> lstCcObj = new List<SingleField>();
            //lstCcObj.Add(ccObj);
            //SqlMast sm = ccmf.GetSqlMastInfo(lstCcObj, "POSTransaction")[0];
            //// Sql Connection
            //string strConn = string.Format(string.Format(SqlServerHelper.customerAllConn, ccm.posIp, ccm.posDBName, ccm.posDBUserName
            //    , ccm.posDBPassword));
            //// Sql文
            //string strSql = string.Format(sm.sqlCommand, param.cardId);
            //// 取得交易信息
            //lstTransLog = SqlServerHelper.GetEntityList<TransLog>(strConn, strSql);
            List <TransLog> lstTransLog = GetList <TransLog>(param.costCenterCode, param.cardId, "POSTransaction");

            foreach (TransLog t in lstTransLog)
            {
                string[] sArray = t.transDate.Split(' ');
                t.year      = sArray[0].Substring(0, 4);
                t.month     = t.year + "." + sArray[0].Substring(5, 2);
                t.transDate = sArray[0];
                t.transTime = sArray[1];
            }

            lstTransLog = lstTransLog.OrderByDescending(r => r.transDate).ToList();

            return(lstTransLog);
        }