public List<CellName> Ho_Nrel_Get(IEnumerable<小区切换查询> cdd_nrel) { var nrelation = cdd_nrel.ToLookup(e => e.小区名); List<CellName> nrel = new List<CellName>(); int thr = 0; foreach (var n in nrelation) { var nreltop = n.OrderByDescending(e => e.切换次数); foreach (var nn in nreltop) { thr++; if (thr > 5) continue; CellName cn = new CellName(); cn.Cell_name = n.Key; cn.N_cell_name = nn.邻小区名; cn.Handover = nn.切换次数; nrel.Add(cn); } thr = 0; } foreach (var n in nrelation) { CellName cn = new CellName(); cn.Cell_name = n.Key; cn.N_cell_name = n.Key; nrel.Add(cn); } return nrel; }
public List<CellName> Cdd_Nrel_Get(IEnumerable<现网cdd_Nrel> cdd_nrel) { List<CellName> nrel = new List<CellName>(); var nrelation = from p in cdd_nrel select new { p.cell_name, p.n_cell_name }; var nnative = cdd_nrel.Select(e => e.cell_name).Distinct(); foreach (var n in nrelation) { CellName cn = new CellName(); cn.Cell_name = n.cell_name; cn.N_cell_name = n.n_cell_name; if (cn.Cell_name.Length > 2 && cn.N_cell_name.Length > 2) { if (cn.Cell_name.IndexOf(cn.N_cell_name.Substring(0, cn.N_cell_name.Length - 2)) != -1) if (cn.Cell_name.Length == cn.N_cell_name.Length) //比较长度即可 nrel.Add(cn); } } foreach (string n in nnative) { CellName cn = new CellName(); cn.Cell_name = n; cn.N_cell_name = n; nrel.Add(cn); } return nrel; }