109 lines
2.7 KiB
C#
109 lines
2.7 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 FormShowUserControl : Form
|
|
{
|
|
private Benutzer benutzer;
|
|
private UCAuftragSuchen ucas;
|
|
private UCStatistik ucs;
|
|
private UCAuftragListe ucal;
|
|
private UserControl uc;
|
|
public List<Auftrag> auftragliste;
|
|
private string gb;
|
|
private bool toclose = false;
|
|
public (DateTime datum, string text, string[] touren) lieferDaten;
|
|
|
|
public bool _toclose
|
|
{
|
|
get { return toclose; }
|
|
set
|
|
{
|
|
if (toclose != value)
|
|
{
|
|
toclose = value;
|
|
if (toclose == true)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public FormShowUserControl()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
public FormShowUserControl(string groupBox, Benutzer user) : this()
|
|
{
|
|
this.gb = groupBox;
|
|
this.benutzer = user;
|
|
this.Text = gb;
|
|
}
|
|
public FormShowUserControl(string groupBox, Benutzer user, List<Auftrag> auftragListe) : this(groupBox, user)
|
|
{
|
|
this.auftragliste = auftragListe;
|
|
}
|
|
|
|
private void FormShowUserControl_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;
|
|
case var t when t == "Tourenplan":
|
|
{
|
|
uc = new UCTourenplan(this.benutzer);
|
|
this.Controls.Add(uc);
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
private void FormShowUserControl_Shown(object sender, EventArgs e)
|
|
{
|
|
this.ClientSize = new Size(uc.Width, uc.Height);
|
|
//ucs.Location = new Point(5, 10);
|
|
}
|
|
|
|
private void FormShowUserControl_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
var form = sender as Form;
|
|
if (this.benutzer.Rolle == BenutzerRolle.Expedit) this.DialogResult = DialogResult.OK;
|
|
else
|
|
{
|
|
UCTourenplan uc = (UCTourenplan)form.Controls[0];
|
|
lieferDaten = uc.lieferDaten;
|
|
this.DialogResult = DialogResult.OK;
|
|
}
|
|
}
|
|
}
|
|
}
|