using DatenDB; using Deckungsbeitrag.AA_Klassen; using Npgsql; using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Data; using System.Drawing; using System.Linq; using System.Net.NetworkInformation; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using static System.Windows.Forms.AxHost; using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace Deckungsbeitrag.UserControls { public partial class UCAuftragInfo : UserControl { private readonly Auftrag auftrag; private List Infos; private int x = 20; private int y = 20; List infoListe = new List(); public UCAuftragInfo() { InitializeComponent(); } public UCAuftragInfo(Auftrag _auftrag) : this() { this.auftrag = _auftrag; } private void UCAuftragInfo_Load(object sender, EventArgs e) { this.BackColor = Program.Wirlblau; GetInfoListe(); foreach(string s in this.infoListe) { Label lbl = GetLabel(); lbl.Text = s; this.Controls.Add(lbl); lbl.Location = new Point(x, y); y += lbl.Height; } } private void GetInfoListe() { string info = string.Empty; Benutzer benutzer; if (auftrag.Erstellt != null) { benutzer = Benutzer.GetBenutzer(null, auftrag.ErstelltVon); info = $"Erstellt von {benutzer.Vorname} {benutzer.Nachname} am/um {this.auftrag.Erstellt}"; infoListe.Add(info); } if (auftrag.Gedruckt != null) { benutzer = Benutzer.GetBenutzer(null, auftrag.GedrucktVon); info = $"Gedruckt von {benutzer.Vorname} {benutzer.Nachname} am/um {this.auftrag.Gedruckt}"; infoListe.Add(info); } if (auftrag.Erledigt != null) { benutzer = Benutzer.GetBenutzer(null, auftrag.ErledigtVon); info = $"Aufgabe Erledigt von {benutzer.Vorname} {benutzer.Nachname} am/um {this.auftrag.Erledigt}"; infoListe.Add(info); } int i = 1; Infos = AuftragInfo.LadeInfos(this.auftrag); foreach (AuftragInfo aufinfo in Infos) { if (aufinfo.Bezeichnung == "abteilungen_status") info = $"{aufinfo.Client} hat am {aufinfo.Datum} {aufinfo.AbtStatus}"; else info = $"{aufinfo.Client} hat am {aufinfo.Datum} {aufinfo.Bezeichnung.ToUpper()} von {aufinfo.AlterWert} zu {aufinfo.NeuerWert}"; infoListe.Add(info); i++; } } private Label GetLabel() { Label lbl = new Label { Font = new Font("Microsoft Sans Serif", 12, FontStyle.Regular), ForeColor = Color.Black, AutoSize = true, BackColor = Color.Transparent }; return lbl; } private void Paint_Boarder(Size size, PaintEventArgs e) { e.Graphics.Clear(SystemColors.ControlDark); Pen pen = new Pen(Color.Red, 6); Rectangle rect = new Rectangle(1, 2, size.Width - 5, size.Height - 6); e.Graphics.DrawRectangle(pen, rect); } private void UCAuftragInfo_Paint(object sender, PaintEventArgs e) { Paint_Boarder(this.Size, e); } } }