Esempio n. 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="cgo"></param>
 /// <param name="code"></param>
 /// <returns></returns>
 public static bool Exists(CgoConfig[] cgo,string code)
 {
     bool found=false;
     for(int i=0;i<cgo.Length;i++)
     {
         if(cgo[i].Code==code)
         {
             found=true;
             i=cgo.Length;
         }
     }
     return found;
 }
Esempio n. 2
0
        /// <summary>
        /// Searches for all CgoConfig given the criteria. It will search for
        /// services with a similar code or name.
        /// </summary>
        /// <returns>List of matching services.</returns>
        public static CgoConfig[] Search()
        {
            string xpath = string.Format( CultureInfo.InvariantCulture,
                @"field" );

            XmlDocument doc = LoadServiceList();
            XmlNodeList nodeList = doc.DocumentElement.SelectNodes(xpath);

            CgoConfig[] results = new CgoConfig[ nodeList.Count ];

            for ( int i=0; i<results.Length; i++ )
            {
                results[i] = new CgoConfig(nodeList[i].Attributes["code"].Value,
                    nodeList[i].Attributes["name"].Value,
                    nodeList[i].Attributes["id"] == null ? null : nodeList[i].Attributes["id"].Value,
                    nodeList[i].Attributes["label"] == null ? null : nodeList[i].Attributes["label"].Value,
                    nodeList[i].Attributes["summary"] == null ? null : nodeList[i].Attributes["summary"].Value,
                    nodeList[i].Attributes["type"] == null ? null : nodeList[i].Attributes["type"].Value,
                    nodeList[i].Attributes["size"] == null ? null : nodeList[i].Attributes["size"].Value,
                    nodeList[i].Attributes["lovType"] == null ? null : nodeList[i].Attributes["lovType"].Value);
            }

            return results;
        }
Esempio n. 3
0
        /// <summary>
        /// Searches for all CgoConfig given the criteria. It will search for
        /// services with a similar code or name.
        /// </summary>
        /// <returns>List of matching services.</returns>
        public static CgoConfig[] Search()
        {
            string xpath = string.Format(CultureInfo.InvariantCulture,
                                         @"field");

            XmlDocument doc      = LoadServiceList();
            XmlNodeList nodeList = doc.DocumentElement.SelectNodes(xpath);

            CgoConfig[] results = new CgoConfig[nodeList.Count];

            for (int i = 0; i < results.Length; i++)
            {
                results[i] = new CgoConfig(nodeList[i].Attributes["code"].Value,
                                           nodeList[i].Attributes["name"].Value,
                                           nodeList[i].Attributes["id"] == null ? null : nodeList[i].Attributes["id"].Value,
                                           nodeList[i].Attributes["label"] == null ? null : nodeList[i].Attributes["label"].Value,
                                           nodeList[i].Attributes["summary"] == null ? null : nodeList[i].Attributes["summary"].Value,
                                           nodeList[i].Attributes["type"] == null ? null : nodeList[i].Attributes["type"].Value,
                                           nodeList[i].Attributes["size"] == null ? null : nodeList[i].Attributes["size"].Value,
                                           nodeList[i].Attributes["lovType"] == null ? null : nodeList[i].Attributes["lovType"].Value);
            }

            return(results);
        }