Пример #1
0
        /// <summary>
        /// Fills the destination element with the serialization data for the
        /// property.
        /// </summary>
        /// <param name="element">Element serialization.</param>
        /// <returns>True if the element is to be append to the shape XML, false otherwise.</returns>
        public bool Fill(XmlElement element)
        {
            if (valueControl.Items.Count == 0)
            {
                return(false);
            }

            ApplyChangeShapeRules();
            if (valueControl.SelectedIndex < 0)
            {
                if (valueControl.Text != "")
                {
                    element.InnerText = valueControl.Text;
                    return(true);
                }
                return(false);
            }
            else
            {
                ComboBoxObject Combo = (ComboBoxObject)valueControl.SelectedItem;
                if (Combo.Code == string.Empty)
                {
                    return(false);
                }

                element.InnerText = Combo.Code;
                element.SetAttribute("Name", Combo.Name);
            }
            return(true);
        }
Пример #2
0
        /// <summary>
        /// Searches for all ComboBoxObject given the criteria. It will search in config file for
        /// services with a similar code or name.
        /// </summary>
        /// <returns>List of matching services.</returns>
        public static ComboBoxObject[] Search(string nodeType, string fileName)
        {
            string xpath = string.Format( CultureInfo.InvariantCulture,
                string.Format("{0}",nodeType));

            ComboBoxObject[] results=null;

            XmlDocument doc = LoadServiceListFromFile(fileName);
            if(doc!=null)
            {
                XmlNodeList nodeList = doc.DocumentElement.SelectNodes( xpath );
                results = new ComboBoxObject[ nodeList.Count ];

                //results[0]=new ComboBoxObject(string.Empty,string.Empty);

                for ( int i=0; i<results.Length; i++ )
                {
                    string code = nodeList[ i ].Attributes[ "code" ].Value;
                    string name = nodeList[ i ].Attributes[ "name" ].Value;

                    results[ i ] = new ComboBoxObject( code, name);
                }
            }

            return results;
        }
Пример #3
0
        /// <summary>
        /// Searches for all ComboBoxObject given the criteria. It will search in config file for
        /// services with a similar code or name.
        /// </summary>
        /// <returns>List of matching services.</returns>
        public static ComboBoxObject[] Search(string nodeType, string fileName)
        {
            string xpath = string.Format(CultureInfo.InvariantCulture,
                                         string.Format("{0}", nodeType));

            ComboBoxObject[] results = null;

            XmlDocument doc = LoadServiceListFromFile(fileName);

            if (doc != null)
            {
                XmlNodeList nodeList = doc.DocumentElement.SelectNodes(xpath);
                results = new ComboBoxObject[nodeList.Count];

                //results[0]=new ComboBoxObject(string.Empty,string.Empty);

                for (int i = 0; i < results.Length; i++)
                {
                    string code = nodeList[i].Attributes["code"].Value;
                    string name = nodeList[i].Attributes["name"].Value;

                    results[i] = new ComboBoxObject(code, name);
                }
            }

            return(results);
        }