private void YeniKategoriEkle() { if (LookUpKategori.EditValue == null) { MessageBox.Show("Kategori seçimi yapınız!", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else if (txtBarkod.Text == null || txtUrunAdi.Text == null) { MessageBox.Show("Ürün eklemek için bilgilerini giriniz!", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { UrunRepo dbUrun = new UrunRepo(); Urun yeniUrun = new Urun() { Barkod = txtBarkod.Text, UrunAdi = txtUrunAdi.Text, KategoriID = Convert.ToInt32(LookUpKategori.EditValue), AlisFiyati = spinEditAlisFiyati.Value, SatisFiyati = spinEditSatisFiyati.Value }; dbUrun.Insert(yeniUrun); MessageBox.Show("Yeni Ürün Eklendir"); KategoriyeGoreUrunleriGrideGetir(Convert.ToInt32(LookUpKategori.EditValue)); } }
private void simpleButton1_Click_1(object sender, EventArgs e) { try { UrunRepo urun = new UrunRepo(); urun.Insert(new Urun() { Barkod = txtBarkod.Text, IndirimOrani = int.Parse(txtIndirimOrani.Text), SatistaMi = chcSatistaMi.Checked, Stok = int.Parse(txtStokMiktari.Text), UrunAdi = txtUrunAdi.Text, KategoriID = secilikategori?.KategoriID, UrunSatisFiyati = Convert.ToDecimal(txtSatisFiyati.Text), UrunResmi = StokTakipMethods.imageToByteArray(pictureUrunResmi.Image) }); MessageBox.Show("Ürün kaydedilmiştir.", "İşlem başarılı!", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }