Programm_Wirl/AA-Forms/FormShowGroupBox.cs

90 lines
2.1 KiB
C#

using DatenDB;
using Deckungsbeitrag.UserControls;
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.AA_Forms
{
public partial class FormShowGroupBox : Form
{
private Benutzer benutzer;
private UserControl uc;
public List<Auftrag> auftragliste;
private string gb;
private bool toclose = false;
public bool _toclose
{
get { return toclose; }
set
{
if (toclose != value)
{
toclose = value;
if (toclose == true)
{
this.Close();
}
}
}
}
public FormShowGroupBox()
{
InitializeComponent();
}
public FormShowGroupBox(string groupBox, Benutzer user) : this()
{
this.gb = groupBox;
this.benutzer = user;
this.Text = gb;
}
public FormShowGroupBox(string groupBox, Benutzer user, List<Auftrag> auftragListe) : this(groupBox, user)
{
this.auftragliste = auftragListe;
}
private void FormShowGroupBox_Load(object sender, EventArgs e)
{
switch (this.gb)
{
case var t when t == "Auftrag Suchen":
{
uc = new UCAuftragSuchen(this.benutzer, this);
this.Controls.Add(uc);
}
break;
case var t when t == "Statistik":
{
uc = new UCStatistik();
this.Controls.Add(uc);
}
break;
case var t when t == "Auftragliste":
uc = new UCAuftragListe(this.benutzer, this.auftragliste);
this.Controls.Add(uc);
break;
default:
break;
}
}
private void FormShowGroupBox_Shown(object sender, EventArgs e)
{
this.ClientSize = new Size(uc.Width, uc.Height);
//ucs.Location = new Point(5, 10);
}
private void FormShowGroupBox_FormClosing(object sender, FormClosingEventArgs e)
{
if (this.benutzer.Rolle == BenutzerRolle.Expedit) this.DialogResult = DialogResult.OK;
}
}
}