Browse Source

Создание профиля

sanyogromov@mail.ru 2 years ago
parent
commit
631fdf6cd9
1 changed files with 30 additions and 1 deletions
  1. 30 1
      project/Profile.cs

+ 30 - 1
project/Profile.cs

@@ -24,9 +24,38 @@ namespace project
         {
             string proverkaLogin = Login.login;
             dataBase.openConnection();
+
             SqlCommand sqlCommand2 = new SqlCommand($"SELECT name From Employee WHERE login = '{proverkaLogin}'", dataBase.GetConnection());
             string namePolzovatel = sqlCommand2.ExecuteScalar().ToString();
-            label1.Text = label1.Text + namePolzovatel;
+            if (namePolzovatel == "")
+                label1.Text = label1.Text + " Отсутствует";
+            else
+                label1.Text = label1.Text + " " + namePolzovatel;
+            sqlCommand2 = new SqlCommand($"SELECT surname From Employee WHERE login = '{proverkaLogin}'", dataBase.GetConnection());
+            string surnamePolzovatel = sqlCommand2.ExecuteScalar().ToString();
+            if (surnamePolzovatel == "")
+                label2.Text = label2.Text + " Отсутствует";
+            else
+                label2.Text = label2.Text + " " + surnamePolzovatel;
+            sqlCommand2 = new SqlCommand($"SELECT number From Employee WHERE login = '{proverkaLogin}'", dataBase.GetConnection());
+            string numberPolzovatel = sqlCommand2.ExecuteScalar().ToString();
+            if (numberPolzovatel == "")
+                label3.Text = label3.Text + " Отсутствует";
+            else
+                label3.Text = label3.Text + " " + numberPolzovatel;
+            sqlCommand2 = new SqlCommand($"SELECT pol From Employee WHERE login = '{proverkaLogin}'", dataBase.GetConnection());
+            string polPolzovatel = sqlCommand2.ExecuteScalar().ToString();
+            if (polPolzovatel == "")
+                label4.Text = label4.Text + " Не указан";
+            else
+                label4.Text = label4.Text + " " + polPolzovatel;
+            sqlCommand2 = new SqlCommand($"SELECT id From Employee WHERE login = '{proverkaLogin}'", dataBase.GetConnection());
+            string idPolzovatel = sqlCommand2.ExecuteScalar().ToString();
+            label5.Text = label5.Text + " " + idPolzovatel;
+            sqlCommand2 = new SqlCommand($"SELECT administrator From Employee WHERE login = '{proverkaLogin}'", dataBase.GetConnection());
+            string admPolzovatel = sqlCommand2.ExecuteScalar().ToString();
+            if (admPolzovatel.Trim() == "true")
+                label6.Visible = true;
         }
     }
 }