public bool MusteriBilgiGuncelle(musteriBilgi musteri, Int64 eskitc) { bool result = false; using (var connection = Database.GetConnection()) { string sqlstring = "UPDATE musteri SET musteri_tc = '" + musteri.musteriTcKimlik + "'," + "musteri_adi = '" + musteri.musteriAdi + "'," + "musteri_soyadi= '" + musteri.musteriSoyad + "'," + "musteri_mail = '" + musteri.musteriEpost + "'," + "musteri_telefon = '" + musteri.musteriTelefon + "'," + "musteri_adres = '" + musteri.musteriAdres + "' WHERE musteri_tc = '" + eskitc + "'"; var command = new SqlCommand(sqlstring); command.Connection = connection; connection.Open(); if (command.ExecuteNonQuery() != -1) { result = true; } connection.Close(); } return(result); }
private void musteriEkleButton_Click(object sender, EventArgs e) { string musteriAdi = Txt_musteri_ad.Text.ToString(); string musteriSoyad = txt_Musteri_soyad.Text.ToString(); string musteriEposta = txt_Musteri_posta.Text.ToString(); string musteriTelefon = txt_Musteri_telefon.Text.ToString(); Int64 musteriTcKimlik = Convert.ToInt64(txt_Musteri_tc.Text); string musteriAdres = richTextBox1_musteri_adres.Text.ToString(); musteriBilgi deneme = new musteriBilgi(); deneme.musteriAdi = musteriAdi; deneme.musteriSoyad = musteriSoyad; deneme.musteriEpost = musteriEposta; deneme.musteriTelefon = musteriTelefon; deneme.musteriTcKimlik = musteriTcKimlik; deneme.musteriAdres = musteriAdres; UserProvider musteriEkle = new UserProvider(); if (musteriEkle.MusteriEkle(deneme)) { MessageBox.Show("Müşteri Başarıyla Eklendi"); } else { MessageBox.Show("Müşteri Eklerken Hata Oluştu"); } }
private void musteriBilgileriGuncelleButton_Click(object sender, EventArgs e) { musteriBilgi musteri = new musteriBilgi(); musteri.musteriAdi = textBox7.Text.ToString(); musteri.musteriSoyad = textBox8.Text.ToString(); musteri.musteriEpost = textBox9.Text.ToString(); musteri.musteriTelefon = textBox10.Text.ToString(); musteri.musteriAdres = richTextBox2.Text.ToString(); UserProvider guncelle = new UserProvider(); if (guncelle.MusteriBilgiGuncelle(musteri, musteri_tc_tut)) { MessageBox.Show("Başarıyla Güncellendi"); } else { MessageBox.Show("Bir Hata Oluştu"); } }
public bool MusteriEkle(musteriBilgi musteri) { bool result = false; using (var connection = Database.GetConnection()) { var command = new SqlCommand("INSERT INTO musteri(musteri_tc,musteri_adi,musteri_soyadi,musteri_mail,musteri_telefon,musteri_adres) " + "VALUES('" + musteri.musteriTcKimlik + "','" + musteri.musteriAdi + "','" + musteri.musteriSoyad + "','" + musteri.musteriEpost + "','" + musteri.musteriTelefon + "','" + musteri.musteriAdres + "')"); command.Connection = connection; connection.Open(); if (command.ExecuteNonQuery() != -1) { result = true; } connection.Close(); } return(result); }