Beispiel #1
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            if (!chkNoFilter.Checked)
            {
                string filter    = "";
                bool   noInitial = true;

                if (chkStadsdeel.Checked)
                {
                    string initial = "";
                    if (!noInitial)
                    {
                        initial = " AND";
                    }
                    filter   += string.Format(initial + " stadsdeel = '{0}'", cBoxStadsdeel.Text);
                    noInitial = false;
                }
                if (chkScore.Checked)
                {
                    if (!string.IsNullOrWhiteSpace(txtScore.Text))
                    {
                        string initial = "";
                        if (!noInitial)
                        {
                            initial = " AND";
                        }
                        filter   += string.Format(initial + " totaal_score > {0}", int.Parse(txtScore.Text));
                        noInitial = false;
                    }
                }
                if (chkName.Checked)
                {
                    if (!string.IsNullOrWhiteSpace(txtName.Text))
                    {
                        string initial = "";
                        if (!noInitial)
                        {
                            initial = " AND";
                        }
                        filter   += string.Format(initial + " wijk LIKE '%{0}%' OR wijk LIKE '%{1}%' OR wijk LIKE '%{2}%'", txtName.Text.ToLower(), txtName.Text.ToUpper(), (txtName.Text.ToLower())[0].ToString().ToUpper() + txtName.Text.ToLower().Substring(1));
                        noInitial = false;
                    }
                }
                if (filter != "")
                {
                    mainForm.LoadDataGridInitial(" WHERE" + filter);
                    Close();
                }
                else
                {
                    Close();
                }
            }
            else
            {
                mainForm.LoadDataGridInitial(); Close();
            }
        }