Beispiel #1
0
        public QueryItemTable RetrieveQueryItemById(string queryItemId)
        {
            if (queryItemId.Trim() == string.Empty)
            {
                return(null);
            }

            QueryItemTable returnTable = new QueryItemTable();

            string itemFile = DataPath + @"items\" + queryItemId.Trim() + ".item";

            XmlDocument doc = new XmlDocument();

            if (!File.Exists(itemFile))
            {
                return(null);
            }

            doc.Load(itemFile);

            XmlNode rootNode = doc.DocumentElement;

            DataRow row = returnTable.NewRow();

            row["id"]     = queryItemId;
            row["name"]   = rootNode.Attributes["name"].Value;
            row["kindId"] = rootNode.Attributes["kindId"].Value;

            XmlNode descriptionNode = rootNode.SelectSingleNode("Description");

            if (descriptionNode != null)
            {
                row["description"] = descriptionNode.InnerText;
            }

            XmlNode connectionStringNode = rootNode.SelectSingleNode("ConnectionString");

            if (connectionStringNode != null)
            {
                row["connectionString"] = connectionStringNode.InnerText;
            }

            XmlNode sqlStringNode = rootNode.SelectSingleNode("Body");

            if (sqlStringNode != null)
            {
                row["sqlString"] = sqlStringNode.InnerText;
            }

            returnTable.Rows.Add(row);

            return(returnTable);
        }
Beispiel #2
0
        public QueryItemTable RetrieveQueryItemByKindId(string kindId)
        {
            if (kindId.Trim() == string.Empty)
            {
                return(null);
            }

            QueryItemTable returnTable = new QueryItemTable();

            string itemsFile = DataPath + @"items\Items.xml";

            XmlDocument doc = new XmlDocument();

            doc.Load(itemsFile);

            XmlNode rootNode = doc.DocumentElement;

            DataRow row = null;

            foreach (XmlNode node in rootNode.ChildNodes)
            {
                if (node.Attributes["kindId"].Value == kindId)
                {
                    row           = returnTable.NewRow();
                    row["id"]     = node.Attributes["id"].Value;
                    row["kindId"] = kindId;

                    if (SetAttributes(row, node.Attributes["id"].Value))
                    {
                        returnTable.Rows.Add(row);
                    }
                }
            }

            return(returnTable);
        }