protected void gvSatis_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Duzenle") { guid = Convert.ToInt32(e.CommandArgument); lblId.Text = guid.ToString(); Satis.Text = "Guncelle"; //? if (guid != 0) { bagla(guid, sender, e); } ModalSatis.Show(); } else if (e.CommandName == "Sil") { try { long YemeklerId = Convert.ToInt64(e.CommandArgument); Satis Satis = SatisBLL.SelectWithId(YemeklerId); if (Satis != null) { Satis.SatisAktif = false; SatisBLL.Update(YemeklerId, Satis); } GridDoldur(); } catch (Exception ex) { } } }
private void btnKaydet_Click(object sender, EventArgs e) { if (txtSatisMiktar.Text.Trim() == "") { MessageBox.Show("Satış miktarı giriniz"); } else { if (isUpdate) { if (detaydto.SatisMiktar == Convert.ToInt32(txtSatisMiktar.Text)) { MessageBox.Show("değişilik yok"); } else { int temp = detaydto.SatisMiktar + Convert.ToInt32(txtStok.Text); if (temp < Convert.ToInt32(txtSatisMiktar.Text)) { MessageBox.Show("Elinizde yeterli stok yok"); } else { detaydto.SatisMiktar = Convert.ToInt32(txtSatisMiktar.Text); detaydto.StokMiktar = Convert.ToInt32(txtStok.Text); if (bll.Update(detaydto)) { MessageBox.Show("Güncellendi"); this.Close(); } } } } else { if (detay.UrunID == 0) { MessageBox.Show("Ürün seçiniz"); } else if (detay.MusteriID == 0) { MessageBox.Show("Müşteri seçiniz"); } else if (detay.StokMiktar < Convert.ToInt32(txtSatisMiktar.Text)) { MessageBox.Show("Elinizde yeterli stok yok"); } else { detay.SatisMiktar = Convert.ToInt32(txtSatisMiktar.Text); if (bll.Insert(detay)) { MessageBox.Show("Eklendi"); txtSatisMiktar.Clear(); dto = bll.Select(); gridUrunler.DataSource = dto.Urunler; } } } } }