コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            textBox3.Clear();
            Crews searchResults = new Crews();
            Form1 f1            = this.Owner as Form1;
            int   border        = Convert.ToInt32(textBox1.Text);

            foreach (Crew i in f1.crews.crews)
            {
                if (i.plane.seats >= border)
                {
                    searchResults.crews.Add(i);
                    textBox3.Text += i.plane.id + " " + i.plane.type + " " + i.plane.seats + "\r\n";
                }
            }
            f1.seatsSearchResult = searchResults;
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Clear();
            Crews result = new Crews();
            Form1 f1     = this.Owner as Form1;

            if (radioButton1.Checked)
            {
                foreach (Crew i in f1.crews.crews)
                {
                    if (i.plane.type == "Военный")
                    {
                        result.crews.Add(i);
                        textBox1.Text += i.plane.id + ", " + i.plane.type + "\r\n";
                    }
                }
            }
            if (radioButton2.Checked)
            {
                foreach (Crew i in f1.crews.crews)
                {
                    if (i.plane.type == "Пассажирский")
                    {
                        result.crews.Add(i);
                        textBox1.Text += i.plane.id + ", " + i.plane.type + "\r\n";
                    }
                }
            }
            if (radioButton3.Checked)
            {
                foreach (Crew i in f1.crews.crews)
                {
                    if (i.plane.type == "Грузовой")
                    {
                        result.crews.Add(i);
                        textBox1.Text += i.plane.id + ", " + i.plane.type + "\r\n";
                    }
                }
            }
            f1.typeSearchResult.crews = result.crews;
        }