-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlayersInfo.cs
105 lines (86 loc) · 2.69 KB
/
PlayersInfo.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using TECForGames.Classes;
namespace TECForGames
{
public partial class PlayersInfo : UserControl
{
SqlConnection con;
DataBaseConnection cons = new DataBaseConnection();
ExceptionError ee = new ExceptionError();
PlayerInfoAlert pIA = new PlayerInfoAlert();
public PlayersInfo()
{
InitializeComponent();
}
private void PlayersInfo_Load(object sender, EventArgs e)
{
try
{
con = cons.Getcon();
SqlCommand cmd = new SqlCommand("select * from UserGameInfo", con);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
adp.Fill(dt);
dataGridView1.DataSource = dt;
}
catch (Exception)
{
ee.Show();
throw;
}
}
private void button1_MouseHover_1(object sender, EventArgs e)
{
button1.ForeColor = Color.FromArgb(128, 128, 255);
}
private void button1_MouseLeave_1(object sender, EventArgs e)
{
button1.ForeColor = Color.Black;
}
private void button1_Click_1(object sender, EventArgs e)
{
try
{
if (textBox1.Text.Length > 0 && textBox1.Text.Length <= 15)
{
SqlDataAdapter adp = new SqlDataAdapter("select * from UserGameInfo where UserName='" + textBox1.Text + "'", con);
DataTable dt = new DataTable();
adp.Fill(dt);
if (dt.Rows.Count > 0)
{
if (dt.Rows[0]["UserName"].ToString() == textBox1.Text)
{
dataGridView1.DataSource = dt;
}
else
{
pIA.Show();
}
}
else
{
pIA.Show();
}
}
else
{
pIA.Show();
}
}
catch (Exception)
{
ee.Show();
throw;
}
}
}
}