diff --git a/Artikelverwaltung.sln b/Artikelverwaltung.sln new file mode 100644 index 0000000..8b17d34 --- /dev/null +++ b/Artikelverwaltung.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32929.385 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artikelverwaltung", "Artikelverwaltung\Artikelverwaltung.csproj", "{71F05FAF-8B88-4A3A-AD94-1B9F203AB0EF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {71F05FAF-8B88-4A3A-AD94-1B9F203AB0EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {71F05FAF-8B88-4A3A-AD94-1B9F203AB0EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {71F05FAF-8B88-4A3A-AD94-1B9F203AB0EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {71F05FAF-8B88-4A3A-AD94-1B9F203AB0EF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8F772B57-43C2-4C5B-8E8F-1112F4C254F5} + EndGlobalSection +EndGlobal diff --git a/Artikelverwaltung/App.config b/Artikelverwaltung/App.config new file mode 100644 index 0000000..775e457 --- /dev/null +++ b/Artikelverwaltung/App.config @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Artikelverwaltung/Artikel.cs b/Artikelverwaltung/Artikel.cs new file mode 100644 index 0000000..fd8c575 --- /dev/null +++ b/Artikelverwaltung/Artikel.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Artikelverwaltung +{ + internal class Artikel + { + //Attribute + readonly private uint _Artikelnummer; + private string _Artikelbeschreibung; + private string _Modellname; + private string _Artikelgruppe; + private bool _AktivFlag; + + // Konstruktoren + public Artikel(string artikelbeschreibung, string modellname, string artikelgruppe, bool aktivFlag) + { + Artikelbeschreibung = artikelbeschreibung; + Modellname = modellname; + Artikelgruppe = artikelgruppe; + AktivFlag = aktivFlag; + } + public Artikel(uint artikelnummer,string artikelbeschreibung, string modellname, string artikelgruppe, bool aktivFlag) + { + _Artikelnummer = artikelnummer; + Artikelbeschreibung = artikelbeschreibung; + Modellname = modellname; + Artikelgruppe = artikelgruppe; + AktivFlag = aktivFlag; + } + public Artikel(uint artikelnummer) + { + _Artikelnummer = artikelnummer; + } + public Artikel() + { + + } + + // Getter - Setter + public uint Artikelnummer { get => _Artikelnummer;} + public string Artikelbeschreibung { get => _Artikelbeschreibung; set => _Artikelbeschreibung = value; } + public string Modellname { get => _Modellname; set => _Modellname = value; } + public string Artikelgruppe { get => _Artikelgruppe; set => _Artikelgruppe = value; } + public bool AktivFlag { get => _AktivFlag; set => _AktivFlag = value; } + + // Operationen + public void ArtikelSichtbarkeitAendern(bool flag) + { + AktivFlag = flag; + } + + public string ArtikelInfo() + { + return $"ArtNr: {Artikelnummer} - Art.Beschreibung: {Artikelbeschreibung} - Modellname: {Modellname} - Gruppe: {Artikelgruppe} - Aktiv: {AktivFlag}"; + } + + } +} diff --git a/Artikelverwaltung/Artikel_Aendern.Designer.cs b/Artikelverwaltung/Artikel_Aendern.Designer.cs new file mode 100644 index 0000000..1b4abc2 --- /dev/null +++ b/Artikelverwaltung/Artikel_Aendern.Designer.cs @@ -0,0 +1,176 @@ +namespace Artikelverwaltung +{ + partial class Artikel_Aendern + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.checkBoxFlag = new System.Windows.Forms.CheckBox(); + this.aendernTextBoxArtikelGruppe = new System.Windows.Forms.TextBox(); + this.aendernTextBoxModellname = new System.Windows.Forms.TextBox(); + this.aendernTextBoxArtikelbeschreibung = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.button1.Location = new System.Drawing.Point(321, 293); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(145, 48); + this.button1.TabIndex = 19; + this.button1.Text = "Ändern"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // checkBoxFlag + // + this.checkBoxFlag.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBoxFlag.Location = new System.Drawing.Point(235, 230); + this.checkBoxFlag.Name = "checkBoxFlag"; + this.checkBoxFlag.Size = new System.Drawing.Size(82, 37); + this.checkBoxFlag.TabIndex = 18; + this.checkBoxFlag.Text = "Aktiv"; + this.checkBoxFlag.UseVisualStyleBackColor = true; + // + // aendernTextBoxArtikelGruppe + // + this.aendernTextBoxArtikelGruppe.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.aendernTextBoxArtikelGruppe.Location = new System.Drawing.Point(235, 175); + this.aendernTextBoxArtikelGruppe.Name = "aendernTextBoxArtikelGruppe"; + this.aendernTextBoxArtikelGruppe.Size = new System.Drawing.Size(231, 31); + this.aendernTextBoxArtikelGruppe.TabIndex = 17; + // + // aendernTextBoxModellname + // + this.aendernTextBoxModellname.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.aendernTextBoxModellname.Location = new System.Drawing.Point(235, 122); + this.aendernTextBoxModellname.Name = "aendernTextBoxModellname"; + this.aendernTextBoxModellname.Size = new System.Drawing.Size(231, 31); + this.aendernTextBoxModellname.TabIndex = 16; + // + // aendernTextBoxArtikelbeschreibung + // + this.aendernTextBoxArtikelbeschreibung.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.aendernTextBoxArtikelbeschreibung.Location = new System.Drawing.Point(235, 70); + this.aendernTextBoxArtikelbeschreibung.Name = "aendernTextBoxArtikelbeschreibung"; + this.aendernTextBoxArtikelbeschreibung.Size = new System.Drawing.Size(231, 31); + this.aendernTextBoxArtikelbeschreibung.TabIndex = 15; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.Location = new System.Drawing.Point(12, 235); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(125, 25); + this.label5.TabIndex = 14; + this.label5.Text = "Aktive Flag:"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label4.Location = new System.Drawing.Point(12, 181); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(145, 25); + this.label4.TabIndex = 13; + this.label4.Text = "Artikelgruppe:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.Location = new System.Drawing.Point(12, 128); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(135, 25); + this.label3.TabIndex = 12; + this.label3.Text = "Modellname:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(12, 76); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(208, 25); + this.label2.TabIndex = 11; + this.label2.Text = "Artikelbeschreibung:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(12, 20); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(145, 25); + this.label1.TabIndex = 10; + this.label1.Text = "Artikel ändern"; + // + // Artikel_Aendern + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; + this.ClientSize = new System.Drawing.Size(494, 360); + this.Controls.Add(this.button1); + this.Controls.Add(this.checkBoxFlag); + this.Controls.Add(this.aendernTextBoxArtikelGruppe); + this.Controls.Add(this.aendernTextBoxModellname); + this.Controls.Add(this.aendernTextBoxArtikelbeschreibung); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "Artikel_Aendern"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Artikel_Aendern"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.CheckBox checkBoxFlag; + private System.Windows.Forms.TextBox aendernTextBoxArtikelGruppe; + private System.Windows.Forms.TextBox aendernTextBoxModellname; + private System.Windows.Forms.TextBox aendernTextBoxArtikelbeschreibung; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + } +} \ No newline at end of file diff --git a/Artikelverwaltung/Artikel_Aendern.cs b/Artikelverwaltung/Artikel_Aendern.cs new file mode 100644 index 0000000..afe41c2 --- /dev/null +++ b/Artikelverwaltung/Artikel_Aendern.cs @@ -0,0 +1,56 @@ +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; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; + +namespace Artikelverwaltung +{ + + public partial class Artikel_Aendern : Form + { + Artikel_Verwaltung artikel_Verwaltung; + public System.Windows.Forms.ListView _listView; + public Artikel_Aendern(System.Windows.Forms.ListView listView) + { + _listView = listView; + Artikelverwaltung form = (Artikelverwaltung)Application.OpenForms["Artikelverwaltung"]; + InitializeComponent(); + artikel_Verwaltung = new Artikel_Verwaltung(); + try + { + aendernTextBoxArtikelbeschreibung.Text = _listView.SelectedItems[0].SubItems[1].Text; + aendernTextBoxModellname.Text = _listView.SelectedItems[0].SubItems[2].Text; + aendernTextBoxArtikelGruppe.Text = _listView.SelectedItems[0].SubItems[3].Text; + + if (listView.SelectedItems[0].SubItems[4].Text.Equals("True")) + { + checkBoxFlag.Checked = true; + } + } + catch + { + MessageBox.Show("Bitte einen Artikel wählen!"); + } + + } + + private void button1_Click(object sender, EventArgs e) + { + int id = Convert.ToInt16(_listView.SelectedItems[0].Text); + bool aktiveFlag = false; + + if (checkBoxFlag.CheckState == CheckState.Checked) + { + aktiveFlag = true; + } + artikel_Verwaltung.ArtikelAktualisieren(id, aendernTextBoxArtikelbeschreibung.Text, aendernTextBoxModellname.Text, aendernTextBoxArtikelGruppe.Text, aktiveFlag); + this.Close(); + } + } +} diff --git a/Artikelverwaltung/Artikel_Aendern.resx b/Artikelverwaltung/Artikel_Aendern.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Artikelverwaltung/Artikel_Aendern.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Artikelverwaltung/Artikel_Anlegen.Designer.cs b/Artikelverwaltung/Artikel_Anlegen.Designer.cs new file mode 100644 index 0000000..d26283f --- /dev/null +++ b/Artikelverwaltung/Artikel_Anlegen.Designer.cs @@ -0,0 +1,176 @@ +namespace Artikelverwaltung +{ + partial class Artikel_Anlegen + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.anlegenTextBoxArtikelbeschreibung = new System.Windows.Forms.TextBox(); + this.AnlegenTextBoxModellname = new System.Windows.Forms.TextBox(); + this.AnlegenTextBoxArtikelGruppe = new System.Windows.Forms.TextBox(); + this.checkBoxFlag = new System.Windows.Forms.CheckBox(); + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(155, 25); + this.label1.TabIndex = 0; + this.label1.Text = "Artikel anlegen"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(13, 69); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(208, 25); + this.label2.TabIndex = 1; + this.label2.Text = "Artikelbeschreibung:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.Location = new System.Drawing.Point(13, 121); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(135, 25); + this.label3.TabIndex = 2; + this.label3.Text = "Modellname:"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label4.Location = new System.Drawing.Point(13, 174); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(145, 25); + this.label4.TabIndex = 3; + this.label4.Text = "Artikelgruppe:"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.Location = new System.Drawing.Point(13, 228); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(125, 25); + this.label5.TabIndex = 4; + this.label5.Text = "Aktive Flag:"; + // + // anlegenTextBoxArtikelbeschreibung + // + this.anlegenTextBoxArtikelbeschreibung.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.anlegenTextBoxArtikelbeschreibung.Location = new System.Drawing.Point(236, 63); + this.anlegenTextBoxArtikelbeschreibung.Name = "anlegenTextBoxArtikelbeschreibung"; + this.anlegenTextBoxArtikelbeschreibung.Size = new System.Drawing.Size(231, 31); + this.anlegenTextBoxArtikelbeschreibung.TabIndex = 5; + // + // AnlegenTextBoxModellname + // + this.AnlegenTextBoxModellname.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.AnlegenTextBoxModellname.Location = new System.Drawing.Point(236, 115); + this.AnlegenTextBoxModellname.Name = "AnlegenTextBoxModellname"; + this.AnlegenTextBoxModellname.Size = new System.Drawing.Size(231, 31); + this.AnlegenTextBoxModellname.TabIndex = 6; + // + // AnlegenTextBoxArtikelGruppe + // + this.AnlegenTextBoxArtikelGruppe.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.AnlegenTextBoxArtikelGruppe.Location = new System.Drawing.Point(236, 168); + this.AnlegenTextBoxArtikelGruppe.Name = "AnlegenTextBoxArtikelGruppe"; + this.AnlegenTextBoxArtikelGruppe.Size = new System.Drawing.Size(231, 31); + this.AnlegenTextBoxArtikelGruppe.TabIndex = 7; + // + // checkBoxFlag + // + this.checkBoxFlag.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBoxFlag.Location = new System.Drawing.Point(236, 223); + this.checkBoxFlag.Name = "checkBoxFlag"; + this.checkBoxFlag.Size = new System.Drawing.Size(82, 37); + this.checkBoxFlag.TabIndex = 8; + this.checkBoxFlag.Text = "Aktiv"; + this.checkBoxFlag.UseVisualStyleBackColor = true; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.button1.Location = new System.Drawing.Point(322, 286); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(145, 48); + this.button1.TabIndex = 9; + this.button1.Text = "Anlegen"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Artikel_Anlegen + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; + this.ClientSize = new System.Drawing.Size(500, 346); + this.Controls.Add(this.button1); + this.Controls.Add(this.checkBoxFlag); + this.Controls.Add(this.AnlegenTextBoxArtikelGruppe); + this.Controls.Add(this.AnlegenTextBoxModellname); + this.Controls.Add(this.anlegenTextBoxArtikelbeschreibung); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "Artikel_Anlegen"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Artikel_Anlegen"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.TextBox anlegenTextBoxArtikelbeschreibung; + private System.Windows.Forms.TextBox AnlegenTextBoxModellname; + private System.Windows.Forms.TextBox AnlegenTextBoxArtikelGruppe; + private System.Windows.Forms.CheckBox checkBoxFlag; + private System.Windows.Forms.Button button1; + } +} \ No newline at end of file diff --git a/Artikelverwaltung/Artikel_Anlegen.cs b/Artikelverwaltung/Artikel_Anlegen.cs new file mode 100644 index 0000000..fa9f3a3 --- /dev/null +++ b/Artikelverwaltung/Artikel_Anlegen.cs @@ -0,0 +1,49 @@ +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 Artikelverwaltung +{ + + public partial class Artikel_Anlegen : Form + { + Artikel_Verwaltung artikelverwaltung; + public Artikel_Anlegen() + { + InitializeComponent(); + artikelverwaltung = new Artikel_Verwaltung(); + } + + private void button1_Click(object sender, EventArgs e) + { + string artikelBeschreibung = anlegenTextBoxArtikelbeschreibung.Text; + string modellName = AnlegenTextBoxModellname.Text; + string artikelGruppe = AnlegenTextBoxArtikelGruppe.Text; + bool aktiveFlag = false; + + if(checkBoxFlag.CheckState == CheckState.Checked) + { + aktiveFlag = true; + } + + try + { + artikelverwaltung.ArtikelAnlegen(artikelBeschreibung, modellName, artikelGruppe, aktiveFlag); + MessageBox.Show("Erfolgreich angelegt!"); + this.Close(); + } + catch(Exception ex) + { + + MessageBox.Show(ex.ToString()); ; + } + + } + } +} diff --git a/Artikelverwaltung/Artikel_Anlegen.resx b/Artikelverwaltung/Artikel_Anlegen.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Artikelverwaltung/Artikel_Anlegen.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Artikelverwaltung/Artikel_Verwaltung.cs b/Artikelverwaltung/Artikel_Verwaltung.cs new file mode 100644 index 0000000..92e4c2c --- /dev/null +++ b/Artikelverwaltung/Artikel_Verwaltung.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Artikelverwaltung +{ + internal class Artikel_Verwaltung + { + Database database; + public List Artikelliste = new List(); + + public Artikel_Verwaltung() + { + database = new Database(); + } + + // Objekt wird erzeugt und an die Datenbank weiter gereicht + public void ArtikelAnlegen(string Modellname, string Artikelbeschreibung, string Artikelgruppe, bool aktiv) + { + Artikel artikel = new Artikel(Modellname, Artikelbeschreibung, Artikelgruppe, aktiv); + database.ArtikelAnlegen(artikel); + } + + // Löschen über die Artikelnummer + public void ArtikelLoeschen(int ArtikelID) + { + database.ArtikelLoeschen(ArtikelID); + } + + + // Update eines Artikels in der Datenbank + public void ArtikelAktualisieren(int ArtikelId,string Artikelbeschreibung, string Modellname, string ArtikelGruppe, bool aktiv) + { + Artikel artikel = new Artikel(Artikelbeschreibung, Modellname, ArtikelGruppe, aktiv); + database.ArtikelAendern(artikel, ArtikelId); + } + + // Alle Artikel werden aus der Datenbank abgerufen und in die Liste hinzugefügt. + + public void AlleArtikelAbrufen() + { + Artikelliste = database.ArtikelAbrufen(); + } + +} +} diff --git a/Artikelverwaltung/Artikelverwaltung.Designer.cs b/Artikelverwaltung/Artikelverwaltung.Designer.cs new file mode 100644 index 0000000..1195b8e --- /dev/null +++ b/Artikelverwaltung/Artikelverwaltung.Designer.cs @@ -0,0 +1,170 @@ +namespace Artikelverwaltung +{ + partial class Artikelverwaltung + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.anlegen = new System.Windows.Forms.Button(); + this.loeschen = new System.Windows.Forms.Button(); + this.aendern = new System.Windows.Forms.Button(); + this.listeAktual = new System.Windows.Forms.Button(); + this.listView1 = new System.Windows.Forms.ListView(); + this.logout = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.searchbox = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(19, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(111, 25); + this.label1.TabIndex = 1; + this.label1.Text = "Artikelliste"; + // + // anlegen + // + this.anlegen.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.anlegen.Location = new System.Drawing.Point(784, 37); + this.anlegen.Name = "anlegen"; + this.anlegen.Size = new System.Drawing.Size(174, 37); + this.anlegen.TabIndex = 2; + this.anlegen.Text = "Artikel Anlegen"; + this.anlegen.UseVisualStyleBackColor = true; + this.anlegen.Click += new System.EventHandler(this.anlegen_Click); + // + // loeschen + // + this.loeschen.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.loeschen.Location = new System.Drawing.Point(784, 94); + this.loeschen.Name = "loeschen"; + this.loeschen.Size = new System.Drawing.Size(174, 37); + this.loeschen.TabIndex = 3; + this.loeschen.Text = "Artikel Löschen"; + this.loeschen.UseVisualStyleBackColor = true; + this.loeschen.Click += new System.EventHandler(this.loeschen_Click); + // + // aendern + // + this.aendern.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.aendern.Location = new System.Drawing.Point(784, 153); + this.aendern.Name = "aendern"; + this.aendern.Size = new System.Drawing.Size(174, 37); + this.aendern.TabIndex = 4; + this.aendern.Text = "Artikel Ändern"; + this.aendern.UseVisualStyleBackColor = true; + this.aendern.Click += new System.EventHandler(this.aendern_Click); + // + // listeAktual + // + this.listeAktual.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listeAktual.Location = new System.Drawing.Point(784, 215); + this.listeAktual.Name = "listeAktual"; + this.listeAktual.Size = new System.Drawing.Size(174, 37); + this.listeAktual.TabIndex = 5; + this.listeAktual.Text = "Liste Abrufen"; + this.listeAktual.UseVisualStyleBackColor = true; + this.listeAktual.Click += new System.EventHandler(this.listeAktual_Click); + // + // listView1 + // + this.listView1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listView1.FullRowSelect = true; + this.listView1.HideSelection = false; + this.listView1.Location = new System.Drawing.Point(24, 49); + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size(754, 821); + this.listView1.TabIndex = 6; + this.listView1.UseCompatibleStateImageBehavior = false; + // + // logout + // + this.logout.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.logout.Location = new System.Drawing.Point(784, 276); + this.logout.Name = "logout"; + this.logout.Size = new System.Drawing.Size(174, 37); + this.logout.TabIndex = 7; + this.logout.Text = "Logout"; + this.logout.UseVisualStyleBackColor = true; + this.logout.Click += new System.EventHandler(this.logout_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(505, 20); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(55, 20); + this.label2.TabIndex = 8; + this.label2.Text = "Suche"; + // + // searchbox + // + this.searchbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.searchbox.Location = new System.Drawing.Point(566, 17); + this.searchbox.Name = "searchbox"; + this.searchbox.Size = new System.Drawing.Size(212, 26); + this.searchbox.TabIndex = 9; + // + // Artikelverwaltung + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; + this.ClientSize = new System.Drawing.Size(982, 882); + this.Controls.Add(this.searchbox); + this.Controls.Add(this.label2); + this.Controls.Add(this.logout); + this.Controls.Add(this.listView1); + this.Controls.Add(this.listeAktual); + this.Controls.Add(this.aendern); + this.Controls.Add(this.loeschen); + this.Controls.Add(this.anlegen); + this.Controls.Add(this.label1); + this.Name = "Artikelverwaltung"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Artikelverwaltung"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button anlegen; + private System.Windows.Forms.Button loeschen; + private System.Windows.Forms.Button aendern; + private System.Windows.Forms.Button listeAktual; + private System.Windows.Forms.ListView listView1; + private System.Windows.Forms.Button logout; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox searchbox; + } +} \ No newline at end of file diff --git a/Artikelverwaltung/Artikelverwaltung.cs b/Artikelverwaltung/Artikelverwaltung.cs new file mode 100644 index 0000000..47189af --- /dev/null +++ b/Artikelverwaltung/Artikelverwaltung.cs @@ -0,0 +1,109 @@ +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 Artikelverwaltung +{ + public partial class Artikelverwaltung : Form + { + Artikel_Verwaltung artikelverwaltung; + public Artikelverwaltung() + { + InitializeComponent(); + artikelverwaltung = new Artikel_Verwaltung(); + + // Spaltern für die Listview erstellen und Listview generieren + listView1.Columns.Add("Artikel Nr.", 100); + listView1.Columns.Add("Artikelbeschreibung", 220, HorizontalAlignment.Center); + listView1.Columns.Add("Modellname", 150, HorizontalAlignment.Center); + listView1.Columns.Add("Artikelgruppe", 150, HorizontalAlignment.Center); + listView1.Columns.Add("Flag", 110); + listView1.View = View.Details; + listView1.MouseDoubleClick += new MouseEventHandler(listView1_MouseDoubleClick); + ListeAktuallisieren(); + searchbox.TextChanged += new EventHandler(searchBox_TextChanged); + } + private void anlegen_Click(object sender, EventArgs e) + { + Artikel_Anlegen form = new Artikel_Anlegen(); + form.ShowDialog(); + ListeAktuallisieren(); + } + + private void listeAktual_Click(object sender, EventArgs e) + { + ListeAktuallisieren(); + } + + private void loeschen_Click(object sender, EventArgs e) + { + try { + int id = Convert.ToInt32(listView1.Items[listView1.FocusedItem.Index].Text); + artikelverwaltung.ArtikelLoeschen(id); + ListeAktuallisieren(); + } + catch + { + MessageBox.Show("Fehler beim Löschen!"); + } + } + + // Aufruf nach Löschen, Ändern, Anlegen etc... + public void ListeAktuallisieren() + { + listView1.Items.Clear(); + artikelverwaltung.AlleArtikelAbrufen(); + + foreach (Artikel artikel in artikelverwaltung.Artikelliste) + { + //Objekt muss in Array umgewandelt werden + string[] arr = { artikel.Artikelnummer.ToString(), artikel.Artikelbeschreibung.ToString(), artikel.Modellname.ToString(), artikel.Artikelgruppe.ToString(), artikel.AktivFlag.ToString() }; + listView1.Items.Add(new ListViewItem(arr)); + } + } + + private void aendern_Click(object sender, EventArgs e) + { + Artikel_Aendern form = new Artikel_Aendern(listView1); + form.ShowDialog(); + ListeAktuallisieren(); + } + + private void logout_Click(object sender, EventArgs e) + { + this.Hide(); + Login form = new Login(); + form.ShowDialog(); + } + + private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) + { + ListViewHitTestInfo hit = listView1.HitTest(e.Location); + + if (hit.Item != null) + + { + Artikel_Aendern form = new Artikel_Aendern(listView1); + form.ShowDialog(); + ListeAktuallisieren(); + } + } + private void searchBox_TextChanged(object sender, EventArgs e) + { + ListeAktuallisieren(); + if (searchbox.Text == "") + { + return; + } + var list = listView1.Items.Cast().Where(x => x.SubItems.Cast().Any(y => y.Text.ToLower().Contains(searchbox.Text.ToLower()))).ToArray(); + listView1.Items.Clear(); + listView1.Items.AddRange(list); + } + } +} diff --git a/Artikelverwaltung/Artikelverwaltung.csproj b/Artikelverwaltung/Artikelverwaltung.csproj new file mode 100644 index 0000000..ad36be6 --- /dev/null +++ b/Artikelverwaltung/Artikelverwaltung.csproj @@ -0,0 +1,149 @@ + + + + + Debug + AnyCPU + {71F05FAF-8B88-4A3A-AD94-1B9F203AB0EF} + WinExe + Artikelverwaltung + Artikelverwaltung + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\MySqlConnector.2.1.13\lib\net471\MySqlConnector.dll + + + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + ..\packages\System.Diagnostics.DiagnosticSource.5.0.1\lib\net46\System.Diagnostics.DiagnosticSource.dll + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Threading.Tasks.Extensions.4.3.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll + + + + + + + + + + + + + + + + Form + + + Artikelverwaltung.cs + + + Form + + + Artikel_Aendern.cs + + + + Form + + + Artikel_Anlegen.cs + + + + Form + + + Login.cs + + + + + + + Form + + + Register.cs + + + + Artikelverwaltung.cs + + + Artikel_Aendern.cs + + + Artikel_Anlegen.cs + + + Login.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + Register.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/Artikelverwaltung/Artikelverwaltung.resx b/Artikelverwaltung/Artikelverwaltung.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Artikelverwaltung/Artikelverwaltung.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Artikelverwaltung/Database.cs b/Artikelverwaltung/Database.cs new file mode 100644 index 0000000..f73f771 --- /dev/null +++ b/Artikelverwaltung/Database.cs @@ -0,0 +1,95 @@ +using MySqlConnector; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace Artikelverwaltung +{ + internal class Database + { + string connectionString; + MySqlConnection connection; + MySqlCommand cmd; + + public Database() + { + connectionString = "Server=localhost;User=root;Password=;Database=Artikelverwaltung"; + connection = new MySqlConnection(connectionString); + cmd = new MySqlCommand(); + } + + // Benutzer abgleich direkt aus der Datenbank, ohne die Daten im Programm zu haben. + public bool loginAbgleich(string bn, string pw) + { + connection.Open(); + cmd.Connection = connection; + cmd.CommandText = $"select count(*) as result from mitarbeiter where benutzername = '{bn}' and passwort = '{pw}'"; + MySqlDataReader reader = cmd.ExecuteReader(); + while (reader.Read()) + { + if(reader["result"].ToString().Equals("1")) + { + connection.Close(); + return true; + } + } + connection.Close(); + return false; + + + } + public void BenutzerAnlegen(MitarbeiterAccount acc) + { + connection.Open(); + cmd.Connection = connection; + cmd.CommandText = $"insert into mitarbeiter(benutzername, passwort) values('{acc.benutzername}', '{acc.passwort}')"; + cmd.ExecuteNonQuery(); + connection.Close(); + } + public void ArtikelAnlegen(Artikel artikel) + { + connection.Open(); + cmd.Connection= connection; + cmd.CommandText = $"insert into artikel(artikelbeschreibung, modellname,artikelgruppe,aktivFlag) values('{artikel.Artikelbeschreibung}','{artikel.Modellname}','{artikel.Artikelgruppe}','{Convert.ToInt16(artikel.AktivFlag)}')"; + cmd.ExecuteNonQuery(); + connection.Close(); + } + + public void ArtikelLoeschen(int id) + { + connection.Open(); + cmd.Connection = connection; + cmd.CommandText = $"delete from artikel where artikelnummer = {id}"; + cmd.ExecuteNonQuery(); + connection.Close(); + } + + public void ArtikelAendern(Artikel artikel, int id) + { + connection.Open(); + cmd.Connection = connection; + cmd.CommandText = $"update artikel set artikelbeschreibung = '{artikel.Artikelbeschreibung}', modellname = '{artikel.Modellname}', artikelgruppe = '{artikel.Artikelgruppe}', aktivFlag = '{Convert.ToInt16(artikel.AktivFlag)}' where artikelnummer = {id}"; + cmd.ExecuteNonQuery(); + connection.Close(); + } + public List ArtikelAbrufen() + { + List list = new List(); + connection.Open(); + cmd.Connection = connection; + cmd.CommandText = $"select * from artikel"; + MySqlDataReader reader = cmd.ExecuteReader(); + while (reader.Read()) + { + Artikel artikel = new Artikel(Convert.ToUInt32(reader["artikelnummer"]), reader["artikelbeschreibung"].ToString(), reader["modellname"].ToString(),reader["artikelgruppe"].ToString(), Convert.ToBoolean(reader["aktivFlag"])); + list.Add(artikel); + } + connection.Close(); + return list; + } + + } +} diff --git a/Artikelverwaltung/Lager.cs b/Artikelverwaltung/Lager.cs new file mode 100644 index 0000000..8ee90ff --- /dev/null +++ b/Artikelverwaltung/Lager.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Artikelverwaltung +{ + internal class Lager + { + private uint _Lagernummer; + readonly private uint _Kapazitaet; + private uint _Lagerbestand; + //public int[] Regale; + public List Artikelliste = new List(); + + //Getter - Setter + public uint Lagernummer { get => _Lagernummer; set => _Lagernummer = value; } + public uint Lagerbestand { get => _Lagerbestand; set => _Lagerbestand = value; } + public uint Kapazitaet { get => _Kapazitaet;} + + + //Konstruktoren + public Lager() + { + } + public Lager(uint kapazitaet) + { + _Kapazitaet = kapazitaet; + } + public Lager(uint lagernummer,uint kapazitaet, uint lagerbestand ) + { + Lagernummer = lagernummer; + _Kapazitaet = kapazitaet; + Lagerbestand = lagerbestand; + } + + // Operationen + public bool Einlagern(Artikel item, int menge) + { + if(verfügbarerPlatz(menge)) // Berechnet die freie Kapazitaet, wenn genug vorhanden, findet Einlagerung statt + { + try + { + // Fügt der Atikelliste, der Menge entsprechend, den Artikel hinzu + for (int i = 0; i < menge; i++) + { + Artikelliste.Add(item); + } + BestandAktualisieren(); // Bestand wird aktuallisiert + } + catch (Exception) + { + return false; //Fehlschlag beim Einlagern + } + } + return true; + } + public bool Auslagern(Artikel item, int menge) + { + try + { + if (ZaehleArtikel(item, menge)) // Schaut, ob überhaupt soviele Artikel vorhanden sind + { + for (int i = 0; i < menge; i++) + { + Artikelliste.Remove(item); + } + BestandAktualisieren(); + } + } + catch (Exception) + { + return false; + } + return true; + } + private void BestandAktualisieren() + { + Lagerbestand = (uint)Artikelliste.Count(); + } + + //Zählt ob Artikel in der Liste mindestens n mal enthalten + private bool ZaehleArtikel(Artikel item, int menge) + { + int vorhandeneArtikel = 0; + + for(int i = 0; i < Artikelliste.Count(); i++) + { + if (Artikelliste[i].Artikelnummer == item.Artikelnummer) + { + vorhandeneArtikel += 1; + } + } + return vorhandeneArtikel >= menge; + + } + private bool verfügbarerPlatz(int menge) + { + return (Lagerbestand + menge) <= Kapazitaet; + } + } + +} diff --git a/Artikelverwaltung/Login.Designer.cs b/Artikelverwaltung/Login.Designer.cs new file mode 100644 index 0000000..ea3c5ad --- /dev/null +++ b/Artikelverwaltung/Login.Designer.cs @@ -0,0 +1,145 @@ +namespace Artikelverwaltung +{ + partial class Login + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.textBoxBenutzername = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.textBoxPasswort = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.button2 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(22, 43); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(157, 25); + this.label1.TabIndex = 0; + this.label1.Text = "Benutzername:"; + // + // textBoxBenutzername + // + this.textBoxBenutzername.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textBoxBenutzername.Location = new System.Drawing.Point(27, 86); + this.textBoxBenutzername.Name = "textBoxBenutzername"; + this.textBoxBenutzername.Size = new System.Drawing.Size(229, 31); + this.textBoxBenutzername.TabIndex = 1; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(22, 136); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(106, 25); + this.label2.TabIndex = 2; + this.label2.Text = "Passwort:"; + // + // textBoxPasswort + // + this.textBoxPasswort.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textBoxPasswort.Location = new System.Drawing.Point(27, 177); + this.textBoxPasswort.Name = "textBoxPasswort"; + this.textBoxPasswort.Size = new System.Drawing.Size(229, 31); + this.textBoxPasswort.TabIndex = 3; + // + // 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.Name = "button1"; + this.button1.Size = new System.Drawing.Size(95, 35); + this.button1.TabIndex = 4; + this.button1.Text = "Login"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.login); + // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBox1.Location = new System.Drawing.Point(166, 214); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(90, 28); + this.checkBox1.TabIndex = 5; + this.checkBox1.Text = "Klartext"; + this.checkBox1.UseVisualStyleBackColor = true; + this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); + // + // button2 + // + 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.Name = "button2"; + this.button2.Size = new System.Drawing.Size(95, 35); + this.button2.TabIndex = 6; + this.button2.Text = "Anlegen"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // Login + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + 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.Controls.Add(this.button2); + this.Controls.Add(this.checkBox1); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBoxPasswort); + this.Controls.Add(this.label2); + this.Controls.Add(this.textBoxBenutzername); + this.Controls.Add(this.label1); + this.Cursor = System.Windows.Forms.Cursors.Hand; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "Login"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Login"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBoxBenutzername; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBoxPasswort; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.Button button2; + } +} + diff --git a/Artikelverwaltung/Login.cs b/Artikelverwaltung/Login.cs new file mode 100644 index 0000000..8eed5b6 --- /dev/null +++ b/Artikelverwaltung/Login.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Artikelverwaltung +{ + public partial class Login : Form + { + Zugriffsverwaltung zugriffsverwaltung; + Thread th; + public Login() + { + 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(); + } + else + { + MessageBox.Show("Login Fehlgeschlagen!"); + } + } + + private void checkBox1_CheckedChanged(object sender, EventArgs e) + { + if(checkBox1.CheckState != CheckState.Checked) + { + textBoxPasswort.PasswordChar = '*'; + } + else + { + textBoxPasswort.PasswordChar = '\0'; + } + } + + private void button2_Click(object sender, EventArgs e) + { + this.Close(); + th = new Thread(RegisterForm); + th.SetApartmentState(ApartmentState.STA); + th.Start(); + } + private void RegisterForm(object obj) + { + Application.Run(new Register()); + } + + private void AritelverwaltunForm(object obj) + { + Application.Run(new Artikelverwaltung()); ; + } + } +} diff --git a/Artikelverwaltung/Login.resx b/Artikelverwaltung/Login.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Artikelverwaltung/Login.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Artikelverwaltung/Mitarbeiter.cs b/Artikelverwaltung/Mitarbeiter.cs new file mode 100644 index 0000000..1500ce1 --- /dev/null +++ b/Artikelverwaltung/Mitarbeiter.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Artikelverwaltung +{ + internal class MitarbeiterAccount + { + // Attribute + public string benutzername; + public string passwort; + + public MitarbeiterAccount(string benutzername, string passwort) + { + this.benutzername = benutzername; + this.passwort = passwort; + } + // Methoden + public void BenutzernameAender(string neu) { } + public void PasswortAender(string neu) { } + + } + +} diff --git a/Artikelverwaltung/Program.cs b/Artikelverwaltung/Program.cs new file mode 100644 index 0000000..9ed9563 --- /dev/null +++ b/Artikelverwaltung/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Artikelverwaltung +{ + internal static class Program + { + /// + /// Der Haupteinstiegspunkt für die Anwendung. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Login()); + } + } +} diff --git a/Artikelverwaltung/Properties/AssemblyInfo.cs b/Artikelverwaltung/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..34abd7a --- /dev/null +++ b/Artikelverwaltung/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("Artikelverwaltung")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Artikelverwaltung")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("71f05faf-8b88-4a3a-ad94-1b9f203ab0ef")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Artikelverwaltung/Properties/Resources.Designer.cs b/Artikelverwaltung/Properties/Resources.Designer.cs new file mode 100644 index 0000000..a818d52 --- /dev/null +++ b/Artikelverwaltung/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion: 4.0.30319.42000 +// +// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn +// der Code neu generiert wird. +// +//------------------------------------------------------------------------------ + +namespace Artikelverwaltung.Properties +{ + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse + // über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Artikelverwaltung.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Artikelverwaltung/Properties/Resources.resx b/Artikelverwaltung/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Artikelverwaltung/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Artikelverwaltung/Properties/Settings.Designer.cs b/Artikelverwaltung/Properties/Settings.Designer.cs new file mode 100644 index 0000000..99d6d8f --- /dev/null +++ b/Artikelverwaltung/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Artikelverwaltung.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Artikelverwaltung/Properties/Settings.settings b/Artikelverwaltung/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Artikelverwaltung/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Artikelverwaltung/Register.Designer.cs b/Artikelverwaltung/Register.Designer.cs new file mode 100644 index 0000000..9cd9da3 --- /dev/null +++ b/Artikelverwaltung/Register.Designer.cs @@ -0,0 +1,140 @@ +namespace Artikelverwaltung +{ + partial class Register + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.textBoxRegisterBenutzername = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.textBoxRegisterPasswort = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(250, 25); + this.label1.TabIndex = 0; + this.label1.Text = "Neuen Benutzer anlegen"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(18, 61); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(157, 25); + this.label2.TabIndex = 1; + this.label2.Text = "Benutzername:"; + // + // textBoxRegisterBenutzername + // + this.textBoxRegisterBenutzername.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textBoxRegisterBenutzername.Location = new System.Drawing.Point(18, 89); + this.textBoxRegisterBenutzername.Name = "textBoxRegisterBenutzername"; + this.textBoxRegisterBenutzername.Size = new System.Drawing.Size(177, 31); + this.textBoxRegisterBenutzername.TabIndex = 2; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.Location = new System.Drawing.Point(18, 147); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(106, 25); + this.label3.TabIndex = 3; + this.label3.Text = "Passwort:"; + // + // textBoxRegisterPasswort + // + this.textBoxRegisterPasswort.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textBoxRegisterPasswort.Location = new System.Drawing.Point(18, 175); + this.textBoxRegisterPasswort.Name = "textBoxRegisterPasswort"; + this.textBoxRegisterPasswort.Size = new System.Drawing.Size(177, 31); + this.textBoxRegisterPasswort.TabIndex = 4; + // + // 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(152, 249); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(102, 43); + this.button1.TabIndex = 5; + this.button1.Text = "Anlegen"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + 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(18, 249); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(106, 43); + this.button2.TabIndex = 6; + this.button2.Text = "Zurück"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // Register + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; + this.ClientSize = new System.Drawing.Size(284, 331); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBoxRegisterPasswort); + this.Controls.Add(this.label3); + this.Controls.Add(this.textBoxRegisterBenutzername); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "Register"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Register"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBoxRegisterBenutzername; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBoxRegisterPasswort; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + } +} \ No newline at end of file diff --git a/Artikelverwaltung/Register.cs b/Artikelverwaltung/Register.cs new file mode 100644 index 0000000..1669046 --- /dev/null +++ b/Artikelverwaltung/Register.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Artikelverwaltung +{ + public partial class Register : Form + { + Zugriffsverwaltung zugriffsverwaltung; + Thread th; + public Register() + { + InitializeComponent(); + zugriffsverwaltung = new Zugriffsverwaltung(); + } + + private void button1_Click(object sender, EventArgs e) + { + if (zugriffsverwaltung.benutzerAnlegen(textBoxRegisterBenutzername.Text, textBoxRegisterPasswort.Text)) + { + MessageBox.Show("Benutzer Angelegt"); + } + else + { + MessageBox.Show("Fehler beim Anlegen!"); + } + } + + private void button2_Click(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()); + } + } +} diff --git a/Artikelverwaltung/Register.resx b/Artikelverwaltung/Register.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Artikelverwaltung/Register.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Artikelverwaltung/Zugriffsverwaltung.cs b/Artikelverwaltung/Zugriffsverwaltung.cs new file mode 100644 index 0000000..f6d6c71 --- /dev/null +++ b/Artikelverwaltung/Zugriffsverwaltung.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Artikelverwaltung +{ + internal class Zugriffsverwaltung + { + Database dbConnection = new Database(); + // Methoden (Operations) Login, abgleich von Benutzername und Passwort + public bool loginArtikelverwaltung(string bn, string pw) + { + bool access = false; + + if (dbConnection.loginAbgleich(bn,pw)) + { + access = true; + + } + return access; + } + public bool benutzerAnlegen(string bn, string pw) + { + MitarbeiterAccount mitarbeiter = new MitarbeiterAccount(bn, pw); + try + { + dbConnection.BenutzerAnlegen(mitarbeiter); + return true; + } + catch + { + return false; + } + + } + } +} diff --git a/Artikelverwaltung/packages.config b/Artikelverwaltung/packages.config new file mode 100644 index 0000000..7b32013 --- /dev/null +++ b/Artikelverwaltung/packages.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file