T0 Lampiran Institutional Repository | Satya Wacana Christian University: Perancangan Implementasi Aplikasi Desktop Sistem Informasi Pengelolaan Data dan Penyebaran Informasi Sekolah Dasar Berbasis SMS Gateway

LAMPIRAN
1. Kode Program
Kode Program 1. Kode program untuk Fo rm Data
Imports BusinessLib
Public Class formData
#Region " Member "
Dim _siswa As Siswa
Dim _guru As Guru
Dim _mapel As MataPelajaran
Dim _kelas As Kelas
Dim _ruang As Ruang
Dim _ta As TahunAjaran
#End Region
#Region " Method "
Private Sub FillCombo()
Dim _list As ListKelas = ListKelas.GetData
For Each l As Kelas In _list
KelasCB.Items.Add(l.NAMA_KELAS)
Next
End Sub
Private Sub FillDGV()

Dim _myList As ListSiswa = ListSiswa.GetData()
SiswaDGV.DataSource = _myList
Dim _myTeacherList As ListGuru = ListGuru.GetData()
GuruDGV.DataSource = _myTeacherList
Dim _mapelList As ListMapel = ListMapel.GetData()
MapelDGV.DataSource = _mapelList
Dim _kelasList As ListKelas = ListKelas.GetData()
KelasDGV.DataSource = _kelasList
Dim _ruangList As ListRuang = ListRuang.GetData()
RuangDGV.DataSource = _ruangList
Dim _taList As ListTA = ListTA.GetData()
TADGV.DataSource = _taList
End Sub
Private Sub reset()
NISTb.Text = ""
namaTB.Text = ""
TempatLahirTb.Text = ""
TglLahirTb.Value = Date.Now
AlamatTb.Text = ""
LakiRb.Checked = False

PuanRb.Checked = False
AgamaCB.SelectedIndex = 0
anakNUD.Value = 1
TglMasukTb.Value = Date.Now
KelasCB.SelectedIndex = 0
NamaORtuTB.Text = ""
PekerjaanOrtuTb.Text = ""
AlamatOrtuTb.Text = ""
No_telpTb.Text = ""
kodeGuruTb.Text = ""
NIPTb.Text = ""
NamaGuruTb.Text = ""
tempatLairGuruTb.Text = ""
tglLahirGuruTb.Value = Date.Now

51

52

alamatGuruTb.Text = ""

lakiGuruRb.Checked = False
pereGuruRb.Checked = False
AgamaGuruCb.SelectedIndex = 0
TelpGuruTb.Text = ""
kodeMapelTb.Text = ""
namaMapelTb.Text = ""
kodeKelasTb.Text = ""
namaKelasTb.Text = ""
kodeRuangTb.Text = ""
namaRuangTb.Text = ""
idTAtb.Text = ""
taTb.Text = ""
taNUD.Value = 1
End Sub
Private Sub GetDatabyNIS(ByVal nis As String)
Try
Dim _oneData As ListSiswa = ListSiswa.GetData(nis)
If Not _oneData Is Nothing Then
SiswaDGV.DataSource = _oneData
End If

SearchTb.Text = "Cari Berdasarkan NIS"
Catch ex As Exception
Throw ex
End Try
End Sub
Private Sub EditSiswa()
Dim d As Siswa = SiswaDGV.SelectedRows(0).DataBoundItem
_siswa = Siswa.GetOneData(d.NIS)
With _siswa
NISTb.Text = .NIS
namaTB.Text = .NAMA
TempatLahirTb.Text = .TEMPAT_LAHIR
TglLahirTb.Value = .TANGGAL_LAHIR
AlamatTb.Text = .ALAMAT
CekJenis(.JENIS_KELAMIN.Trim, SplitContainer2.Panel2)
AgamaCB.Text = .AGAMA.Trim
anakNUD.Value = .ANAK_KE
TglMasukTb.Value = .TANGGAL_MASUK
KelasCB.Text = .START_CLASS
NamaORtuTB.Text = .NAMA_ORANG_TUA

PekerjaanOrtuTb.Text = .PEKERJAAN
AlamatOrtuTb.Text = .ALAMAT_ORANG_TUA
No_telpTb.Text = .NO_TELEPON
End With
NISTb.ReadOnly = True
End Sub
Private Sub editGuru()
Dim g As Guru = GuruDGV.SelectedRows(0).DataBoundItem
_guru = Guru.GetOneData(g.KODE_GURU)
With _guru
kodeGuruTb.Text = .KODE_GURU
NIPTb.Text = .NIP
NamaGuruTb.Text = .NAMA
tempatLairGuruTb.Text = .TEMPAT_LAHIR
tglLahirGuruTb.Value = .TANGGAL_LAHIR
alamatGuruTb.Text = .ALAMAT
CekJenis(.JENIS_KELAMIN.Trim, SplitContainer3.Panel2)

53


AgamaGuruCb.Text = .AGAMA.Trim
TelpGuruTb.Text = .NO_TELEPON
End With
kodeGuruTb.ReadOnly = True
End Sub
Private Sub EditMapel()
Dim m As MataPelajaran =
MapelDGV.SelectedRows(0).DataBoundItem
_mapel = MataPelajaran.GetOneData(m.KODE_MAPEL)
With _mapel
kodeMapelTb.Text = .KODE_MAPEL
namaMapelTb.Text = .NAMA_MAPEL
End With
kodeMapelTb.ReadOnly = True
End Sub
Private Sub EditRuang()
Dim r As Ruang = RuangDGV.SelectedRows(0).DataBoundItem
_ruang = Ruang.GetOneData(r.KODE_RUANG)
With _ruang
kodeRuangTb.Text = .KODE_RUANG

namaRuangTb.Text = .NAMA_RUANG
End With
kodeRuangTb.ReadOnly = True
End Sub
Private Sub EditKelas()
Dim k As Kelas = KelasDGV.SelectedRows(0).DataBoundItem
_kelas = Kelas.GetOneData(k.KODE_KELAS)
With k
kodeKelasTb.Text = .KODE_KELAS
namaKelasTb.Text = .NAMA_KELAS
End With
kodeKelasTb.ReadOnly = True
End Sub
Private Sub EditTA()
Dim ta As TahunAjaran =
TADGV.SelectedRows(0).DataBoundItem
_ta = TahunAjaran.GetOneData(ta.KODE_TAHUN)
With ta
idTAtb.Text = .KODE_TAHUN
taTb.Text = .TAHUN_AJARAN

taNUD.Value = .WAKTU_MAKS
End With
idTAtb.ReadOnly = True
End Sub
Private Sub CekJenis(ByVal _jenis As String, ByVal sender As
System.Object)
For Each c As Control In sender.Controls
If TypeOf c Is RadioButton Then
If c.Text = _jenis Then
CType(c, RadioButton).Checked = True
End If
End If
Next
End Sub
#End Region
#Region " Event Handler "
Private Sub formData_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

54


FillDGV()
FillCombo()
reset()
End Sub
Private Sub TambahSiswaBt_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TambahSiswaBt.Click
If NISTb.ReadOnly = False Then
_siswa = Siswa.NewObj
End If
Try
With _siswa
.NIS = NISTb.Text
.NAMA = namaTB.Text
.TEMPAT_LAHIR = TempatLahirTb.Text
.TANGGAL_LAHIR = TglLahirTb.Value
.ALAMAT = AlamatTb.Text
If LakiRb.Checked Then
.JENIS_KELAMIN = LakiRb.Text
Else

.JENIS_KELAMIN = PuanRb.Text
End If
.AGAMA = AgamaCB.Text
.ANAK_KE = anakNUD.Value
.TANGGAL_MASUK = TglMasukTb.Value
.START_CLASS = KelasCB.Text
.NAMA_ORANG_TUA = NamaORtuTB.Text
.PEKERJAAN = PekerjaanOrtuTb.Text
.ALAMAT_ORANG_TUA = AlamatOrtuTb.Text
.NO_TELEPON = No_telpTb.Text
.STATUS_AKTIF = "1"
.KELAS_SEKARANG = KelasCB.Text
.save()
End With
MessageBox.Show("Data Telah Tersimpan", "Informasi")
reset()
FillDGV()
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub
Private Sub GuruBt_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles GuruBt.Click
If kodeGuruTb.ReadOnly = False Then
_guru = Guru.NewObj
End If
Try
With _guru
.KODE_GURU = kodeGuruTb.Text
.NIP = NIPTb.Text
.NAMA = NamaGuruTb.Text
.TEMPAT_LAHIR = tempatLairGuruTb.Text
.TANGGAL_LAHIR = tglLahirGuruTb.Value
.ALAMAT = alamatGuruTb.Text
If lakiGuruRb.Checked Then
.JENIS_KELAMIN = lakiGuruRb.Text
Else
.JENIS_KELAMIN = pereGuruRb.Text

55

End If
.AGAMA = AgamaGuruCb.Text
.NO_TELEPON = TelpGuruTb.Text
.save()
End With
MessageBox.Show("Data Telah Tersimpan", "Informasi")
reset()
FillDGV()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub MapelBt_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MapelBt.Click
If kodeMapelTb.ReadOnly = False Then
_mapel = MataPelajaran.NewObj
End If
Try
With _mapel
.KODE_MAPEL = kodeMapelTb.Text
.NAMA_MAPEL = namaMapelTb.Text
.save()
End With
MessageBox.Show("Data Telah Tersimpan", "Informasi")
reset()
FillDGV()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub KelasBt_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles KelasBt.Click
If kodeKelasTb.ReadOnly = False Then
_kelas = Kelas.NewObj
End If
Try
With _kelas
.KODE_KELAS = kodeKelasTb.Text
.NAMA_KELAS = namaKelasTb.Text
.save()
End With
MessageBox.Show("Data Telah Tersimpan", "Informasi")
reset()
FillDGV()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub RuangBt_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles RuangBt.Click
If kodeRuangTb.ReadOnly = False Then
_ruang = Ruang.NewObj
End If
Try
With _ruang
.KODE_RUANG = kodeRuangTb.Text

56

.NAMA_RUANG = namaRuangTb.Text
.save()
End With
MessageBox.Show("Data Telah Tersimpan", "Informasi")
reset()
FillDGV()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub taBt_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles taBt.Click
If idTAtb.ReadOnly = False Then
_ta = TahunAjaran.NewObj
End If
Try
With _ta
.KODE_TAHUN = idTAtb.Text
.TAHUN_AJARAN = taTb.Text
.WAKTU_MAKS = taNUD.Value
.save()
End With
MessageBox.Show("Data Telah Tersimpan", "Informasi")
reset()
FillDGV()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub SearchTb_Enter(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SearchTb.Enter
SearchTb.Text = ""
End Sub
Private Sub SearchBt_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles SearchBt.Click
GetDatabyNIS(SearchTb.Text)
End Sub
Private Sub SearchTb_KeyPress(ByVal sender As Object, ByVal e
As System.Windows.Forms.KeyPressEventArgs) Handles
SearchTb.KeyPress
If Not (IsNumeric(e.KeyChar) Or Asc(e.KeyChar) = 8 Or
Asc(e.KeyChar) = 13) Then
e.Handled = True
End If
If Asc(e.KeyChar) = 13 Then
GetDatabyNIS(SearchTb.Text)
End If
End Sub
Private Sub AllBt_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles AllBt.Click
FillDGV()
End Sub
Private Sub NewBt_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles NewBt.Click
reset()
NISTb.Focus()
NISTb.ReadOnly = False
End Sub

57

Private Sub EditBt_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles EditBt.Click
If SiswaDGV.SelectedRows.Count > 0 Then
EditSiswa()
Else
MessageBox.Show(My.Resources.EditRows, "Informasi")
End If
End Sub
Private Sub SiswaDGV_CellDoubleClick(ByVal sender As Object,
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles
SiswaDGV.CellDoubleClick
EditSiswa()
End Sub
Private Sub GuruDGV_CellDoubleClick(ByVal sender As Object,
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles
GuruDGV.CellDoubleClick
editGuru()
End Sub
Private Sub KelasDGV_CellDoubleClick(ByVal sender As Object,
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles
KelasDGV.CellDoubleClick
EditKelas()
End Sub
Private Sub MapelDGV_CellDoubleClick(ByVal sender As Object,
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles
MapelDGV.CellDoubleClick
EditMapel()
End Sub
Private Sub RuangDGV_CellDoubleClick(ByVal sender As Object,
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles
RuangDGV.CellDoubleClick
EditRuang()
End Sub
Private Sub TADGV_CellDoubleClick(ByVal sender As Object,
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles
TADGV.CellDoubleClick
EditTA()
End Sub
Private Sub CancelBt_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles CancelBtGuru.Click,
CancelBtSiswa.Click, CancelBtKelas.Click, CancelBtMapel.Click,
CancelBtRuang.Click, CancelBtTA.Click
reset()
End Sub
#End Region
Private Sub numerikTb_KeyPress(ByVal sender As Object, ByVal e
As System.Windows.Forms.KeyPressEventArgs) Handles NISTb.KeyPress,
TelpGuruTb.KeyPress, No_telpTb.KeyPress, SearchTb.KeyPress,
NIPTb.KeyPress
If Not IsNumeric(e.KeyChar) And Not Asc(e.KeyChar) = 8
Then
e.Handled = True
End If
End Sub
Private Sub namaTB_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles namaTB.KeyPress
If IsNumeric(e.KeyChar) Then
e.Handled = True

58

End If
End Sub
End Class

Kode Program 2. Kode program untuk Form Jadwal
Imports BusinessLib
Public Class FormJadwal
#Region " Data Members "
Dim _guru As Guru
Dim _mapel As MataPelajaran
Dim _kelas As Kelas
Dim _ruang As Ruang
Dim _ta As TahunAjaran
Dim _jadwal As Jadwal
Dim _nilai As Nilai
Private kelas As String = ""
Private tahunAjaran As String = ""
Private hari As String = ""
Private jam As String = ""
Private kodeGuru As String = ""
Private kodeRuang As String = ""
Private kodeMapel As String = ""
Dim waktuMaks As Integer = 0
Private _isNEw As Boolean = False
#End Region
#Region " Event Handler "
Private Sub FormJadwal_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Call FillController()
Call reNew()
End Sub
Private Sub NewBt_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles NewBt.Click
_isNEw = True
MakeTemplateJadwal()
End Sub
Private Sub TambahBt_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TambahBt.Click
kodeGuru = GuruCB.Text.Substring(0, 3)
kodeMapel = MapelCB.Text.Substring(0, 3)
kodeRuang = RuangCB.Text.Substring(0, 3)
For Each col As DataGridViewColumn In JadwalDGV.Columns
If col.Name = KelasCB.Text Then
For Each row As DataGridViewRow In JadwalDGV.Rows
For i As Integer = 0 To row.Cells.Count - 1
If row.Cells.Item(i).Value = HariCb.Text Then
Dim max As Decimal = 1
Do While max