Ejemplo n.º 1
0
        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());
        }