Пример #1
0
        public QueryBuiler(IEnumerable <PropertyInfo> queryableProperties)
        {
            this.queryableProperties = queryableProperties;

            InitializeComponent();
            var queryControlListElement = new QueryControlListElement(queryableProperties);

            this.button4.Click += (_, e) => FindClick?.Invoke(this, e);
            queryControlListElement.AndClick    += buttonAND_Click;
            queryControlListElement.OrClick     += buttonOR_Click;
            queryControlListElement.DeleteClick += buttonDelete_Click;
            this.tableLayoutPanel1.Controls.Add(queryControlListElement, 0, 0);
        }
        private void LaunchSearch()
        {
            int           count       = IndexEngine.LuceneService.DirReader.MaxDoc;
            List <string> users       = new List <string>();
            List <string> dates       = new List <string>();
            var           stringQuery = searchBox.Text;

            if (!userToggle.Checked && !dateToggle.Checked)
            {
                FindClick?.Invoke(this, new LuceneQueryEventArgs(stringQuery, count, false));
            }
            else if (userToggle.Checked && !dateToggle.Checked)
            {
                if (userList.CheckedItems.Count != 0)
                {
                    users.Clear();
                    foreach (ListViewItem item in userList.CheckedItems)
                    {
                        users.Add(item.Text);
                    }
                    FindClick?.Invoke(this, new LuceneQueryEventArgs(stringQuery, count, users.ToArray(), false));
                }
            }
            else if (!userToggle.Checked && dateToggle.Checked)
            {
                if (startDate.Checked && finishDate.Checked)
                {
                    DateTime[] date = new DateTime[2];
                    date[0] = startDate.Value;
                    date[1] = finishDate.Value;
                    FindClick?.Invoke(this, new LuceneQueryEventArgs(stringQuery, count, date, false));
                }
            }
            else if (userToggle.Checked && dateToggle.Checked)
            {
                users.Clear();
                foreach (ListViewItem item in userList.CheckedItems)
                {
                    users.Add(item.Text);
                }
                DateTime[] date = new DateTime[2];
                date[0] = startDate.Value;
                date[1] = finishDate.Value;
                FindClick?.Invoke(this, new LuceneQueryEventArgs(stringQuery, 50, users.ToArray(), date, false));
            }
        }
Пример #3
0
 private void btnFind_Click(object sender, EventArgs e)
 {
     FindClick?.Invoke(this, e);
 }