/// <summary>
        /// 订单导出
        /// </summary>
        /// <param name="businessName">商家名称</param>
        /// <param name="orderNo">订单号</param>
        /// <param name="userAccount">下单人</param>
        /// <param name="orderStatus">订单状态</param>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <returns></returns>
        public ActionResult OrderExport(string QueryBusinessName, string QueryOrderNo, string QueryUserName, int QueryOrderStatusId, string QueryStartTime, string QueryEndTime)
        {
            try
            {
                var list   = _orderService.OrderExpert(QueryBusinessName, QueryOrderNo, QueryUserName, QueryOrderStatusId, QueryStartTime, QueryEndTime, int.Parse(Loginer.BusinessId));
                var result = OrderToOrderExpert(list);
                var dt     = EntityConverter <OrderExpert> .CreateDataTableByAnyListEntity(result);

                if (dt == null || dt.Rows.Count <= 0)
                {
                    return(Content("<script type='text/javascript'>alert('无查询结果,请检查。'); window.location.href = '/Order/List'</script>"));
                }
                string[] expColNames = { "OrderId", "OrderNo", "RealAmount", "NickName", "PhoneNo", "BusinessName", "StatusName", "OrderTime" };
                Dictionary <string, string> expColAsNames = new Dictionary <string, string>()
                {
                    { "OrderId", "序号" },
                    { "OrderNo", "订单编号" },
                    { "RealAmount", "订单金额" },
                    { "NickName", "下单人" },
                    { "PhoneNo", "下单人电话" },
                    { "BusinessName", "商家名称" },
                    { "StatusName", "订单状态" },
                    { "OrderTime", "创建时间" }
                };
                var ms = ExcelHelp.ToExcel(dt, null, expColNames, expColAsNames, null, 0);
                return(File(ms, "application/vnd.ms-excel", ExcelHelp.CreateFileName("D")));
            }
            catch (Exception ex)
            {
                //Logger.Error("OrdersController--->OrderExport:" + ex.ToString());
            }
            return(Content("<script type='text/javascript'>alert('Execl生成失败,请检查。'); window.location.href = '/Order/List'</script>"));
        }
Ejemplo n.º 2
0
        public ActionResult PayDetailExport(string QueryOrderNo, string QueryUserName, int QueryPayStatus, string QueryStartTime, string QueryEndTime)
        {
            try
            {
                var list   = _payDetailService.PayDetailExpert(QueryOrderNo, QueryUserName, QueryPayStatus, QueryStartTime, QueryEndTime);
                var result = PayDetailToExpert(list);
                var dt     = EntityConverter <PayDetailExpert> .CreateDataTableByAnyListEntity(result);

                if (dt == null || dt.Rows.Count <= 0)
                {
                    return(Content("<script type='text/javascript'>alert('无查询结果,请检查。'); window.location.href = '/Order/List'</script>"));
                }
                string[] expColNames = { "PayDetailId", "OrderNo", "RealAmount", "NickName", "PhoneNo", "Remark", "OrderTime", "PayTime", "PayType", "PaySerialNo", "PayStatus" };
                Dictionary <string, string> expColAsNames = new Dictionary <string, string>()
                {
                    { "PayDetailId", "序号" },
                    { "OrderNo", "订单编号" },
                    { "RealAmount", "订单金额" },
                    { "NickName", "下单人" },
                    { "PhoneNo", "下单人电话" },
                    { "Remark", "备注" },
                    { "OrderTime", "订单时间" },
                    { "PayTime", "支付时间" },
                    { "PayType", "支付方式" },
                    { "PaySerialNo", "支付流水号" },
                    { "PayStatus", "支付状态" }
                };
                var ms = ExcelHelp.ToExcel(dt, null, expColNames, expColAsNames, null, 0);
                return(File(ms, "application/vnd.ms-excel", ExcelHelp.CreateFileName("D")));
            }
            catch (Exception ex)
            {
                //Logger.Error("OrdersController--->OrderExport:" + ex.ToString());
            }
            return(Content("<script type='text/javascript'>alert('Execl生成失败,请检查。'); window.location.href = '/Order/List'</script>"));
        }