diff --git a/Database.cs b/Database.cs index 98a3b50..1f4dee5 100644 --- a/Database.cs +++ b/Database.cs @@ -16,13 +16,13 @@ namespace it_projekt { connection.Open(); - string sql = "SELECT * FROM stammdaten"; + string sql = "SELECT stammdaten.id, stammdaten.firstname, stammdaten.lastname, stammdaten.creationdate, abteilung.kuerzel, abteilung.name FROM `stammdaten` JOIN abteilung GROUP BY stammdaten.id; "; MySqlCommand cmd = new MySqlCommand(sql, connection); MySqlDataReader rdr = cmd.ExecuteReader(); Persons = new List(); while (rdr.Read()) { - Person p = new Person(rdr[0].ToString(), rdr[1].ToString(), rdr[2].ToString(), DateTime.Parse(rdr[3].ToString())); + Person p = new Person(rdr[0].ToString(), rdr[1].ToString(), rdr[2].ToString(), DateTime.Parse(rdr[3].ToString()), rdr[4].ToString(), rdr[5].ToString()); Persons.Add(p); } diff --git a/Form1.Designer.cs b/Form1.Designer.cs index 7db3143..55e4c66 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -1,34 +1,34 @@ - -namespace it_projekt -{ - partial class Form1 - { - /// - /// 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() - { + +namespace it_projekt +{ + partial class Form1 + { + /// + /// 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.loginBtn = new System.Windows.Forms.Button(); this.exportBtn = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); @@ -189,24 +189,24 @@ namespace it_projekt this.ResumeLayout(false); this.PerformLayout(); - } - - #endregion - - private System.Windows.Forms.Button loginBtn; - private System.Windows.Forms.Button exportBtn; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox userTxt; - private System.Windows.Forms.TextBox passTxt; - private System.Windows.Forms.DataGridView dataGrid; - private System.Windows.Forms.DataGridViewTextBoxColumn Id; - private System.Windows.Forms.DataGridViewTextBoxColumn firstname; - private System.Windows.Forms.DataGridViewTextBoxColumn lastname; - private System.Windows.Forms.DataGridViewTextBoxColumn creationDate; + } + + #endregion + + private System.Windows.Forms.Button loginBtn; + private System.Windows.Forms.Button exportBtn; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox userTxt; + private System.Windows.Forms.TextBox passTxt; + private System.Windows.Forms.DataGridView dataGrid; + private System.Windows.Forms.DataGridViewTextBoxColumn Id; + private System.Windows.Forms.DataGridViewTextBoxColumn firstname; + private System.Windows.Forms.DataGridViewTextBoxColumn lastname; + private System.Windows.Forms.DataGridViewTextBoxColumn creationDate; private System.Windows.Forms.DataGridViewCheckBoxColumn markItem; private System.Windows.Forms.RadioButton jsonRBtn; private System.Windows.Forms.RadioButton xmlRBtn; - } -} - + } +} + diff --git a/Form1.cs b/Form1.cs index 322d948..96a42ec 100644 --- a/Form1.cs +++ b/Form1.cs @@ -41,7 +41,7 @@ namespace it_projekt } foreach (Person person in db.Persons) { - this.dataGrid.Rows.Add(person.Id, person.Firstname, person.Lastname, person.CreationDate, false); + this.dataGrid.Rows.Add(person.Id, person.Firstname, person.Lastname, person.department_short, person.department_long, person.CreationDate, false); } } diff --git a/Person.cs b/Person.cs index 92eb085..d151730 100644 --- a/Person.cs +++ b/Person.cs @@ -12,17 +12,21 @@ namespace it_projekt public string Lastname { get; set; } public string Firstname { get; set; } public DateTime CreationDate { get; set; } + public string department_short { get; set; } + public string department_long { get; set; } public Person() { } - public Person(string Id, string Lastname, string Firstname, DateTime CreationDate) + public Person(string Id, string Lastname, string Firstname, DateTime CreationDate, string department_short, string department_long) { this.Id = Id; this.Lastname = Lastname; this.Firstname = Firstname; this.CreationDate = CreationDate; + this.department_short = department_short; + this.department_long = department_long; } } }