BExIS.Ddm.Model.SearchCriteria.GetProperty C# (CSharp) Method

GetProperty() public method

Check if Property in SerachCriteriaList This function is used to check whether an property is present in the list.
public GetProperty ( string Name ) : Property
Name string
return Property
        public Property GetProperty(string Name)
        {
            var sc = (from sco in SearchCriteriaList
                            from v in sco.Values
                            where v.Equals(Name, StringComparison.InvariantCulture) ||
                            sco.SearchComponent.Name.Equals(Name, StringComparison.InvariantCulture)
                            select sco).FirstOrDefault();

            if (sc != null) return sc.SearchComponent as Property;

            return null;
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Remove a property from the Dictionary 
        /// </summary>
        /// <example>
        /// grassland: all | yes | no
        /// grassland is name
        /// value is (all | yes | no)
        /// </example>
        /// <param name="name">Name of the property</param>
        /// <param name="value">Value of the property</param>
        public void RemoveFromPropertiesDic(string name, string value, SearchCriteria sc)
        {
            if (name != null)
            {
                if (sc.GetProperty(name) != null)
                {
                    string datasourceKey = sc.GetProperty(name).DataSourceKey;

                    if (PropertiesDic.ContainsKey(datasourceKey))
                    {
                        foreach (KeyValuePair<string, string> kvp in PropertiesDic)
                        {
                            if (kvp.Value == value && kvp.Key == datasourceKey)
                            {
                                PropertiesDic.Remove(datasourceKey);
                                break;
                            }
                        }
                    }
                }
            }
        }