Ejemplo n.º 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <remarks></remarks>
 /// <seealso cref=""/>
 /// <param name="values"></param>
 /// <param name="multiSelect"></param>
 /// <param name="valueSearchOperation"></param>
 /// <param name="searchComponent"></param>
 public SearchCriterion(List<string> values, bool multiSelect, string valueSearchOperation, SearchComponentBase searchComponent)
 {
     //Name = name;
     Values = values;
     MultiSelect = multiSelect;
     //Range = range;
     ValueSearchOperation = valueSearchOperation;
     SearchComponent = searchComponent;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Update a SearchCriterion with a list of values
 /// multiselect must be true
 /// </summary>
 /// <remarks></remarks>
 /// <seealso cref=""/>
 /// <param name="name"></param>
 /// <param name="values"></param>
 /// <param name="multiSelect"></param>
 /// <param name="range"></param>
 /// <param name="dataType"></param>
 public void Update(SearchComponentBase scb,List<string> values, bool multiSelect=true, string valueSearchOperation = "OR")
 {
     //1. prüfe ob name in list vorhanden
     if (ContainsSearchCriterion(scb.Name, scb.Type))
     {
         SearchCriterion sco = Get(scb.Name, scb.Type);
         //2. check if MultiSelect
         if (multiSelect)
         {
             if (values.Count > 0) sco.Values = values;
             else SearchCriteriaList.Remove(sco);
         }
     }
     else
     {
         //wenn nicht vorhanden dann füge hinzu
         if (values.Count>0)
         SearchCriteriaList.Add(new SearchCriterion(values, multiSelect, valueSearchOperation,scb));
     }
 }
Ejemplo n.º 3
0
 public SearchCriterion(string value, bool multiSelect, string valueSearchOperation , SearchComponentBase searchComponent)
 {
     if (Values == null) Values = new List<string>();
     //Name = name;
     Values.Add(value);
     MultiSelect = multiSelect;
     //Range = range;
     ValueSearchOperation = valueSearchOperation;
     SearchComponent = searchComponent;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Update a SearchCriterion with one value
        /// </summary>
        /// <remarks></remarks>
        /// <seealso cref=""/>
        /// <param name="name"></param>
        /// <param name="value"></param>
        /// <param name="multiSelect"></param>
        /// <param name="range"></param>
        /// <param name="dataType"></param>
        public void Update(SearchComponentBase scb, string value, bool multiSelect = false, string valueSearchOperation = "OR")
        {
            //1. prüfe ob name in list vorhanden
            if (ContainsSearchCriterion(scb.Name, scb.Type))
            {
                SearchCriterion sco = Get(scb.Name, scb.Type);

                //2. check if MultiSelect
                if (multiSelect)
                {
                    // diffferent values can be in  the list
                    // if the values is in the list remove the value
                    if (sco.Values.Contains(value))
                    {
                        sco.Values.Remove(value);
                        if (sco.Values.Count() == 0) SearchCriteriaList.Remove(sco);
                    }
                    // else add value to the list
                    else
                    {
                        sco.Values.Add(value);
                    }
                }
                else
                {
                    // override values of SearchCriterion if not multiselect
                    // or remove if values contains this value
                    if (sco.Values.Contains(value))
                    {
                        sco.Values.Clear();
                        SearchCriteriaList.Remove(sco);
                    }
                    else
                    {
                        sco.Values.Clear();

                        bool isDefault = false;
                        if (scb is Property)
                        {
                            Property p = (Property)scb;
                            if (p.DefaultValue == value) isDefault = true;
                        }

                        if (!isDefault)
                        {
                            sco.Values.Clear();
                            if (!String.IsNullOrEmpty(value))
                                sco.Values.Add(value);
                            else
                                SearchCriteriaList.Remove(sco);
                        }
                        else SearchCriteriaList.Remove(sco);
                    }
                }
            }
            else
            {

                //wenn nicht vorhanden dann füge hinzu
                if (scb != null && !String.IsNullOrEmpty(value))
                {
                    SearchCriteriaList.Add(new SearchCriterion(value, multiSelect, valueSearchOperation, scb));
                }
            }
        }