예제 #1
0
        public void AddNew(int index = -1)
        {
            CriteriaLine criteria = new CriteriaLine(this.SelectCriteria, this.SearchCriteria, this.OrderByCriteria);
            if (index >= 0)
            {
                //index++;
                for (int i = index; i < Criteria.Count; i++)
                {
                    CriteriaLine shiftCriteria = Criteria[i];
                    shiftCriteria.Location = new Point(shiftCriteria.Location.X, shiftCriteria.Location.Y + shiftCriteria.Height);
                }
                criteria.Location = new Point(3, CriteriaStartLocation + CriteriaLine.LineHeight * index);
                Criteria.Insert(index, criteria);
            }
            else
            {
                criteria.Location = new Point(3, CriteriaStartLocation + CriteriaLine.LineHeight * Criteria.Count);
                Criteria.Add(criteria);
            }
            criteria.Remove.Click += RemoveClick;
            criteria.Insert.Click += AddClick;

            if (CriteriaType != null)
                criteria.PropertySelect.ParentType = CriteriaType;

            Controls.Add(criteria);
            Add.Location = new Point(10, Criteria.Last().Bottom + 3);
            Add.Visible = true;
            Criteria.First().QueryOperatorSelect.Visible = false;
            if (Criteria.Count > 1)
                Criteria[1].QueryOperatorSelect.Visible = true;
            AutoResize();
        }
예제 #2
0
        public List <object> Search(CriteriaLine criteria = null)
        {
            if (_selectProperties.SelectedIndex > 0)
            {
                _searchList.Select(_selectProperties.GetSelectedProperties());
            }

            /*if (SelectProperties.SelectedProperty.IsList)
             * SearchList.Select(SelectProperties.SelectedProperty.Name, SelectProperties.SelectedProperty.Type.GetGenericArguments()[0]);
             * else
             * SearchList.Select(SelectProperties.SelectedProperty.Name, SelectProperties.SelectedProperty.Type);*/
            else
            {
                _searchList.ResetSelect();
            }

            _searchList.Search(SelectionPanel.BuildQuery());
            _searchList.SubListSearch(SearchPanel.BuildQuery(criteria));
            if (criteria == null)
            {
                _searchList.OrderBy(OrderByPanel.BuildQuery());
            }

            return(_searchList.GetResults());
        }
예제 #3
0
        public List <SearchInfo> BuildQuery(CriteriaLine breakCriteria = null)
        {
            List <SearchInfo> query = new List <SearchInfo>();

            if (breakCriteria != null && breakCriteria.QueryOperatorSelect.Text == "OR")
            {
                for (int i = Criteria.IndexOf(breakCriteria); i >= 0; i--)
                {
                    if (Criteria[i].QueryOperatorSelect.Text == "AND" || i == 0)
                    {
                        breakCriteria = Criteria[i];
                        break;
                    }
                }
            }

            foreach (CriteriaLine line in Criteria.Where(line => line.IsComplete() || line == breakCriteria))
            {
                if (line == breakCriteria)
                {
                    break;
                }
                SearchInfo criteria = line.BuildSearchInfo();
                if (criteria != null)
                {
                    query.Add(criteria);
                    //criteria.Operator = QueryOperator.And;
                }
            }
            if (query.Count > 0)
            {
                query.First().Operator = QueryOperator.Or;
            }
            return(query);
        }
예제 #4
0
        public List<object> SearchSelection(CriteriaLine criteria = null)
        {
            if (SelectProperties.SelectedIndex > 0)
                SearchList.Select(SelectProperties.GetSelectedProperties());
            //SearchList.Select(SelectProperties.SelectedProperty.Name, SelectProperties.SelectedProperty.Type.GetGenericArguments()[0]);
            else
                SearchList.ResetSelect();

            SearchList.Search(SelectionPanel.BuildQuery(criteria));
            return SearchList.GetSelection();
        }
예제 #5
0
 public void UpdateValueSelects(CriteriaLine criteriaAfter)
 {
     foreach (CriteriaLine line in Criteria.Where(criteria => Criteria.IndexOf(criteria) > Criteria.IndexOf(criteriaAfter) || Criteria.IndexOf(criteria) < 0))
     {
         line.GetValueOptions();
     }
     if (SelectCriteria)
     {
         (Parent as QueryControl).SearchPanel.UpdateAllValueSelects();
     }
 }
예제 #6
0
        public List <object> SearchSelection(CriteriaLine criteria = null)
        {
            if (_selectProperties.SelectedIndex > 0)
            {
                _searchList.Select(_selectProperties.GetSelectedProperties());
            }
            else
            {
                _searchList.ResetSelect();
            }

            _searchList.Search(SelectionPanel.BuildQuery(criteria));
            return(_searchList.GetSelection());
        }
예제 #7
0
        public List <object> SearchSelection(CriteriaLine criteria = null)
        {
            if (SelectProperties.SelectedIndex > 0)
            {
                SearchList.Select(SelectProperties.GetSelectedProperties());
            }
            //SearchList.Select(SelectProperties.SelectedProperty.Name, SelectProperties.SelectedProperty.Type.GetGenericArguments()[0]);
            else
            {
                SearchList.ResetSelect();
            }

            SearchList.Search(SelectionPanel.BuildQuery(criteria));
            return(SearchList.GetSelection());
        }
예제 #8
0
        public List<object> Search(CriteriaLine criteria = null)
        {
            if (SelectProperties.SelectedIndex > 0)
                SearchList.Select(SelectProperties.GetSelectedProperties());
            /*if (SelectProperties.SelectedProperty.IsList)
                SearchList.Select(SelectProperties.SelectedProperty.Name, SelectProperties.SelectedProperty.Type.GetGenericArguments()[0]);
            else
                SearchList.Select(SelectProperties.SelectedProperty.Name, SelectProperties.SelectedProperty.Type);*/
            else
                SearchList.ResetSelect();

            SearchList.Search(SelectionPanel.BuildQuery());
            SearchList.SubListSearch(SearchPanel.BuildQuery(criteria));
            if (criteria == null)
                SearchList.OrderBy(OrderByPanel.BuildQuery());
            return SearchList.GetResults();
        }
예제 #9
0
 public void Remove(CriteriaLine criteria)
 {
     int index = Criteria.IndexOf(criteria);
     //if (index == 0 && Criteria.Count == 1) return;
     for (int i = index; i < Criteria.Count; i++)
     {
         CriteriaLine shiftCritera = Criteria[i];
         shiftCritera.Location = new Point(shiftCritera.Location.X, shiftCritera.Location.Y - CriteriaLine.LineHeight);
     }
     Criteria.Remove(criteria);
     Controls.Remove(criteria);
     if (Criteria.Count == 0) AddNew();
     Criteria.First().QueryOperatorSelect.Visible = false;
     Criteria.First().QueryOperatorSelect.SelectedItem = QueryOperator.And;
     Add.Location = new Point(10, Criteria.Last().Bottom + 3);
     AutoResize();
     UpdateValueSelects(index);
 }
예제 #10
0
        public List <object> Search(CriteriaLine criteria = null)
        {
            if (_selectProperties.SelectedIndex > 0)
            {
                _searchList.Select(_selectProperties.GetSelectedProperties());
            }
            else
            {
                _searchList.ResetSelect();
            }

            _searchList.Search(SelectionPanel.BuildQuery());
            _searchList.SubListSearch(SearchPanel.BuildQuery(criteria));
            if (criteria == null)
            {
                _searchList.OrderBy(OrderByPanel.BuildQuery());
            }

            return(_searchList.GetResults());
        }
예제 #11
0
        public void Remove(CriteriaLine criteria)
        {
            int index = Criteria.IndexOf(criteria);

            //if (index == 0 && Criteria.Count == 1) return;
            for (int i = index; i < Criteria.Count; i++)
            {
                CriteriaLine shiftCritera = Criteria[i];
                shiftCritera.Location = new Point(shiftCritera.Location.X, shiftCritera.Location.Y - CriteriaLine.LineHeight);
            }
            Criteria.Remove(criteria);
            Controls.Remove(criteria);
            if (Criteria.Count == 0)
            {
                AddNew();
            }
            Criteria.First().QueryOperatorSelect.Visible = false;
            Criteria.First().QueryOperatorSelect.SelectedItem = QueryOperator.And;
            Add.Location = new Point(10, Criteria.Last().Bottom + 3);
            AutoResize();
            UpdateValueSelects(index);
        }
예제 #12
0
        public void AddNew(int index = -1)
        {
            CriteriaLine criteria = new CriteriaLine(SelectCriteria, SearchCriteria, OrderByCriteria);

            if (index >= 0)
            {
                //index++;
                for (int i = index; i < Criteria.Count; i++)
                {
                    CriteriaLine shiftCriteria = Criteria[i];
                    shiftCriteria.Location = new Point(shiftCriteria.Location.X, shiftCriteria.Location.Y + shiftCriteria.Height);
                }
                criteria.Location = new Point(3, CriteriaStartLocation + CriteriaLine.LineHeight * index);
                Criteria.Insert(index, criteria);
            }
            else
            {
                criteria.Location = new Point(3, CriteriaStartLocation + CriteriaLine.LineHeight * Criteria.Count);
                Criteria.Add(criteria);
            }
            criteria.Remove.Click += RemoveClick;
            criteria.Insert.Click += AddClick;

            if (CriteriaType != null)
            {
                criteria.PropertySelect.ParentType = CriteriaType;
            }

            Controls.Add(criteria);
            Add.Location = new Point(10, Criteria.Last().Bottom + 3);
            Add.Visible  = true;
            Criteria.First().QueryOperatorSelect.Visible = false;
            if (Criteria.Count > 1)
            {
                Criteria[1].QueryOperatorSelect.Visible = true;
            }

            AutoResize();
        }
예제 #13
0
        public List<SearchInfo> BuildQuery(CriteriaLine breakCriteria = null)
        {
            List<SearchInfo> query = new List<SearchInfo>();

            if (breakCriteria != null && breakCriteria.QueryOperatorSelect.Text == "OR")
            {
                for (int i = Criteria.IndexOf(breakCriteria); i >= 0; i--)
                {
                    if (Criteria[i].QueryOperatorSelect.Text == "AND" || i == 0)
                    {
                        breakCriteria = Criteria[i];
                        break;
                    }

                }

            }

            foreach (CriteriaLine line in Criteria.Where(line => line.IsComplete() || line == breakCriteria))
            {
                if (line == breakCriteria) break;
                SearchInfo criteria = line.BuildSearchInfo();
                if (criteria != null)
                {
                    query.Add(criteria);
                    //criteria.Operator = QueryOperator.And;
                }
            }
            if (query.Count > 0)
                query.First().Operator = QueryOperator.Or;
            return query;
        }
예제 #14
0
 public void UpdateValueSelects(CriteriaLine criteriaAfter)
 {
     foreach (CriteriaLine line in Criteria.Where(criteria => Criteria.IndexOf(criteria) > Criteria.IndexOf(criteriaAfter) || Criteria.IndexOf(criteria) < 0))
     {
         line.GetValueOptions();
     }
     if (SelectCriteria) (Parent as QueryControl).SearchPanel.UpdateAllValueSelects();
 }