private void Button1_Click(object sender, EventArgs e) { if (comboBox1.SelectedValue == null) { MessageBox.Show("İlk önce salon seçmeniz gerekmektedir.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { groupBox1.Visible = true; checkBox1.Checked = false; checkBox2.Checked = false; checkBox3.Checked = false; checkBox4.Checked = false; checkBox5.Checked = false; checkBox1.Enabled = true; checkBox2.Enabled = true; checkBox3.Enabled = true; checkBox4.Enabled = true; checkBox5.Enabled = true; button2.Enabled = true; List <Showtimes> showtimes = HelperShowtimes.GetShowtimesListByHallIdAndDate(Convert.ToInt32(comboBox1.SelectedValue), dateTimePicker1.Value); foreach (var item in showtimes) { if (item.Clock == 1) { checkBox1.Checked = true; checkBox1.Enabled = false; } if (item.Clock == 2) { checkBox2.Checked = true; checkBox2.Enabled = false; } if (item.Clock == 3) { checkBox3.Checked = true; checkBox3.Enabled = false; } if (item.Clock == 4) { checkBox4.Checked = true; checkBox4.Enabled = false; } if (item.Clock == 5) { checkBox5.Checked = true; checkBox5.Enabled = false; } } } if (checkBox1.Checked && checkBox2.Checked && checkBox3.Checked && checkBox4.Checked && checkBox5.Checked) { button2.Enabled = false; } }
private void button1_Click(object sender, EventArgs e) { flowLayoutPanel1.Controls.Clear(); List <Showtimes> showtimesHelper = HelperShowtimes.GetShowtimesListByHallIdAndDate(Convert.ToInt32(comboBox1.SelectedValue), dateTimePicker1.Value); List <Showtimes> showtimes = showtimesHelper.OrderBy(x => x.Clock).ToList(); List <ShowtimesModel> showtimesModels = HelperShowtimes.GetShowtimesModelPartialList(showtimes); foreach (var item in showtimesModels) { RadioButton radioButton = new RadioButton(); radioButton.Text = item.Clock; radioButton.ForeColor = Color.White; radioButton.CheckedChanged += RadioButton_CheckedChanged; flowLayoutPanel1.Controls.Add(radioButton); } }