private IEnumerable<OpCiPDCH> MakeOpCiPDCH() { foreach (var tt in itemp_pdch) { OpCiPDCH ci = new OpCiPDCH(); ci.LacCi = tt.Key; ci.CiKbps = tt.Sum(e => e.CiKbps); ci.CiPDCH = tt.Max(e => e.CiPDCH); ci.StreamingMedia = tt.Sum(e => e.StreamingMedia); ci.StockCategory = tt.Sum(e => e.StockCategory); ci.OtherCategory = tt.Sum(e => e.OtherCategory); ci.MMS = tt.Sum(e => e.MMS); ci.IM = tt.Sum(e => e.IM); ci.GeneralDownloads = tt.Sum(e => e.GeneralDownloads); ci.GameCategory = tt.Sum(e => e.GameCategory); ci.BrowseCategory = tt.Sum(e => e.BrowseCategory); ci.P2P = tt.Sum(e => e.P2P); yield return ci; } }
private IEnumerable<OpCiPDCH> OutCiUsePDCH(int? filenum) { mess = new DataClasses1DataContext(streamType.LocalConnString); mess.CommandTimeout = 0; var temp = mess.mLocatingType.Where(e => e.fileNum == filenum) .Select(e => new { e.lacCI, e.ciCoverUsePDCH, e.trafficType, e.mLen }); var itemp = temp.ToLookup(e => e.lacCI); foreach (var tt in itemp.Where(e=>e.Key !=null)) //删除空的部分 { OpCiPDCH ci = new OpCiPDCH(); //outputtableid = outputtableid + 1; //ci.OpCiPDCH_id = outputtableid; ci.LacCi = tt.Key; ci.CiKbps = tt.Sum(e => e.mLen.ByteToKbps()) / mTime; ci.CiPDCH = tt.Max(e => e.ciCoverUsePDCH.StringToDouble()); ci.StreamingMedia = tt.Where(e => e.trafficType == "StreamingMedia").Sum(e => e.mLen.ByteToKbps()) / mTime; ci.StockCategory = tt.Where(e => e.trafficType == "StockCategory").Sum(e => e.mLen.ByteToKbps()) / mTime; ci.OtherCategory = tt.Where(e => e.trafficType == "OtherCategory").Sum(e => e.mLen.ByteToKbps()) / mTime; ci.MMS = tt.Where(e => e.trafficType == "MMS").Sum(e => e.mLen.ByteToKbps()) / mTime; ci.IM = tt.Where(e => e.trafficType == "IM").Sum(e => e.mLen.ByteToKbps()) / mTime; ci.GeneralDownloads = tt.Where(e => e.trafficType == "GeneralDownloads").Sum(e => e.mLen.ByteToKbps()) / mTime; ci.GameCategory = tt.Where(e => e.trafficType == "GameCategory").Sum(e => e.mLen.ByteToKbps()) / mTime; ci.BrowseCategory = tt.Where(e => e.trafficType == "BrowseCategory").Sum(e => e.mLen.ByteToKbps()) / mTime; ci.P2P = tt.Where(e => e.trafficType == "P2P").Sum(e => e.mLen.ByteToKbps()) / mTime; yield return ci; } }