-
Notifications
You must be signed in to change notification settings - Fork 0
/
RibbonForm1.cs
347 lines (294 loc) · 14.1 KB
/
RibbonForm1.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraBars;
using System.Data.SqlClient;
namespace FighyGym2
{
public partial class RibbonForm1 : DevExpress.XtraBars.Ribbon.RibbonForm
{
public RibbonForm1()
{
InitializeComponent();
}
DataTable dt;
string ConString = System.Configuration.ConfigurationManager.ConnectionStrings["Database1ConnectionString"].ConnectionString;
SqlConnection conn;
private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e)
{
getuserid();
// conn = new SqlConnection(ConString);
tbl = db.readData(" SELECT dbo.PermisionSetting.[Permisission_Particpiation] FROM dbo.PermisionSetting INNER JOIN dbo.Roles ON dbo.PermisionSetting.Role_id = '" + User_id + "' Group by Permisission_Particpiation", "");
// string da = "SELECT dbo.Tbl_eshtrackat.ID, dbo.Students.Student_Name, dbo.Tbl_eshtrackat.class_name, dbo.Tbl_eshtrackat.[From], dbo.Tbl_eshtrackat.[To], dbo.Tbl_eshtrackat.mount FROM dbo.Students INNER JOIN dbo.Tbl_eshtrackat ON dbo.Students.Student_Id = dbo.Tbl_eshtrackat.Student_id INNER JOIN dbo.Employees ON dbo.Tbl_eshtrackat.emp_id = dbo.Employees.Employee_Id where dbo.Tbl_eshtrackat.[From] between '" + date1 + "' and '" + date2 + "' ";
// SqlCommand comandReader = new SqlCommand(selectCmd, conn);
// comandReader.ExecuteNonQuery();
// conn.Open();
// dt = new DataTable();
// SqlDataAdapter adapt = new SqlDataAdapter(comandReader);
// adapt.Fill(dt);
if (tbl.Rows.Count <= 0)
{
if (!panel1.Controls.Contains(CondetialsEshtracat.Instance))
{
panel1.Controls.Add(CondetialsEshtracat.Instance);
CondetialsEshtracat.Instance.Dock = DockStyle.Fill;
CondetialsEshtracat.Instance.BringToFront();
}
CondetialsEshtracat.Instance.BringToFront();
}
else
{
if (Convert.ToDecimal(tbl.Rows[0][0]) == 0)
{
MessageBox.Show(" انت لاتملك صلاحية الدخول لهذه الشاشه", "تأكيد", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
else
{
if (!panel1.Controls.Contains(CondetialsEshtracat.Instance))
{
panel1.Controls.Add(CondetialsEshtracat.Instance);
CondetialsEshtracat.Instance.Dock = DockStyle.Fill;
CondetialsEshtracat.Instance.BringToFront();
}
CondetialsEshtracat.Instance.BringToFront();
}
}
}
private void barButtonItem3_ItemClick(object sender, ItemClickEventArgs e)
{
getuserid();
// conn = new SqlConnection(ConString);
tbl = db.readData(" SELECT dbo.PermisionSetting.[Permisission_TrainerTech] FROM dbo.PermisionSetting INNER JOIN dbo.Roles ON dbo.PermisionSetting.Role_id = '" + User_id + "' Group by dbo.PermisionSetting.[Permisission_TrainerTech]", "");
if (tbl.Rows.Count <= 0)
{
if (!panel1.Controls.Contains(AddEmployee.Instance))
{
panel1.Controls.Add(AddEmployee.Instance);
AddEmployee.Instance.Dock = DockStyle.Fill;
AddEmployee.Instance.BringToFront();
}
AddEmployee.Instance.BringToFront();
}
else
{
if (Convert.ToDecimal(tbl.Rows[0][0]) == 0)
{
MessageBox.Show(" انت لاتملك صلاحية الدخول لهذه الشاشه", "تأكيد", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
else
{
if (!panel1.Controls.Contains(AddEmployee.Instance))
{
panel1.Controls.Add(AddEmployee.Instance);
AddEmployee.Instance.Dock = DockStyle.Fill;
AddEmployee.Instance.BringToFront();
}
AddEmployee.Instance.BringToFront();
}
}
}
private void barButtonItem6_ItemClick(object sender, ItemClickEventArgs e)
{
getuserid();
// conn = new SqlConnection(ConString);
tbl = db.readData(" SELECT dbo.PermisionSetting.[Permisission_Users] FROM dbo.PermisionSetting INNER JOIN dbo.Roles ON dbo.PermisionSetting.Role_id = '" + User_id + "' Group by dbo.PermisionSetting.[Permisission_Users]", "");
// string da = "SELECT dbo.Tbl_eshtrackat.ID, dbo.Students.Student_Name, dbo.Tbl_eshtrackat.class_name, dbo.Tbl_eshtrackat.[From], dbo.Tbl_eshtrackat.[To], dbo.Tbl_eshtrackat.mount FROM dbo.Students INNER JOIN dbo.Tbl_eshtrackat ON dbo.Students.Student_Id = dbo.Tbl_eshtrackat.Student_id INNER JOIN dbo.Employees ON dbo.Tbl_eshtrackat.emp_id = dbo.Employees.Employee_Id where dbo.Tbl_eshtrackat.[From] between '" + date1 + "' and '" + date2 + "' ";
// SqlCommand comandReader = new SqlCommand(selectCmd, conn);
// comandReader.ExecuteNonQuery();
// conn.Open();
// dt = new DataTable();
// SqlDataAdapter adapt = new SqlDataAdapter(comandReader);
// adapt.Fill(dt);
if (tbl.Rows.Count <= 0)
{
if (!panel1.Controls.Contains(Con_Permission.Instance))
{
panel1.Controls.Add(Con_Permission.Instance);
Con_Permission.Instance.Dock = DockStyle.Fill;
Con_Permission.Instance.BringToFront();
}
Con_Permission.Instance.BringToFront();
}
else
{
if (Convert.ToDecimal(tbl.Rows[0][0]) == 0)
{
MessageBox.Show(" انت لاتملك صلاحية الدخول لهذه الشاشه", "تأكيد", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
else
{
if (!panel1.Controls.Contains(Con_Permission.Instance))
{
panel1.Controls.Add(Con_Permission.Instance);
Con_Permission.Instance.Dock = DockStyle.Fill;
Con_Permission.Instance.BringToFront();
}
Con_Permission.Instance.BringToFront();
}
}
}
int User_id;
public void getuserid()
{
try
{
conn = new SqlConnection(ConString);
string selectCmd = " SELECT [role_Id] FROM [fightGym].[dbo].[Roles] where Employee_Name='" + Properties.Settings.Default.USER_NAME + "' ";
// string da = "SELECT dbo.Tbl_eshtrackat.ID, dbo.Students.Student_Name, dbo.Tbl_eshtrackat.class_name, dbo.Tbl_eshtrackat.[From], dbo.Tbl_eshtrackat.[To], dbo.Tbl_eshtrackat.mount FROM dbo.Students INNER JOIN dbo.Tbl_eshtrackat ON dbo.Students.Student_Id = dbo.Tbl_eshtrackat.Student_id INNER JOIN dbo.Employees ON dbo.Tbl_eshtrackat.emp_id = dbo.Employees.Employee_Id where dbo.Tbl_eshtrackat.[From] between '" + date1 + "' and '" + date2 + "' ";
SqlCommand comandReader = new SqlCommand(selectCmd, conn);
conn.Open();
comandReader.ExecuteNonQuery();
// conn.Open();
dt = new DataTable();
SqlDataAdapter adapt = new SqlDataAdapter(comandReader);
adapt.Fill(dt);
User_id = Convert.ToInt16(dt.Rows[0][0].ToString());
// User_id = Convert.ToInt16(db.readData("select User_ID from Users where User_Name=N'" + Properties.Settings.Default.USER_NAME + "'", "").Rows[0][0]);
}
catch { }
}
DataTable tbl = new DataTable();
Database db = new Database();
private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
{
getuserid();
//getuserid();
// conn = new SqlConnection(ConString);
tbl =db.readData( " SELECT dbo.PermisionSetting.Permisission_Player FROM dbo.PermisionSetting INNER JOIN dbo.Roles ON dbo.PermisionSetting.Role_id = '"+User_id+ "' Group by dbo.PermisionSetting.Permisission_Player", "");
if (tbl.Rows.Count <= 0)
{
if (!panel1.Controls.Contains(ConEditStudents.Instance))
{
panel1.Controls.Add(ConEditStudents.Instance);
ConEditStudents.Instance.Dock = DockStyle.Fill;
ConEditStudents.Instance.BringToFront();
}
ConEditStudents.Instance.BringToFront();
}
else
{
if (Convert.ToDecimal(tbl.Rows[0][0]) == 0)
{
MessageBox.Show(" انت لاتملك صلاحية الدخول لهذه الشاشه", "تأكيد", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}else
{
if (!panel1.Controls.Contains(ConEditStudents.Instance))
{
panel1.Controls.Add(ConEditStudents.Instance);
ConEditStudents.Instance.Dock = DockStyle.Fill;
ConEditStudents.Instance.BringToFront();
}
ConEditStudents.Instance.BringToFront();
}
}
}
private void barButtonItem7_ItemClick(object sender, ItemClickEventArgs e)
{
getuserid();
tbl = db.readData(" SELECT dbo.PermisionSetting.[Permisission_Game] FROM dbo.PermisionSetting INNER JOIN dbo.Roles ON dbo.PermisionSetting.Role_id = '" + User_id + "' Group by dbo.PermisionSetting.[Permisission_Game]", "");
if (tbl.Rows.Count <= 0)
{
if (!panel1.Controls.Contains(ConGames.Instance))
{
panel1.Controls.Add(ConGames.Instance);
ConGames.Instance.Dock = DockStyle.Fill;
ConGames.Instance.BringToFront();
}
ConGames.Instance.BringToFront();
}
else
{
if (Convert.ToDecimal(tbl.Rows[0][0]) == 0)
{
MessageBox.Show(" انت لاتملك صلاحية الدخول لهذه الشاشه", "تأكيد", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
else
{
if (!panel1.Controls.Contains(ConGames.Instance))
{
panel1.Controls.Add(ConGames.Instance);
ConGames.Instance.Dock = DockStyle.Fill;
ConGames.Instance.BringToFront();
}
ConGames.Instance.BringToFront();
}
}
}
private void barButtonItem9_ItemClick(object sender, ItemClickEventArgs e)
{
getuserid();
tbl = db.readData(" SELECT dbo.PermisionSetting.[Permisission_Game] FROM dbo.PermisionSetting INNER JOIN dbo.Roles ON dbo.PermisionSetting.Role_id = '" + User_id + "' Group by dbo.PermisionSetting.[Permisission_Game]", "");
if (tbl.Rows.Count <= 0)
{
if (!panel1.Controls.Contains(ConGameSett.Instance))
{
panel1.Controls.Add(ConGameSett.Instance);
ConGameSett.Instance.Dock = DockStyle.Fill;
ConGameSett.Instance.BringToFront();
}
ConGameSett.Instance.BringToFront();
}
else
{
if (Convert.ToDecimal(tbl.Rows[0][0]) == 0)
{
MessageBox.Show(" انت لاتملك صلاحية الدخول لهذه الشاشه", "تأكيد", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
else
{
if (!panel1.Controls.Contains(ConGameSett.Instance))
{
panel1.Controls.Add(ConGameSett.Instance);
ConGameSett.Instance.Dock = DockStyle.Fill;
ConGameSett.Instance.BringToFront();
}
ConGameSett.Instance.BringToFront();
}
}
}
private void barEditItem1_ItemClick(object sender, ItemClickEventArgs e)
{
}
private void ribbon_Click(object sender, EventArgs e)
{
}
private void barButtonItem11_ItemClick(object sender, ItemClickEventArgs e)
{
aboutus a = new aboutus();
a.Show();
}
private void barButtonItem4_ItemClick(object sender, ItemClickEventArgs e)
{
}
private void barButtonItem12_ItemClick(object sender, ItemClickEventArgs e)
{
}
private void barEditItem4_ItemClick(object sender, ItemClickEventArgs e)
{
}
private void RibbonForm1_Load(object sender, EventArgs e)
{
}
private void barButtonItem16_ItemClick(object sender, ItemClickEventArgs e)
{
aboutus a = new aboutus();
a.Show();
}
private void RibbonForm1_FormClosed(object sender, FormClosedEventArgs e)
{
Application.Exit();
}
}
}