using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.SqlClient; namespace Proje_Odevi { public partial class frmSeansEkle : Form { public frmSeansEkle() { InitializeComponent(); } string seans = ""; sinemaTableAdapters.Seans_BilgileriTableAdapter filmseansi = new sinemaTableAdapters.Seans_BilgileriTableAdapter(); SqlConnection baglanti = new SqlConnection("Data Source=SERVER;Initial Catalog=Sinema_Bileti;Integrated Security=True"); private void RadioButonSeciliyse() { if (radioButton1.Checked == true) seans = radioButton1.Text; else if (radioButton2.Checked == true) seans = radioButton2.Text; else if (radioButton3.Checked == true) seans = radioButton3.Text; else if (radioButton4.Checked == true) seans = radioButton4.Text; else if (radioButton5.Checked == true) seans = radioButton5.Text; else if (radioButton6.Checked == true) seans = radioButton6.Text; else if (radioButton7.Checked == true) seans = radioButton7.Text; else if (radioButton8.Checked == true) seans = radioButton8.Text; else if (radioButton9.Checked == true) seans = radioButton9.Text; else if (radioButton10.Checked == true) seans = radioButton10.Text; else if (radioButton11.Checked == true) seans = radioButton11.Text; else if (radioButton12.Checked == true) seans = radioButton12.Text; } private void FilmveSalonGosterim(ComboBox combo, string sql, string sql2) { baglanti.Open(); SqlCommand komut = new SqlCommand(sql, baglanti); SqlDataReader read = komut.ExecuteReader(); while (read.Read() == true) { combo.Items.Add(read[sql2].ToString()); } baglanti.Close(); } private void frmSeansEkle_Load(object sender, EventArgs e) { FilmveSalonGosterim(comboFilm, "select *from_filmbilgileri", "filmadi"); FilmveSalonGosterim(comboSalon, "select *from salon_bilgileri", "salonadi"); } private void frmSeansEkle_FormClosing(object sender, FormClosingEventArgs e) { frmAnaSayfa anasayfa = new frmAnaSayfa(); anasayfa.Show(); } private void btnSeansEkle_Click(object sender, EventArgs e) { RadioButonSeciliyse(); if (seans != "") { filmseansi.SeansEkleme(comboFilm.Text, comboSalon.Text, dateTimePicker1.Text, seans); MessageBox.Show("Seans Eklendi", "Bilgi"); } else if (seans == "") { MessageBox.Show("Seansın saatini seçmediniz", "Uyarı"); } comboFilm.Text = ""; comboSalon.Text = ""; dateTimePicker1.Text = DateTime.Now.ToShortDateString(); } private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { foreach (Control item3 in panel1.Controls) { item3.Enabled = true; } DateTime bugun = DateTime.Parse(DateTime.Now.ToLongDateString()); DateTime yeni = DateTime.Parse(dateTimePicker1.Text); if (bugun == yeni) { foreach (Control item in panel1.Controls) { if (DateTime.Parse(DateTime.Now.ToShortTimeString()) > DateTime.Parse(item.Text)) { item.Enabled = false; } } TarihiKarsilastir(); } else if (yeni>bugun) { TarihiKarsilastir(); } else if (yeni