/// <summary>
        /// Create a Tagged value type
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="property"></param>
        /// <returns></returns>
        public static bool TaggedValueTyeExists(EA.Repository rep, string property)
        {
            try
            {
                string      sql    = $@"select count(*) as COUNT from t_propertytypes 
                                  where Property = '{property}';";
                string      xml    = rep.SQLQuery(sql);
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(xml);

                XmlNode countXml = xmlDoc.SelectSingleNode("//COUNT");
                if (countXml != null)
                {
                    int count = Int32.Parse(countXml.InnerText);
                    if (count == 0)
                    {
                        return(false);
                    }
                    return(true);
                }

                return(false);
            }
            catch (Exception e)
            {
                MessageBox.Show($@"Property: '{property}'

{e}", @"Can't read Tagged Value Type");
                return(false);
            }
        }
Ejemplo n.º 2
0
        public int GetLifeCycleDiagramID(int parentDiagramID)
        {
            // Load the list if not loaded already
            if (null == lifeCycleDiagrams)
            {
                String returnXML = eaRepo.SQLQuery(
                    String.Format("SELECT Diagram_ID, ParentID, Name, Stereotype FROM t_diagram WHERE Stereotype = '{0}'",
                                  diagramConfig.Configuration.LifeCycleAlias));
                lifeCycleDiagrams = EA.Diagram.DeSerialiseEASQLQueryResult.DeSerialiseAsDiagramRow(returnXML);
            }


            String lifeCycleDiagramID;

            lifeCycleDiagramID = (from f in lifeCycleDiagrams
                                  where f.ParentID == parentDiagramID.ToString()
                                  select f.Diagram_ID).First();

            return(SafeToInt(lifeCycleDiagramID, 0));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get list of strings from a SQL
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="columnName"></param>
        /// <returns></returns>
        public static List <string> GetListOfStringFromSql(EA.Repository rep, string sql, string columnName)
        {
            List <string> l        = new List <string>();
            string        str      = rep.SQLQuery(sql);
            XElement      xelement = XElement.Parse(str);

            foreach (XElement xEle in xelement.Descendants("Row"))
            {
                l.Add(xEle.Element(columnName).Value);
            }

            return(l);
        }
        public List <EAQueryResults.EAConnector.Row> GetConnectorsByGuid(String fromGuid)
        {
            String strResult =
                eaRepository.SQLQuery(
                    String.Format(
                        @"SELECT oStart.Object_ID AS Start_Object_ID, oStart.ea_guid AS Start_ea_guid, oStart.Name AS Start_Name, oEnd.ea_guid AS End_ea_guid, oEnd.Name AS End_Name, 
							conn.Direction AS Direction, conn.Connector_Type AS Connector_Type, conn.StereoType AS Connector_StereoType
                            FROM t_object oStart, t_object oEnd, t_connector conn 
                           WHERE oStart.ea_guid = '{0}' AND conn.Start_Object_ID = oStart.Object_ID AND conn.End_Object_ID = oEnd.Object_ID"                , fromGuid));
            List <EAQueryResults.EAConnector.Row> rows = EAQueryResults.EAConnector.EAConnector.Deserialise(strResult);

            return(rows);
        }
Ejemplo n.º 5
0
        protected void InitializeTypesListFromModel()
        {
            _typesList = new ObservableCollection <TypeDataModel>();
            try
            {
                string sqlResult = _repository.SQLQuery(_queryString);

                XDocument doc = XDocument.Parse(sqlResult);

                XElement dataSetElement = doc.Element("EADATA").Element("Dataset_0");

                XElement dataElement = dataSetElement.Element("Data");

                foreach (XElement row in dataElement.Elements("Row"))
                {
                    TypeDataModel dataModel = new TypeDataModel();

                    XElement name = row.Element("Name");

                    if (name != null)
                    {
                        dataModel.Name = name.Value;
                    }

                    XElement obejctID = row.Element("Object_ID");

                    if (obejctID != null)
                    {
                        int id = 0;
                        int.TryParse(obejctID.Value, out id);

                        dataModel.ElementID = id;
                    }
                    _typesList.Add(dataModel);
                }
            }
            catch (Exception exception)
            {
                ;
            }
        }