예제 #1
0
        // Отменить поиск. Обработка события нажатия на кнопку.
        private void tbSearchCancel_Click(object sender, EventArgs e)
        {
            IDataSourceView students  = this.ActiveMdiChild as DataViewForm <IStudent>;
            IDataSourceView companies = this.ActiveMdiChild as DataViewForm <ICompany>;

            IDataSourceView form = students ?? companies;

            if (form == null)
            {
                return;
            }

            form.SetDataSourceFilter(null);
        }
예제 #2
0
        // Поиск. Обработка события нажатия на кнопку.
        private void btnSearch_Click(object sender, EventArgs e)
        {
            IDataSourceView students  = this.ActiveMdiChild as DataViewForm <IStudent>;
            IDataSourceView companies = this.ActiveMdiChild as DataViewForm <ICompany>;

            IDataSourceView form = students ?? companies;

            if (form == null)
            {
                return;
            }

            var filter = students == null ? $"([Название] LIKE '%{tbSearch.Text}%')" : BuildStudentSearchString();

            form.SetDataSourceFilter(filter);
        }