Exemple #1
0
        /// <summary>
        /// 导出
        /// </summary>
        /// <returns></returns>
        public ActionResult Export()
        {
            List <BWYGateMapping> gates       = BWYGateMappingServices.QueryAll();
            List <OnlineOrder>    onlineOrder = OnlineOrderServices.ExportQueryPage(GetOnlineOrderCondition());
            var result = from p in onlineOrder
                         select new
            {
                订单编号   = p.OrderID.ToString(),
                车场名称   = p.PKName,
                车牌号    = p.PlateNo,
                支付金额   = p.Amount,
                续期月数   = p.OrderType == OnlineOrderType.MonthCardRecharge ? p.MonthNum.ToString() : string.Empty,
                支付人    = p.PayerNickName,
                步支付次数  = p.SyncResultTimes,
                最后同步时间 = p.LastSyncResultTime != DateTime.MinValue ? p.LastSyncResultTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty,
                退款订单号  = p.RefundOrderId,
                订单类型   = p.OrderType.GetDescription(),
                订单状态   = p.Status.GetDescription(),
                订单时间   = p.OrderTime.ToString("yyyy-MM-dd HH:mm:ss"),
                支付时间   = p.RealPayTime != DateTime.MinValue ? p.RealPayTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty,
                外部车场名称 = GetBWYParkingName(p.ExternalPKID, gates),
                备注     = p.Remark
            };
            StringBuilder sb = new StringBuilder();

            sb.Append(JsonHelper.GetJsonString(result));
            var dt = JsonToDataTable(sb.ToString());
            var dl = DownLoadExcel(dt);

            return(dl);
        }