This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnrollmentData.vb
1891 lines (1183 loc) · 60.6 KB
/
EnrollmentData.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 System.Data.OleDb
Imports System.IO
Public Class EnrollmentData
Private Sub RoundButtonApprove(btn As Button)
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 12)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
Raduis.AddLine(10, 0, btn.Width - 20, 0)
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnApprove.Width, 20, btn.Width, btn.Height - 10)
Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 25, 25, 25), 0, 90)
Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()
btnApprove.Region = New Region(Raduis)
End Sub
Private Sub RoundButtonDenied(btn As Button)
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 12)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
Raduis.AddLine(10, 0, btn.Width - 20, 0)
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnDenied.Width, 20, btn.Width, btn.Height - 10)
Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 25, 25, 25), 0, 90)
Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()
btnDenied.Region = New Region(Raduis)
End Sub
Private Sub RoundButtonSave(btn As Button)
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 12)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
Raduis.AddLine(10, 0, btn.Width - 20, 0)
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnSave.Width, 20, btn.Width, btn.Height - 10)
Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 25, 25, 25), 0, 90)
Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()
btnSave.Region = New Region(Raduis)
End Sub
Private Sub RoundButtonDelete(btn As Button)
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 12)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
Raduis.AddLine(10, 0, btn.Width - 20, 0)
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnDelete.Width, 20, btn.Width, btn.Height - 10)
Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 25, 25, 25), 0, 90)
Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()
btnDelete.Region = New Region(Raduis)
End Sub
Private Sub RoundButtonCapture(btn As Button)
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 12)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
Raduis.AddLine(10, 0, btn.Width - 20, 0)
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnCapture.Width, 20, btn.Width, btn.Height - 10)
Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 25, 25, 25), 0, 90)
Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()
btnCapture.Region = New Region(Raduis)
End Sub
Private Sub RoundButtonBrowse(btn As Button)
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 12)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
Raduis.AddLine(10, 0, btn.Width - 20, 0)
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnBrowse.Width, 20, btn.Width, btn.Height - 10)
Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 25, 25, 25), 0, 90)
Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()
btnBrowse.Region = New Region(Raduis)
End Sub
Private Sub RoundButtonRemove(btn As Button)
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 12)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
Raduis.AddLine(10, 0, btn.Width - 20, 0)
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnRemove.Width, 20, btn.Width, btn.Height - 10)
Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 25, 25, 25), 0, 90)
Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()
btnRemove.Region = New Region(Raduis)
End Sub
Private Sub RoundButtonGenerateID(btn As Button)
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 12)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
Raduis.AddLine(10, 0, btn.Width - 20, 0)
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnGenerateID.Width, 20, btn.Width, btn.Height - 10)
Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 25, 25, 25), 0, 90)
Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()
btnGenerateID.Region = New Region(Raduis)
End Sub
Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
RoundButtonApprove(btnApprove)
RoundButtonDenied(btnDenied)
RoundButtonSave(btnSave)
RoundButtonDelete(btnDelete)
RoundButtonCapture(btnCapture)
RoundButtonBrowse(btnBrowse)
RoundButtonRemove(btnRemove)
RoundButtonGenerateID(btnGenerateID)
'TODO: This line of code loads data into the 'Pre_enrollmentDataSet.EnrollmentData' table. You can move, or remove it, as needed.
Me.EnrollmentDataTableAdapter.Fill(Me.Pre_enrollmentDataSet.EnrollmentData)
Try
Dim x As Byte() = AdvancedDataGridView1.CurrentRow.Cells(0).Value
Dim ms As New MemoryStream(x)
PictureID.Image = Image.FromStream(ms)
Dim Status As String = AdvancedDataGridView1.CurrentRow.Cells(3).Value
StatusTextBox.Text = Status
If StatusTextBox.Text = "enrolled" Then
btnApprove.Visible = False
btnGenerateID.Visible = True
Else
btnApprove.Visible = True
btnGenerateID.Visible = False
End If
If StatusTextBox.Text = "denied" Then
btnDenied.Visible = False
Else
btnDenied.Visible = True
End If
Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Load Picture ID failed!")
Exit Sub
End Try
End Sub
Private Sub AdvancedDataGridView1_SortStringChanged(sender As Object, e As EventArgs) Handles AdvancedDataGridView1.SortStringChanged
EnrollmentDataBindingSource.Sort = AdvancedDataGridView1.SortString
End Sub
Private Sub AdvancedDataGridView1_FilterStringChanged(sender As Object, e As EventArgs) Handles AdvancedDataGridView1.FilterStringChanged
EnrollmentDataBindingSource.Filter = AdvancedDataGridView1.FilterString
End Sub
Private Sub EnrollmentDataBindingSource_ListChanged(sender As Object, e As System.ComponentModel.ListChangedEventArgs) Handles EnrollmentDataBindingSource.ListChanged
lblTotal.Text = String.Format("Total Student Pre-enrolled: {0}", EnrollmentDataBindingSource.List.Count)
End Sub
Sub SaveData()
Try
Dim SaveDataConnection As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database\Pre-enrollment.accdb")
If SaveDataConnection.State = ConnectionState.Open Then SaveDataConnection.Close()
SaveDataConnection.Open()
Dim SaveDataCommand As New OleDbCommand("Update EnrollmentData Set [StudentNumber]=@StudentNumber,[GradeLevel]=@GradeLevel,[Strand]=@Strand,[Semester]=@Semester,[SchoolYear]=@SchoolYear,[Lastname]=@Lastname,[Firstname]=@Firstname,[Middlename]=@Middlename,[Age]=@Age,DOB=@DOB,[Sex]=@Sex,[POB]=@POB,[Nationality]=@Nationality,[Religion]=@Religion,[Email]=@Email,[MobileNumber]=@MobileNumber,[TelephoneNumber]=@TelephoneNumber,[Address]=@Address,[City]=@City,[FatherName]=@FatherName,[FatherOccupation]=@FatherOccupation,[FatherEmail]=@FatherEmail,[FatherWorkAddress]=@FatherWorkAddress,[FatherContactNumber]=@FatherContactNumber,[MotherName]=@MotherName,[MotherOccupation]=@MotherOccupation,[MotherEmail]=@MotherEmail,[MotherWorkAddress]=@MotherWorkAddress,[MotherContactNumber]=@MotherContactNumber,[NumberOfSiblings]=@NumberOfSiblings,[PersonEmergency]=@PersonEmergency,[GuardianName]=@GuardianName,[GuardianRelation]=@GuardianRelation,[GuardianEmail]=@GuardianEmail,[GuardianWorkAddress]=@GuardianWorkAddress,[GuardianContactNumber]=@GuardianContactNumber,[FetcherName]=@FetcherName,[FetcherContactNumber]=@FetcherContactNumber,[SiblingsOfStudent1]=@SiblingsOfStudent1,[SiblingsOfStudent2]=@SiblingsOfStudent2,[SiblingsOfStudent3]=@SiblingsOfStudent3,[SiblingsOfStudentAge1]=@SiblingsOfStudentAge1,[SiblingsOfStudentAge2]=@SiblingsOfStudentAge2,[SiblingsOfStudentAge3]=@SiblingsOfStudentAge3,[SiblingsOfStudentSchool1]=@SiblingsOfStudentSchool1,[SiblingsOfStudentSchool2]=@SiblingsOfStudentSchool2,[SiblingsOfStudentSchool3]=@SiblingsOfStudentSchool3,[SchoolLastAttended1]=@SchoolLastAttended1,[SchoolLastAttended2]=@SchoolLastAttended2,[SchoolLastAttended3]=@SchoolLastAttended3,[AcademicYear1]=@AcademicYear1,[AcademicYear2]=@AcademicYear2,[AcademicYear3]=@AcademicYear3,[ReasonApplying]=@ReasonApplying,[Status]=@Status,StudentPicture=@StudentPicture Where (EnrollmentNumber=" & EnrollmentNumberTextBox1.Text & ")", SaveDataConnection)
' Student Number
Dim StudentNumber As New OleDbParameter("@StudentNumber", OleDbType.VarWChar, 100) With {
.Value = StudentNumberTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(StudentNumber)
' Grade Level
Dim GradeLevel As New OleDbParameter("@GradeLevel", OleDbType.VarWChar, 100) With {
.Value = GradeLevelTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(GradeLevel)
' Strand
Dim Strand As New OleDbParameter("@Strand", OleDbType.VarWChar, 100) With {
.Value = StrandTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Strand)
' Semester
Dim Semester As New OleDbParameter("@Semester", OleDbType.VarWChar, 100) With {
.Value = SemesterTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Semester)
' SchoolYear
Dim SchoolYear As New OleDbParameter("@SchoolYear", OleDbType.VarWChar, 100) With {
.Value = SchoolYearTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SchoolYear)
' Lastname
Dim Lastname As New OleDbParameter("@Lastname", OleDbType.VarWChar, 100) With {
.Value = LastnameTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Lastname)
' Firstname
Dim Firstname As New OleDbParameter("@Firstname", OleDbType.VarWChar, 100) With {
.Value = FirstnameTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Firstname)
' Middlename
Dim Middlename As New OleDbParameter("@Middlename", OleDbType.VarWChar, 100) With {
.Value = MiddlenameTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Middlename)
' Age
Dim Age As New OleDbParameter("@Age", OleDbType.VarWChar, 100) With {
.Value = AgeTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Age)
' Date of Birth
Dim DOB As New OleDbParameter("@DOB", OleDbType.Date, 100) With {
.Value = DOBDateTimePicker1.Text.ToString()
}
SaveDataCommand.Parameters.Add(DOB)
' Sex
Dim Sex As New OleDbParameter("@Sex", OleDbType.VarWChar, 100) With {
.Value = SexTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Sex)
' Place of Birth
Dim POB As New OleDbParameter("@POB", OleDbType.VarWChar, 100) With {
.Value = POBTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(POB)
' Nationality
Dim Nationality As New OleDbParameter("@Nationality", OleDbType.VarWChar, 100) With {
.Value = NationalityTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Nationality)
' Religion
Dim Religion As New OleDbParameter("@Religion", OleDbType.VarWChar, 100) With {
.Value = ReligionTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Religion)
' Email
Dim Email As New OleDbParameter("@Email", OleDbType.VarWChar, 100) With {
.Value = EmailTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Email)
' Mobile Number
Dim MobileNumber As New OleDbParameter("@MobileNumber", OleDbType.VarWChar, 100) With {
.Value = MobileNumberTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(MobileNumber)
' TelephoneNumber
Dim TelephoneNumber As New OleDbParameter("@TelephoneNumber", OleDbType.VarWChar, 100) With {
.Value = TelephoneNumberTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(TelephoneNumber)
' Address
Dim Address As New OleDbParameter("@Address", OleDbType.VarWChar, 100) With {
.Value = AddressTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Address)
' City
Dim City As New OleDbParameter("@City", OleDbType.VarWChar, 100) With {
.Value = CityTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(City)
' Father Name
Dim FatherName As New OleDbParameter("@FatherName", OleDbType.VarWChar, 100) With {
.Value = FatherNameTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FatherName)
' Father Occupation
Dim FatherOccupation As New OleDbParameter("@FatherOccupation", OleDbType.VarWChar, 100) With {
.Value = FatherOccupationTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FatherOccupation)
' Father Email
Dim FatherEmail As New OleDbParameter("@FatherEmail", OleDbType.VarWChar, 100) With {
.Value = FatherEmailTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FatherEmail)
' Father Work Address
Dim FatherWorkAddress As New OleDbParameter("@FatherWorkAddress", OleDbType.VarWChar, 100) With {
.Value = FatherWorkAddressTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FatherWorkAddress)
' Father Contact Number
Dim FatherContactNumber As New OleDbParameter("@FatherContactNumber", OleDbType.VarWChar, 100) With {
.Value = FatherContactNumberTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FatherContactNumber)
' Mother Name
Dim MotherName As New OleDbParameter("@MotherName", OleDbType.VarWChar, 100) With {
.Value = MotherNameTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(MotherName)
' Mother Occupation
Dim MotherOccupation As New OleDbParameter("@MotherOccupation", OleDbType.VarWChar, 100) With {
.Value = MotherOccupationTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(MotherOccupation)
' Mother Email
Dim MotherEmail As New OleDbParameter("@MotherEmail", OleDbType.VarWChar, 100) With {
.Value = MotherEmailTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(MotherEmail)
' Mother Work Address
Dim MotherWorkAddress As New OleDbParameter("@MotherWorkAddress", OleDbType.VarWChar, 100) With {
.Value = MotherWorkAddressTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(MotherWorkAddress)
' Mother Contact Number
Dim MotherContactNumber As New OleDbParameter("@MotherContactNumber", OleDbType.VarWChar, 100) With {
.Value = MotherContactNumberTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(MotherContactNumber)
' Number of Siblings
Dim NumberOfSiblings As New OleDbParameter("@NumberOfSiblings", OleDbType.VarWChar, 100) With {
.Value = NumberOfSiblingsTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(NumberOfSiblings)
' Person in case of Emergency
Dim PersonEmergency As New OleDbParameter("@PersonEmergency", OleDbType.VarWChar, 100) With {
.Value = PersonEmergencyTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(PersonEmergency)
' Guardian Name
Dim GuardianName As New OleDbParameter("@GuardianName", OleDbType.VarWChar, 100) With {
.Value = GuardianNameTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(GuardianName)
' Guardian Relation
Dim GuardianRelation As New OleDbParameter("@GuardianRelation", OleDbType.VarWChar, 100) With {
.Value = GuardianRelationTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(GuardianRelation)
' Guardian Email
Dim GuardianEmail As New OleDbParameter("@GuardianEmail", OleDbType.VarWChar, 100) With {
.Value = GuardianEmailTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(GuardianEmail)
' Guardian Work Address
Dim GuardianWorkAddress As New OleDbParameter("@GuardianWorkAddress", OleDbType.VarWChar, 100) With {
.Value = GuardianWorkAddressTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(GuardianWorkAddress)
' Guardian Contact Number
Dim GuardianContactNumber As New OleDbParameter("@GuardianContactNumber", OleDbType.VarWChar, 100) With {
.Value = GuardianContactNumberTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(GuardianContactNumber)
' Fetcher Name
Dim FetcherName As New OleDbParameter("@FetcherName", OleDbType.VarWChar, 100) With {
.Value = FetcherNameTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FetcherName)
' Fetcher Contact Number
Dim FetcherContactNumber As New OleDbParameter("@FetcherContactNumber", OleDbType.VarWChar, 100) With {
.Value = FetcherContactNumberTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FetcherContactNumber)
' Siblings of Student 1
Dim SiblingsOfStudent1 As New OleDbParameter("@SiblingsOfStudent1", OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudent1TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudent1)
' Siblings of Student 2
Dim SiblingsOfStudent2 As New OleDbParameter("@SiblingsOfStudent2", OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudent2TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudent2)
' Siblings of Student 3
Dim SiblingsOfStudent3 As New OleDbParameter("@SiblingsOfStudent3", OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudent3TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudent3)
' Siblings of Student Age 1
Dim SiblingsOfStudentAge1 As New OleDbParameter("@SiblingsOfStudentAge1", OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudentAge1TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudentAge1)
' Siblings of Student Age 2
Dim SiblingsOfStudentAge2 As New OleDbParameter("@SiblingsOfStudentAge2", OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudentAge2TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudentAge2)
' Siblings of Student Age 3
Dim SiblingsOfStudentAge3 As New OleDbParameter("@SiblingsOfStudentAge3", OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudentAge3TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudentAge3)
' Siblings of Student School 1
Dim SiblingsOfStudentSchool1 As New OleDbParameter("@SiblingsOfStudentSchool1", OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudentSchool1TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudentSchool1)
' Siblings of Student School 2
Dim SiblingsOfStudentSchool2 As New OleDbParameter("@SiblingsOfStudentSchool2", OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudentSchool2TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudentSchool2)
' Siblings of Student School 3
Dim SiblingsOfStudentSchool3 As New OleDbParameter("@SiblingsOfStudentSchool3", OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudentSchool3TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudentSchool3)
' School Last Attended 1
Dim SchoolLastAttended1 As New OleDbParameter("@SchoolLastAttended1", OleDbType.VarWChar, 100) With {
.Value = SchoolLastAttended1TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SchoolLastAttended1)
' School Last Attended 2
Dim SchoolLastAttended2 As New OleDbParameter("@SchoolLastAttended2", OleDbType.VarWChar, 100) With {
.Value = SchoolLastAttended2TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SchoolLastAttended2)
' School Last Attended 3
Dim SchoolLastAttended3 As New OleDbParameter("@SchoolLastAttended3", OleDbType.VarWChar, 100) With {
.Value = SchoolLastAttended3TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SchoolLastAttended3)
' Academic Year 1
Dim AcademicYear1 As New OleDbParameter("@AcademicYear1", OleDbType.VarWChar, 100) With {
.Value = AcademicYear1TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(AcademicYear1)
' AcademicYear2
Dim AcademicYear2 As New OleDbParameter("@AcademicYear2", OleDbType.VarWChar, 100) With {
.Value = AcademicYear2TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(AcademicYear2)
' AcademicYear3
Dim AcademicYear3 As New OleDbParameter("@AcademicYear3", OleDbType.VarWChar, 100) With {
.Value = AcademicYear3TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(AcademicYear3)
' Reason Applying
Dim ReasonApplying As New OleDbParameter("@ReasonApplying", OleDbType.VarWChar, 550) With {
.Value = ReasonApplyingTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(ReasonApplying)
' Status
Dim Status As New OleDbParameter("@Status", OleDbType.VarWChar, 100) With {
.Value = StatusTextBox.Text.ToString()
}
SaveDataCommand.Parameters.Add(Status)
Dim StudentMemStream As New MemoryStream
Dim StudentDataPic_Update As Byte()
PictureID.Image.Save(StudentMemStream, Imaging.ImageFormat.Png)
StudentDataPic_Update = StudentMemStream.GetBuffer()
StudentMemStream.Read(StudentDataPic_Update, 0, StudentMemStream.Length)
' Student ID Picture
Dim TeacherPicture As New OleDbParameter("@StudentPicture", SqlDbType.Image) With {
.Value = StudentDataPic_Update
}
SaveDataCommand.Parameters.Add(TeacherPicture)
If SaveDataCommand.ExecuteNonQuery() Then
SaveDataConnection.Close()
MsgBox("Your data updated successfully.", MsgBoxStyle.Information, "Data Updated")
Else
MsgBox("Your data update failed.", MsgBoxStyle.Critical, "Update Failed")
Return
End If
Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Saving data failed!")
Exit Sub
End Try
End Sub
Private Sub BtnApprove_Click(sender As Object, e As EventArgs) Handles btnApprove.Click
Try
Dim EnrollmentApproveConnection As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database\Pre-enrollment.accdb")
If EnrollmentApproveConnection.State = ConnectionState.Open Then EnrollmentApproveConnection.Close()
EnrollmentApproveConnection.Open()
Dim EnrollmentApproveCommand As New OleDbCommand("Update EnrollmentData Set Status=@Status,StudentNumber=@StudentNumber Where EnrollmentNumber=" & AdvancedDataGridView1.CurrentRow.Cells(2).Value & "", EnrollmentApproveConnection)
' Status
Dim Status As New OleDbParameter("@Status", OleDbType.VarChar, 100) With {
.Value = "enrolled"
}
EnrollmentApproveCommand.Parameters.Add(Status)
Dim year As String = AdvancedDataGridView1.CurrentRow.Cells(12).Value.ToString()
Dim SplitPart = year.Split(" "c)
Dim Sfinal As String = SplitPart(0).Trim
Dim years As String = (String.Format("{0}", Sfinal)).ToString
Dim SplitParts = years.Split("0"c)
Dim finals As String = SplitParts(1).Trim
Dim yearss As String = (String.Format("{0}", Sfinal)).ToString
' Student Number
Dim StudentNumber As New OleDbParameter("@StudentNumber", OleDbType.VarChar, 100) With {
.Value = (yearss.Remove(0, 2)).ToString & "-" & (String.Format("{0:000000}", AdvancedDataGridView1.CurrentRow.Cells(2).Value)).ToString
}
EnrollmentApproveCommand.Parameters.Add(StudentNumber)
If EnrollmentApproveCommand.ExecuteNonQuery() Then
EnrollmentApproveConnection.Close()
MsgBox("Student approved successfully.", MsgBoxStyle.Information, "Student Approved!")
Me.EnrollmentDataTableAdapter.Fill(Me.Pre_enrollmentDataSet.EnrollmentData)
Else
MsgBox("Your data update failed.", MsgBoxStyle.Critical, "Update Failed")
Return
End If
If StatusTextBox.Text = "enrolled" Then
btnApprove.Visible = False
btnGenerateID.Visible = True
Else
btnApprove.Visible = True
btnGenerateID.Visible = False
End If
If StatusTextBox.Text = "denied" Then
btnDenied.Visible = False
Else
btnDenied.Visible = True
End If
Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Saving data failed!")
Exit Sub
End Try
End Sub
Private Sub BtnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
SaveData()
Me.EnrollmentDataTableAdapter.Fill(Me.Pre_enrollmentDataSet.EnrollmentData)
End Sub
Private Sub BtnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click
Try
If AdvancedDataGridView1.CurrentRow.Cells(2).Value.ToString <> "" Then
If MsgBox("Are you sure to delete data of the student: " & AdvancedDataGridView1.CurrentRow.Cells(6).Value.ToString & ", " & AdvancedDataGridView1.CurrentRow.Cells(7).Value.ToString & " " & AdvancedDataGridView1.CurrentRow.Cells(8).Value.ToString & "?", MsgBoxStyle.OkCancel, "Delete confirm") = MsgBoxResult.Cancel Then
' do nothing
Else
Dim EnrollmentDeleteConnection As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database\Pre-enrollment.accdb")
If EnrollmentDeleteConnection.State = ConnectionState.Open Then EnrollmentDeleteConnection.Close()
EnrollmentDeleteConnection.Open()
Dim temp As Integer = 0
Dim query As String = "DELETE FROM EnrollmentData Where EnrollmentNumber=" & AdvancedDataGridView1.CurrentRow.Cells(2).Value & ""
Dim EnrollmentDeleteCommand As New OleDbCommand(query) With {
.Connection = EnrollmentDeleteConnection
}
temp = EnrollmentDeleteCommand.ExecuteNonQuery()
If temp > 0 Then
EnrollmentDeleteConnection.Close()
MessageBox.Show("Student enrollment data successfully deleted", "Successfully deleted!", MessageBoxButtons.OK, MessageBoxIcon.Information)
Me.EnrollmentDataTableAdapter.Fill(Me.Pre_enrollmentDataSet.EnrollmentData)
Else
MessageBox.Show("No record found", "Sorry", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End If
Else
MsgBox("Can't 'delete' students data. Make sure to have proper enrollment number!", MsgBoxStyle.OkOnly, "Students Data")
End If
Catch ex As Exception
MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error 'DELETE' students data")
Exit Sub
End Try
End Sub
Private Sub BtnCapture_Click(sender As Object, e As EventArgs) Handles btnCapture.Click
cmbCapture.Text = "EnrollmentData"
CapturePicture.Show()
End Sub
Private Sub BtnBrowse_Click(sender As Object, e As EventArgs) Handles btnBrowse.Click
Dim OpenFile As New OpenFileDialog()
Try
With OpenFile
.FileName = ""
.Title = "Photo:"
.Filter = "Image files: (*.jpg)|*.jpg|(*.jpeg)|*.jpeg|(*.png)|*.png|(*.Gif)|*.Gif|(*.bmp)|*.bmp| All Files (*.*)|*.*"
If .ShowDialog = Windows.Forms.DialogResult.OK Then
PictureID.Image = Image.FromFile(.FileName)
End If
End With
Catch ex As Exception
MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error...")
End Try
End Sub
Private Sub BtnRemove_Click(sender As Object, e As EventArgs) Handles btnRemove.Click
PictureID.Image = Image.FromFile(My.Application.Info.DirectoryPath & "\Image\personal.png")
End Sub
Private Sub AdvancedDataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles AdvancedDataGridView1.CellClick
Try
Dim x As Byte() = AdvancedDataGridView1.CurrentRow.Cells(0).Value
Dim ms As New MemoryStream(x)
PictureID.Image = Image.FromStream(ms)
Dim Status As String = AdvancedDataGridView1.CurrentRow.Cells(3).Value
StatusTextBox.Text = Status
If StatusTextBox.Text = "enrolled" Then
btnApprove.Visible = False
btnGenerateID.Visible = True
Else
btnApprove.Visible = True
btnGenerateID.Visible = False
End If
If StatusTextBox.Text = "denied" Then
btnDenied.Visible = False
Else
btnDenied.Visible = True
End If
Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Load Picture ID failed!")
Exit Sub
End Try
End Sub
Private Sub AdvancedDataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles AdvancedDataGridView1.CellContentClick
If AdvancedDataGridView1.Columns(e.ColumnIndex).Name = "Approve" Then
btnApprove.PerformClick()
End If
End Sub
Private Sub BtnDenied_Click(sender As Object, e As EventArgs) Handles btnDenied.Click
Try
Dim EnrollmentDeniedConnection As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database\Pre-enrollment.accdb")
If EnrollmentDeniedConnection.State = ConnectionState.Open Then EnrollmentDeniedConnection.Close()
EnrollmentDeniedConnection.Open()
Dim EnrollmentDeniedCommand As New OleDbCommand("Update EnrollmentData Set Status=@Status,StudentNumber=@StudentNumber Where EnrollmentNumber=" & AdvancedDataGridView1.CurrentRow.Cells(2).Value & "", EnrollmentDeniedConnection)
' Status
Dim Status As New OleDbParameter("@Status", OleDbType.VarChar, 100) With {
.Value = "denied"
}
EnrollmentDeniedCommand.Parameters.Add(Status)
' Student Number
Dim StudentNumber As New OleDbParameter("@StudentNumber", OleDbType.VarChar, 100) With {
.Value = ""
}
EnrollmentDeniedCommand.Parameters.Add(StudentNumber)
If EnrollmentDeniedCommand.ExecuteNonQuery() Then
EnrollmentDeniedConnection.Close()
MsgBox("Student denied successfully.", MsgBoxStyle.Information, "Student Denied!")
Me.EnrollmentDataTableAdapter.Fill(Me.Pre_enrollmentDataSet.EnrollmentData)
Else
MsgBox("Your data update failed.", MsgBoxStyle.Critical, "Update Failed")
Return
End If
If StatusTextBox.Text = "enrolled" Then
btnApprove.Visible = False
btnGenerateID.Visible = True
Else
btnApprove.Visible = True
btnGenerateID.Visible = False
End If
If StatusTextBox.Text = "denied" Then
btnDenied.Visible = False
Else
btnDenied.Visible = True
End If
Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Rejecting data failed!")
Exit Sub
End Try
End Sub
Private Sub GenerateID_Click(sender As Object, e As EventArgs) Handles btnGenerateID.Click
cmbEnrollmentNum.Text = AdvancedDataGridView1.CurrentRow.Cells(2).Value.ToString
GenarateID.Show()
End Sub
Private Sub EnrollmentNumberTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles EnrollmentNumberTextBox1.KeyPress
'Allowed Numbers only
If Asc(e.KeyChar) <> 8 Then
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
e.Handled = True
End If
End If
End Sub
Private Sub StudentNumberTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles StudentNumberTextBox1.KeyPress
'Allowed Numbers and "-" only
If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 45 Then
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
e.Handled = True
End If
End If
End Sub
Private Sub GradeLevelTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles GradeLevelTextBox1.KeyPress
'Allowed Numbers and "-" only
If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 45 Then
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
e.Handled = True
End If
End If
End Sub
Private Sub StrandTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles StrandTextBox1.KeyPress
'Allowed letters numbers and ()
If e.KeyChar <> ControlChars.Back = True Then
If "~`@%^&+={[}]!:,;'><?/|\-.#+_$*".IndexOf(e.KeyChar) = -1 = False Then
e.Handled = True
End If
End If