/// <summary> /// 总车数 /// </summary> /// <param name="result"></param> /// <param name="list"></param> private CollectInfo GetCarsAccount(QueryResultList <CardPaymentInfo> result) { var carCounts = from count in result.QueryObjects group count by count.CarType into CollectGridView select new { CarType = CollectGridView.Key, Count = CollectGridView.Count() }; CollectInfo cAcccount = new CollectInfo(); cAcccount.Name = "总车数"; decimal total = 0; foreach (var cars in carCounts) { PropertyInfo carInfo = cAcccount.GetType().GetProperty(cars.CarType.ToString()); carInfo.SetValue(cAcccount, (decimal)cars.Count, null); total += cars.Count; } cAcccount.TotalMomey = total; return(cAcccount); }
/// <summary> /// 免费时段车辆数 /// </summary> /// <param name="result"></param> /// <returns></returns> private CollectInfo GetFreeTimeCars(QueryResultList <CardPaymentInfo> result) { var freeCarCounts = from freeCounts in result.QueryObjects where freeCounts.Accounts == 0 group freeCounts by freeCounts.CarType into CollectGridView select new { CarType = CollectGridView.Key, Count = CollectGridView.Count() }; CollectInfo cAcccount = new CollectInfo(); cAcccount.Name = "免费时段"; decimal total = 0; foreach (var cars in freeCarCounts) { PropertyInfo carInfo = cAcccount.GetType().GetProperty(cars.CarType.ToString()); carInfo.SetValue(cAcccount, (decimal)cars.Count, null); total += cars.Count; } cAcccount.TotalMomey = total; return(cAcccount); }