Programm_Wirl/Program.cs

78 lines
2.8 KiB
C#

using DatenDB;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Management;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Deckungsbeitrag
{
static class Program
{
/// <summary>
/// Der Haupteinstiegspunkt für die Anwendung.
/// </summary>
[STAThread]
static void Main()
{
string userid = ConfigurationManager.AppSettings["ConnectionString"].Split(';')[0];
userid = userid.Split('=')[1];
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Screen[] screens = Screen.AllScreens;
//TODO: Wenn mit Anmeldung dann if-Clause entfernen und Switch alleine verwenden.
if (userid.StartsWith("ms") | userid.StartsWith("ps"))
{
if (userid.Contains("wstrasse")) Application.Run(new FormAusschlager(userid));
else Application.Run(new FormFehlmengeCount(userid));
}
else
{
FormLogin loginForm = new FormLogin();
if (loginForm.ShowDialog() == DialogResult.OK)
{
// Switch on BenutzerRolle für Weiterleitung zum richtigen Screen
switch (loginForm.Person.Rolle)
{
case BenutzerRolle.Verwaltung: //Büropersonal ohne aktive Hallenbeschäftigung
Application.Run(new FormMain(loginForm.Person));
break;
case BenutzerRolle.Fahrer: //Zustellfahrer
Application.Run(new FormMain(loginForm.Person));
break;
case BenutzerRolle.Admin: //Höheres Büropersonal oder Claudia und Kevin
Application.Run(new FormMain(loginForm.Person));
break;
case BenutzerRolle.Waschstrasse: //Bediener einer Waschstraße
Application.Run(new FormNeuerAuftrag(loginForm.Person));
break;
case BenutzerRolle.Master: //Entwickler oder Claudia und Kevin
Application.Run(new FormMain(loginForm.Person));
break;
case BenutzerRolle.Expedit: //Endkontrolle Lieferungen und Lieferscheine (Mirka)
Application.Run(new FormExpedit(loginForm.Person, screens));
break;
case BenutzerRolle.Frottee: //Containerbestückung Frotteewäsche
//BenutzerRolle Frottee = Expedit Frottee da die Maschine keine Anmeldung erfordert.
Application.Run(new FormExpedit(loginForm.Person, screens));
break;
case BenutzerRolle.Flach: //Containerbestückung Flachwäsche
//BenutzerRolle Flach = Expedit Frottee da die Maschine keine Anmeldung erfordert.
Application.Run(new FormExpedit(loginForm.Person, screens));
break;
default:
break;
}
}
}
}
}
}