1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- 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();
- }
- }
- }
|