/// <summary> /// Obter todos as projetos e camadas disponĂveis para o usuário. /// </summary> /// <param name="user">Usario registro no COMOS.</param> /// <returns>Todos projetos e Camadas.</returns> public List <IBRServiceContracts.CProject> GetProjectsAndLayers(string user) { try { if (m_ComosSession == null) { return(null); } m_ComosSession.SetCurrentUser(user); List <IBRServiceContracts.CProject> cProjects = new List <IBRServiceContracts.CProject>(); foreach (var project in m_ComosSession.GetProjects()) { if (project.Name.StartsWith("@")) { continue; } IBRServiceContracts.CProject cProject = new IBRServiceContracts.CProject() { Description = project.Description, Name = project.Name }; List <IBRServiceContracts.CLayer> layers = new List <IBRServiceContracts.CLayer>(); foreach (var layer in m_ComosSession.GetWorkingOverlays(project)) { IBRServiceContracts.CLayer cLayer = new IBRServiceContracts.CLayer() { Description = layer.Description, ID = layer.ID(), Name = layer.Name, }; cLayer.WorkingLayers = GetWorkingLayers(layer); layers.Add(cLayer); } cProject.WorkingLayers = layers; cProjects.Add(cProject); } return(cProjects); } catch (Exception ex) { Log.WriteLog(ex.Message + ":GetProjectsAndLayers", System.Diagnostics.EventLogEntryType.Warning); System.Diagnostics.Debug.Assert(false); } return(null); }
/// <summary> /// Obter todos as e camadas em camda. /// </summary> /// <param name="parentlayer">Camada de trabalho</param> /// <returns>Todos Camadas.</returns> private List <IBRServiceContracts.CLayer> GetWorkingLayers(Plt.IComosDWorkingOverlay parentlayer) { try { List <IBRServiceContracts.CLayer> layers = new List <IBRServiceContracts.CLayer>(); foreach (var layer in m_ComosSession.GetWorkingOverlays(parentlayer)) { IBRServiceContracts.CLayer clayer = new IBRServiceContracts.CLayer() { Name = layer.Name, Description = layer.Description, ID = layer.ID() }; clayer.WorkingLayers = GetWorkingLayers(layer); layers.Add(clayer); } return(layers); } catch (Exception ex) { Log.WriteLog(ex.Message + ":GetWorkingLayers", System.Diagnostics.EventLogEntryType.Warning); System.Diagnostics.Debug.Assert(false); } return(null); }