private void PorsiyonClick(object sender, EventArgs e) { ControlPorsiyonButton button = (ControlPorsiyonButton)sender; urunHareketEntity.PorsiyonId = button.Id; urunHareketEntity.BirimFiyat = button.Fiyat; txtPorsiyonTutar.Value = button.Fiyat; if (!button.EkMalzemeler.Any()) { UrunHareketEkle(); navigationKategori.SelectedPage = pageKategoriUrunler; return; } EkMalzemeButtonOlustur(button.EkMalzemeCarpan, button.EkMalzemeler); txtToplamTutar.Value = txtPorsiyonTutar.Value + txtEkMalzemeTutar.Value; }
private void UrunClick(object sender, EventArgs e) { ControlKategoriUrun button = (ControlKategoriUrun)sender; if (!button.Porsiyonlar.Any()) { MessageBox.Show("Bu Ürüne Atanmış Bir Porsiyon Bulunamadı"); return; } btnKategoriyeDon.Visible = true; flowPorsiyon.Controls.Clear(); urunHareketEntity = new UrunHareket(); urunHareketEntity.AdisyonId = secilenAdisyon.Id; urunHareketEntity.Id = Guid.NewGuid(); urunHareketEntity.UrunId = button.Id; urunHareketEntity.Miktar = txtMiktar.Value; urunHareketEntity.UrunHareketTip = UrunHareketTip.Satis; navigationKategori.SelectedPage = pageUrunPorsiyon; foreach (var porsiyon in button.Porsiyonlar) { ControlPorsiyonButton porsiyonButton = new ControlPorsiyonButton { Name = porsiyon.Id.ToString(), Text = porsiyon.Adi + "\n" + porsiyon.Fiyat.ToString("C2"), Fiyat = porsiyon.Fiyat, EkMalzemeCarpan = porsiyon.EkMalzemeCarpan, Id = porsiyon.Id, Height = 200, Width = 200, Font = new Font("Tahoma", 12, FontStyle.Bold), EkMalzemeler = button.EkMalzemeler }; porsiyonButton.Click += PorsiyonClick; flowPorsiyon.Controls.Add(porsiyonButton); } if (button.Porsiyonlar.Count() == 1) { ControlPorsiyonButton buttonPorsiyon = (ControlPorsiyonButton)flowPorsiyon.Controls[0]; buttonPorsiyon.PerformClick(); } }