public bool Ekle(Defo defo) { if (defo != null && defo.urun > 0 && defo.personel > 0 && defo.adet > 0) { String[] sutunlar = { sorguUrun, sorguAdet, sorguPersonel, sorguAciklama }; String[] degerler = { defo.urun.ToString(), defo.adet.ToString(), defo.personel.ToString(), defo.aciklama }; veriTabani.komutAl(komut: this.ekle( tablo: tabloDefo, sutunlar: sutunlar, degerler: degerler )); return(veriTabani.sonucDondurmeyenSorguKomutIsle()); } return(false); }
private void buttonKaydet_Click(object sender, EventArgs e) { DialogResult dialogResult; if (this.numericUpDownAdet.Value != 0 && urun != null && urun.adet >= (int)this.numericUpDownAdet.Value) { dialogResult = MessageBox.Show("Emin misiniz?", "Dikkat!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (dialogResult == DialogResult.OK) { defo = new Defo(); defo.personel = temelVeri.Id; defo.urun = urun.id; defo.adet = (int)this.numericUpDownAdet.Value; defo.aciklama = this.textBoxAcıklama.Text; if (sorguDefo.Ekle(defo)) { Urun yeni = sorguUrun.kopyaOlustur(urun); yeni.adet -= defo.adet; sorguUrun.Guncelle(urun, yeni); MessageBox.Show("Başarı ile tamalandı"); } else { MessageBox.Show( "Kayıt esnasında bir sorun oluştu", "dikkat", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (dialogResult == DialogResult.Cancel) { this.textBoxBarkod.Text = ""; this.numericUpDownAdet.Value = 1; this.textBoxAcıklama.Text = ""; this.textBoxBarkodKntrl = false; } } }