private void salonSil_Click(object sender, EventArgs e) { salonlar s = new salonlar(); s.salonNo = salonNoText.Text; salonlarDAO salonlarDAO = new salonlarDAO(); salonlarDAO.salonSil(s); }
private void salonEkle_Click(object sender, EventArgs e) { salonlar s = new salonlar(); s.salonNo = salonNoText.Text; s.salonAdi = salonAdiText.Text; s.bulunduguKat = salonBulunduguKatText.Text; salonlarDAO salonlarDAO = new salonlarDAO(); salonlarDAO.salonEkle(s); }
public void salonEkle(salonlar s) { SqlConnection con = openConnection(); try { SqlCommand cmd = new SqlCommand("insert into salon(salonNo, salonAdi, bulunduguKat) values (@salonNo, @salonAdi, @bulunduguKat)", con); cmd.Parameters.AddWithValue("@salonNo", s.salonNo); cmd.Parameters.AddWithValue("@salonAdi", s.salonAdi); cmd.Parameters.AddWithValue("@bulunduguKat", s.bulunduguKat); cmd.ExecuteNonQuery(); MessageBox.Show("Eklendi"); } catch (Exception ex) { Console.WriteLine(ex.Message); } con.Close(); }
public void salonSil(salonlar s) { SqlConnection con = openConnection(); try { SqlCommand cmd = new SqlCommand("delete from salon where salonNo=@salonNo", con); int x = 0; Int32.TryParse(s.salonNo, out x); cmd.Parameters.AddWithValue("@salonNo", x); cmd.ExecuteNonQuery(); MessageBox.Show("Silindi"); } catch (Exception ex) { Console.WriteLine(ex.Message); } con.Close(); }
public void salonGuncelle(salonlar s) { SqlConnection con = openConnection(); try { SqlCommand cmd = new SqlCommand("update salon set salonNo=@salonNo, salonAdi=@salonAdi, bulunduguKat=@bulunduguKat where salonNo=@salonNoEski", con); cmd.Parameters.AddWithValue("@salonNo", s.salonNo); cmd.Parameters.AddWithValue("@salonAdi", s.salonAdi); cmd.Parameters.AddWithValue("@bulunduguKat", s.bulunduguKat); int x = 0; Int32.TryParse(s.salonNoEski, out x); cmd.Parameters.AddWithValue("@x", x); cmd.Parameters.AddWithValue("@salonNoEski", x); cmd.ExecuteNonQuery(); MessageBox.Show("güncellendi"); } catch (Exception e) { Console.WriteLine(e.Message); } con.Close(); }