123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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 System.Data.SqlClient;
- namespace project
- {
- public partial class Profile : Form
- {
- public static string login;
- DataBase dataBase = new DataBase();
- public Profile()
- {
- InitializeComponent();
- }
- private void Profile_Load(object sender, EventArgs e)
- {
- string proverkaLogin = Login.login;
- dataBase.openConnection();
- SqlCommand sqlCommand2 = new SqlCommand($"SELECT name From Employee WHERE login = '{proverkaLogin}'", dataBase.GetConnection());
- string namePolzovatel = sqlCommand2.ExecuteScalar().ToString();
- if (namePolzovatel == "")
- label1.Text = label1.Text + " Отсутствует";
- else
- label1.Text = label1.Text + " " + namePolzovatel;
- Login.name = 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;
- Login.surname = 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;
- Login.number = 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;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- RedactorProfile redactorProfile = new RedactorProfile();
- this.Hide();
- redactorProfile.Show();
- }
- }
- }
|