-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdminForm.cs
63 lines (55 loc) · 1.73 KB
/
AdminForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using MySql.Data.MySqlClient;
using System;
using System.IO;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using MySQLData;
namespace jsu1xd
{
public partial class AdminForm : Form
{
string strPath = System.Environment.GetEnvironmentVariable("TEMP");
public int UserId { get; set; }
public AdminForm()
{
InitializeComponent();
string path = Path.Combine(strPath, "jsu1xd.tmp");
using (var sr = new StreamReader(path))
{
UserId = Convert.ToInt32(sr.ReadToEnd());
}
var dbCon = DBConnection.Instance();
if (dbCon.IsConnect())
{
string query = $"SELECT fio FROM admins WHERE id={UserId}";
var cmd = new MySqlCommand(query, dbCon.Connection);
var result = cmd.ExecuteReader();
while (result.Read())
{
guna2HtmlLabel2.Text = $"{result.GetString(0)}";
}
dbCon.Close();
}
}
private void guna2Button1_Click(object sender, EventArgs e)
{
Form addOperator = new AddOperatorForm();
addOperator.ShowDialog();
}
private void AdminForm_FormClosed(object sender, FormClosedEventArgs e)
{
Application.Exit();
}
private void guna2Button2_Click(object sender, EventArgs e)
{
Form addAdmin = new AddAdminForm();
addAdmin.ShowDialog();
}
private void guna2Button4_Click(object sender, EventArgs e)
{
Form AllStats = new AdminAllStats();
AllStats.ShowDialog();
}
}
}