public static List <FlowView> QueryTopViewsByPolicy(this List <FlowView> source, int topCount, OrderTopFlowPolicy policy) { var minDate = source.Min(x => x.StatTime); var maxDate = source.Max(x => x.StatTime); topCount *= (maxDate - minDate).Days + 1; switch (policy) { case OrderTopFlowPolicy.OrderByDownlinkFlowDescending: return(source.OrderByDescending(x => x.PdcpDownlinkFlow).Take(topCount).ToList()); case OrderTopFlowPolicy.OrderByUplinkFlowDescending: return(source.OrderByDescending(x => x.PdcpUplinkFlow).Take(topCount).ToList()); case OrderTopFlowPolicy.OrderByTotalFlowDescending: return(source.OrderByDescending(x => x.PdcpDownlinkFlow + x.PdcpUplinkFlow).Take(topCount).ToList()); case OrderTopFlowPolicy.OrderByMaxUsersDescending: return(source.OrderByDescending(x => x.MaxUsers).Take(topCount).ToList()); case OrderTopFlowPolicy.OrderByMaxActiveUsersDescending: return(source.OrderByDescending(x => x.MaxActiveUsers).Take(topCount).ToList()); default: return(new List <FlowView>()); } }
public List <FlowView> QueryTopFlowViews(string city, string district, DateTime begin, DateTime end, int topCount, OrderTopFlowPolicy policy) { var joinViews = QueryDistrictViews(city, district, begin, end); return(joinViews.ToList().QueryTopViewsByPolicy(topCount, policy)); }
public List <FlowView> QueryTopFlowViews(DateTime begin, DateTime end, int topCount, OrderTopFlowPolicy policy) { var zteStats = ZteRepository.FilterTopList(begin, end); var huaweiStats = HuaweiRepository.FilterTopList(begin, end); var joinViews = HuaweiCellRepository.QueryAllFlowViews <FlowView, FlowZte, FlowHuawei>(zteStats, huaweiStats); return(joinViews.ToList().QueryTopViewsByPolicy(topCount, policy)); }