/// <summary> /// 获取分类管理(通过图层与地图类型区分) /// </summary> /// <param name="dataType">图层或地图基本代码</param> /// <returns></returns> public ListResultOutput <DataTypeDto> GetAllListByDataType(string dataType) { try { var query = _IDataTypeRepository.GetAll().Where(q => q.DictCodeID == dataType); var list = new ListResultOutput <DataTypeDto>(query.MapTo <List <DataTypeDto> >()); return(list); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 获取地图列表(通过标签,类型,名称) /// </summary> /// <param name="input"></param> /// <returns></returns> public ListResultOutput <MapDto> GetAllListByName(MapInputDto input) { ListResultOutput <MapDto> list; try { string mapType = input.MapType, tag = input.MapTag, name = input.MapName, mapID = "", type = ""; if (!string.IsNullOrEmpty(tag)) { mapID = GetMultiLayerIDByTag(tag); } if (!string.IsNullOrEmpty(mapType)) { type = GetMultiChildTypeByType(mapType); } if (string.IsNullOrWhiteSpace(input.CreateUserId)) { return(null); } var mapUserData = GetDataByUserCodeAsync(input.CreateUserId, name, type, mapID).Result; var listMapType = _IDataTypeRepository.GetAll(); var listMapRefence = _IDicDataCodeRepository.GetAll(); var listMapScale = _IDicDataCodeRepository.GetAll(); var query = (from l in mapUserData join t in listMapType on l.MapType equals t.Id into tt from de in tt.DefaultIfEmpty() join r in listMapRefence on l.SpatialRefence equals r.Id into rr from re in rr.DefaultIfEmpty() join dt in listMapScale on l.MapScale equals dt.Id into dtt from ldt in dtt.DefaultIfEmpty() select new MapDto { Id = l.Id, MapName = l.MapName, MapEnName = l.MapEnName, MapBBox = l.MapBBox, MapPublishAddress = l.MapPublishAddress, MapStatus = l.MapStatus, MapDesc = l.MapDesc, MapType = (de == null) ? "" : de.TypeName, MapTag = l.MapTag, PublishDT = l.PublishDT, SortCode = l.SortCode, EnabledMark = l.EnabledMark, DeleteMark = l.DeleteMark, CreateUserId = l.CreateUserId, CreateUserName = l.CreateUserName, CreateDT = l.CreateDT, ModifyUserId = l.ModifyUserId, ModifyUserName = l.ModifyUserName, ModifyDate = l.ModifyDate, MapScale = l.MapScale, MapScaleName = (ldt == null) ? "" : ldt.CodeName, SpatialRefence = l.SpatialRefence, SpatialRefenceName = (re == null) ? "" : re.CodeName, MaxY = l.MaxY, MinY = l.MinY, MinX = l.MinX, MaxX = l.MaxX, MapLegend = l.MapLegend, MaxDegLat = "", MinDegLat = "", MinDegLon = "", MaxDegLon = "" }).OrderByDescending(x => x.CreateDT); var result = query.ToList(); list = new ListResultOutput <MapDto>(result.MapTo <List <MapDto> >()); return(list); } catch (Exception ex) { throw new Exception(ex.Message); } }
private Tuple <IEnumerable <ContentType>, IEnumerable <Module> > ParseUSyncFiles(string folder) { //pages var uSyncFolder = Directory .GetDirectories(folder, "uSync", SearchOption.AllDirectories) .First(i => Directory.GetDirectories(i, "v8", SearchOption.AllDirectories).Any()); _context.BaseFolder = uSyncFolder; var contentTypeFiles = _contentTypeRepository.GetAll(); var dataTypeFiles = _dataTypeRepository.GetAll(); var blueprintFiles = _blueprintRepository.GetAll(); if (!blueprintFiles.Any()) { textBoxResults.AppendText(Environment.NewLine + "Blueprints folder not found or empty!"); return(new Tuple <IEnumerable <ContentType>, IEnumerable <Module> >(null, null)); } var contentTypes = contentTypeFiles.Build(dataTypeFiles, blueprintFiles); foreach (var contentType in contentTypes) { ComputeNestedContentProperties(contentType, dataTypeFiles); //ComputeNestedContentElementsProperties(contentType, dataTypeFiles, blueprintFiles); //ComputeTreePickerMaxItems(dataTypeDocuments, allProperties); ComputeNotes(contentType, dataTypeFiles); var parentDocTypes = contentTypes.Where(i => i.ChildDocTypes.Contains(contentType.Alias)); contentType.ParentDocTypes = parentDocTypes.Select(i => i.Name).ToList(); var childDocTypesNames = new List <string>(); foreach (var childAlias in contentType.ChildDocTypes) { var name = contentTypes.FirstOrDefault(i => i.Alias == childAlias)?.Name; if (!string.IsNullOrEmpty(name)) { childDocTypesNames.Add(name); } } contentType.ChildDocTypes = childDocTypesNames; } // fill nested content properties foreach (var docType in contentTypes) { foreach (var prop in docType.PropertiesSelf) { if (prop.NestedContentDocTypes != null && prop.NestedContentDocTypes.Any()) { var nestedContentList = new List <NestedContentDocType>(); foreach (var nestedContentDocType in prop.NestedContentDocTypes) { nestedContentDocType.Properties = contentTypes .FirstOrDefault(i => i.Alias == nestedContentDocType.Alias)?.PropertiesSelf.ToList(); nestedContentList.Add(nestedContentDocType); } prop.NestedContentDocTypes = nestedContentList; } else if (prop.NestedContentElementsDocTypes != null && prop.NestedContentElementsDocTypes.Any()) { foreach (var item in prop.NestedContentElementsDocTypes) { item.ContentType = contentTypes.First(i => i.Alias == item.NcContentTypeAlias); } } } } var allModules = contentTypes .SelectMany(i => i.Properties) .Where(i => i.NestedContentElementsDocTypes != null && i.NestedContentElementsDocTypes.Any()) .SelectMany(i => i.NestedContentElementsDocTypes) .GroupBy(i => i.NcContentTypeAlias) .Select(g => { var module = g.First(); if (!string.IsNullOrEmpty(module.NcContentTypeAlias)) { module.ContentType = contentTypes.FirstOrDefault(c => c.Alias == module.NcContentTypeAlias); } return(module); }) .OrderBy(i => i.Name) .ToList(); var pages = contentTypes.Where(i => i.Alias.EndsWith("Page") || i.Alias.EndsWith("websiteSettings")); return(new Tuple <IEnumerable <ContentType>, IEnumerable <Module> >(pages, allModules)); }