using DatenDB; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Deckungsbeitrag.UserControls { public partial class UCArtikel : UserControl { public event EventHandler DeleteClicked; public string ArtikelName { get => labelArtikel.Text; set => labelArtikel.Text = value; } public int Anzahl; public UCArtikel() { InitializeComponent(); } public UCArtikel(Artikel artikel, int anzahl) : this() { this.labelArtikel.Text = $"{artikel.Nummer.ToString()}\n{artikel.Bezeichnung}"; this.Anzahl = anzahl; this.Tag = artikel; } public UCArtikel(KundeArtikel artikel, int anzahl) : this() { this.labelArtikel.Text = $"{artikel.ArtikelNR.ToString()}\n{artikel.ArtikelName}"; this.Anzahl = anzahl; this.Tag = artikel; } //public UCArtikel(string s) : this() //{ // this.labelArtikel.Text = s; //} private void pictureBoxMinus_Click(object sender, EventArgs e) { if (this.DeleteClicked != null) { if (MessageBox.Show("Möchtest du den Artikel wirklich löschen?", "Frage", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.DeleteClicked(this, EventArgs.Empty); } } } private void UCArtikel_Load(object sender, EventArgs e) { this.labelArtikel.ForeColor = Color.Black; } } }