126 lines
4.5 KiB
C#
126 lines
4.5 KiB
C#
using DatenDB;
|
|
using Deckungsbeitrag.AA_Forms;
|
|
using Microsoft.Win32;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
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;
|
|
|
|
string readmePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Verwaltung_ReadMe.txt");
|
|
|
|
// Prüfe, ob ReadMe schon einmal geöffnet wurde
|
|
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\KilianWirlGmbH\Verwaltung"))
|
|
{
|
|
if (key == null || key.GetValue("ReadMeShown") == null)
|
|
{
|
|
// Erstes Mal nach Installation
|
|
if (File.Exists(readmePath))
|
|
{
|
|
Process.Start(new ProcessStartInfo
|
|
{
|
|
FileName = readmePath,
|
|
UseShellExecute = true
|
|
});
|
|
|
|
// WICHTIG: Warte 2 Sekunden (ReadMe öffnen)
|
|
System.Threading.Thread.Sleep(2000);
|
|
|
|
// Abbruch-Dialog
|
|
DialogResult result = MessageBox.Show(
|
|
"ReadMe wurde geöffnet.\n\n" +
|
|
"Falls INSTALL-REMINDER noch Änderungen enthält,\n" +
|
|
"soll die Anwendung jetzt ABGEBROCHEN werden?\n\n" +
|
|
"[JA = Abbruch | NEIN = Fortfahren]",
|
|
"Nach Installation - Update prüfen",
|
|
MessageBoxButtons.YesNo,
|
|
MessageBoxIcon.Question,
|
|
MessageBoxDefaultButton.Button1 // Standard: Abbruch
|
|
);
|
|
|
|
if (result == DialogResult.Yes)
|
|
{
|
|
MessageBox.Show("Installation wurde abgebrochen.\nBitte Änderungen vornehmen und neu installieren.",
|
|
"Abbruch", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return; // App beenden
|
|
}
|
|
|
|
// Markiere als gezeigt
|
|
Registry.CurrentUser.CreateSubKey(@"Software\KilianWirlGmbH\Verwaltung")
|
|
.SetValue("ReadMeShown", 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if (userid.StartsWith("ms") | userid.StartsWith("ps"))
|
|
{
|
|
if (userid.Contains("wstrasse")) Application.Run(new FormWSVerfolgung(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;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
} |