/// <summary> /// 通过查询数据库数据填充Standard实体 /// </summary> private async Task FillStandardByDB() { await Task.Run(() => { if (currentStandard == string.Empty) { return; } List <ItemMajorBlock> list = dbStandardGateway.Find(currentStandard); if (list == null || list.Count() == 0) { return; } standard = new Standard(); standard.Name = currentStandard; var groupingMajors = list.GroupBy(s => s.Major); foreach (var gMajors in groupingMajors) { Major major = new Major(); major.Name = gMajors.Key; standard.Majors.Add(major); var groupingSecondaryMenus = gMajors.ToList().GroupBy(s => s.SecondaryMenu); foreach (var gSecondaryMenus in groupingSecondaryMenus) { SecondaryMenu secondaryMenu = new SecondaryMenu(); secondaryMenu.Name = gSecondaryMenus.Key; major.SecondaryMenus.Add(secondaryMenu); var groupingModules = gSecondaryMenus.ToList().GroupBy(s => s.Module); foreach (var gModules in groupingModules) { Module module = new Module(); module.Name = gModules.Key; secondaryMenu.Modules.Add(module); var groupingBuildingTypes = gModules.ToList().GroupBy(s => s.BuildingType); foreach (var gBuildingTypes in groupingBuildingTypes) { BuildingType buildingType = new BuildingType(); buildingType.Name = gBuildingTypes.Key; module.BuildingTypes.Add(buildingType); var groupingItems = gBuildingTypes.ToList().GroupBy(s => s.Item); foreach (var gItems in groupingItems) { Item item = new Item(); item.Name = gItems.Key; buildingType.Items.Add(item); } } } } } }); }
/// <summary> /// 通过条文加载条文专业块数据集 /// </summary> /// <returns></returns> public List <ItemMajorBlock> LoadItemMajorBlocks() { if (technologyProduct.Items == null) { return(null); } itemMajorBlocks = new List <ItemMajorBlock>(); foreach (var item in technologyProduct.Items) { List <ItemMajorBlock> list = dbStandardGateway.Find(standard, item); if (list == null) { continue; } itemMajorBlocks.AddRange(list); } return(itemMajorBlocks); }