-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tarea.vb
1086 lines (986 loc) · 51.4 KB
/
Tarea.vb
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
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Imports MySql.Data.MySqlClient
#Disable Warning CA1822 ' Marcar miembros como static
#Disable Warning IDE0017 ' Simplificar la inicialización de objetos
Public Class Tarea
Dim db As ReMe_DB
Private categ_adc As Integer = 1
Public categ As Integer = 1
Public estado As Integer = 1
Public panel_tarea As New Panel()
Public funcion_tarea As New PictureBox()
Public desaprobar_tarea As New Button()
Public eliminar_tarea As New PictureBox()
Public fecha_tarea As New Label()
Public aprobar_tarea As New Button()
Public fecha_label_tarea As New Label()
Public nombre_tarea As New Label()
Public tarea_vencimiento As New Label()
Private Shared c As Integer = 0
Private estado_notif As Integer = 0
Private Shared rentrega As Integer = 0
Public Property Rt As Integer
Get
Return rentrega
End Get
Set(value As Integer)
rentrega = value
End Set
End Property
Public Property Ctg As Integer
Get
Return categ
End Get
Set(value As Integer)
categ = value
End Set
End Property
Public Property CAdc As Integer
Get
Return categ_adc
End Get
Set(value As Integer)
categ_adc = value
End Set
End Property
Public ReadOnly Property Id_increment As Integer
Get
Return c
End Get
End Property
Public ReadOnly Property Efn As Integer
Get
Return estado_notif
End Get
End Property
Public Sub Crear_Tarea(Nombre As String, Finalizacion As Date, IdUsuario As Integer, venc As Date)
Try
db = New ReMe_DB
db.miComando.CommandText = "Crear_Tarea"
db.miComando.CommandType = CommandType.StoredProcedure
Dim param1 As New MySqlParameter("n1", MySqlDbType.VarChar)
Dim param2 As New MySqlParameter("n2", MySqlDbType.Int32)
Dim param3 As New MySqlParameter("n3", MySqlDbType.Int32)
Dim param4 As New MySqlParameter("n4", MySqlDbType.Int32)
Dim param5 As New MySqlParameter("n5", MySqlDbType.Date)
Dim param6 As New MySqlParameter("n6", MySqlDbType.Date)
Dim param7 As New MySqlParameter("n7", MySqlDbType.Int32)
Dim param8 As New MySqlParameter("n8", MySqlDbType.Date)
param1.Direction = ParameterDirection.Input
param2.Direction = ParameterDirection.Input
param3.Direction = ParameterDirection.Input
param4.Direction = ParameterDirection.Input
param5.Direction = ParameterDirection.Input
param6.Direction = ParameterDirection.Input
param7.Direction = ParameterDirection.Input
param8.Direction = ParameterDirection.Input
param1.Value = Nombre
If rt <> 0 Then
categ = 2
End If
param2.Value = categ
param3.Value = estado
param4.Value = categ_adc
param5.Value = Now()
param6.Value = Finalizacion
param7.Value = IdUsuario
param8.Value = venc
db.miComando.Parameters.Add(param1)
db.miComando.Parameters.Add(param2)
db.miComando.Parameters.Add(param3)
db.miComando.Parameters.Add(param4)
db.miComando.Parameters.Add(param5)
db.miComando.Parameters.Add(param6)
db.miComando.Parameters.Add(param7)
db.miComando.Parameters.Add(param8)
Dim rd As MySqlDataReader = db.miComando.ExecuteReader
If rd.Read() Then
c = rd.GetInt32(0)
estado_notif = rd.GetInt32(1)
End If
panel_tarea.BorderStyle = BorderStyle.FixedSingle
panel_tarea.Controls.Add(eliminar_tarea)
panel_tarea.Controls.Add(funcion_tarea)
panel_tarea.Controls.Add(desaprobar_tarea)
panel_tarea.Controls.Add(aprobar_tarea)
panel_tarea.Controls.Add(fecha_tarea)
panel_tarea.Controls.Add(fecha_label_tarea)
panel_tarea.Controls.Add(nombre_tarea)
panel_tarea.Controls.Add(tarea_vencimiento)
panel_tarea.Location = New Point(3, 94)
panel_tarea.Name = "Tarea_" & c
panel_tarea.Size = New Size(504, 85)
panel_tarea.TabIndex = 1
panel_tarea.Visible = True
eliminar_tarea.Cursor = Cursors.Hand
eliminar_tarea.Image = My.Resources.Resource1.cerrar_tarea
eliminar_tarea.Location = New Point(458, 29)
eliminar_tarea.Name = "BtnEliminar_" & c
eliminar_tarea.Size = New Size(35, 31)
eliminar_tarea.SizeMode = PictureBoxSizeMode.StretchImage
eliminar_tarea.TabIndex = 14
eliminar_tarea.TabStop = False
eliminar_tarea.Visible = False
funcion_tarea.Cursor = Cursors.Hand
funcion_tarea.Image = My.Resources.Resource1.plus_img
funcion_tarea.Location = New Point(458, 29)
funcion_tarea.Name = "BtnFunciones_" & c
funcion_tarea.Size = New Size(34, 30)
funcion_tarea.SizeMode = PictureBoxSizeMode.StretchImage
funcion_tarea.TabIndex = 14
funcion_tarea.TabStop = False
desaprobar_tarea.AccessibleDescription = "Marcar tarea como desaprobada"
desaprobar_tarea.AccessibleName = "Desaprobado"
desaprobar_tarea.Cursor = Cursors.Hand
desaprobar_tarea.FlatStyle = FlatStyle.Flat
desaprobar_tarea.Font = New Font("Segoe UI", 9.0!, FontStyle.Regular, GraphicsUnit.Point)
desaprobar_tarea.ForeColor = Color.White
desaprobar_tarea.Location = New Point(378, 29)
desaprobar_tarea.Name = "BtnDesaprobado_" & c
desaprobar_tarea.Size = New Size(34, 30)
desaprobar_tarea.TabIndex = 14
desaprobar_tarea.TabStop = False
desaprobar_tarea.Text = "Dp"
desaprobar_tarea.UseVisualStyleBackColor = True
desaprobar_tarea.Visible = False
aprobar_tarea.AccessibleDescription = "Marcar tarea como aprobada"
aprobar_tarea.AccessibleName = "Aprobado"
aprobar_tarea.Cursor = Cursors.Hand
aprobar_tarea.FlatStyle = FlatStyle.Flat
aprobar_tarea.Font = New Font("Segoe UI", 9.0!, FontStyle.Regular, GraphicsUnit.Point)
aprobar_tarea.ForeColor = Color.White
aprobar_tarea.Location = New Point(418, 29)
aprobar_tarea.Name = "BtnAprobado_" & c
aprobar_tarea.Size = New Size(34, 30)
aprobar_tarea.TabIndex = 12
aprobar_tarea.TabStop = False
aprobar_tarea.Text = "Ap"
aprobar_tarea.UseVisualStyleBackColor = True
aprobar_tarea.Visible = False
fecha_tarea.AutoSize = True
fecha_tarea.Font = New Font("Segoe UI", 11.0!, FontStyle.Regular, GraphicsUnit.Point)
fecha_tarea.ForeColor = Color.White
fecha_tarea.Location = New Point(160, 39)
fecha_tarea.Name = "FechaTarea_" & c
fecha_tarea.Size = New Size(69, 20)
fecha_tarea.TabIndex = 3
fecha_tarea.Text = Finalizacion
fecha_label_tarea.AutoSize = True
fecha_label_tarea.Font = New Font("Segoe UI", 11.0!, FontStyle.Regular, GraphicsUnit.Point)
fecha_label_tarea.ForeColor = Color.White
fecha_label_tarea.Location = New Point(10, 39)
fecha_label_tarea.Name = "FechaLabelTarea_" & c
fecha_label_tarea.Size = New Size(151, 20)
fecha_label_tarea.TabIndex = 2
fecha_label_tarea.Text = "Fecha de finalización:"
nombre_tarea.AutoSize = True
nombre_tarea.Font = New Font("Segoe UI", 13.0!, FontStyle.Regular, GraphicsUnit.Point)
nombre_tarea.ForeColor = Color.White
nombre_tarea.Location = New Point(10, 11)
nombre_tarea.Name = "NombreTarea_" & c
nombre_tarea.Size = New Size(80, 25)
nombre_tarea.TabIndex = 1
nombre_tarea.Text = Nombre
tarea_vencimiento.AutoSize = True
tarea_vencimiento.Font = New Font("Segoe UI", 13.0!, FontStyle.Regular, GraphicsUnit.Point)
tarea_vencimiento.ForeColor = Color.White
tarea_vencimiento.Location = New Point(150, 11)
tarea_vencimiento.Name = "Vencimiento_" & c
tarea_vencimiento.Size = New Size(80, 25)
tarea_vencimiento.TabIndex = 1
tarea_vencimiento.Text = venc
tarea_vencimiento.Visible = False
If categ = 1 Then
Form2.contenedor_tareas.Controls.Add(panel_tarea)
Else
Form3.contenedor_tareas.Controls.Add(panel_tarea)
End If
AddHandler funcion_tarea.Click, AddressOf Funcion_tarea_Click
AddHandler aprobar_tarea.Click, AddressOf Aprobar_tarea_Click
AddHandler desaprobar_tarea.Click, AddressOf Desaprobar_tarea_Click
AddHandler eliminar_tarea.Click, AddressOf Eliminar_tarea_Click
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public Sub Eliminar_tarea_Click(sender As Object, e As EventArgs)
Try
If Form2.contenedor_tareas.Controls.Count > 0 And Form1.Contenedor_tareas.Controls.ContainsKey("Form2") Then
Form1.Notif_Globales_Timer.Enabled = False
Form1.Vencimiento_Globales_Timer.Enabled = False
End If
If Form3.contenedor_tareas.Controls.Count > 0 And Form1.Contenedor_tareas.Controls.ContainsKey("Form3") Then
Form1.Notif_Importantes_Timer.Enabled = False
Form1.Vencimiento_Importantes_Timer.Enabled = False
End If
If Form4.contenedor_tareas.Controls.Count > 0 And Form1.Contenedor_tareas.Controls.ContainsKey("Form3") Then
Form1.Vencimiento_Olvidadas_Timer.Enabled = False
End If
db = New ReMe_DB
db.miComando.CommandText = "Eliminar_Tarea"
db.miComando.CommandType = CommandType.StoredProcedure
Dim p1 As New MySqlParameter("n1", MySqlDbType.Int32)
p1.Direction = ParameterDirection.Input
p1.Value = CType(sender, PictureBox).Name.Split("_")(1)
db.miComando.Parameters.Add(p1)
db.miComando.ExecuteNonQuery()
db.Dispose()
Dim notif_eliminada As New NotifyIcon With {
.Icon = My.Resources.Resource1.notificacion,
.Text = "ReMe",
.BalloonTipTitle = $"[ReMe] La tarea fué borrada con éxito",
.BalloonTipText = $"La tarea se eliminó definitivamente del sistema.",
.Visible = True
}
notif_eliminada.ShowBalloonTip(5000)
If Form2.contenedor_tareas.Controls.Count > 0 And Form1.Contenedor_tareas.Controls.ContainsKey("Form2") Then
Dim indx_notif As Integer = Form1.ids_globales_notif.IndexOf(Convert.ToInt32(CType(sender, PictureBox).Name.Split("_")(1)))
Form1.ids_globales_notif_estado.RemoveAt(Convert.ToInt32(indx_notif))
Form1.ids_globales_notif.Remove(Convert.ToInt32(CType(sender, PictureBox).Name.Split("_")(1)))
Form1.ids_globales_venc.Remove(Convert.ToInt32(CType(sender, PictureBox).Name.Split("_")(1)))
Form2.contenedor_tareas.Controls.RemoveByKey("Tarea_" & CType(sender, PictureBox).Name.Split("_")(1))
If Form2.contenedor_tareas.Controls.Count >= 1 Then
Form1.Notif_Globales_Timer.Enabled = True
Form1.Vencimiento_Globales_Timer.Enabled = True
End If
End If
If Form3.contenedor_tareas.Controls.Count > 0 And Form1.Contenedor_tareas.Controls.ContainsKey("Form3") Then
Dim indx_notif As Integer = Form1.ids_importantes_notif.IndexOf(Convert.ToInt32(CType(sender, PictureBox).Name.Split("_")(1)))
Form1.ids_importantes_notif_estado.RemoveAt(Convert.ToInt32(indx_notif))
Form1.ids_importantes_notif.Remove(Convert.ToInt32(CType(sender, PictureBox).Name.Split("_")(1)))
Form1.ids_importantes_venc.Remove(Convert.ToInt32(CType(sender, PictureBox).Name.Split("_")(1)))
Form3.contenedor_tareas.Controls.RemoveByKey("Tarea_" & CType(sender, PictureBox).Name.Split("_")(1))
If Form3.contenedor_tareas.Controls.Count >= 1 Then
Form1.Notif_Importantes_Timer.Enabled = True
Form1.Vencimiento_Importantes_Timer.Enabled = True
End If
End If
If Form4.contenedor_tareas.Controls.Count > 0 And Form1.Contenedor_tareas.Controls.ContainsKey("Form4") Then
Form1.ids_olvidadas_venc.Remove(Convert.ToInt32(CType(sender, PictureBox).Name.Split("_")(1)))
Form4.contenedor_tareas.Controls.RemoveByKey("Tarea_" & CType(sender, PictureBox).Name.Split("_")(1))
If Form4.contenedor_tareas.Controls.Count >= 1 Then
Form1.Vencimiento_Olvidadas_Timer.Enabled = True
End If
End If
If Form5.contenedor_tareas.Controls.Count > 0 And Form1.Contenedor_tareas.Controls.ContainsKey("Form5") Then
Form5.contenedor_tareas.Controls.RemoveByKey("Tarea_" & CType(sender, PictureBox).Name.Split("_")(1))
End If
Actualizar_Tareas()
Catch ex As Exception
MsgBox("Se produjo un error al intentar eliminar la tarea..", vbCritical, "ERROR")
End Try
End Sub
Public Sub Desaprobar_tarea_Click(sender As Object, e As EventArgs)
Try
If Form2.contenedor_tareas.Controls.Count > 0 Then
Form1.Notif_Globales_Timer.Enabled = False
Form1.Vencimiento_Globales_Timer.Enabled = False
End If
If Form3.contenedor_tareas.Controls.Count > 0 Then
Form1.Notif_Importantes_Timer.Enabled = False
Form1.Vencimiento_Importantes_Timer.Enabled = False
End If
If Form4.contenedor_tareas.Controls.Count > 0 Then
Form1.Vencimiento_Olvidadas_Timer.Enabled = False
End If
db = New ReMe_DB
db.miComando.CommandText = "Actualizar_Estado"
db.miComando.CommandType = CommandType.StoredProcedure
Dim param1 As New MySqlParameter("n1", MySqlDbType.Int32)
Dim param2 As New MySqlParameter("n2", MySqlDbType.Int32)
param1.Direction = ParameterDirection.Input
param2.Direction = ParameterDirection.Input
param1.Value = 3
param2.Value = Convert.ToInt32(CType(sender, Button).Name.Split("_")(1))
db.miComando.Parameters.Add(param1)
db.miComando.Parameters.Add(param2)
db.miComando.ExecuteNonQuery()
db.Dispose()
If Form2.contenedor_tareas.Controls.ContainsKey($"{"Tarea_" & CType(sender, Button).Name.Split("_")(1)}") Then
Dim indx_notif As Integer = Form1.ids_globales_notif.IndexOf(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form1.ids_globales_notif_estado.RemoveAt(Convert.ToInt32(indx_notif))
Form1.ids_globales_notif.Remove(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form1.ids_globales_venc.Remove(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form2.contenedor_tareas.Controls.RemoveByKey("Tarea_" & CType(sender, Button).Name.Split("_")(1))
If Form2.contenedor_tareas.Controls.Count >= 1 Then
Form1.Notif_Globales_Timer.Enabled = True
Form1.Vencimiento_Globales_Timer.Enabled = True
End If
End If
If Form3.contenedor_tareas.Controls.ContainsKey($"{"Tarea_" & CType(sender, Button).Name.Split("_")(1)}") Then
Dim indx_notif As Integer = Form1.ids_importantes_notif.IndexOf(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form1.ids_importantes_notif_estado.RemoveAt(indx_notif)
Form1.ids_importantes_notif.Remove(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form1.ids_importantes_venc.Remove(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form3.contenedor_tareas.Controls.RemoveByKey("Tarea_" & CType(sender, Button).Name.Split("_")(1))
If Form3.contenedor_tareas.Controls.Count >= 1 Then
Form1.Notif_Importantes_Timer.Enabled = True
Form1.Vencimiento_Importantes_Timer.Enabled = True
End If
End If
If Form4.contenedor_tareas.Controls.ContainsKey($"{"Tarea_" & CType(sender, Button).Name.Split("_")(1)}") Then
Form1.ids_olvidadas_venc.Remove(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form4.contenedor_tareas.Controls.RemoveByKey("Tarea_" & CType(sender, Button).Name.Split("_")(1))
Form1.Vencimiento_Olvidadas_Timer.Enabled = True
End If
Actualizar_Tareas()
Catch ex As Exception
MsgBox(ex.Message, vbOKOnly + vbCritical, "Error")
End Try
End Sub
Public Sub Funcion_tarea_Click(sender As Object, e As EventArgs)
Dim ap_tarea As Button
Dim dp_tarea As Button
Dim re_tarea As Button
If Form1.Contenedor_tareas.Controls.ContainsKey("Form2") Then
ap_tarea = Form2.contenedor_tareas.Controls.Find("BtnAprobado_" & CType(sender, PictureBox).Name.Split("_")(1), True)(0)
dp_tarea = Form2.contenedor_tareas.Controls.Find("BtnDesaprobado_" & CType(sender, PictureBox).Name.Split("_")(1), True)(0)
ElseIf Form1.Contenedor_tareas.Controls.ContainsKey("Form3") Then
ap_tarea = Form3.contenedor_tareas.Controls.Find("BtnAprobado_" & CType(sender, PictureBox).Name.Split("_")(1), True)(0)
dp_tarea = Form3.contenedor_tareas.Controls.Find("BtnDesaprobado_" & CType(sender, PictureBox).Name.Split("_")(1), True)(0)
Else
ap_tarea = Form4.contenedor_tareas.Controls.Find("BtnAprobado_" & CType(sender, PictureBox).Name.Split("_")(1), True)(0)
dp_tarea = Form4.contenedor_tareas.Controls.Find("BtnDesaprobado_" & CType(sender, PictureBox).Name.Split("_")(1), True)(0)
re_tarea = Form4.contenedor_tareas.Controls.Find("BtnRentrega_" & CType(sender, PictureBox).Name.Split("_")(1), True)(0)
If ap_tarea.Visible = False Then
re_tarea.Visible = True
Else
re_tarea.Visible = False
End If
End If
If ap_tarea.Visible = False Then
ap_tarea.Visible = True
dp_tarea.Visible = True
sender.Image = My.Resources.Resource1.minus_recurso
ElseIf ap_tarea.Visible = True Then
ap_tarea.Visible = False
dp_tarea.Visible = False
sender.Image = My.Resources.Resource1.plus_img
End If
End Sub
Public Sub Aprobar_tarea_Click(sender As Object, e As EventArgs)
Try
If Form2.contenedor_tareas.Controls.Count > 0 And Form1.Contenedor_tareas.Controls.ContainsKey("Form2") Then
Form1.Notif_Globales_Timer.Enabled = False
Form1.Vencimiento_Globales_Timer.Enabled = False
End If
If Form3.contenedor_tareas.Controls.Count > 0 And Form1.Contenedor_tareas.Controls.ContainsKey("Form3") Then
Form1.Notif_Importantes_Timer.Enabled = False
Form1.Vencimiento_Importantes_Timer.Enabled = False
End If
If Form4.contenedor_tareas.Controls.Count > 0 And Form1.Contenedor_tareas.Controls.ContainsKey("Form4") Then
Form1.Vencimiento_Olvidadas_Timer.Enabled = False
End If
db = New ReMe_DB
db.miComando.CommandText = "Actualizar_Estado"
db.miComando.CommandType = CommandType.StoredProcedure
Dim p1 As New MySqlParameter("n1", MySqlDbType.Int32)
Dim p2 As New MySqlParameter("n2", MySqlDbType.Int32)
p1.Direction = ParameterDirection.Input
p2.Direction = ParameterDirection.Input
p1.Value = 2
p2.Value = CInt(CType(sender, Button).Name.Split("_")(1))
db.miComando.Parameters.Add(p1)
db.miComando.Parameters.Add(p2)
db.miComando.ExecuteNonQuery()
db.Dispose()
Dim Nombre_Tarea As Label
If Form2.contenedor_tareas.Controls.ContainsKey("Tarea_" & CType(sender, Button).Name.Split("_")(1)) Then
Nombre_Tarea = Form2.Controls.Find("NombreTarea_" & CType(sender, Button).Name.Split("_")(1), True)(0)
ElseIf Form3.contenedor_tareas.Controls.ContainsKey("Tarea_" & CType(sender, Button).Name.Split("_")(1)) Then
Nombre_Tarea = Form3.Controls.Find("NombreTarea_" & CType(sender, Button).Name.Split("_")(1), True)(0)
Else
Nombre_Tarea = Form4.Controls.Find("NombreTarea_" & CType(sender, Button).Name.Split("_")(1), True)(0)
End If
Generar_Aprobadas(CType(sender, Button).Name.Split("_")(1), Nombre_Tarea.Text, Now().Date)
If Form2.contenedor_tareas.Controls.ContainsKey($"{"Tarea_" & CType(sender, Button).Name.Split("_")(1)}") Then
Dim indx_notif As Integer = Form1.ids_globales_notif.IndexOf(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form1.ids_globales_notif_estado.RemoveAt(indx_notif)
Form1.ids_globales_notif.Remove(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form1.ids_globales_venc.Remove(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form2.contenedor_tareas.Controls.RemoveByKey("Tarea_" & CType(sender, Button).Name.Split("_")(1))
If Form2.contenedor_tareas.Controls.Count >= 1 Then
Form1.Notif_Globales_Timer.Enabled = True
Form1.Vencimiento_Globales_Timer.Enabled = True
End If
End If
If Form3.contenedor_tareas.Controls.ContainsKey($"{"Tarea_" & CType(sender, Button).Name.Split("_")(1)}") Then
MsgBox(Form1.ids_importantes_notif.Count & " - " & Form1.ids_importantes_notif_estado.Count)
Dim indx_notif As Integer = Form1.ids_importantes_notif.IndexOf(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form1.ids_importantes_notif_estado.RemoveAt(indx_notif)
Form1.ids_importantes_notif.Remove(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form1.ids_importantes_venc.Remove(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form3.contenedor_tareas.Controls.RemoveByKey("Tarea_" & CType(sender, Button).Name.Split("_")(1))
If Form3.contenedor_tareas.Controls.Count >= 1 Then
Form1.Notif_Importantes_Timer.Enabled = True
Form1.Vencimiento_Importantes_Timer.Enabled = True
End If
End If
If Form4.contenedor_tareas.Controls.ContainsKey($"{"Tarea_" & CType(sender, Button).Name.Split("_")(1)}") Then
Form1.ids_olvidadas_venc.Remove(Convert.ToInt32(CType(sender, Button).Name.Split("_")(1)))
Form4.contenedor_tareas.Controls.RemoveByKey("Tarea_" & CType(sender, Button).Name.Split("_")(1))
Form1.Vencimiento_Olvidadas_Timer.Enabled = True
End If
Actualizar_Tareas()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public Sub Generar_Aprobadas(id As Integer, nombre As String, fecha As DateTime)
Dim aprobar_panel As New Panel() With {
.Name = "Tarea_" & id,
.Size = New Size(504, 85),
.BorderStyle = BorderStyle.FixedSingle,
.Font = New Font("Segoe UI", 13.0!, FontStyle.Regular, GraphicsUnit.Point),
.Visible = True
}
Dim aprobar_nombre As New Label() With {
.AutoSize = True,
.Name = "AprobadaNombre_" & id,
.Location = New Point(10, 11),
.Font = New Font("Segoe UI", 13.0!, FontStyle.Regular, GraphicsUnit.Point),
.ForeColor = Color.White,
.Text = nombre,
.Visible = True
}
Dim aprobar_texto_fecha_aprobada As New Label() With {
.AutoSize = True,
.Name = "AprobadaTextoFechaAprobada_" & id,
.Font = New Font("Segoe UI", 11.0!, FontStyle.Regular, GraphicsUnit.Point),
.ForeColor = Color.White,
.Location = New Point(10, 39),
.Text = "Fecha Aprobada:",
.Visible = True
}
Dim aprobar_fecha_aprobada As New Label() With {
.AutoSize = True,
.Name = "Aprobada-Fecha-Aprobada_" & id,
.Font = New Font("Segoe UI", 11.0!, FontStyle.Regular, GraphicsUnit.Point),
.ForeColor = Color.White,
.Location = New Point(130, 39),
.Text = fecha,
.Visible = True
}
Dim aprobar_eliminar_aprobada As New PictureBox() With {
.Cursor = Cursors.Hand,
.Image = My.Resources.Resource1.cerrar_tarea,
.Location = New Point(458, 29),
.Name = "BtnEliminar_" & id,
.Size = New Size(35, 31),
.SizeMode = PictureBoxSizeMode.StretchImage,
.TabIndex = 14,
.TabStop = False,
.Visible = False
}
aprobar_panel.Controls.Add(aprobar_eliminar_aprobada)
aprobar_panel.Controls.Add(aprobar_nombre)
aprobar_panel.Controls.Add(aprobar_texto_fecha_aprobada)
aprobar_panel.Controls.Add(aprobar_fecha_aprobada)
Form5.contenedor_tareas.Controls.Add(aprobar_panel)
AddHandler aprobar_eliminar_aprobada.Click, AddressOf Eliminar_tarea_Click
End Sub
Public Sub Generar_Globales(id As Integer, nombre As String, finalizacion As DateTime, Notif As DateTime)
Dim panel_tarea As New Panel()
Dim eliminar_tarea As New PictureBox()
Dim funcion_tarea As New PictureBox()
Dim desaprobar_tarea As New Button()
Dim aprobar_tarea As New Button()
Dim fecha_tarea As New Label()
Dim fecha_label_tarea As New Label()
Dim nombre_tarea As New Label()
Dim tarea_vencimiento As New Label()
panel_tarea.BorderStyle = BorderStyle.FixedSingle
panel_tarea.Controls.Add(eliminar_tarea)
panel_tarea.Controls.Add(funcion_tarea)
panel_tarea.Controls.Add(desaprobar_tarea)
panel_tarea.Controls.Add(aprobar_tarea)
panel_tarea.Controls.Add(fecha_tarea)
panel_tarea.Controls.Add(fecha_label_tarea)
panel_tarea.Controls.Add(nombre_tarea)
panel_tarea.Controls.Add(tarea_vencimiento)
panel_tarea.Location = New Point(3, 94)
panel_tarea.Name = "Tarea_" & id
panel_tarea.Size = New Size(504, 85)
panel_tarea.TabIndex = 1
panel_tarea.Visible = True
eliminar_tarea.Cursor = Cursors.Hand
eliminar_tarea.Image = My.Resources.Resource1.cerrar_tarea
eliminar_tarea.Location = New Point(458, 29)
eliminar_tarea.Name = "BtnEliminar_" & id
eliminar_tarea.Size = New Size(35, 31)
eliminar_tarea.SizeMode = PictureBoxSizeMode.StretchImage
eliminar_tarea.TabIndex = 14
eliminar_tarea.TabStop = False
eliminar_tarea.Visible = False
funcion_tarea.Cursor = Cursors.Hand
funcion_tarea.Image = My.Resources.Resource1.plus_img
funcion_tarea.Location = New Point(458, 29)
funcion_tarea.Name = "BtnFunciones_" & id
funcion_tarea.Size = New Size(34, 30)
funcion_tarea.SizeMode = PictureBoxSizeMode.StretchImage
funcion_tarea.TabIndex = 14
funcion_tarea.TabStop = False
desaprobar_tarea.Cursor = Cursors.Hand
desaprobar_tarea.FlatStyle = FlatStyle.Flat
desaprobar_tarea.Font = New Font("Segoe UI", 9.0!, FontStyle.Regular, GraphicsUnit.Point)
desaprobar_tarea.ForeColor = Color.White
desaprobar_tarea.Location = New Point(378, 29)
desaprobar_tarea.Name = "BtnDesaprobado_" & id
desaprobar_tarea.Size = New Size(34, 30)
desaprobar_tarea.TabIndex = 14
desaprobar_tarea.TabStop = False
desaprobar_tarea.Text = "Dp"
desaprobar_tarea.UseVisualStyleBackColor = True
desaprobar_tarea.Visible = False
aprobar_tarea.Cursor = Cursors.Hand
aprobar_tarea.FlatStyle = FlatStyle.Flat
aprobar_tarea.Font = New Font("Segoe UI", 9.0!, FontStyle.Regular, GraphicsUnit.Point)
aprobar_tarea.ForeColor = Color.White
aprobar_tarea.Location = New Point(418, 29)
aprobar_tarea.Name = "BtnAprobado_" & id
aprobar_tarea.Size = New Size(34, 30)
aprobar_tarea.TabIndex = 12
aprobar_tarea.TabStop = False
aprobar_tarea.Text = "Ap"
aprobar_tarea.UseVisualStyleBackColor = True
aprobar_tarea.Visible = False
fecha_tarea.AutoSize = True
fecha_tarea.Font = New Font("Segoe UI", 11.0!, FontStyle.Regular, GraphicsUnit.Point)
fecha_tarea.ForeColor = Color.White
fecha_tarea.Location = New Point(160, 39)
fecha_tarea.Name = "FechaTarea_" & id
fecha_tarea.Size = New Size(69, 20)
fecha_tarea.TabIndex = 3
fecha_tarea.Text = finalizacion
fecha_label_tarea.AutoSize = True
fecha_label_tarea.Font = New Font("Segoe UI", 11.0!, FontStyle.Regular, GraphicsUnit.Point)
fecha_label_tarea.ForeColor = Color.White
fecha_label_tarea.Location = New Point(10, 39)
fecha_label_tarea.Name = "FechaLabelTarea_" & id
fecha_label_tarea.Size = New Size(151, 20)
fecha_label_tarea.TabIndex = 2
fecha_label_tarea.Text = "Fecha de finalización:"
nombre_tarea.AutoSize = True
nombre_tarea.Font = New Font("Segoe UI", 13.0!, FontStyle.Regular, GraphicsUnit.Point)
nombre_tarea.ForeColor = Color.White
nombre_tarea.Location = New Point(10, 11)
nombre_tarea.Name = "NombreTarea_" & id
nombre_tarea.Size = New Size(80, 25)
nombre_tarea.TabIndex = 1
nombre_tarea.Text = nombre
tarea_vencimiento.AutoSize = True
tarea_vencimiento.Font = New Font("Segoe UI", 13.0!, FontStyle.Regular, GraphicsUnit.Point)
tarea_vencimiento.ForeColor = Color.White
tarea_vencimiento.Location = New Point(150, 11)
tarea_vencimiento.Name = "Vencimiento_" & id
tarea_vencimiento.Size = New Size(80, 25)
tarea_vencimiento.TabIndex = 1
tarea_vencimiento.Text = Notif
tarea_vencimiento.Visible = False
Form2.contenedor_tareas.Controls.Add(panel_tarea)
AddHandler funcion_tarea.Click, AddressOf Funcion_tarea_Click
AddHandler aprobar_tarea.Click, AddressOf Aprobar_tarea_Click
AddHandler desaprobar_tarea.Click, AddressOf Desaprobar_tarea_Click
AddHandler eliminar_tarea.Click, AddressOf Eliminar_tarea_Click
End Sub
Public Sub Generar_Importantes(id As Integer, nombre As String, finalizacion As DateTime, Notif As DateTime)
Dim panel_tarea As New Panel()
Dim eliminar_tarea As New PictureBox()
Dim funcion_tarea As New PictureBox()
Dim desaprobar_tarea As New Button()
Dim aprobar_tarea As New Button()
Dim fecha_tarea As New Label()
Dim fecha_label_tarea As New Label()
Dim nombre_tarea As New Label()
Dim tarea_vencimiento As New Label()
panel_tarea.BorderStyle = BorderStyle.FixedSingle
panel_tarea.Controls.Add(eliminar_tarea)
panel_tarea.Controls.Add(funcion_tarea)
panel_tarea.Controls.Add(desaprobar_tarea)
panel_tarea.Controls.Add(aprobar_tarea)
panel_tarea.Controls.Add(fecha_tarea)
panel_tarea.Controls.Add(fecha_label_tarea)
panel_tarea.Controls.Add(nombre_tarea)
panel_tarea.Controls.Add(tarea_vencimiento)
panel_tarea.Location = New Point(3, 94)
panel_tarea.Name = "Tarea_" & id
panel_tarea.Size = New Size(504, 85)
panel_tarea.TabIndex = 1
panel_tarea.Visible = True
eliminar_tarea.Cursor = Cursors.Hand
eliminar_tarea.Image = My.Resources.Resource1.cerrar_tarea
eliminar_tarea.Location = New Point(458, 29)
eliminar_tarea.Name = "BtnEliminar_" & id
eliminar_tarea.Size = New Size(35, 31)
eliminar_tarea.SizeMode = PictureBoxSizeMode.StretchImage
eliminar_tarea.TabIndex = 14
eliminar_tarea.TabStop = False
eliminar_tarea.Visible = False
funcion_tarea.Cursor = Cursors.Hand
funcion_tarea.Image = My.Resources.Resource1.plus_img
funcion_tarea.Location = New Point(458, 29)
funcion_tarea.Name = "BtnFunciones_" & id
funcion_tarea.Size = New Size(34, 30)
funcion_tarea.SizeMode = PictureBoxSizeMode.StretchImage
funcion_tarea.TabIndex = 14
funcion_tarea.TabStop = False
desaprobar_tarea.Cursor = Cursors.Hand
desaprobar_tarea.FlatStyle = FlatStyle.Flat
desaprobar_tarea.Font = New Font("Segoe UI", 9.0!, FontStyle.Regular, GraphicsUnit.Point)
desaprobar_tarea.ForeColor = Color.White
desaprobar_tarea.Location = New Point(378, 29)
desaprobar_tarea.Name = "BtnDesaprobado_" & id
desaprobar_tarea.Size = New Size(34, 30)
desaprobar_tarea.TabIndex = 14
desaprobar_tarea.TabStop = False
desaprobar_tarea.Text = "Dp"
desaprobar_tarea.UseVisualStyleBackColor = True
desaprobar_tarea.Visible = False
aprobar_tarea.Cursor = Cursors.Hand
aprobar_tarea.FlatStyle = FlatStyle.Flat
aprobar_tarea.Font = New Font("Segoe UI", 9.0!, FontStyle.Regular, GraphicsUnit.Point)
aprobar_tarea.ForeColor = Color.White
aprobar_tarea.Location = New Point(418, 29)
aprobar_tarea.Name = "BtnAprobado_" & id
aprobar_tarea.Size = New Size(34, 30)
aprobar_tarea.TabIndex = 12
aprobar_tarea.TabStop = False
aprobar_tarea.Text = "Ap"
aprobar_tarea.UseVisualStyleBackColor = True
aprobar_tarea.Visible = False
fecha_tarea.AutoSize = True
fecha_tarea.Font = New Font("Segoe UI", 11.0!, FontStyle.Regular, GraphicsUnit.Point)
fecha_tarea.ForeColor = Color.White
fecha_tarea.Location = New Point(160, 39)
fecha_tarea.Name = "FechaTarea_" & id
fecha_tarea.Size = New Size(69, 20)
fecha_tarea.TabIndex = 3
fecha_tarea.Text = finalizacion
fecha_label_tarea.AutoSize = True
fecha_label_tarea.Font = New Font("Segoe UI", 11.0!, FontStyle.Regular, GraphicsUnit.Point)
fecha_label_tarea.ForeColor = Color.White
fecha_label_tarea.Location = New Point(10, 39)
fecha_label_tarea.Name = "FechaLabelTarea_" & id
fecha_label_tarea.Size = New Size(151, 20)
fecha_label_tarea.TabIndex = 2
fecha_label_tarea.Text = "Fecha de finalización:"
nombre_tarea.AutoSize = True
nombre_tarea.Font = New Font("Segoe UI", 13.0!, FontStyle.Regular, GraphicsUnit.Point)
nombre_tarea.ForeColor = Color.White
nombre_tarea.Location = New Point(10, 11)
nombre_tarea.Name = "NombreTarea_" & id
nombre_tarea.Size = New Size(80, 25)
nombre_tarea.TabIndex = 1
nombre_tarea.Text = nombre
tarea_vencimiento.AutoSize = True
tarea_vencimiento.Font = New Font("Segoe UI", 13.0!, FontStyle.Regular, GraphicsUnit.Point)
tarea_vencimiento.ForeColor = Color.White
tarea_vencimiento.Location = New Point(150, 11)
tarea_vencimiento.Name = "Vencimiento_" & id
tarea_vencimiento.Size = New Size(80, 25)
tarea_vencimiento.TabIndex = 1
tarea_vencimiento.Text = Notif
tarea_vencimiento.Visible = False
Form3.contenedor_tareas.Controls.Add(panel_tarea)
AddHandler funcion_tarea.Click, AddressOf Funcion_tarea_Click
AddHandler aprobar_tarea.Click, AddressOf Aprobar_tarea_Click
AddHandler desaprobar_tarea.Click, AddressOf Desaprobar_tarea_Click
AddHandler eliminar_tarea.Click, AddressOf Eliminar_tarea_Click
End Sub
Public Sub Generar_Olvidadas(id As Integer, nombre As String, finalizacion As DateTime, Notif As DateTime)
Dim panel_tarea As New Panel()
Dim eliminar_tarea As New PictureBox()
Dim funcion_tarea As New PictureBox()
Dim desaprobar_tarea As New Button()
Dim aprobar_tarea As New Button()
Dim fecha_tarea As New Label()
Dim fecha_label_tarea As New Label()
Dim nombre_tarea As New Label()
Dim tarea_vencimiento As New Label()
Dim reentregar_tarea As New Button()
panel_tarea.BorderStyle = BorderStyle.FixedSingle
panel_tarea.Controls.Add(eliminar_tarea)
panel_tarea.Controls.Add(funcion_tarea)
panel_tarea.Controls.Add(desaprobar_tarea)
panel_tarea.Controls.Add(reentregar_tarea)
panel_tarea.Controls.Add(aprobar_tarea)
panel_tarea.Controls.Add(fecha_tarea)
panel_tarea.Controls.Add(fecha_label_tarea)
panel_tarea.Controls.Add(nombre_tarea)
panel_tarea.Controls.Add(tarea_vencimiento)
panel_tarea.Location = New Point(3, 94)
panel_tarea.Name = "Tarea_" & id
panel_tarea.Size = New Size(504, 85)
panel_tarea.TabIndex = 1
panel_tarea.Visible = True
eliminar_tarea.Cursor = Cursors.Hand
eliminar_tarea.Image = My.Resources.Resource1.cerrar_tarea
eliminar_tarea.Location = New Point(458, 29)
eliminar_tarea.Name = "BtnEliminar_" & id
eliminar_tarea.Size = New Size(35, 31)
eliminar_tarea.SizeMode = PictureBoxSizeMode.StretchImage
eliminar_tarea.TabIndex = 14
eliminar_tarea.TabStop = False
eliminar_tarea.Visible = False
funcion_tarea.Cursor = Cursors.Hand
funcion_tarea.Image = My.Resources.Resource1.plus_img
funcion_tarea.Location = New Point(458, 29)
funcion_tarea.Name = "BtnFunciones_" & id
funcion_tarea.Size = New Size(34, 30)
funcion_tarea.SizeMode = PictureBoxSizeMode.StretchImage
funcion_tarea.TabIndex = 14
funcion_tarea.TabStop = False
desaprobar_tarea.Cursor = Cursors.Hand
desaprobar_tarea.FlatStyle = FlatStyle.Flat
desaprobar_tarea.Font = New Font("Segoe UI", 9.0!, FontStyle.Regular, GraphicsUnit.Point)
desaprobar_tarea.ForeColor = Color.White
desaprobar_tarea.Location = New Point(378, 29)
desaprobar_tarea.Name = "BtnDesaprobado_" & id
desaprobar_tarea.Size = New Size(34, 30)
desaprobar_tarea.TabIndex = 14
desaprobar_tarea.TabStop = False
desaprobar_tarea.Text = "Dp"
desaprobar_tarea.UseVisualStyleBackColor = True
desaprobar_tarea.Visible = False
aprobar_tarea.Cursor = Cursors.Hand
aprobar_tarea.FlatStyle = FlatStyle.Flat
aprobar_tarea.Font = New Font("Segoe UI", 9.0!, FontStyle.Regular, GraphicsUnit.Point)
aprobar_tarea.ForeColor = Color.White
aprobar_tarea.Location = New Point(418, 29)
aprobar_tarea.Name = "BtnAprobado_" & id
aprobar_tarea.Size = New Size(34, 30)
aprobar_tarea.TabIndex = 12
aprobar_tarea.TabStop = False
aprobar_tarea.Text = "Ap"
aprobar_tarea.UseVisualStyleBackColor = True
aprobar_tarea.Visible = False
fecha_tarea.AutoSize = True
fecha_tarea.Font = New Font("Segoe UI", 11.0!, FontStyle.Regular, GraphicsUnit.Point)
fecha_tarea.ForeColor = Color.White
fecha_tarea.Location = New Point(160, 39)
fecha_tarea.Name = "FechaTarea_" & id
fecha_tarea.Size = New Size(69, 20)
fecha_tarea.TabIndex = 3
fecha_tarea.Text = finalizacion
fecha_label_tarea.AutoSize = True
fecha_label_tarea.Font = New Font("Segoe UI", 11.0!, FontStyle.Regular, GraphicsUnit.Point)
fecha_label_tarea.ForeColor = Color.White
fecha_label_tarea.Location = New Point(10, 39)
fecha_label_tarea.Name = "FechaLabelTarea_" & id
fecha_label_tarea.Size = New Size(151, 20)
fecha_label_tarea.TabIndex = 2
fecha_label_tarea.Text = "Fecha de finalización:"
nombre_tarea.AutoSize = True
nombre_tarea.Font = New Font("Segoe UI", 13.0!, FontStyle.Regular, GraphicsUnit.Point)
nombre_tarea.ForeColor = Color.White
nombre_tarea.Location = New Point(10, 11)
nombre_tarea.Name = "NombreTarea_" & id
nombre_tarea.Size = New Size(80, 25)
nombre_tarea.TabIndex = 1
nombre_tarea.Text = nombre
tarea_vencimiento.AutoSize = True
tarea_vencimiento.Font = New Font("Segoe UI", 13.0!, FontStyle.Regular, GraphicsUnit.Point)
tarea_vencimiento.ForeColor = Color.White
tarea_vencimiento.Location = New Point(150, 11)
tarea_vencimiento.Name = "Vencimiento_" & id
tarea_vencimiento.Size = New Size(80, 25)
tarea_vencimiento.TabIndex = 1
tarea_vencimiento.Text = Notif
tarea_vencimiento.Visible = False
reentregar_tarea.Cursor = Cursors.Hand
reentregar_tarea.FlatStyle = FlatStyle.Flat
reentregar_tarea.Font = New Font("Segoe UI", 9.0!, FontStyle.Regular, GraphicsUnit.Point)
reentregar_tarea.ForeColor = Color.White
reentregar_tarea.Location = New Point(337, 29)
reentregar_tarea.Name = "BtnRentrega_" & id
reentregar_tarea.Size = New Size(34, 30)
reentregar_tarea.TabIndex = 1
reentregar_tarea.Text = "Rt"
reentregar_tarea.TabStop = False
reentregar_tarea.UseVisualStyleBackColor = True
reentregar_tarea.Visible = False
Form4.contenedor_tareas.Controls.Add(panel_tarea)
AddHandler funcion_tarea.Click, AddressOf Funcion_tarea_Click
AddHandler aprobar_tarea.Click, AddressOf Aprobar_tarea_Click
AddHandler desaprobar_tarea.Click, AddressOf Desaprobar_tarea_Click
AddHandler reentregar_tarea.Click, AddressOf Reentregar_Tarea_Click
AddHandler eliminar_tarea.Click, AddressOf Eliminar_tarea_Click
End Sub
Private Sub Reentregar_Tarea_Click(sender As Object, e As EventArgs)
Form1.Hide()
rt = CType(sender, Button).Name.Split("_")(1)
Form6.txt_nombre_tarea.Visible = False
Form6.txt_decorador.Visible = False
Form6.box_nombre_tarea.Visible = False
Form6.opc_categoria_adc.Text = "Trabajo Practico"
Form6.opc_categoria_adc.Visible = False
Form6.txt_categoria.Visible = False
Form6.txt_fecha.Location = New Point(257, 161)
Form6.date_finalizacion.Location = New Point(241, 194)
Form6.txt_plazo.Location = New Point(266, 253)
Form6.opc_plazo_fecha.Location = New Point(283, 287)
Form6.Show()
End Sub
Public Sub Ordenar_Tareas(categoria As Integer, modo As Integer, id As Integer)
Try
db = New ReMe_DB
db.miComando.CommandText = "Ordenar_Tareas"
db.miComando.CommandType = CommandType.StoredProcedure
Dim pa1 As New MySqlParameter("n1", MySqlDbType.Int32)
Dim pa2 As New MySqlParameter("n2", MySqlDbType.Int32)
Dim pa3 As New MySqlParameter("n3", MySqlDbType.Int32)
pa1.Direction = ParameterDirection.Input
pa2.Direction = ParameterDirection.Input
pa3.Direction = ParameterDirection.Input
pa1.Value = categoria
pa2.Value = modo
pa3.Value = id
db.miComando.Parameters.Add(pa1)
db.miComando.Parameters.Add(pa2)
db.miComando.Parameters.Add(pa3)
Dim rd As MySqlDataReader = db.miComando.ExecuteReader
Dim idTarea As Integer
Dim nombreTarea As String
Dim finalizaTarea As DateTime
Dim notifTarea As DateTime
Dim aprobadaTarea As DateTime
If categoria = 1 Then
Form2.contenedor_tareas.Controls.Clear()
ElseIf categoria = 2 Then
Form3.contenedor_tareas.Controls.Clear()
ElseIf categoria = 3 Then
Form4.contenedor_tareas.Controls.Clear()
ElseIf categoria = 4 Then
Form5.contenedor_tareas.Controls.Clear()
End If
Dim cantidad As Integer = 0
If rd.HasRows Then
While rd.Read()
If categoria = 1 Then
idTarea = rd.GetInt32(0)
nombreTarea = rd.GetString(1)
finalizaTarea = rd.GetDateTime(2)
notifTarea = rd.GetDateTime(3)
Generar_Globales(idTarea, nombreTarea, finalizaTarea.Date, notifTarea.Date)
cantidad += 1
Form2.Cantidad.Text = "Cantidad: " & cantidad
ElseIf categoria = 2 Then
idTarea = rd.GetInt32(0)
nombreTarea = rd.GetString(1)
finalizaTarea = rd.GetDateTime(2)
notifTarea = rd.GetDateTime(3)
Generar_Importantes(idTarea, nombreTarea, finalizaTarea.Date, notifTarea.Date)
cantidad += 1
Form3.Cantidad.Text = "Cantidad: " & cantidad
ElseIf categoria = 3 Then
idTarea = rd.GetInt32(0)
nombreTarea = rd.GetString(1)
finalizaTarea = rd.GetDateTime(2)
notifTarea = rd.GetDateTime(3)
Generar_Olvidadas(idTarea, nombreTarea, finalizaTarea.Date, notifTarea.Date)
cantidad += 1
Form4.Cantidad.Text = "Cantidad: " & cantidad
ElseIf categoria = 4 Then
idTarea = rd.GetInt32(0)
nombreTarea = rd.GetString(1)
aprobadaTarea = rd.GetDateTime(2)
Generar_Aprobadas(idTarea, nombreTarea, aprobadaTarea.Date)
cantidad += 1
Form5.Cantidad.Text = "Cantidad: " & cantidad
End If
End While
rd.NextResult()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public Sub Actualizar_Tareas()
If Form1.Contenedor_tareas.Controls.ContainsKey("Form2") Then
Form2.Cantidad.Text = "Cantidad: " & Str(Form2.contenedor_tareas.Controls.Count())
ElseIf Form1.Contenedor_tareas.Controls.ContainsKey("Form3") Then
Form3.Cantidad.Text = "Cantidad: " & Str(Form3.contenedor_tareas.Controls.Count())
ElseIf Form1.Contenedor_tareas.Controls.ContainsKey("Form4") Then
Form4.Cantidad.Text = "Cantidad: " & Str(Form4.contenedor_tareas.Controls.Count())
ElseIf Form1.Contenedor_tareas.Controls.ContainsKey("Form5") Then