Explorar o código

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

sanyogromov@mail.ru %!s(int64=2) %!d(string=hai) anos
pai
achega
631fdf6cd9
Modificáronse 1 ficheiros con 30 adicións e 1 borrados
  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;
         }
     }
 }