Ejemplo n.º 1
0
 /// <summary>
 /// Inserts a ISqlFilterMangler instance into the collection.
 /// </summary>
 /// <param name="item">The item to add.</param>
 public void Insert(int index, ISqlFilterMangler item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     List.Insert(index, item);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Removes a ISqlFilterMangler item to the collection.
 /// </summary>
 /// <param name="item">The item to remove.</param>
 public void Remove(ISqlFilterMangler item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     List.Remove(item);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds a ISqlFilterMangler instance to the collection.
 /// </summary>
 /// <param name="item">The item to add.</param>
 public int Add(ISqlFilterMangler item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     return(List.Add(item));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Discovers if the given item is in the collection.
 /// </summary>
 /// <param name="item">The item to find.</param>
 /// <returns>Returns true if the given item is in the collection.</returns>
 public bool Contains(ISqlFilterMangler item)
 {
     if (IndexOf(item) == -1)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Ejemplo n.º 5
0
        public FilterMangler(string manglerId, SimpleXmlPropertyBag settings, ISqlFilterMangler filter)
        {
            if (manglerId == null)
            {
                throw new ArgumentNullException("manglerId");
            }
            if (manglerId.Length == 0)
            {
                throw new ArgumentOutOfRangeException("'manglerId' is zero-length.");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (filter == null)
            {
                throw new ArgumentNullException("filter");
            }

            // set...
            _manglerId     = manglerId;
            _settings      = settings;
            _filterMangler = filter;
        }
Ejemplo n.º 6
0
        private static FilterMangler LoadMangler(SqlSearchSettings settings, XmlElement element)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            // get the type...
            string manglerId = XmlHelper.GetAttributeString(element, "manglerId", OnNotFound.ThrowException);

            if (manglerId == null)
            {
                throw new InvalidOperationException("'manglerId' is null.");
            }
            if (manglerId.Length == 0)
            {
                throw new InvalidOperationException("'manglerId' is zero-length.");
            }

            // get the type...
            Type type = XmlHelper.GetAttributeType(element, "type", OnNotFound.ThrowException);

            if (type == null)
            {
                throw new InvalidOperationException("type is null.");
            }

            // create...
            ISqlFilterMangler filter = (ISqlFilterMangler)CreateInstance(type);

            if (filter == null)
            {
                throw new InvalidOperationException("filter is null.");
            }

            // get the settings element...
            XmlElement settingsElement = (XmlElement)element.SelectSingleNode("Settings");

            if (settingsElement == null)
            {
                throw new InvalidOperationException("settingsElement is null.");
            }

            // load...
            SimpleXmlPropertyBag bag = SimpleXmlPropertyBag.Load(settingsElement, typeof(SimpleXmlPropertyBag));

            if (bag == null)
            {
                throw new InvalidOperationException("bag is null.");
            }

            // Lets deserialize the bag into the control
            filter.DeserializeSqlSearchSettings(bag);
            FilterMangler mangler = new FilterMangler(manglerId, bag, filter);

            // patch...
            //mangler.DeserializeSqlSearchSettings(bag);

            // return...
            return(mangler);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Returns the index of the item in the collection.
 /// </summary>
 /// <param name="item">The item to find.</param>
 /// <returns>The index of the item, or -1 if it is not found.</returns>
 public int IndexOf(ISqlFilterMangler item)
 {
     return(List.IndexOf(item));
 }
Ejemplo n.º 8
0
 public FilterMangler(string manglerId, ISqlFilterMangler filter) : this(manglerId, new SimpleXmlPropertyBag(), filter)
 {
 }