Login verbessert
This commit is contained in:
parent
8954fb1197
commit
508d2cb06c
6
Artikelverwaltung/Artikelverwaltung.Designer.cs
generated
6
Artikelverwaltung/Artikelverwaltung.Designer.cs
generated
|
@ -152,11 +152,11 @@
|
|||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label4.Location = new System.Drawing.Point(620, 859);
|
||||
this.label4.Location = new System.Drawing.Point(648, 859);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(101, 20);
|
||||
this.label4.Size = new System.Drawing.Size(73, 20);
|
||||
this.label4.TabIndex = 11;
|
||||
this.label4.Text = "Insgesammt:";
|
||||
this.label4.Text = "Bestand:";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
|
|
|
@ -48,8 +48,6 @@ namespace Artikelverwaltung
|
|||
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
public void BenutzerAnlegen(MitarbeiterAccount acc)
|
||||
{
|
||||
|
@ -65,7 +63,6 @@ namespace Artikelverwaltung
|
|||
{
|
||||
MessageBox.Show("SQL Error");
|
||||
}
|
||||
|
||||
}
|
||||
public void ArtikelAnlegen(Artikel artikel)
|
||||
{
|
||||
|
@ -98,7 +95,6 @@ namespace Artikelverwaltung
|
|||
{
|
||||
MessageBox.Show("SQL Error");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void ArtikelAendern(Artikel artikel, int id)
|
||||
|
@ -141,7 +137,6 @@ namespace Artikelverwaltung
|
|||
MessageBox.Show("SQL Error");
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
// Gibt anzahl an Artikel zurück
|
||||
public int ArtikelZählen()
|
||||
|
@ -194,7 +189,6 @@ namespace Artikelverwaltung
|
|||
connection.Close();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,6 +98,7 @@ namespace Artikelverwaltung
|
|||
private bool verfügbarerPlatz(int menge)
|
||||
{
|
||||
return (Lagerbestand + menge) <= Kapazitaet;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
44
Artikelverwaltung/Login.Designer.cs
generated
44
Artikelverwaltung/Login.Designer.cs
generated
|
@ -35,6 +35,8 @@
|
|||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.verwaltungsButton = new System.Windows.Forms.Button();
|
||||
this.beenden_Button = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
|
@ -76,9 +78,9 @@
|
|||
// button1
|
||||
//
|
||||
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button1.Location = new System.Drawing.Point(27, 268);
|
||||
this.button1.Location = new System.Drawing.Point(12, 268);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(95, 35);
|
||||
this.button1.Size = new System.Drawing.Size(116, 35);
|
||||
this.button1.TabIndex = 4;
|
||||
this.button1.Text = "Login";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
|
@ -98,14 +100,38 @@
|
|||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Enabled = false;
|
||||
this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button2.Location = new System.Drawing.Point(161, 268);
|
||||
this.button2.Location = new System.Drawing.Point(158, 268);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(95, 35);
|
||||
this.button2.Size = new System.Drawing.Size(116, 35);
|
||||
this.button2.TabIndex = 6;
|
||||
this.button2.Text = "Anlegen";
|
||||
this.button2.Text = "Add User";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
this.button2.Click += new System.EventHandler(this.RegistrierungsButton);
|
||||
//
|
||||
// verwaltungsButton
|
||||
//
|
||||
this.verwaltungsButton.Enabled = false;
|
||||
this.verwaltungsButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.verwaltungsButton.Location = new System.Drawing.Point(12, 309);
|
||||
this.verwaltungsButton.Name = "verwaltungsButton";
|
||||
this.verwaltungsButton.Size = new System.Drawing.Size(116, 35);
|
||||
this.verwaltungsButton.TabIndex = 7;
|
||||
this.verwaltungsButton.Text = "Verwaltung";
|
||||
this.verwaltungsButton.UseVisualStyleBackColor = true;
|
||||
this.verwaltungsButton.Click += new System.EventHandler(this.verwaltungsButton_Click);
|
||||
//
|
||||
// beenden_Button
|
||||
//
|
||||
this.beenden_Button.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.beenden_Button.Location = new System.Drawing.Point(158, 309);
|
||||
this.beenden_Button.Name = "beenden_Button";
|
||||
this.beenden_Button.Size = new System.Drawing.Size(116, 35);
|
||||
this.beenden_Button.TabIndex = 8;
|
||||
this.beenden_Button.Text = "Beenden";
|
||||
this.beenden_Button.UseVisualStyleBackColor = true;
|
||||
this.beenden_Button.Click += new System.EventHandler(this.beenden_Button_Click);
|
||||
//
|
||||
// Login
|
||||
//
|
||||
|
@ -113,7 +139,9 @@
|
|||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
|
||||
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||
this.ClientSize = new System.Drawing.Size(284, 331);
|
||||
this.ClientSize = new System.Drawing.Size(286, 354);
|
||||
this.Controls.Add(this.beenden_Button);
|
||||
this.Controls.Add(this.verwaltungsButton);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.checkBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
|
@ -140,6 +168,8 @@
|
|||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button verwaltungsButton;
|
||||
private System.Windows.Forms.Button beenden_Button;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,25 +20,22 @@ namespace Artikelverwaltung
|
|||
InitializeComponent();
|
||||
zugriffsverwaltung = new Zugriffsverwaltung();
|
||||
textBoxPasswort.PasswordChar = '*';
|
||||
|
||||
}
|
||||
|
||||
private void login(object sender, EventArgs e)
|
||||
{
|
||||
if (zugriffsverwaltung.loginArtikelverwaltung(textBoxBenutzername.Text, textBoxPasswort.Text))
|
||||
{
|
||||
MessageBox.Show("Login erfolgreich!");
|
||||
this.Close();
|
||||
th = new Thread(AritelverwaltunForm);
|
||||
th.SetApartmentState(ApartmentState.STA);
|
||||
th.Start();
|
||||
verwaltungsButton.Enabled = true;
|
||||
button2.Enabled = true;
|
||||
textBoxBenutzername.Text = "";
|
||||
textBoxPasswort.Text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Login Fehlgeschlagen!");
|
||||
}
|
||||
}
|
||||
|
||||
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(checkBox1.CheckState != CheckState.Checked)
|
||||
|
@ -50,22 +47,28 @@ namespace Artikelverwaltung
|
|||
textBoxPasswort.PasswordChar = '\0';
|
||||
}
|
||||
}
|
||||
private void RegistrierungsButton(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
Register register = new Register(this);
|
||||
register.Show();
|
||||
}
|
||||
private void AritelverwaltunForm(object obj)
|
||||
{
|
||||
Application.Run(new Artikelverwaltung());
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
private void beenden_Button_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void verwaltungsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
th = new Thread(RegisterForm);
|
||||
th = new Thread(AritelverwaltunForm);
|
||||
th.SetApartmentState(ApartmentState.STA);
|
||||
th.Start();
|
||||
}
|
||||
private void RegisterForm(object obj)
|
||||
{
|
||||
Application.Run(new Register());
|
||||
}
|
||||
|
||||
private void AritelverwaltunForm(object obj)
|
||||
{
|
||||
Application.Run(new Artikelverwaltung()); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
4
Artikelverwaltung/Register.Designer.cs
generated
4
Artikelverwaltung/Register.Designer.cs
generated
|
@ -92,7 +92,7 @@
|
|||
this.button1.TabIndex = 5;
|
||||
this.button1.Text = "Anlegen";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
this.button1.Click += new System.EventHandler(this.AnlegenButton);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
|
@ -103,7 +103,7 @@
|
|||
this.button2.TabIndex = 6;
|
||||
this.button2.Text = "Zurück";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
this.button2.Click += new System.EventHandler(this.ZurückButton);
|
||||
//
|
||||
// Register
|
||||
//
|
||||
|
|
|
@ -14,35 +14,30 @@ namespace Artikelverwaltung
|
|||
public partial class Register : Form
|
||||
{
|
||||
Zugriffsverwaltung zugriffsverwaltung;
|
||||
Thread th;
|
||||
public Register()
|
||||
Form form; // Login Form
|
||||
public Register(Form form)
|
||||
{
|
||||
InitializeComponent();
|
||||
zugriffsverwaltung = new Zugriffsverwaltung();
|
||||
this.form = form;
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
private void AnlegenButton(object sender, EventArgs e)
|
||||
{
|
||||
if (zugriffsverwaltung.benutzerAnlegen(textBoxRegisterBenutzername.Text, textBoxRegisterPasswort.Text))
|
||||
{
|
||||
MessageBox.Show("Benutzer Angelegt");
|
||||
MessageBox.Show($"Benutzer {textBoxRegisterBenutzername.Text} Angelegt ");
|
||||
textBoxRegisterBenutzername.Text = "";
|
||||
textBoxRegisterPasswort.Text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Fehler beim Anlegen!");
|
||||
}
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
private void ZurückButton(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
th = new Thread(openNewForm);
|
||||
th.SetApartmentState(ApartmentState.STA);
|
||||
th.Start();
|
||||
}
|
||||
private void openNewForm(object obj)
|
||||
{
|
||||
Application.Run(new Login());
|
||||
form.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,8 +31,7 @@ namespace Artikelverwaltung
|
|||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user