public Dictionary <int, List <Mst_mapincentive> > GetMapIncentive(int mapinfoId) { Dictionary <int, List <Mst_mapincentive> > dictionary = new Dictionary <int, List <Mst_mapincentive> >(); string tableName = Mst_mapincentive.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_mapincentive> list = new List <Mst_mapincentive>(); foreach (XElement item in enumerable) { Mst_mapincentive instance = null; Model_Base.SetMaster(out instance, item); list.Add(instance); } ILookup <int, Mst_mapincentive> lookup = list.ToLookup((Mst_mapincentive x) => x.Map_cleared); foreach (IGrouping <int, Mst_mapincentive> 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_mapincentive> > GetMapIncentive(int mapinfoId) { Dictionary <int, List <Mst_mapincentive> > dictionary = new Dictionary <int, List <Mst_mapincentive> >(); string tableName = Mst_mapincentive.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_mapincentive> list = new List <Mst_mapincentive>(); using (IEnumerator <XElement> enumerator = enumerable.GetEnumerator()) { while (enumerator.MoveNext()) { XElement current = enumerator.get_Current(); Mst_mapincentive mst_mapincentive = null; Model_Base.SetMaster <Mst_mapincentive>(out mst_mapincentive, current); list.Add(mst_mapincentive); } } ILookup <int, Mst_mapincentive> lookup = Enumerable.ToLookup <Mst_mapincentive, int>(list, (Mst_mapincentive x) => x.Map_cleared); using (IEnumerator <IGrouping <int, Mst_mapincentive> > enumerator2 = lookup.GetEnumerator()) { while (enumerator2.MoveNext()) { IGrouping <int, Mst_mapincentive> current2 = enumerator2.get_Current(); dictionary.Add(current2.get_Key(), Enumerable.ToList <Mst_mapincentive>(Enumerable.OrderBy <Mst_mapincentive, int>(current2, (Mst_mapincentive x) => x.Incentive_no))); } } return(dictionary); }