-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrincipal.cs
810 lines (625 loc) · 27.1 KB
/
Principal.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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.ServiceModel.Channels;
using System.Text;
using System.Threading.Tasks;
using System.Web.Services.Description;
using System.Windows.Forms;
using Microsoft.SqlServer.Types;
using Microsoft.Reporting;
using Microsoft.Reporting;
namespace WindowsFormsApp1
{
public partial class Principal : Form
{
bool expansionMenu = true;
string c = $"Data Source=DESKTOP-PPMBHAK\\SQLEXPRESS;Initial Catalog=proyectoFinaltbdd;User ID=sa;Password=;";
public string cUser = "";
public string cPassword = "";
string conexionABDD = "";
public Principal()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
private void bunifuButton1_Click(object sender, EventArgs e)
{
}
private void Principal_Load(object sender, EventArgs e)
{
//Conexion de bdd en todo el form
// Conectarse c = new Conectarse(cUser,cPassword);
//Si el usuario no es admin, no podrá ver esto
ocultar();
conexionABDD = $"Data Source=DESKTOP-PPMBHAK\\SQLEXPRESS;Initial Catalog=proyectoFinaltbdd;User ID={cUser};Password={cPassword};";
int admin = 0;
using (SqlConnection conexion = new SqlConnection(c))
{
try
{
conexion.Open();
string consulta = $"SELECT Rol FROM proyecto.Usuario where Nombre_Usuario='{cUser}' ";
SqlCommand command = new SqlCommand(consulta, conexion);
var esAdmin = command.ExecuteScalar();
admin = Convert.ToInt32(esAdmin);
if (admin == 0)
{
btnAuditoria.Visible = false;
btnReporte.Visible = false;
btnAdministrar.Visible = false;
}
}
catch (Exception ex)
{
MessageBox.Show("Error XD: " + ex.Message);
}
conexion.Close();
//SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
}
}
private void timerMenu_Tick(object sender, EventArgs e)
{
if (expansionMenu)
{
//Si el menú está expandido, minimizalo
menu.Width -= 10;
if (menu.Width == menu.MinimumSize.Width)
{
expansionMenu = false;
timerMenu.Stop();
}
}
else
{
menu.Width += 10;
if (menu.Width == menu.MaximumSize.Width)
{
expansionMenu = true;
timerMenu.Stop();
}
}
}
private void pictureBox1_Click(object sender, EventArgs e)
{
timerMenu.Start();
}
private void button5_Click(object sender, EventArgs e)
{
}
//Hacer visible manda el numero del caso de lo que quiero hacer visible
//Primero ejecutar el ocultarTodo y luego el hacer visible
public void hacerVisible(int valor)
{
switch (valor)
{
case 0:
dataJuegos.Visible = true;
dataJuegos.Location = new System.Drawing.Point(298, 46);
dataJuegos.Size = new Size(376, 358);
lblNombreJuego.Visible = true;
pbImagenJuego.Visible = true;
lblDescripcion.Visible = true;
lblPrecio.Visible = true;
lblDinero.Visible = true;
btnComprar.Text = "Comprar";
btnComprar.Visible = true;
break;
case 1:
dataJuegos.Visible = true;
dataJuegos.Location = new System.Drawing.Point(298, 46);
dataJuegos.Size = new Size(376, 358);
lblNombreJuego.Visible = true;
pbImagenJuego.Visible = true;
lblDescripcion.Visible = true;
btnComprar.Text = "Jugar";
btnComprar.Visible = true;
break;
case 2:
dataJuegos.Visible = true;
dataJuegos.Location = new System.Drawing.Point(298, 46);
dataJuegos.Size = new Size(376, 358);
btnComprar.Visible = true;
btnComprar.Text = "Realizar operación";
lblAdNombre.Visible = true;
lblAdPortada.Visible = true;
lblAdDescripcion.Visible = true;
lblAdPrecio.Visible = true;
txtNombre.Visible = true;
txtPortada.Visible = true;
txtDescripcion.Visible = true;
txtPrecio.Visible = true;
groupBox1.Visible = true;
lblIdJuego.Visible = true;
txtId.Visible = true;
btnRestaurar.Visible = true;
btnBackup.Visible = true;
break;
case 3:
dataJuegos.Visible = true;
dataJuegos.Location = new System.Drawing.Point(206, 3);
dataJuegos.Size = new Size(707, 445);
break;
case 4:
break;
}
}
public void ocultar()
{
//Tienda
dataJuegos.Visible = false;
dataJuegos.DataSource= null;
lblNombreJuego.Visible = false;
pbImagenJuego.Visible = false;
lblDescripcion.Visible = false;
lblPrecio.Visible = false;
lblDinero.Visible = false;
btnComprar.Visible = false;
//Administrar
btnComprar.Visible = false;
lblAdNombre.Visible = false;
lblAdPortada.Visible = false;
lblAdDescripcion.Visible = false;
lblAdPrecio.Visible = false;
txtNombre.Visible = false;
txtPortada.Visible = false;
txtDescripcion.Visible = false;
txtPrecio.Visible = false;
groupBox1.Visible = false;
lblIdJuego.Visible = false;
txtId.Visible= false;
btnRestaurar.Visible = false;
btnBackup.Visible = false;
//Reporte
//rvReporte.Visible = false;
}
int botonElegido;
private void btnTienda_Click(object sender, EventArgs e)
{
ocultar();
hacerVisible(0);
actualizarDinero();
botonElegido = 0;
using (SqlConnection conexion = new SqlConnection(conexionABDD))
{
try
{
conexion.Open();
SqlDataAdapter sqlDA = new SqlDataAdapter("SELECT nombre as 'Nombre del videojuego' FROM proyecto.Tienda ", conexion);
DataTable dtbl = new DataTable();
sqlDA.Fill(dtbl);
dataJuegos.DataSource = dtbl;
}
catch (Exception ex)
{
// MessageBox.Show("Error de inicio de sesión: " + ex.Message);
}
}
}
private void dataJuegos_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void dataJuegos_CellClick(object sender, DataGridViewCellEventArgs e)
{
switch (botonElegido)
{
case 0:
darClickLlenar("Tienda");
break;
case 1:
darClickLlenar("Libreria");
break;
case 2:
darClickLlenar("Tienda");
break;
}
}
public void darClickLlenar(string tabla)
{
string nombre = lblNombreJuego.Text = dataJuegos.CurrentRow.Cells[0].Value.ToString();
SqlConnection conexion = new SqlConnection(conexionABDD);
string[] consultas = new string[4];
string[] datos = new string[4];
consultas[0] = $"SELECT Portada FROM proyecto.{tabla} where nombre = '{nombre}'";
consultas[1] = $"SELECT precio FROM proyecto.{tabla} where nombre = '{nombre}'";
consultas[2] = $"SELECT descripcion FROM proyecto.{tabla} where nombre = '{nombre}'";
consultas[3] = $"SELECT Idjuego FROM proyecto.{tabla} where nombre = '{nombre}'";
conexion.Open();
DataTable dtbl = new DataTable();
for (int i = 0; i < consultas.Length; i++)
{
SqlCommand sqlDA = new SqlCommand(consultas[i], conexion);
var resultado = sqlDA.ExecuteScalar();
datos[i] = Convert.ToString(resultado);
}
if (botonElegido != 2)
{
lblNombreJuego.Text = nombre;
pbImagenJuego.Load($"{datos[0]}");
lblPrecio.Text = datos[1];
lblDescripcion.Text = datos[2];
}
else
{
txtId.Text = datos[3].ToString();
txtNombre.Text = nombre;
txtPortada.Text=datos[0].ToString();
txtPrecio.Text = datos[1].ToString();
txtDescripcion.Text = datos[2].ToString();
}
}
private void btnComprar_Click(object sender, EventArgs e)
{
switch (botonElegido)
{
case 0:
//Seleccionar id del juego cuyo nombre sea
string[] consultas = new string[4];
string nombre = lblNombreJuego.Text = dataJuegos.CurrentRow.Cells[0].Value.ToString();
consultas[0] = $"SELECT IdJuego FROM proyecto.Tienda where nombre = '{nombre}'";
consultas[1] = $"SELECT dinero from proyecto.Usuario where Nombre_Usuario ='{cUser}'";
consultas[2] = $"SELECT precio from proyecto.Tienda where nombre ='{nombre}'";
consultas[3] = $"Select IdUsuario from proyecto.usuario where Nombre_usuario='{cUser}'";
string[] resultados = new string[4];
double dineroUser = 0;
double costoJuego = 0;
SqlConnection conexion = new SqlConnection(conexionABDD);
try
{
conexion.Open();
for (int i = 0; i < consultas.Length; i++)
{
SqlCommand sqlDA = new SqlCommand(consultas[i], conexion);
var resultado = sqlDA.ExecuteScalar();
resultados[i] = Convert.ToString(resultado);
}
dineroUser = Convert.ToDouble(resultados[1]);
costoJuego = Convert.ToDouble(resultados[2]);
string idjuego = resultados[0].ToString();
string iduser = resultados[3].ToString();
// MessageBox.Show($"{dineroUser} {costoJuego}");
if (dineroUser < costoJuego)
{
MessageBox.Show($"No se puede hacer la compra, no cuentas con los fondos suficientes, tienes {resultados[1]}");
}
else
{
double resta = dineroUser - costoJuego;
var opcion = MessageBox.Show($"Tienes {dineroUser} pesos, te quedarían" +
$" {resta} ", "Aviso", MessageBoxButtons.YesNo);
if (opcion == DialogResult.Yes)
{
procedimientosAlmacenadosTienda();
//Crear procedimiento para insert para el juego añadido a su biblioteca
//Crear procedimiento update para el dinero retirado de su cuenta
//Ejecutar el procedimiento almacenado para añadir el juego a la biblioteca
string[] compra = new string[2];
DateTime fechaActual = DateTime.Now;
string fechaFormateada = fechaActual.ToString("yyyyMMdd");
MessageBox.Show(fechaFormateada.ToString());
compra[0] = "exec proyecto.proce_CompraJuego " +
$"@IdUsuario ={iduser}," +
$"@idjuego={idjuego}," +
$"@fechacompra = '{fechaFormateada}'";
compra[1] = "exec proyecto.proce_RestarDinero " +
$"@IdUsuario ={iduser}," +
$"@Dinero={resta}";
for (int i = 0; i < compra.Length; i++)
{
using (SqlCommand command = new SqlCommand(compra[i], conexion))
{
// Ejecutar la consulta
command.ExecuteNonQuery();
// MessageBox.Show($"Creado exitosamente los datos de las tablas{i}");
}
}
MessageBox.Show("Felicidades por su nueva compra");
actualizarDinero();
}
}
}
catch (Exception ex)
{
MessageBox.Show("Error de inicio de sesión: " + ex.Message);
}
break;
case 1:
MessageBox.Show("El juego iniciará pronto");
break;
case 2:
string consulta="";
if (rbAdd.Checked)
{
consulta = "exec proyecto.proce_BaseTienda " +
$"@IdJuego ={txtId.Text} , " +
$"@Portada = '{txtPortada.Text}'," +
$"@Nombre = '{txtNombre.Text}', " +
$"@Precio = {txtPrecio.Text}, " +
$"@Descripcion = '{txtDescripcion.Text}';";
}
else if (rbEliminar.Checked)
{
var op= MessageBox.Show($"Seguro que deseas eliminar el juego con el id ={txtId.Text}","Advertencia",MessageBoxButtons.YesNo);
if (op==DialogResult.Yes)
{
consulta = "exec proyecto.proce_EliminarJuego " +
$"@IdJuego ={txtId.Text} ;";
}
}
else if (rbModificar.Checked)
{
consulta = "exec proyecto.proce_ActualizarJuego " +
$"@IdJuego ={txtId.Text} , " +
$"@Portada = '{txtPortada.Text}'," +
$"@Nombre = '{txtNombre.Text}', " +
$"@Precio = {txtPrecio.Text}, " +
$"@Descripcion = '{txtDescripcion.Text}';";
}
else
{
MessageBox.Show("Elija un botón");
}
MessageBox.Show(consulta);
using (SqlConnection con = new SqlConnection(conexionABDD))
{
con.Open();
using (SqlCommand command = new SqlCommand(consulta, con))
{
// Ejecutar la consulta
command.ExecuteNonQuery();
// MessageBox.Show($"Creado exitosamente los datos de las tablas{i}");
SqlDataAdapter sqlDA = new SqlDataAdapter("SELECT nombre as 'Nombre del videojuego' FROM proyecto.Tienda ", con);
DataTable dtbl = new DataTable();
sqlDA.Fill(dtbl);
dataJuegos.DataSource = dtbl;
}
}
break;
}
}
private void btnLibreria_Click(object sender, EventArgs e)
{
ocultar();
hacerVisible(1);
botonElegido=1;
using (SqlConnection conexion = new SqlConnection(conexionABDD))
{
try
{
conexion.Open();
SqlDataAdapter sqlDA = new SqlDataAdapter("select ti.Nombre" +
" FROM proyecto.Libreria li " +
"JOIN proyecto.Usuario us ON li.IdUsuario = us.IdUsuario " +
"JOIN proyecto.Tienda ti ON li.IdJuego = ti.IdJuego " +
$"where us.Nombre_Usuario='{cUser}' ", conexion);
DataTable dtbl = new DataTable();
sqlDA.Fill(dtbl);
dataJuegos.DataSource = dtbl;
}
catch (Exception ex)
{
MessageBox.Show("Error de inicio de sesión: " + ex.Message);
}
}
}
public void btnAdministrar_Click(object sender, EventArgs e)
{
ocultar();
hacerVisible(2);
procedimientosAlmacenadosJuegos();
botonElegido = 2;
using (SqlConnection conexion = new SqlConnection(conexionABDD))
{
try
{
conexion.Open();
SqlDataAdapter sqlDA = new SqlDataAdapter("SELECT nombre as 'Nombre del videojuego' FROM proyecto.Tienda ", conexion);
DataTable dtbl = new DataTable();
sqlDA.Fill(dtbl);
dataJuegos.DataSource = dtbl;
}
catch (Exception ex)
{
MessageBox.Show("Error de inicio de sesión: " + ex.Message);
}
}
}
private void btnAuditoria_Click(object sender, EventArgs e)
{
ocultar();
hacerVisible(3);
botonElegido = 3;
using (SqlConnection conexion = new SqlConnection(c))
{
try
{
conexion.Open();
SqlDataAdapter sqlDA = new SqlDataAdapter("SELECT id_evento as 'Id evento'," +
"tipo_evento as 'Tipo evento',fecha as 'Fecha', descripcion as 'Descripción'" +
", usuario as 'Usuario', terminal as 'Terminal'," +
"aplicacion as 'Aplicación' FROM proyecto.Auditoria ", conexion);
DataTable dtbl = new DataTable();
sqlDA.Fill(dtbl);
dataJuegos.DataSource = dtbl;
}
catch (Exception ex)
{
MessageBox.Show("Error de inicio de sesión: " + ex.Message);
}
}
}
private void btnReporte_Click(object sender, EventArgs e)
{
try
{
ocultar();
hacerVisible(4);
botonElegido = 4;
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
public void procedimientosAlmacenadosTienda()
{
string[] procedimientos = new string[2];
procedimientos[0] = "IF NOT EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND OBJECT_ID = OBJECT_ID('proyecto.proce_CompraJuego'))" +
"BEGIN " +
"EXEC('" +
"CREATE PROCEDURE proyecto.proce_CompraJuego(" +
"@IdUsuario INT," +
"@IdJuego INT," +
"@FechaCompra DATE) " +
"AS " +
"BEGIN " +
"INSERT INTO proyecto.Libreria (" +
"IdUsuario," +
"IdJuego," +
"FechaCompra) " +
"VALUES ( " +
"@IdUsuario," +
"@IdJuego," +
"@FechaCompra" +
")" +
"END')" +
"END;";
procedimientos[1] = "IF NOT EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND OBJECT_ID = OBJECT_ID('proyecto.proce_RestarDinero'))" +
"BEGIN " +
"EXEC('" +
"CREATE PROCEDURE proyecto.proce_RestarDinero(" +
"@IdUsuario INT," +
"@Dinero MONEY ) " +
"AS " +
"BEGIN " +
"UPDATE proyecto.Usuario SET Dinero=@Dinero WHERE IdUsuario=@IdUsuario " +
"END')" +
"END;";
SqlConnection conexion = new SqlConnection(c);
try
{
conexion.Open();
for (int i = 0; i < procedimientos.Length; i++)
{
using (SqlCommand command = new SqlCommand(procedimientos[i], conexion))
{
// Ejecutar la consulta
command.ExecuteNonQuery();
// MessageBox.Show($"Creado exitosamente los datos de las tablas{i}");
}
}
}
catch (Exception ex)
{
MessageBox.Show("Error de inicio de sesión: " + ex.Message);
}
conexion.Close();
}
public void procedimientosAlmacenadosJuegos()
{
string[] procedimientos = new string[2];
procedimientos[0] = "IF NOT EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND OBJECT_ID = OBJECT_ID('proyecto.proce_EliminarJuego'))" +
"BEGIN " +
"EXEC('" +
"CREATE PROCEDURE proyecto.proce_EliminarJuego(" +
"@IdJuego INT) " +
"AS " +
"BEGIN " +
"Delete FROM proyecto.Tienda " +
"WHERE " +
"IdJuego = @IdJuego " +
"END')" +
"END;";
procedimientos[1] = "IF NOT EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND OBJECT_ID = OBJECT_ID('proyecto.proce_ActualizarJuego'))" +
"BEGIN " +
"EXEC('" +
"CREATE PROCEDURE proyecto.proce_ActualizarJuego(" +
"@IdJuego INT, " +
"@Portada VARCHAR(2083), " +
"@Nombre VARCHAR(50), " +
"@Precio MONEY, " +
"@Descripcion VARCHAR(200)) " +
"AS " +
"BEGIN " +
"UPDATE proyecto.Tienda SET Portada=@Portada, Nombre=@Nombre, Precio=@Precio, Descripcion=@Descripcion " +
"WHERE " +
"IdJuego = @IdJuego " +
"END')" +
"END;";
SqlConnection conexion = new SqlConnection(c);
try
{
conexion.Open();
for (int i = 0; i < procedimientos.Length; i++)
{
using (SqlCommand command = new SqlCommand(procedimientos[i], conexion))
{
// Ejecutar la consulta
command.ExecuteNonQuery();
// MessageBox.Show($"Creado exitosamente los datos de las tablas{i}");
}
}
}
catch (Exception ex)
{
MessageBox.Show("Error de inicio de sesión: " + ex.Message);
}
conexion.Close();
}
public void actualizarDinero()
{
SqlConnection conexion = new SqlConnection(conexionABDD);
conexion.Open();
string consulta = $"SELECT Dinero from proyecto.Usuario where Nombre_Usuario='{cUser}'";
using (SqlCommand command = new SqlCommand(consulta, conexion))
{
var resultado = command.ExecuteScalar();
lblDinero.Text = Convert.ToString(resultado);
}
}
private void rbModificar_CheckedChanged(object sender, EventArgs e)
{
}
private void btnBackup_Click(object sender, EventArgs e)
{
//exec proyecto.proceBackup
SqlConnection conexion = new SqlConnection(conexionABDD);
conexion.Open();
string consulta = $"exec proyecto.proceBackup";
using (SqlCommand command = new SqlCommand(consulta, conexion))
{
command.ExecuteNonQuery();
}
MessageBox.Show("Se ha guardado la base de datos actual");
conexion.Close();
}
private void btnRestaurar_Click(object sender, EventArgs e)
{
SqlConnection conexion = new SqlConnection(c);
conexion.Open();
string consulta = $"use master " +
$"Alter Database proyectofinaltbdd SET SINGLE_USER With ROLLBACK IMMEDIATE " +
$"exec proceRestaurar " +
$"ALTER DATABASE proyectofinaltbdd SET Multi_User " +
$"use proyectofinaltbdd ";
using (SqlCommand command = new SqlCommand(consulta, conexion))
{
command.ExecuteNonQuery();
}
MessageBox.Show("Se ha restaurado la base de datos a una versión anterior");
conexion.Close();
}
private void bindingSource1_CurrentChanged(object sender, EventArgs e)
{
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
}
}
}