public Dictionary <int, List <Mst_mapcellincentive> > GetMapCellIncentive(int mapinfoId) { Dictionary <int, List <Mst_mapcellincentive> > dictionary = new Dictionary <int, List <Mst_mapcellincentive> >(); string tableName = Mst_mapcellincentive.tableName; string text = Utils.getTableDirMaster(tableName) + tableName + "/"; string path = text + tableName + "_" + mapinfoId.ToString() + ".xml"; IEnumerable <XElement> enumerable = Utils.Xml_Result_To_Path(path, tableName, "Id"); if (enumerable == null) { return(dictionary); } List <Mst_mapcellincentive> list = new List <Mst_mapcellincentive>(); foreach (XElement item in enumerable) { Mst_mapcellincentive instance = null; Model_Base.SetMaster(out instance, item); list.Add(instance); } ILookup <int, Mst_mapcellincentive> lookup = list.ToLookup((Mst_mapcellincentive x) => x.Mapcell_id); foreach (IGrouping <int, Mst_mapcellincentive> item2 in lookup) { dictionary.Add(item2.Key, (from x in item2 orderby x.Incentive_no select x).ToList()); } return(dictionary); }
public Dictionary <int, List <Mst_mapcellincentive> > GetMapCellIncentive(int mapinfoId) { Dictionary <int, List <Mst_mapcellincentive> > dictionary = new Dictionary <int, List <Mst_mapcellincentive> >(); string tableName = Mst_mapcellincentive.tableName; string text = Utils.getTableDirMaster(tableName) + tableName + "/"; string path = string.Concat(new string[] { text, tableName, "_", mapinfoId.ToString(), ".xml" }); IEnumerable <XElement> enumerable = Utils.Xml_Result_To_Path(path, tableName, "Id"); if (enumerable == null) { return(dictionary); } List <Mst_mapcellincentive> list = new List <Mst_mapcellincentive>(); using (IEnumerator <XElement> enumerator = enumerable.GetEnumerator()) { while (enumerator.MoveNext()) { XElement current = enumerator.get_Current(); Mst_mapcellincentive mst_mapcellincentive = null; Model_Base.SetMaster <Mst_mapcellincentive>(out mst_mapcellincentive, current); list.Add(mst_mapcellincentive); } } ILookup <int, Mst_mapcellincentive> lookup = Enumerable.ToLookup <Mst_mapcellincentive, int>(list, (Mst_mapcellincentive x) => x.Mapcell_id); using (IEnumerator <IGrouping <int, Mst_mapcellincentive> > enumerator2 = lookup.GetEnumerator()) { while (enumerator2.MoveNext()) { IGrouping <int, Mst_mapcellincentive> current2 = enumerator2.get_Current(); dictionary.Add(current2.get_Key(), Enumerable.ToList <Mst_mapcellincentive>(Enumerable.OrderBy <Mst_mapcellincentive, int>(current2, (Mst_mapcellincentive x) => x.Incentive_no))); } } return(dictionary); }