You are on page 1of 14

Public Class frmcurriculumList

Dim ctr As Integer = 0


Dim trues As Integer = 1
Dim used0 As Integer = 0
Dim curid1, yrlevelid1, subcode, subdesc, used1 As String
Dim found, found1
Sub loadall()
sSql = "Select * from tblsubject where used<> '" & trues & "' order by subjcode
asc"
execSQL(sSql, False)
loadsubject()
sSql = "select * from tblcurriculumlist order by curriculumid"
execSQL(sSql, False)
loadcurriculumlist()
End Sub
Sub loadcmbsubject()

cmbsubjectcode.Items.Clear()
While RD.Read
cmbsubjectcode.Items.Add(RD(1))
End While
End Sub
Sub loadsubject()
Lvsubject.Items.Clear()

While RD.Read
With Lvsubject.Items.Add(RD(1), 0)
.SubItems.Add(RD("description"))
.SubItems.Add(RD("subjid"))
End With
End While
End Sub
Sub loadsubjecttrap()
Lvsubject.Items.Clear()

While RD.Read
With Lvsubject.Items.Add(RD(1), 0)
.SubItems.Add(RD("description"))
.SubItems.Add(RD("subjid"))
End With
End While
End Sub
Sub loadglevel()

cmbglevel.Items.Clear()
While RD.Read
cmbglevel.Items.Add(RD("gradelevel"))
End While
End Sub
Sub loadcurriculum()

cmbcurriculum.Items.Clear()
While RD.Read
cmbcurriculum.Items.Add(RD(1))
cmbcurriculum1.Items.Add(RD(1))
End While
End Sub
Sub loadcurriculumlist()
Lvadd.Items.Clear()

While RD.Read
With Lvadd.Items.Add(RD(0), 0)
sSql2 = "select * from tblcurriculum where curriculumid = '" &
RD("curriculumid") & "'"
execSQL2(sSql2, False)
If RD2.Read Then
.SubItems.Add(RD2("curriculum"))
End If
sSql1 = "select * from tblgradelevel where glevelid = '" & RD("glevelid")
& "'"
execSQL1(sSql1, False)
If RD1.Read Then
.SubItems.Add(RD1("gradelevel"))
End If
sSql3 = "select * from tblsubject where subjid = '" & RD("subjid") & "'"
execSQL3(sSql3, False)
If RD3.Read Then
.SubItems.Add(RD3("subjcode"))
End If
'.SubItems.Add(RD("description"))
'.SubItems.Add(RD("unit"))
End With
End While
End Sub

Sub addedit()
cmdadd.Enabled = False
cmdremove.Enabled = True
cmdupdate.Enabled = True
GroupBox2.Enabled = True
GroupBox1.Enabled = False
txtsearch.Text = ""
End Sub
Sub Clear()
For Each obj In Me.GroupBox3.Controls
If TypeOf (obj) Is Bunifu.Framework.UI.BunifuMetroTextbox Then
obj.text = ""
End If
Next
For Each obj In Me.GroupBox3.Controls
If TypeOf (obj) Is ComboBox Then
obj.text = ""
End If
Next

End Sub
Sub savecancel()
cmdadd.Enabled = True

cmdremove.Enabled = False
cmdupdate.Enabled = False
txtsearch.Focus()
GroupBox2.Enabled = False
GroupBox1.Enabled = True
txtsearch.Text = ""
txtcurcid.Text = "-1"
txtsubjectid.Text = "-1"
txtcurriculumid.Text = "-1"
Clear()
End Sub
Private Sub frmcurriculumList_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
sSql = "Select * from tblsubject where used<> '" & trues & "' order by subjcode
asc"
execSQL(sSql, False)
loadsubject()

sSql = "select * from tblsubject order by subjid"


execSQL(sSql, False)
loadcmbsubject()

sSql = "select * from tblgradelevel order by glevelid"


execSQL(sSql, False)
loadglevel()

sSql = "select * from tblcurriculum order by curriculum"


execSQL(sSql, False)
loadcurriculum()

sSql = "select * from tblcurriculumlist order by curriculumid"


execSQL(sSql, False)
loadcurriculumlist()

Me.Text = "Curriculum Checklist"


End Sub

Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles


CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
While ctr <= Val(Lvsubject.Items.Count) - 1
Lvsubject.Items(ctr).Checked = True
ctr += 1
End While
ElseIf CheckBox1.Checked = False Then
While ctr <= Val(Lvsubject.Items.Count) - 1
Lvsubject.Items(ctr).Checked = False
ctr += 1
End While
End If
ctr = 0
End Sub

Private Sub txtcurid_TextChanged(sender As Object, e As EventArgs) Handles


txtcurid.TextChanged
sSql = "select * from tblcurriculum where curriculumid = " & txtcurriculumid.Text
& ""
execSQL(sSql, False)
If RD.Read Then
cmbcurriculum1.Text = RD("curriculum")
End If
End Sub
Private Sub cmbcurriculum_SelectedIndexChanged(sender As Object, e As EventArgs)
Handles cmbcurriculum.SelectedIndexChanged
sSql = "select * from tblcurriculum where curriculum = '" & cmbcurriculum.Text &
"'"
execSQL(sSql, False)
If RD.Read Then
txtcurriculumid.Text = RD(0)
End If

If cmbcurriculum.Text = "" Or cmbglevel.Text = "" Then


Lvsubject.CheckBoxes = False
CheckBox1.Enabled = False
ElseIf cmbcurriculum.Text <> "" Or cmbglevel.Text <> "" Then
Lvsubject.CheckBoxes = True
CheckBox1.Enabled = True
End If
End Sub

Private Sub cmbcurriculum_DropDown(sender As Object, e As EventArgs) Handles


cmbcurriculum.DropDown
sSql = "select * from tblcurriculum order by curriculum"
execSQL(sSql, False)
loadcurriculum()
End Sub

Private Sub cmbglevel_DropDown(sender As Object, e As EventArgs) Handles


cmbglevel.DropDown
sSql = "select * from tblgradelevel order by glevelid"
execSQL(sSql, False)
loadglevel()
End Sub

Private Sub cmbglevel_SelectedIndexChanged(sender As Object, e As EventArgs) Handles


cmbglevel.SelectedIndexChanged
sSql1 = "select * from tblgradelevel where gradelevel='" & cmbglevel.Text & "'"
execSQL1(sSql1, False)
If RD1.Read Then
txtglevelid.Text = RD1("glevelid")
End If

sSql = "Select * from tblsubject where glevelid='" & txtglevelid.Text & "' and
used<> '" & trues & "' order by subjcode asc"
execSQL(sSql, False)
loadsubject()

If cmbcurriculum.Text = "" Or cmbglevel.Text = "" Then


Lvsubject.CheckBoxes = False
CheckBox1.Enabled = False
ElseIf cmbcurriculum.Text <> "" Or cmbglevel.Text <> "" Then
Lvsubject.CheckBoxes = True
CheckBox1.Enabled = True
End If
'Try
' If cmbglevel.Text = "" Then
' txtglevelid.Text = ""
' Else
' sSql1 = "select * from tblgradelevel where gradelevel='" &
cmbglevel.Text & "'"
' execSQL1(sSql1, False)
' If RD1.Read Then
' txtglevelid.Text = RD1("glevelid")
' End If
' End If
'Catch ex As Exception
'End Try
End Sub

Private Sub cmbglevel_TextChanged(sender As Object, e As EventArgs) Handles


cmbglevel.TextChanged
sSql1 = "select * from tblgradelevel where gradelevel='" & cmbglevel.Text & "'"
execSQL1(sSql1, False)
If RD1.Read Then
txtglevelid.Text = RD1("glevelid")
End If

sSql = "Select * from tblsubject where glevelid='" & txtglevelid.Text & "' and
used<> '" & trues & "' order by subjcode asc"
execSQL(sSql, False)
loadsubject()

'Try
' sSql1 = "select * from tblgradelevel where gradelevel='" & cmbglevel.Text &
"'"
' execSQL1(sSql1, False)
' If RD1.Read Then
' txtglevelid.Text = RD1("glevelid")
' End If
' sSql = "Select * from tbltempsubject where glevelid='" & txtglevelid.Text &
"' order by subjcode asc"
' execSQL(sSql, False)
' loadsubject()
'Catch ex As Exception
'End Try

'Dim ctr As Integer = 0

'Try
' While ctr <= Val(Lvadd.Items.Count) - 1
' sSql1 = "select * from tblgradelevel where gradelevel='" &
cmbglevel.Text & "'"
' execSQL1(sSql1, False)
' If RD1.Read Then
' txtglevelid.Text = RD1("glevelid")
' End If

' If sSql1 = "Select * from tblcurriculumlist where glevelid='" &


txtglevelid.Text & "' and subjid='" & Lvadd.Items(ctr).SubItems(3).Text & "'" Then
' execSQL1(sSql1, False)
' If RD1.Read Then
' MsgBox("You cannot add the same curriculum checklist",
MsgBoxStyle.Critical)
' End If
' Else
' sSql1 = "Select * from tbltempsubject where glevelid='" &
txtglevelid.Text & "' order by subjcode asc"
' execSQL1(sSql1, False)
' loadsubject()
' End If
' ctr += 1
' End While
' 'cmbsubjectcode.Items.Clear()

'Catch ex As Exception

'End Try
'Me.Text = "Curriculum Checklist"
End Sub

Private Sub txtglevelid_TextChanged(sender As Object, e As EventArgs) Handles


txtglevelid.TextChanged
sSql = "select * from tblgradelevel where glevelid = " & txtglevelid.Text & ""
execSQL(sSql, False)
If RD.Read Then
cmbglevel.Text = RD("gradelevel")
End If
End Sub

Private Sub cmdadd_Click(sender As Object, e As EventArgs) Handles cmdadd.Click


Dim ctr As Integer = 0
'Dim ctr1 As Integer = 0
'If Me.Text = "Curriculum Checklist" Then
' If Lvsubject.Items(ctr1).Checked = True Then
' sSql = "select * from tblsubject where subjid= '" &
Lvsubject.Items(ctr).SubItems(2).Text & "' and used= '" & trues & "'"
' If RD.Read Then
' MsgBox("Checklist already exist", MsgBoxStyle.Critical, "Warning")
' ElseIf (cmbcurriculum.Text = "" Or txtcurriculumid.Text = "") And
(cmbglevel.Text = "" Or txtglevelid.Text = "") Then
' cmdadd.Enabled = False
' ElseIf txtcurriculumid.Text = "" Or cmbcurriculum.Text = "" Then
' MsgBox("Please Select a curriculum where in to enlist the subject.
Thank you!", MsgBoxStyle.Information, "information")
' txtcurriculumid.Text = "-1"
' txtglevelid.Text = "-1"
' loadall()
' ElseIf txtglevelid.Text = "" Or cmbcurriculum.Text = "" Then
' MsgBox("Please Select a Grade Level where in to enlist the subject.
Thank you!", MsgBoxStyle.Information, "information")
' txtcurriculumid.Text = "-1"
' txtglevelid.Text = "-1"
' loadall()
' Else
' While ctr <= Lvsubject.CheckedItems.Count - 1
' If MsgBox("Are you sure you want to add subject " &
Lvsubject.Items(ctr).SubItems(0).Text & " in the curriculum of " & cmbcurriculum.Text & "
?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
' sSql1 = "insert into tblcurriculumlist values(" &
txtcurriculumid.Text & "," & txtglevelid.Text & _
' ", '" & Lvsubject.Items(ctr).SubItems(2).Text & "')"
' execSQL1(sSql1, True)
' txtused.Text = "1"
' used1 = txtused.Text
' sSql2 = "update tblsubject set used='" & used1 & "' where
subjid=" & Lvsubject.Items(ctr).SubItems(2).Text & ""
' execSQL2(sSql2, True)
' End If
' sSql = "select * from tblcurriculumlist order by curriculumid"
' execSQL(sSql, False)
' loadcurriculumlist()
' ctr += 1
' End While
' End If
' End If
'End If
'Clear()
'sSql = "Select * from tblsubject where used<> '" & trues & "' order by subjcode
asc"
'execSQL(sSql, False)
'loadsubject()

' 222 If Me.Text = "Curriculum Checklist" Then

' sSql = "select * from tblsubject where subjid= '" &


Lvsubject.Items(ctr).SubItems(2).Text & "' and used= '" & trues & "'"
' If RD.Read Then
' MsgBox("Checklist already exist", MsgBoxStyle.Critical, "Warning")
' ElseIf (cmbcurriculum.Text = "" Or txtcurriculumid.Text = "") And
(cmbglevel.Text = "" Or txtglevelid.Text = "") Then
' cmdadd.Enabled = False
' ElseIf txtcurriculumid.Text = "" Or cmbcurriculum.Text = "" Then
' MsgBox("Please Select a curriculum where in to enlist the subject. Thank
you!", MsgBoxStyle.Information, "information")
' txtcurriculumid.Text = "-1"
' txtglevelid.Text = "-1"
' loadall()
' ElseIf txtglevelid.Text = "" Or cmbcurriculum.Text = "" Then
' MsgBox("Please Select a Grade Level where in to enlist the subject.
Thank you!", MsgBoxStyle.Information, "information")
' txtcurriculumid.Text = "-1"
' txtglevelid.Text = "-1"
' loadall()
' Else
' If MsgBox("Are you sure you want to add subject " &
Lvsubject.Items(ctr).SubItems(0).Text & " in the curriculum of " & cmbcurriculum.Text & "
?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
' If Lvsubject.Items(ctr).Checked = True Then
' While ctr <= Val(Lvsubject.Items.Count) - 1
' sSql1 = "insert into tblcurriculumlist values(" &
txtcurriculumid.Text & "," & txtglevelid.Text & _
' ", '" & Lvsubject.Items(ctr).SubItems(2).Text & "')"
' execSQL1(sSql1, True)
' txtused.Text = "1"
' used1 = txtused.Text
' sSql2 = "update tblsubject set used='" & used1 & "' where
subjid=" & Lvsubject.Items(ctr).SubItems(2).Text & ""
' execSQL2(sSql2, True)
' ctr += 1
' End While
' End If
' sSql = "select * from tblcurriculumlist order by curriculumid"
' execSQL(sSql, False)
' loadcurriculumlist()
' End If
'End If
'End If

'sSql = "Select * from tblsubject where used<> '" & trues & "' order by subjcode
asc"
'execSQL(sSql, False)
'loadsubject()
'Clear()

333: While ctr <= Val(Lvsubject.Items.Count) - 1


If Me.Text = "Curriculum Checklist" Then
If Lvsubject.Items(ctr).Checked = True Then
sSql = "select * from tblsubject where subjid= '" &
Lvsubject.Items(ctr).SubItems(2).Text & "' and used= '" & trues & "'"
If RD.Read Then
MsgBox("Checklist already exist", MsgBoxStyle.Critical,
"Warning")
ElseIf (cmbcurriculum.Text = "" Or txtcurriculumid.Text = "") And
(cmbglevel.Text = "" Or txtglevelid.Text = "") Then
cmdadd.Enabled = False
ElseIf txtcurriculumid.Text = "" Or cmbcurriculum.Text = "" Then
MsgBox("Please Select a curriculum where in to enlist the
subject. Thank you!", MsgBoxStyle.Information, "information")
txtcurriculumid.Text = "-1"
txtglevelid.Text = "-1"
loadall()
ElseIf txtglevelid.Text = "" Or cmbcurriculum.Text = "" Then
MsgBox("Please Select a Grade Level where in to enlist the
subject. Thank you!", MsgBoxStyle.Information, "information")
txtcurriculumid.Text = "-1"
txtglevelid.Text = "-1"
loadall()
Else
If MsgBox("Are you sure you want to add subject " &
Lvsubject.Items(ctr).SubItems(0).Text & " in the curriculum of " & cmbcurriculum.Text & "
?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
sSql1 = "insert into tblcurriculumlist values(" &
txtcurriculumid.Text & "," & txtglevelid.Text & _
", '" & Lvsubject.Items(ctr).SubItems(2).Text & "')"
execSQL1(sSql1, True)
txtused.Text = "1"
used1 = txtused.Text
sSql2 = "update tblsubject set used='" & used1 & "' where
subjid=" & Lvsubject.Items(ctr).SubItems(2).Text & ""
execSQL2(sSql2, True)
clientTrail("Successfully added new curriculum checklist with
a curriculum of " & cmbcurriculum.Text & " and a subject code of " &
Lvsubject.Items(ctr).SubItems(0).Text & "")
End If
sSql = "select * from tblcurriculumlist order by curriculumid"
execSQL(sSql, False)
loadcurriculumlist()
End If
End If
End If
ctr += 1
End While
Clear()
CheckBox1.Checked = False
If cmbcurriculum.Text = "" Or cmbglevel.Text = "" Then
Lvsubject.CheckBoxes = False
CheckBox1.Enabled = False
ElseIf cmbcurriculum.Text <> "" Or cmbglevel.Text <> "" Then
Lvsubject.CheckBoxes = True
CheckBox1.Enabled = True
End If

sSql = "Select * from tblsubject where used<> '" & trues & "' order by subjcode
asc"
execSQL(sSql, False)
loadsubject()

'If Me.Text = "Curriculum Checklist" Then

' If MsgBox("Are you sure you want to save?", MsgBoxStyle.YesNo) =


MsgBoxResult.Yes Then
' While ctr >= Val(Lvsubject.Items.Count) - 1
' sSql = "select * from tblcurriculumlist"
' execSQL(sSql, False)
' If RD.Read Then
' sSql1 = "insert into tblcurriculumlist values( " &
txtcurriculumid.Text & "," & txtglevelid.Text & _
' ", " & Lvsubject.Items(ctr).SubItems(2).Text & ") "
' execSQL1(sSql1, True)
' txtused.Text = "1"
' used1 = txtused.Text
' sSql2 = "update tblsubject set used='" & used1 & "' where
subjid=" & Lvsubject.Items(ctr).SubItems(2).Text & ""
' execSQL2(sSql2, True)
' End If
' ctr += 1
' End While
' End If
'End If

'sSql = "select * from tblcurriculumlist"


'execSQL(sSql, False)
'While ctr <= Val(Lvsubject.Items.Count) - 1
' sSql3 = "insert into tblcurriculumlist values( " & txtcurriculumid.Text &
"," & txtglevelid.Text & _
' ", " & Lvsubject.Items(ctr).SubItems(2).Text & ") "
' execSQL3(sSql3, True)
' If Lvsubject.Items(ctr).Checked = False Then
' subcode = Lvsubject.Items(ctr).SubItems(2).Text
' sSql = "select * from tblcurriculumlist where curriculumid=" &
txtcurriculumid.Text & " and glevelid=" & txtglevelid.Text & " and subjid =" & subcode &
" "
' execSQL(sSql, False)
' If RD.Read Then
' MsgBox("Checklist already exists!", MsgBoxStyle.Critical)
' Else
' End If
' End If
' ctr += 1
'End While
'sSql = "select * from tblcurriculumlist order by curriculumid"
'execSQL(sSql, False)
'loadcurriculumlist()
End Sub

Private Sub cmdclose_Click(sender As Object, e As EventArgs) Handles cmdclose.Click


Me.Close()
mainform.enablebutton()
End Sub

Private Sub Lvsubject_ItemChecked(sender As Object, e As ItemCheckedEventArgs)


Handles Lvsubject.ItemChecked
'If Lvsubject.CheckedItems.Count < 1 Then
' cmdadd.Enabled = False
' CheckBox1.Checked = False
'ElseIf (cmbcurriculum.Text = "" Or txtcurriculumid.Text = "") And
(cmbglevel.Text = "" Or txtglevelid.Text = "") Then
' cmdadd.Enabled = False
'ElseIf Lvsubject.CheckedItems.Count > 0 Then
' cmdadd.Enabled = True
' 'Else
' ' MsgBox("Please make sure you select a subject to be added on the
checklist! Thank you!", MsgBoxStyle.Information, "Information Box")
'End If
If Lvsubject.CheckedItems.Count < 1 Then
cmdadd.Enabled = False
CheckBox1.Checked = False
ElseIf Lvsubject.CheckedItems.Count > 0 Then
cmdadd.Enabled = True

'Else
' MsgBox("Please make sure you select a subject to be added on the
checklist! Thank you!", MsgBoxStyle.Information, "Information Box")
End If
End Sub

Private Sub cmdremove_Click(sender As Object, e As EventArgs) Handles cmdremove.Click


'If Lvadd.SelectedItems.Count = 0 Then
' MsgBox("No record was selected to edit .", MsgBoxStyle.Critical)
' 'Else
If ccurcid.Text = "" Then
MsgBox("No record was selected to edit .", MsgBoxStyle.Critical)
ElseIf MsgBox("Are you sure you want to Remove from the Curriculum checklist?",
MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
sSql = "delete from tblcurriculumlist where curriculumid= '" &
ccurriculumid.Text & "' and subjid=" & csubjid.Text & ""
execSQL(sSql, True)
sSql2 = "update tblsubject set used='" & used0 & "' where subjid=" &
csubjid.Text & ""
execSQL2(sSql2, True)
clientTrail("Successfully remove curriculum checklist with a curriculum of "
& cmbcurriculum1.Text & " and a subject code of " & cmbsubjectcode.Text & "")
csubjid.Text = "-1"
ccurcid.Text = ""
ccurriculumid.Text = "-1"
cglevelid.Text = "-1"
txtunit.Text = ""
txtdescription.Text = ""
txtgradel.Text = ""
cmbcurriculum1.Text = ""
cmbsubjectcode.Text = ""

End If

'End If
sSql = "Select * from tblsubject where used<> '" & trues & "' order by subjcode
asc"
execSQL(sSql, False)
loadsubject()
sSql = "select * from tblcurriculumlist order by curriculumid"
execSQL(sSql, False)
loadcurriculumlist()
End Sub

'Private Sub Lvadd_DoubleClick(sender As Object, e As EventArgs) Handles


Lvadd.DoubleClick
' sSql2 = "Select * from tblcurriculumlist where curcid = " &
Lvadd.SelectedItems(0).SubItems(0).Text & ""
' execSQL2(sSql2, False)
' If RD2.Read Then
' ccurcid.Text = RD2(0)
' ccurriculumid.Text = RD2(1)
' cglevelid.Text = RD2(2)
' csubjid.Text = RD2(3)
' End If

' sSql = "Select * from tblsubject where used<> '" & trues & "' order by subjcode
asc"
' execSQL(sSql, False)
' loadsubject()
' sSql = "select * from tblcurriculumlist order by curriculumid"
' execSQL(sSql, False)
' loadcurriculumlist()
'End Sub

Private Sub txtcurriculumid_TextChanged(sender As Object, e As EventArgs) Handles


txtcurriculumid.TextChanged
sSql = "select * from tblcurriculum where curriculumid = " & txtcurriculumid.Text
& ""
execSQL(sSql, False)
If RD.Read Then
cmbcurriculum.Text = RD("curriculum")
End If
End Sub
Private Sub cmbcurriculum1_SelectedIndexChanged(sender As Object, e As EventArgs)
Handles cmbcurriculum1.SelectedIndexChanged
sSql = "select * from tblcurriculum where curriculum = '" & cmbcurriculum1.Text &
"'"
execSQL(sSql, False)
If RD.Read Then
ccurriculumid.Text = RD(0)
End If
End Sub

Private Sub ccurriculumid_TextChanged(sender As Object, e As EventArgs) Handles


ccurriculumid.TextChanged
sSql = "select * from tblcurriculum where curriculumid = " & ccurriculumid.Text &
""
execSQL(sSql, False)
If RD.Read Then
cmbcurriculum1.Text = RD("curriculum")
End If
End Sub

Private Sub cmbsubjectcode_SelectedIndexChanged(sender As Object, e As EventArgs)


Handles cmbsubjectcode.SelectedIndexChanged
sSql = "select * from tblsubject where subjcode = '" & cmbsubjectcode.Text & "'"
execSQL(sSql, False)
If RD.Read Then
csubjid.Text = RD(0)
End If
End Sub

Private Sub txtgradel_OnValueChanged(sender As Object, e As EventArgs) Handles


txtgradel.OnValueChanged
sSql = "select * from tblgradelevel where gradelevel = '" & txtgradel.Text & "'"
execSQL(sSql, False)
If RD.Read Then
cglevelid.Text = RD(0)
End If
End Sub

Private Sub cglevelid_TextChanged(sender As Object, e As EventArgs) Handles


cglevelid.TextChanged
sSql = "select * from tblgradelevel where glevelid = " & cglevelid.Text & ""
execSQL(sSql, False)
If RD.Read Then
txtgradel.Text = RD("gradelevel")
End If
End Sub

Private Sub csubjid_TextChanged(sender As Object, e As EventArgs) Handles


csubjid.TextChanged
sSql = "select * from tblsubject where subjid = " & csubjid.Text & ""
execSQL(sSql, False)
If RD.Read Then
cmbsubjectcode.Text = RD("subjcode")
txtunit.Text = RD("unit")
txtdescription.Text = RD("description")
End If
End Sub

'Private Sub Lvadd_Click(sender As Object, e As EventArgs) Handles Lvadd.Click


' sSql2 = "Select * from tblcurriculumlist where curcid = " &
Lvadd.SelectedItems(0).SubItems(0).Text & ""
' execSQL2(sSql2, False)
' If RD2.Read Then
' ccurcid.Text = RD2(0)
' ccurriculumid.Text = RD2(1)
' cglevelid.Text = RD2(2)
' csubjid.Text = RD2(3)
' End If

' sSql = "Select * from tblsubject where used<> '" & trues & "' order by subjcode
asc"
' execSQL(sSql, False)
' loadsubject()
' sSql = "select * from tblcurriculumlist order by curriculumid"
' execSQL(sSql, False)
' loadcurriculumlist()
'End Sub

Private Sub txtsearch_OnValueChanged(sender As Object, e As EventArgs) Handles


txtsearch.OnValueChanged
If txtsearch.Text = "" Then
sSql = "select * from tblcurriculumlist order by curriculumid"
execSQL(sSql, False)
loadcurriculumlist()

Else
sSql = "select * from tblsubject,tblcurriculum,tblgradelevel where subjcode
like '" & txtsearch.Text & "%' or curriculum like '%" & txtsearch.Text & "%' or
gradelevel like '" & txtsearch.Text & "%' "
execSQL(sSql, False)
loadcurriculumlist()
End If
End Sub

Private Sub cmdupdate_Click(sender As Object, e As EventArgs) Handles cmdupdate.Click


If cmdupdate.LabelText = "UPDATE" Then
cmdremove.Enabled = True
GroupBox3.Enabled = False
cmdupdate.LabelText = "DONE"
cmdadd.Visible = False
GroupBox1.Enabled = True
SUBJECTLABEL.Visible = False
ADDLABEL.Visible = True
ElseIf cmdupdate.LabelText = "DONE" Then
cmdremove.Enabled = False
GroupBox3.Enabled = True
cmdupdate.LabelText = "UPDATE"
cmdadd.Visible = True
GroupBox1.Enabled = False
SUBJECTLABEL.Visible = True
ADDLABEL.Visible = False
csubjid.Text = "-1"
ccurcid.Text = ""
ccurriculumid.Text = "-1"
cglevelid.Text = "-1"
txtunit.Text = ""
txtdescription.Text = ""
txtgradel.Text = ""
cmbcurriculum1.Text = ""
cmbsubjectcode.Text = ""
End If

End Sub

Private Sub Lvadd_Click(sender As Object, e As EventArgs) Handles Lvadd.Click


sSql2 = "Select * from tblcurriculumlist where curcid = " &
Lvadd.SelectedItems(0).SubItems(0).Text & ""
execSQL2(sSql2, False)
If RD2.Read Then
ccurcid.Text = RD2(0)
ccurriculumid.Text = RD2(1)
cglevelid.Text = RD2(2)
csubjid.Text = RD2(3)
End If

sSql = "Select * from tblsubject where used<> '" & trues & "' order by subjcode
asc"
execSQL(sSql, False)
loadsubject()
End Sub
End Class

You might also like