private void BindCommunicationData() { try { string templateID = hidTemplateID.Value; DataTable dt = dc.GetCommunicationList(templateID); CommunicationList.DataSource = dt; CommunicationList.DataBind(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alertException", "javascript:showMessage('操作发生错误:" + ex.Message.Replace("'", "").Replace("\"", "") + "!',8);", true); } }
// 図から必要な要素を取得し、リストを作成する internal void LoadDeployDiagramObjectsInformation(EA.Repository Repository) { // ノードの配置に関するモデルの作成,親をたどることにより必要な情報を入手 // 配置図の要素を環境、デバイス、ノード、コンポーネントのリストに格納 EA.Diagram diagram = Repository.GetCurrentDiagram(); var TmpCommunicationList = new List <Communication>(); for (short i = 0; i < diagram.DiagramObjects.Count; i++) { DiagramObject diagramObject = diagram.DiagramObjects.GetAt(i); Element element = Repository.GetElementByID(diagramObject.ElementID); var ConnectorList = new List <Connector>(); var xdoc = element.Notes.ToXDocument(); switch (element.MetaType) { case "ExecutionEnvironment": ExecutionEnvironmentList.Add(new ExecutionEnvironment(element.Name, element.ElementID, element.ParentID, xdoc)); break; case "Device": // デバイスが保持している接続を取得 for (short j = 0; j < element.Connectors.Count; j++) { Connector connector = element.Connectors.GetAt(j); ConnectorList.Add(connector); TmpCommunicationList.Add(new Communication(connector.Name, connector.ConnectorID, connector.DiagramID, connector.Notes.ToXDocument())); } DeviceList.Add(new Device(element.Name, element.ElementID, element.ParentID, xdoc, element.Stereotype, ConnectorList)); break; case "Node": NodeList.Add(new Node(element.Name, element.ElementID, element.ParentID, xdoc)); break; case "Component": ComponentList.Add(new Component(element.Name, element.ElementID, element.ParentID, xdoc)); break; } } TmpCommunicationList.GroupBy(communication => communication.Name) .Select(x => x.FirstOrDefault()) .ToList() .ForEach(Communication => CommunicationList.Add(Communication)); }