public static SeriesMetaList GetSeriesMeta(IList<string> tagTypes, SeriesTag tag) { SeriesMetaList _meta = new SeriesMetaList(); var db = new Database(); string sql = "SELECT " + "DISTINCT CORE_DATUM_TYPE_ID, DATA_SOURCE, NAME, TAG_TYPE, TAG_VALUE, TAG_DESCRIPTION " + "FROM " + "CORE.DATUM_TYPE_TAG " + "WHERE " + "TAG_TYPE IN " + GetTagTypeInClauseValues(tagTypes) + " " + "ORDER BY " + "CORE_DATUM_TYPE_ID, TAG_TYPE, TAG_VALUE "; DataTable table = db.GetDataTable(sql); int id = 0; string dataSource = string.Empty; string name = string.Empty; SeriesTagList metaTags = new SeriesTagList(); foreach (DataRow record in table.Rows) { if (Convert.ToInt32(record["CORE_DATUM_TYPE_ID"]) != id) { if ((id != 0) && (metaTags.ContainsTag(tag))) { _meta.Add(new SeriesMeta(id, dataSource, name, metaTags)); }; id = Convert.ToInt32(record["CORE_DATUM_TYPE_ID"]); dataSource = record["DATA_SOURCE"].ToString(); name = record["NAME"].ToString(); metaTags = new SeriesTagList(); } metaTags.Add(new SeriesTag(record["TAG_TYPE"].ToString(), record["TAG_VALUE"].ToString())); }; return _meta; }
public static SeriesMetaList GetSeriesMetaList() { SeriesMetaList list = new SeriesMetaList(); string data = GetRequest("https://fundalytics.argusmedia.com/datatypes/2013-01-01/00.00"); XmlDocument xml = new XmlDocument(); xml.LoadXml(data); foreach (XmlNode xmlMeta in xml.SelectNodes("/ArgusFundamentals/DataTypes/DataType")) { data = GetRequest("https://fundalytics.argusmedia.com/datatypes/" + xmlMeta.ChildNodes[0].InnerText); XmlDocument tagsXML = new XmlDocument(); tagsXML.LoadXml(data); SeriesTagList tags = new SeriesTagList(); foreach (XmlNode xmlTag in tagsXML.SelectNodes("/ArgusFundamentals/DataType/DataTypeTags/DataTypeTag")) { tags.Add(new SeriesTag(xmlTag.ChildNodes[0].InnerText, xmlTag.ChildNodes[1].InnerText)); }; list.Add(new SeriesMeta(Convert.ToInt32(xmlMeta.ChildNodes[0].InnerText), xmlMeta.ChildNodes[1].InnerText, xmlMeta.ChildNodes[2].InnerText, tags)); }; return list; }