Exemplo n.º 1
0
        protected virtual void Filter(object sender, EventArgs e)
        {
            AutoCompleteWheretermFormater = null;

            BeforeFilter();
            if (AutoCompleteWheretermFormater != null)
            {
                if (tbxCode.Text != "")
                {
                    var param = AutoCompleteWheretermFormater;
                    Array.Resize(ref param, param.Length + 1);
                    param[param.Length - 1] = WhereTerm.Default(tbxCode.Text, CodeColumn, EnumSqlOperator.Like);

                    AutoCompleteWheretermFormater = param;
                }
            }
            else
            {
                if (tbxCode.Text != "")
                {
                    AutoCompleteWheretermFormater = new IListParameter[] { WhereTerm.Default(tbxCode.Text, CodeColumn, EnumSqlOperator.Like) };
                }
            }

            var paramEmpty = true;

            foreach (Control o in MainContainer.Panel1.Controls)
            {
                if (o is TextBox)
                {
                    if (o.Text != "")
                    {
                        paramEmpty = false;
                        break;
                    }
                }

                if (o is dTextBox)
                {
                    if (o.Text != "")
                    {
                        paramEmpty = false;
                        break;
                    }
                }

                if (o is dTextBoxNumber)
                {
                    if (o.Text != "")
                    {
                        paramEmpty = false;
                        break;
                    }
                }

                if (o is dCalendar)
                {
                    if (((dCalendar)o).EditValue != null)
                    {
                        paramEmpty = false;
                        o.Focus();
                        break;
                    }
                }

                if (o is dLookupC)
                {
                    if (((dLookupC)o).Value != null)
                    {
                        paramEmpty = false;
                        break;
                    }
                }

                if (o is ComboBox)
                {
                    if (((ComboBox)o).SelectedValue != null)
                    {
                        paramEmpty = false;
                        break;
                    }
                }
            }

            if (paramEmpty)
            {
                MessageBox.Show(@"Masukkan parameter pencarian", Resources.title_information, MessageBoxButtons.OK);
                return;
            }

            if (ByPaging)
            {
                PageLimit  = 10;
                PagingForm = new Paging
                {
                    Direction  = SortDirection,
                    SortColumn = SortColumn
                };

                CurrentFilter = GotoFirstPage <TModel>(sender, e);
            }
            else
            {
                CurrentFilter = DataManager.Get <TModel>(AutoCompleteWheretermFormater);
            }

            GridSearch.DataSource = CurrentFilter;
            SearchView.RefreshData();

            NavigatorPagingState = PagingState;
            GridSearch.Focus();
        }