public bool TedarikciBilgiGuncelle(tedarikciBilgi ted, string id) { bool result = false; using (var connection = Database.GetConnection()) { string sqlstring = "UPDATE tedarikci SET firmaadi = '" + ted.FirmaAdi + "'," + "ad = '" + ted.Ad + "'," + "soyad= '" + ted.Soyad + "'," + "eposta = '" + ted.Email + "'," + "telefon = '" + ted.Tel + "'," + "adres = '" + ted.Adres + "' WHERE tedarikci_id = '" + id + "'"; var command = new SqlCommand(sqlstring); command.Connection = connection; connection.Open(); if (command.ExecuteNonQuery() != -1) { result = true; } connection.Close(); } return(result); }
private void button1_Click(object sender, EventArgs e) { tedarikciBilgi ted = new tedarikciBilgi(); ted.FirmaAdi = textBox_tedarikci_firmaadi.Text.ToString(); ted.Ad = textBox_tedarikci_ad.Text.ToString(); ted.Soyad = textBox_tedarikci_soyad.Text.ToString(); ted.Email = textBox_tedarikci_eposta.Text.ToString(); ted.Tel = textBox_tedarikci_telefon.Text.ToString(); ted.Adres = richTextBox_tedarikci_adres.Text.ToString(); ted.Tc = textBox_tedarikci_tc.Text.ToString(); UserProvider pro = new UserProvider(); if (pro.TedarikciEkle(ted)) { MessageBox.Show("Başarıyla Kaydedildi."); } else { MessageBox.Show("Kayıt alınırken bir hata oluştu"); } }
private void button3_Click(object sender, EventArgs e) { tedarikciBilgi ted = new tedarikciBilgi(); ted.FirmaAdi = textBox_guncelle_firmaadi.Text.ToString(); ted.Ad = textBox_guncelle_ad.Text.ToString(); ted.Soyad = textBox_guncelle_soyad.Text.ToString(); ted.Email = textBox_guncelle_mail.Text.ToString(); ted.Adres = textBox_guncelle_adres.Text.ToString(); ted.Tel = textBox_guncelle_telefon.Text.ToString(); UserProvider pro = new UserProvider(); if (pro.TedarikciBilgiGuncelle(ted, tedarikci_id)) { MessageBox.Show("Başarıyla Güncellendi"); } else { MessageBox.Show("Hata oluştu !"); } }
public bool TedarikciEkle(tedarikciBilgi ted) { bool result = false; using (var connection = Database.GetConnection()) { var command = new SqlCommand("INSERT INTO tedarikci(firmaadi,ad,soyad,eposta,telefon,adres,tc) " + "VALUES('" + ted.FirmaAdi + "','" + ted.Ad + "','" + ted.Soyad + "','" + ted.Email + "','" + ted.Tel + "','" + ted.Adres + "','" + ted.Tc + "')"); command.Connection = connection; connection.Open(); if (command.ExecuteNonQuery() != -1) { result = true; } connection.Close(); } return(result); }