117 lines
3.0 KiB
C#
117 lines
3.0 KiB
C#
using DatenDB;
|
|
using Deckungsbeitrag.AA_Klassen;
|
|
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;
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
|
|
namespace Deckungsbeitrag.UserControls
|
|
{
|
|
public partial class UCAuftragInfo : UserControl
|
|
{
|
|
private readonly Auftrag auftrag;
|
|
private List<AuftragInfo> Statis;
|
|
private int x = 20;
|
|
private int y = 20;
|
|
List<string> infoListe = new List<string>();
|
|
|
|
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;
|
|
|
|
Statis = AuftragInfo.LadeInfos(this.auftrag);
|
|
foreach (AuftragInfo aufinfo in Statis)
|
|
{
|
|
benutzer = Benutzer.GetBenutzer(null, aufinfo.BenutzerID);
|
|
|
|
info = $"{i}.Statusänderung von {benutzer.Vorname} {benutzer.Nachname} am/um {aufinfo.Datum} zu {aufinfo.Status}";
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|