示例#1
0
        private void Search_button_Click(object sender, EventArgs e)        //поиск
        {
            if (LNcb.Checked)
            {
                if (SearchBox.Text.Length == 0)
                {
                    SearchBox.Text = "Вы не ввели параметр для поиска";
                }
                else
                {
                    List <Information> find_pos = new List <Information>();
                    find_pos = Base.find_person_LastName(this.Objects, SearchBox.Text);

                    if (find_pos.Count == 0)
                    {
                        DialogResult dr = MessageBox.Show("Записи не найдены",
                                                          "Поиск",
                                                          MessageBoxButtons.OK,
                                                          MessageBoxIcon.Warning,
                                                          MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        Find.BringToFront();
                        Find.DataSource = find_pos;
                    }
                }
            }
            if (Poscb.Checked)
            {
                if (SearchBox.Text.Length == 0)
                {
                    SearchBox.Text = "Вы не ввели параметр для поиска";
                }
                else
                {
                    List <Information> find_pos = new List <Information>();
                    find_pos = Base.find_person_position(this.Objects, SearchBox.Text);
                    if (find_pos.Count == 0)
                    {
                        DialogResult dr = MessageBox.Show("Записи не найдены",
                                                          "Поиск",
                                                          MessageBoxButtons.OK,
                                                          MessageBoxIcon.Warning,
                                                          MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        Find.BringToFront();
                        Find.DataSource = find_pos;
                    }
                }
            }
            if (Actcb.Checked)
            {
                List <Information> find_pos = new List <Information>();
                find_pos = Base.find_person_actuality(this.Objects, Convert.ToBoolean(Fired.Checked));
                if (find_pos.Count == 0)
                {
                    DialogResult dr = MessageBox.Show("Записи не найдены",
                                                      "Поиск",
                                                      MessageBoxButtons.OK,
                                                      MessageBoxIcon.Warning,
                                                      MessageBoxDefaultButton.Button1);
                }
                else
                {
                    Find.BringToFront();
                    Find.DataSource = find_pos;
                }
            }
        }