/// <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); }
public string GetExternalParkingData() { Dictionary <string, string> parkings = new Dictionary <string, string>(); List <BWYGateMapping> gates = BWYGateMappingServices.QueryAll(); foreach (var item in gates) { if (!parkings.ContainsKey(item.ParkingID)) { parkings.Add(item.ParkingID, item.ParkingName); } } StringBuilder strTree = new StringBuilder(); strTree.Append("["); strTree.Append("{\"id\":\"-1\","); strTree.Append("\"text\":\"所有\",\"selected\":true"); strTree.Append("}"); foreach (var item in parkings) { strTree.Append(",{\"id\":\"" + item.Key + "\","); strTree.Append("\"text\":\"" + item.Value + "\""); strTree.Append("}"); } strTree.Append("]"); return(strTree.ToString()); }
public string GetOnlineOrderData() { StringBuilder strData = new StringBuilder(); try { if (string.IsNullOrWhiteSpace(Request.Params["Query"])) { return(strData.ToString()); } int page = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]); int rows = string.IsNullOrEmpty(Request.Params["rows"]) ? 0 : int.Parse(Request.Params["rows"]); List <BWYGateMapping> gates = BWYGateMappingServices.QueryAll(); int total = 0; List <OnlineOrder> result = OnlineOrderServices.QueryPage(GetOnlineOrderCondition(), page, rows, out total); var obj = from p in result select new { OrderID = p.OrderID.ToString(), PKName = p.PKName, PlateNo = p.PlateNo, Amount = p.Amount, MonthNum = p.OrderType == OnlineOrderType.MonthCardRecharge ? p.MonthNum.ToString() : string.Empty, PayerNickName = p.PayerNickName, SyncResultTimes = p.SyncResultTimes, LastSyncResultTime = p.LastSyncResultTime != DateTime.MinValue ? p.LastSyncResultTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty, RefundOrderId = p.RefundOrderId, Remark = p.Remark, OrderType = (int)p.OrderType, OrderTypeDes = p.OrderType.GetDescription(), Status = (int)p.Status, StatusDes = p.Status.GetDescription(), OrderTime = p.OrderTime.ToString("yyyy-MM-dd HH:mm:ss"), RealPayTime = p.RealPayTime != DateTime.MinValue ? p.RealPayTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty, BWYParkingName = GetBWYParkingName(p.ExternalPKID, gates) }; strData.Append("{"); strData.Append("\"total\":" + total + ","); strData.Append("\"rows\":" + JsonHelper.GetJsonString(obj) + ","); strData.Append("\"index\":" + page); strData.Append("}"); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "查询微信订单信息失败"); } return(strData.ToString()); }