From afcebcbeaffb53852eda5cbe0b2eb97489484484 Mon Sep 17 00:00:00 2001 From: Blauschleim Date: Mon, 16 May 2022 20:06:01 +0200 Subject: [PATCH] removed unecessary if case --- Form1.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Form1.cs b/Form1.cs index e960b84..15340ad 100644 --- a/Form1.cs +++ b/Form1.cs @@ -14,7 +14,7 @@ namespace it_projekt private Database db = null; public Form1() { - InitializeComponent(); + InitializeComponent(); this.exportBtn.Enabled = false; } @@ -42,7 +42,8 @@ namespace it_projekt Database.resetDatabase(); MessageBox.Show("Verbindung mit der Datenbank fehlgeschlagen :( \nVersuchen Sie es erneut.", "Datenbank Fehler!"); } - else { + else + { foreach (Person person in db.Persons) { this.dataGrid.Rows.Add(person.Id, person.Firstname, person.Lastname, person.Department_short, person.Department_long, person.CreationDate, false); @@ -53,7 +54,7 @@ namespace it_projekt private void dataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { - + } private System.EventHandler test() @@ -67,12 +68,9 @@ namespace it_projekt List markedUsers = new List(); foreach (DataGridViewRow row in dataGrid.Rows) { - if (row.Cells[6].Value != null) + if (Convert.ToBoolean(row.Cells[6].Value)) { - if (row.Cells[6].Value.ToString() == "True") - { - markedUsers.Add(db.Persons.Find(person => person.Id == row.Cells[0].Value.ToString())); - } + markedUsers.Add(db.Persons.Find(person => person.Id == row.Cells[0].Value.ToString())); } } if (markedUsers.Count == 0)