-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form4.cs
777 lines (739 loc) · 36 KB
/
Form4.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
using MySql.Data.MySqlClient;
using System;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Drawing;
using System.Globalization;
using System.Windows.Forms;
namespace Proyecto_09
{
public class Form4 : Form
{
private IContainer components = null;
private DataGridView dataGridView1;
private Button buttonExit;
private TextBox textBox1;
private Label label1;
private Label label2;
private Button button1;
private Label labelTexto1;
private Label labelTexto2;
private Label labelTexto3;
private Label labelTexto4;
private Label labelTexto5;
private Label labelTexto6;
private Label labelTexto7;
private Label labelTexto8;
private Label labelTexto9;
private Label labelTexto10;
private Label labelTexto11;
private Label labelTexto12;
private Label labelTexto13;
private Label labelTexto14;
public Form4()
{
this.InitializeComponent();
this.llenarTabla();
}
private bool alertaHoras(string num_horas_para_mantenimiento, int tiempoHorasPasadas)
{
bool flag;
bool alerta = false;
if (tiempoHorasPasadas < int.Parse(num_horas_para_mantenimiento) * 90 / 100)
{
flag = alerta;
}
else
{
alerta = true;
flag = alerta;
}
return flag;
}
private bool alertaUnidades(string num_meta, int numeroUnidades)
{
bool flag;
flag = (numeroUnidades < int.Parse(num_meta) * 90 / 100 ? false : true);
return flag;
}
private void button1_Click(object sender, EventArgs e)
{
int num;
string id = this.textBox1.Text;
string query = string.Concat("SELECT * FROM hojaprod WHERE id = '", id, "'");
MySqlConnection conexion = Conectar.Conecta();
conexion.Open();
try
{
MySqlDataReader reader = (new MySqlCommand(query, conexion)).ExecuteReader();
if (!reader.Read())
{
MessageBox.Show("No se encontro el registro");
}
else
{
string num_meta = reader["numero_meta"].ToString();
string num_actual = reader["numero_actual"].ToString();
string num_completo_satisfractorio = reader["numero_completo_satisfractorio"].ToString();
string num_completo_no_satisfactorio = reader["numero_completo_no_satisfactorio"].ToString();
string num_horas_activo_por_dia = reader["numero_horas_activo_por_dia"].ToString();
string num_horas_para_mantenimiento = reader["numero_horas_para_mantenimiento"].ToString();
string fecha_de_inicio_hora = reader["fecha_de_inicio_horas"].ToString();
string tiempo_duracion_even = reader["tiempo_duracion_evento"].ToString();
string dia_del_even = reader["dia_del_evento"].ToString();
string descripcion_del_even = reader["descripcion_del_evento"].ToString();
tiempo_duracion_even = ((string.IsNullOrEmpty(tiempo_duracion_even) ? false : tiempo_duracion_even != "") ? reader["tiempo_duracion_evento"].ToString() : "0");
DateTime DateObject = Convert.ToDateTime(fecha_de_inicio_hora, new CultureInfo("en-US"));
TimeSpan TimeObject = DateTime.Now - DateObject;
int tiempoHorasPasadas = this.calculoHorasPasadas(num_horas_activo_por_dia, TimeObject.Days, num_horas_para_mantenimiento);
int numeroUnidades = this.unidades(num_completo_satisfractorio, num_completo_no_satisfactorio);
DateTime fecha = this.calculoDiasEstimados(num_horas_activo_por_dia, num_horas_para_mantenimiento, fecha_de_inicio_hora);
bool alerta1 = this.alertaHoras(num_horas_para_mantenimiento, tiempoHorasPasadas);
bool alerta2 = this.alertaUnidades(num_meta, numeroUnidades);
if ((!alerta1 ? false : alerta2))
{
this.consulta3(id, 3, "Alerta de Horas y Unidades");
}
else if ((!alerta1 ? false : !alerta2))
{
this.consulta3(id, 1, "Alerta de Horas");
}
else if ((!alerta2 ? true : alerta1))
{
this.consulta3(id, 0, "Sin Alerta");
}
else
{
this.consulta3(id, 2, "Alerta de Unidades");
}
int consul = this.consulta2(id);
if (consul == 1)
{
string texto1 = string.Concat("ID: ", id);
string texto2 = string.Concat("Casos a Atender: ", num_meta);
string texto3 = string.Concat("Casos Atendidos: ", num_actual);
string texto4 = string.Concat("Numero de Casos Conformes: ", num_completo_satisfractorio);
string texto5 = string.Concat("Numero de Casos No Conformes: ", num_completo_no_satisfactorio);
string texto6 = string.Concat("Numero de horas activo por dia: ", num_horas_activo_por_dia);
string texto7 = string.Concat("Numero de horas para mantenimiento: ", num_horas_para_mantenimiento);
string texto8 = string.Concat("Fecha de inicio horas: ", fecha_de_inicio_hora);
string texto9 = string.Concat("Tiempo de duracion del evento: ", tiempo_duracion_even);
string texto10 = string.Concat("Dia del evento: ", dia_del_even);
string texto11 = string.Concat("Descripcion del evento: ", this.verificarTexto(descripcion_del_even));
string[] str = new string[] { "Horas pasadas hasta el dia de hoy: ", tiempoHorasPasadas.ToString(), " horas se recomienda realizar mantenimiento al llegar a ", null, null };
num = Convert.ToInt32(num_horas_para_mantenimiento) * 90 / 100;
str[3] = num.ToString();
str[4] = " horas";
string texto12 = string.Concat(str);
string[] strArrays = new string[] { "Numero de unidades: ", numeroUnidades.ToString(), " se le notificara al usuario cuando llegue a ", null, null };
num = Convert.ToInt32(num_meta) * 90 / 100;
strArrays[3] = num.ToString();
strArrays[4] = " unidades";
string texto13 = string.Concat(strArrays);
string texto14 = string.Concat("Fecha estimada de finalizacion: ", fecha.ToString());
this.labelTexto1.Text = texto1;
this.labelTexto2.Text = texto2;
this.labelTexto3.Text = texto3;
this.labelTexto4.Text = texto4;
this.labelTexto5.Text = texto5;
this.labelTexto6.Text = texto6;
this.labelTexto7.Text = texto7;
this.labelTexto8.Text = texto8;
this.labelTexto9.Text = texto9;
this.labelTexto10.Text = texto10;
this.labelTexto11.Text = texto11;
this.labelTexto12.Text = texto12;
this.labelTexto13.Text = texto13;
this.labelTexto14.Text = texto14;
}
else if (consul == 2)
{
string texto1 = string.Concat("ID: ", id);
string texto2 = string.Concat("Numero de meta: ", num_meta);
string texto3 = string.Concat("Numero actual: ", num_actual);
string texto4 = string.Concat("Numero de unidades conformes: ", num_completo_satisfractorio);
string texto5 = string.Concat("Numero de unidades rechazadas: ", num_completo_no_satisfactorio);
string texto6 = string.Concat("Numero de horas activo por dia: ", num_horas_activo_por_dia);
string texto7 = string.Concat("Numero de horas para mantenimiento: ", num_horas_para_mantenimiento);
string texto8 = string.Concat("Fecha de inicio horas: ", fecha_de_inicio_hora);
string texto9 = string.Concat("Tiempo de duracion del evento: ", tiempo_duracion_even);
string texto10 = string.Concat("Dia del evento: ", dia_del_even);
string texto11 = string.Concat("Descripcion del evento: ", this.verificarTexto(descripcion_del_even));
string[] str1 = new string[] { "Horas pasadas hasta el dia de hoy: ", tiempoHorasPasadas.ToString(), " horas se recomienda realizar mantenimiento al llegar a ", null, null };
num = Convert.ToInt32(num_horas_para_mantenimiento) * 90 / 100;
str1[3] = num.ToString();
str1[4] = " horas";
string texto12 = string.Concat(str1);
string[] strArrays1 = new string[] { "Numero de unidades: ", numeroUnidades.ToString(), " se le notificara al usuario cuando llegue a ", null, null };
num = Convert.ToInt32(num_meta) * 90 / 100;
strArrays1[3] = num.ToString();
strArrays1[4] = " unidades";
string texto13 = string.Concat(strArrays1);
string texto14 = string.Concat("Fecha estimada de finalizacion: ", fecha.ToString());
this.labelTexto1.Text = texto1;
this.labelTexto2.Text = texto2;
this.labelTexto3.Text = texto3;
this.labelTexto4.Text = texto4;
this.labelTexto5.Text = texto5;
this.labelTexto6.Text = texto6;
this.labelTexto7.Text = texto7;
this.labelTexto8.Text = texto8;
this.labelTexto9.Text = texto9;
this.labelTexto10.Text = texto10;
this.labelTexto11.Text = texto11;
this.labelTexto12.Text = texto12;
this.labelTexto13.Text = texto13;
this.labelTexto14.Text = texto14;
}
else if (consul == 3)
{
string texto1 = string.Concat("ID: ", id);
string texto2 = string.Concat("Ingresos Estimados: ", num_meta);
string texto3 = string.Concat("Ingresos Reales: ", num_actual);
string texto4 = string.Concat("Ingresos Conformes", num_completo_satisfractorio);
string texto5 = string.Concat("Ingresos No Conformes: ", num_completo_no_satisfactorio);
string texto6 = string.Concat("Numero de horas activo por dia: ", num_horas_activo_por_dia);
string texto7 = string.Concat("Numero de horas para mantenimiento: ", num_horas_para_mantenimiento);
string texto8 = string.Concat("Fecha de inicio horas: ", fecha_de_inicio_hora);
string texto9 = string.Concat("Tiempo de duracion del evento: ", tiempo_duracion_even);
string texto10 = string.Concat("Dia del evento: ", dia_del_even);
string texto11 = string.Concat("Descripcion del evento: ", this.verificarTexto(descripcion_del_even));
string[] str2 = new string[] { "Horas pasadas hasta el dia de hoy: ", tiempoHorasPasadas.ToString(), " horas se recomienda realizar mantenimiento al llegar a ", null, null };
num = Convert.ToInt32(num_horas_para_mantenimiento) * 90 / 100;
str2[3] = num.ToString();
str2[4] = " horas";
string texto12 = string.Concat(str2);
string[] strArrays2 = new string[] { "Numero de unidades: ", numeroUnidades.ToString(), " se le notificara al usuario cuando llegue a ", null, null };
num = Convert.ToInt32(num_meta) * 90 / 100;
strArrays2[3] = num.ToString();
strArrays2[4] = " unidades";
string texto13 = string.Concat(strArrays2);
string texto14 = string.Concat("Fecha estimada de finalizacion: ", fecha.ToString());
this.labelTexto1.Text = texto1;
this.labelTexto2.Text = texto2;
this.labelTexto3.Text = texto3;
this.labelTexto4.Text = texto4;
this.labelTexto5.Text = texto5;
this.labelTexto6.Text = texto6;
this.labelTexto7.Text = texto7;
this.labelTexto8.Text = texto8;
this.labelTexto9.Text = texto9;
this.labelTexto10.Text = texto10;
this.labelTexto11.Text = texto11;
this.labelTexto12.Text = texto12;
this.labelTexto13.Text = texto13;
this.labelTexto14.Text = texto14;
}
else if (consul == 4)
{
string texto1 = string.Concat("ID: ", id);
string texto2 = string.Concat("Llamadas a Atender: ", this.verificarTexto(num_meta));
string texto3 = string.Concat("Llamadas Atendidas: ", this.verificarTexto(num_actual));
string texto4 = string.Concat("Llamadas Conformes: ", this.verificarTexto(num_completo_satisfractorio));
string texto5 = string.Concat("Llamadas No Conformes: ", this.verificarTexto(num_completo_no_satisfactorio));
string texto6 = string.Concat("Numero de horas activo por dia: ", this.verificarTexto(num_horas_activo_por_dia));
string texto7 = string.Concat("Numero de horas para mantenimiento: ", this.verificarTexto(num_horas_para_mantenimiento));
string texto8 = string.Concat("Fecha de inicio horas: ", this.verificarTexto(fecha_de_inicio_hora));
string texto9 = string.Concat("Tiempo de duracion del evento: ", this.verificarTexto(tiempo_duracion_even));
string texto10 = string.Concat("Dia del evento: ", this.verificarTexto(dia_del_even));
string texto11 = string.Concat("Descripcion del evento: ", this.verificarTexto(descripcion_del_even));
string[] str3 = new string[] { "Horas pasadas hasta el dia de hoy: ", tiempoHorasPasadas.ToString(), " horas se recomienda realizar mantenimiento al llegar a ", null, null };
num = Convert.ToInt32(num_horas_para_mantenimiento) * 90 / 100;
str3[3] = num.ToString();
str3[4] = " horas";
string texto12 = string.Concat(str3);
string[] strArrays3 = new string[] { "Numero de unidades: ", numeroUnidades.ToString(), " se le notificara al usuario cuando llegue a ", null, null };
num = Convert.ToInt32(num_meta) * 90 / 100;
strArrays3[3] = num.ToString();
strArrays3[4] = " unidades";
string texto13 = string.Concat(strArrays3);
string texto14 = string.Concat("Fecha estimada de finalizacion: ", fecha.ToString());
this.labelTexto1.Text = texto1;
this.labelTexto2.Text = texto2;
this.labelTexto3.Text = texto3;
this.labelTexto4.Text = texto4;
this.labelTexto5.Text = texto5;
this.labelTexto6.Text = texto6;
this.labelTexto7.Text = texto7;
this.labelTexto8.Text = texto8;
this.labelTexto9.Text = texto9;
this.labelTexto10.Text = texto10;
this.labelTexto11.Text = texto11;
this.labelTexto12.Text = texto12;
this.labelTexto13.Text = texto13;
this.labelTexto14.Text = texto14;
}
}
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
conexion.Close();
}
private void buttonExit_Click(object sender, EventArgs e)
{
base.Close();
}
private DateTime calculoDiasEstimados(string horaPorDia, string horaTope, string fechaInicio)
{
int horaPorDiaInt = int.Parse(horaPorDia);
int horaTopeInt = int.Parse(horaTope);
DateTime DateObject = Convert.ToDateTime(fechaInicio);
int resultado = 0;
int dias = 0;
while (horaPorDiaInt <= horaTopeInt)
{
horaPorDiaInt += horaPorDiaInt;
resultado += horaPorDiaInt;
dias++;
}
return DateObject.AddDays((double)dias);
}
private int calculoHorasPasadas(string horaPorDia, int fechaInicio, string horasEvento)
{
int num;
int horaPorDiaInt = int.Parse(horaPorDia);
int horasEventoInt = int.Parse(horasEvento);
int resultado = 0;
int dias = fechaInicio;
for (int i = 0; i <= dias; i++)
{
resultado += horaPorDiaInt;
}
if (horasEventoInt != 0)
{
num = resultado;
}
else
{
resultado -= horasEventoInt;
num = resultado;
}
return num;
}
private int consulta2(string id)
{
int num;
string identificador = this.textBox1.Text;
string query = string.Concat("SELECT * FROM hvequipo WHERE id = '", id, "'");
MySqlConnection conexion = Conectar.Conecta();
conexion.Open();
try
{
try
{
MySqlDataReader reader = (new MySqlCommand(query, conexion)).ExecuteReader();
if (!reader.Read())
{
num = 0;
return num;
}
else if (reader["area"].ToString() == "1")
{
num = 1;
return num;
}
else if (reader["area"].ToString() == "2")
{
num = 2;
return num;
}
else if (reader["area"].ToString() == "3")
{
num = 3;
return num;
}
else if (reader["area"].ToString() == "4")
{
num = 4;
return num;
}
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
num = 0;
return num;
}
finally
{
conexion.Close();
}
return num;
}
private void consulta3(string id, int alerta, string descripcionAlerta)
{
int tipoAlerta = alerta;
string query = string.Concat(new string[] { "INSERT INTO alertas (id, tipo_alerta, descripcion_alerta) VALUES ('", id, "', '", tipoAlerta.ToString(), "', '", descripcionAlerta, "')" });
MySqlConnection conexion = Conectar.Conecta();
conexion.Open();
try
{
try
{
(new MySqlCommand(query, conexion)).ExecuteNonQuery();
}
catch (Exception exception)
{
Exception ex = exception;
MessageBox.Show(string.Concat("Error: ", ex.Message));
}
}
finally
{
conexion.Close();
}
}
protected override void Dispose(bool disposing)
{
if ((!disposing ? false : this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.buttonExit = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.labelTexto1 = new System.Windows.Forms.Label();
this.labelTexto2 = new System.Windows.Forms.Label();
this.labelTexto3 = new System.Windows.Forms.Label();
this.labelTexto4 = new System.Windows.Forms.Label();
this.labelTexto5 = new System.Windows.Forms.Label();
this.labelTexto6 = new System.Windows.Forms.Label();
this.labelTexto7 = new System.Windows.Forms.Label();
this.labelTexto8 = new System.Windows.Forms.Label();
this.labelTexto9 = new System.Windows.Forms.Label();
this.labelTexto10 = new System.Windows.Forms.Label();
this.labelTexto11 = new System.Windows.Forms.Label();
this.labelTexto12 = new System.Windows.Forms.Label();
this.labelTexto13 = new System.Windows.Forms.Label();
this.labelTexto14 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
// dataGridView1
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.Padding = new System.Windows.Forms.Padding(10);
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.EnableHeadersVisualStyles = false;
this.dataGridView1.Location = new System.Drawing.Point(12, 41);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.Padding = new System.Windows.Forms.Padding(5, 15, 5, 15);
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dataGridView1.RowHeadersVisible = false;
this.dataGridView1.Size = new System.Drawing.Size(660, 150);
this.dataGridView1.TabIndex = 0;
//
// buttonExit
//
this.buttonExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonExit.FlatAppearance.BorderSize = 0;
this.buttonExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonExit.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonExit.Location = new System.Drawing.Point(597, 12);
this.buttonExit.Name = "buttonExit";
this.buttonExit.Size = new System.Drawing.Size(75, 23);
this.buttonExit.TabIndex = 19;
this.buttonExit.Text = "X";
this.buttonExit.UseVisualStyleBackColor = true;
this.buttonExit.Click += new System.EventHandler(this.buttonExit_Click);
//
// textBox1
//
this.textBox1.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox1.Location = new System.Drawing.Point(203, 249);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 24);
this.textBox1.TabIndex = 20;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(13, 213);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(251, 16);
this.label1.TabIndex = 21;
this.label1.Text = "Generar plan de mantenimiento para:";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(16, 252);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(172, 16);
this.label2.TabIndex = 22;
this.label2.Text = "Numero de identificación";
//
// button1
//
this.button1.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.Location = new System.Drawing.Point(334, 249);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 24);
this.button1.TabIndex = 23;
this.button1.Text = "Generar";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// labelTexto1
//
this.labelTexto1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto1.AutoSize = true;
this.labelTexto1.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto1.Location = new System.Drawing.Point(16, 287);
this.labelTexto1.Name = "labelTexto1";
this.labelTexto1.Size = new System.Drawing.Size(0, 16);
this.labelTexto1.TabIndex = 24;
//
// labelTexto2
//
this.labelTexto2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto2.AutoSize = true;
this.labelTexto2.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto2.Location = new System.Drawing.Point(16, 303);
this.labelTexto2.Name = "labelTexto2";
this.labelTexto2.Size = new System.Drawing.Size(0, 16);
this.labelTexto2.TabIndex = 25;
//
// labelTexto3
//
this.labelTexto3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto3.AutoSize = true;
this.labelTexto3.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto3.Location = new System.Drawing.Point(16, 319);
this.labelTexto3.Name = "labelTexto3";
this.labelTexto3.Size = new System.Drawing.Size(0, 16);
this.labelTexto3.TabIndex = 26;
//
// labelTexto4
//
this.labelTexto4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto4.AutoSize = true;
this.labelTexto4.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto4.Location = new System.Drawing.Point(16, 335);
this.labelTexto4.Name = "labelTexto4";
this.labelTexto4.Size = new System.Drawing.Size(0, 16);
this.labelTexto4.TabIndex = 27;
//
// labelTexto5
//
this.labelTexto5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto5.AutoSize = true;
this.labelTexto5.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto5.Location = new System.Drawing.Point(16, 351);
this.labelTexto5.Name = "labelTexto5";
this.labelTexto5.Size = new System.Drawing.Size(0, 16);
this.labelTexto5.TabIndex = 28;
//
// labelTexto6
//
this.labelTexto6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto6.AutoSize = true;
this.labelTexto6.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto6.Location = new System.Drawing.Point(16, 367);
this.labelTexto6.Name = "labelTexto6";
this.labelTexto6.Size = new System.Drawing.Size(0, 16);
this.labelTexto6.TabIndex = 29;
//
// labelTexto7
//
this.labelTexto7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto7.AutoSize = true;
this.labelTexto7.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto7.Location = new System.Drawing.Point(16, 383);
this.labelTexto7.Name = "labelTexto7";
this.labelTexto7.Size = new System.Drawing.Size(0, 16);
this.labelTexto7.TabIndex = 30;
//
// labelTexto8
//
this.labelTexto8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto8.AutoSize = true;
this.labelTexto8.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto8.Location = new System.Drawing.Point(16, 399);
this.labelTexto8.Name = "labelTexto8";
this.labelTexto8.Size = new System.Drawing.Size(0, 16);
this.labelTexto8.TabIndex = 31;
//
// labelTexto9
//
this.labelTexto9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto9.AutoSize = true;
this.labelTexto9.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto9.Location = new System.Drawing.Point(16, 415);
this.labelTexto9.Name = "labelTexto9";
this.labelTexto9.Size = new System.Drawing.Size(0, 16);
this.labelTexto9.TabIndex = 32;
//
// labelTexto10
//
this.labelTexto10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto10.AutoSize = true;
this.labelTexto10.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto10.Location = new System.Drawing.Point(16, 431);
this.labelTexto10.Name = "labelTexto10";
this.labelTexto10.Size = new System.Drawing.Size(0, 16);
this.labelTexto10.TabIndex = 33;
//
// labelTexto11
//
this.labelTexto11.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto11.AutoSize = true;
this.labelTexto11.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto11.Location = new System.Drawing.Point(16, 447);
this.labelTexto11.Name = "labelTexto11";
this.labelTexto11.Size = new System.Drawing.Size(0, 16);
this.labelTexto11.TabIndex = 34;
//
// labelTexto12
//
this.labelTexto12.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto12.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto12.Location = new System.Drawing.Point(335, 309);
this.labelTexto12.Name = "labelTexto12";
this.labelTexto12.Size = new System.Drawing.Size(337, 48);
this.labelTexto12.TabIndex = 35;
//
// labelTexto13
//
this.labelTexto13.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto13.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto13.Location = new System.Drawing.Point(335, 373);
this.labelTexto13.Name = "labelTexto13";
this.labelTexto13.Size = new System.Drawing.Size(337, 48);
this.labelTexto13.TabIndex = 36;
this.labelTexto13.Click += new System.EventHandler(this.label3_Click);
//
// labelTexto14
//
this.labelTexto14.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTexto14.Font = new System.Drawing.Font("Neo Sans", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTexto14.Location = new System.Drawing.Point(335, 437);
this.labelTexto14.Name = "labelTexto14";
this.labelTexto14.Size = new System.Drawing.Size(337, 48);
this.labelTexto14.TabIndex = 37;
//
// Form4
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(684, 561);
this.Controls.Add(this.labelTexto14);
this.Controls.Add(this.labelTexto13);
this.Controls.Add(this.labelTexto12);
this.Controls.Add(this.labelTexto11);
this.Controls.Add(this.labelTexto10);
this.Controls.Add(this.labelTexto9);
this.Controls.Add(this.labelTexto8);
this.Controls.Add(this.labelTexto7);
this.Controls.Add(this.labelTexto6);
this.Controls.Add(this.labelTexto5);
this.Controls.Add(this.labelTexto4);
this.Controls.Add(this.labelTexto3);
this.Controls.Add(this.labelTexto2);
this.Controls.Add(this.labelTexto1);
this.Controls.Add(this.button1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.buttonExit);
this.Controls.Add(this.dataGridView1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Form4";
this.Text = "Form4";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
private void llenarTabla()
{
DataTable dt = new DataTable();
MySqlConnection conexion = Conectar.Conecta();
string query = "SELECT * FROM hvequipo";
conexion.Open();
try
{
try
{
MySqlCommand cmd = new MySqlCommand(query, conexion);
(new MySqlDataAdapter(cmd)).Fill(dt);
this.dataGridView1.DataSource = dt;
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}
finally
{
conexion.Close();
}
}
private int unidades(string unidadesConformes, string unidadesRechazadas)
{
int unidadesConformesInt = int.Parse(unidadesConformes);
return unidadesConformesInt - int.Parse(unidadesRechazadas);
}
private string verificarTexto(string texto)
{
return (texto != "" ? texto : "No hay datos");
}
}
}