Modul Ujikom SMK Aplikasi Penilaian

MODUL UJIKOM
APLIKASI PENILAIAN
Oleh : Agun Guntara, M.Kom.
1.      Deskripsi sistem
aplikasi penilaian yaitu aplikasi yang dibuat untuk mengelola kontrak mata pelajaranan untuk guru, serta penilaian guru terhadap siswa sesuai dengan kontrak yang sudah dierima. Sistem penilaian memiliki 3 jenis hak akses yaitu untuk Siswa, Guru, dan Admin dengan masing-masing user memiliki kewenangan yang berbeda.

2.      Batasan sistem
Agar aplikasi yang dibuat sesuai dengan tujuan maka sistem perlu dibatasi, batasann sistem sebagai berikut :
a.       Sistem untuk mengelola nilai siswa
b.      Sistem untuk mengelola kontrak guru
c.       Sistem untuk mengelola mata pelajaran
d.      Sistem untuk mengelola data kelas
e.       Sistem untuk mengelola data siswa
f.       Sistem untuk mengelola data guru
g.      Sistem untuk mengelola data wali siswa
3.      Kebutuhan dalam Pengembangan Aplikasi
a.       Software database MySQL bisa menggunakan XAMPP
b.      Visual Studio .NET
c.       mysql-connector-net-6.9.8
untuk koneksi database mysql ke VB NET
d.      ODBC driver
Untuk koneksi crystal report ke database
e.       Crystal Report
Aplikasi untuk membuat laporan
-          Download Version 13  Service Pack (SP) 1 (=> VS 2010)
-          Download Version 13  Service Pack (SP) 2
-          Download Version 13  Service Pack (SP) 3
-          Download Version 13  Service Pack (SP) 4
-          Download Version 13  Service Pack (SP) 5
-          Download Version 13  Service Pack (SP) 6
-          Download Version 13  Service Pack (SP) 7 (=> Mulai Support VS 2012)
-          Download Version 13  Service Pack (SP) 8
-          Download Version 13  Service Pack (SP) 9 (=> Mulai Support VS 2013)
-          Download Version 13 Service Pack (SP) 10
-          Download Version 13 Service Pack (SP) 12 (Tidak ada SP 11)
-          Download Version 13 Service Pack (SP) 13 
*Pilih sesuai dengan visual studio yang digunakan.
4.      Perancangan database
Pada sistem aplikasi terdapat beberapa tabel sebagai berikut :
*ceklis dan underline merupakan primary key


1.      Interface dan Coding
Buat modul koneksi’
Nama : Mdl_Koneksi

Imports MySql.Data.MySqlClient
Imports System.Data
Module Module1
    Public conn As MySqlConnection
    Public da As MySqlDataAdapter
    Public cmd As MySqlCommand
    Public ds As DataSet
    Public str As String
    Dim rawdata() As Byte
    Public tabel As DataTable
    Dim DR As MySqlDataReader

    Sub koneksi()
        Try
            Dim str As String = "SERVER=localhost;DATABASE=dbpenilaian;UID=root;PWD=;PORT=3306"
            conn = New MySqlConnection(str)
            If conn.State = ConnectionState.Closed Then
                conn.Open()
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Module



Imports MySql.Data.MySqlClient
Imports System.IO
Imports System.Drawing.Image
Public Class FrmSiswa
    Dim str As String = String.Empty
    Dim pathfile As String = Nothing
    Dim fs As FileStream
    Dim imagebytes As Byte = Nothing
    Dim filesize As UInt32
    Dim strimagename As String
    Private Property rd As MySqlDataReader

    Private Sub BtnSimpan_Click(sender As Object, e As EventArgs) Handles BtnSimpan.Click
        Dim tgl As Date
        Dim foto() As Byte = IO.File.ReadAllBytes(LblFoto.Text)
        If TxtNISN.Text = "" Then
            MessageBox.Show("NISN tidak boleh kosong")
            TxtNISN.Focus()
        ElseIf TxtNama.Text = "" Then
            MessageBox.Show("Nama tidak boleh kosong")
            TxtNama.Focus()
        ElseIf MEtgl.Text = "" Then
            MessageBox.Show("Tanggal lahir tidak boleh kosong")
            TxtNama.Focus()
        ElseIf TxtAlamat.Text = "" Then
            MessageBox.Show("alamat tidak boleh kosong")
            TxtAlamat.Focus()
        Else
            tgl = MEtgl.Text
            'Try
            Call koneksi()
            Dim str As String
            str = "insert into tbl_siswa(NISN,Nama,Alamat,Tgl_Lahir,Foto_Siswa,Nama_File,Path_File) values (?,?,?,?,?,?,?)"
            Dim cmd As New MySqlCommand(str, conn)
            With cmd
                .Parameters.Clear()
                .Parameters.Add(New MySqlParameter("NISN", MySqlDbType.Text)).Value = TxtNISN.Text ' NISN
                .Parameters.Add(New MySqlParameter("Nama", MySqlDbType.Text)).Value = TxtNama.Text ' Nama
                .Parameters.Add(New MySqlParameter("Alamat", MySqlDbType.Text)).Value = TxtAlamat.Text ' alamat
                .Parameters.Add(New MySqlParameter("Tgl_Lahir", MySqlDbType.Date)).Value = Format(tgl, "yyyy/MM/dd") ' tgl lahir
                .Parameters.Add(New MySqlParameter("Foto_Siswa", MySqlDbType.Binary)).Value = foto ' fot
                .Parameters.Add(New MySqlParameter("Nama_File", MySqlDbType.Text)).Value = TxtFoto.Text ' nama file foto
                .Parameters.Add(New MySqlParameter("Path_File", MySqlDbType.Text)).Value = LblFoto.Text ' lokasi file
                .ExecuteNonQuery()
                conn.Close()
            End With
            MessageBox.Show("Insert Data Siswa Berhasil Dilakukan", "informasi", MessageBoxButtons.OK, MessageBoxIcon.Information)
            'Catch ex As Exception
            'MessageBox.Show(ex.Message)
            'End Try
        End If

        Call tampilSiswa()
        Call input_nonaktif()
        Call tombol_awal()
    End Sub
    Function getFotoByNISN(ByVal NISN As Integer) As Byte()
        Call koneksi()
        Dim foto(0) As Byte
        Dim dc As MySqlCommand

        Dim str As String = "select foto_siswa from tbl_siswa where NISN=" & NISN
        dc = New MySqlCommand(str, conn)
        Dim dr As MySqlDataReader = dc.ExecuteReader
        While dr.Read
            foto = dr("foto_siswa")
        End While
        conn.Close()
        Return foto
    End Function

    Sub aturDGV()
        Try
            dtgridSiswa.Columns(0).Width = 70
            dtgridSiswa.Columns(1).Width = 100
            dtgridSiswa.Columns(2).Width = 100
            dtgridSiswa.Columns(3).Width = 80
            dtgridSiswa.Columns(4).Width = 150
            dtgridSiswa.Columns(5).Width = 150
            dtgridSiswa.Columns(6).Width = 150
            dtgridSiswa.Columns(7).Width = 100
            dtgridSiswa.Columns(0).HeaderText = "NISN"
            dtgridSiswa.Columns(1).HeaderText = "Nama"
            dtgridSiswa.Columns(2).HeaderText = "Alamat"
            dtgridSiswa.Columns(3).HeaderText = "Tanggal Lahir"
            dtgridSiswa.Columns(4).HeaderText = "Foto"
            dtgridSiswa.Columns(5).HeaderText = "Nama File"
            dtgridSiswa.Columns(6).HeaderText = "Path File"
            dtgridSiswa.Columns(4).Visible = False
            dtgridSiswa.Columns(5).Visible = False
            dtgridSiswa.Columns(6).Visible = False
        Catch ex As Exception
        End Try
    End Sub

    Sub tampilSiswa()
        Call koneksi()
        da = New MySqlDataAdapter("select NISN, Nama, Alamat, Tgl_Lahir, foto_siswa,Nama_File, Path_File from tbl_siswa", conn)
        ds = New DataSet
        da.Fill(ds, "tbl_siswa")
        dtgridSiswa.DataSource = ds.Tables("tbl_siswa")
    End Sub

    Private Sub FrmSiswa_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Call tampilSiswa()
        Call aturDGV()
        Call tombol_awal()
        Call input_nonaktif()
    End Sub

    Sub tombol_awal()
        BtnTambah.Enabled = True
        BtnRefresh.Enabled = True
        BtnBatal.Enabled = False
        BtnSimpan.Enabled = False
        BtnHapus.Enabled = False
        BtnEdit.Enabled = False
        BtnBrowse.Enabled = False
    End Sub

    Sub input_nonaktif()
        TxtNISN.Enabled = False
        TxtNama.Enabled = False
        TxtAlamat.Enabled = False
        MEtgl.Enabled = False
        TxtFoto.Enabled = False
        TxtFoto.Enabled = False
        PBfoto.Image = Nothing
        TxtCariNama.Enabled = True
        TxtCariNISN.Enabled = True
    End Sub

    Sub input_aktif()
        TxtNISN.Enabled = True
        TxtNISN.ReadOnly = True
        TxtNISN.ReadOnly = True
        TxtNama.Enabled = True
        TxtAlamat.Enabled = True
        MEtgl.Enabled = True
        TxtFoto.Enabled = True
        TxtCariNama.Enabled = True
        TxtCariNISN.Enabled = True
    End Sub

    Sub bersih()
        TxtNISN.Text = ""
        TxtNama.Text = ""
        TxtAlamat.Text = ""
        MEtgl.Text = Now
        TxtFoto.Text = ""
        PBfoto.Image = Nothing
        TxtFoto.Text = ""
        LblFoto.Text = ""
        TxtCariNISN.Text = ""
        TxtCariNama.Text = ""
    End Sub
    Private Sub BtnRefresh_Click(sender As Object, e As EventArgs) Handles BtnRefresh.Click
        Call koneksi()
        Call tampilSiswa()
    End Sub

    Sub NISNotomatis()
        Call koneksi()
        Dim tahun As String
        tahun = Format(Now, "yyyy")
        Dim DR As MySqlDataReader
        cmd = New MySqlCommand("select * from tbl_siswa where NISN in(select max(NISN) from tbl_siswa) order by NISN desc", conn)
        DR = cmd.ExecuteReader
        DR.Read()
        If DR.HasRows = 0 Then
            TxtNISN.Text = tahun & "0001"
            DR.Close()
        End If
        If Not DR.HasRows Then
            TxtNISN.Text = tahun & "0001"
            DR.Close()
        Else
            TxtNISN.Text = Val(Microsoft.VisualBasic.Mid(DR.Item("NISN").ToString, 5, 4)) + 1
            If Len(TxtNISN.Text) = 1 Then
                TxtNISN.Text = tahun & "000" & TxtNISN.Text
            ElseIf Len(TxtNISN.Text) = 2 Then
                TxtNISN.Text = tahun & "00" & TxtNISN.Text
            ElseIf Len(TxtNISN.Text) = 3 Then
                TxtNISN.Text = tahun & "0" & TxtNISN.Text
            End If
            DR.Close()
        End If
    End Sub

    Private Sub BtnTambah_Click(sender As Object, e As EventArgs) Handles BtnTambah.Click
        Call NISNotomatis()
        Call input_aktif()
        Call bersih()
        Call NISNotomatis()
        BtnSimpan.Enabled = True
        BtnBatal.Enabled = True
        BtnTambah.Enabled = False
        BtnBrowse.Enabled = True
    End Sub

    Private Sub TxtCariNISN_TextChanged(sender As Object, e As EventArgs) Handles TxtCariNISN.TextChanged
        Call koneksi()
        Dim RD As MySqlDataReader
        cmd = New MySqlCommand("select * from tbl_siswa where NISN like '%" & TxtCariNISN.Text & "%'", conn)
        RD = cmd.ExecuteReader
        RD.Read()
        If RD.HasRows Then
            da = New MySqlDataAdapter("select * from tbl_siswa where NISN like '%" & TxtCariNISN.Text & "%'", conn)
            ds = New DataSet
            conn.Close()
            da.Fill(ds, "ada")
            dtgridSiswa.DataSource = ds.Tables("ada")
            dtgridSiswa.ReadOnly = True
        Else
            da = New MySqlDataAdapter("select * from tbl_siswa where NISN like '%" & TxtCariNISN.Text & "%'", conn)
            ds = New DataSet
            conn.Close()
            da.Fill(ds, "ada")
            dtgridSiswa.DataSource = ds.Tables("ada")
            dtgridSiswa.ReadOnly = True
        End If

    End Sub

    Private Sub TxtCariNama_TextChanged(sender As Object, e As EventArgs) Handles TxtCariNama.TextChanged
        Call koneksi()
        Dim RD As MySqlDataReader
        cmd = New MySqlCommand("select * from tbl_siswa where Nama like '%" & TxtCariNama.Text & "%'", conn)
        RD = cmd.ExecuteReader
        RD.Read()
        If RD.HasRows Then
            da = New MySqlDataAdapter("select * from tbl_siswa where Nama like '%" & TxtCariNama.Text & "%'", conn)
            ds = New DataSet
            conn.Close()
            da.Fill(ds, "ada")
            dtgridSiswa.DataSource = ds.Tables("ada")
            dtgridSiswa.ReadOnly = True
        Else
            da = New MySqlDataAdapter("select * from tbl_siswa where Nama like '%" & TxtCariNama.Text & "%'", conn)
            ds = New DataSet
            conn.Close()
            da.Fill(ds, "ada")
            dtgridSiswa.DataSource = ds.Tables("ada")
            dtgridSiswa.ReadOnly = True
        End If
    End Sub

    Private Sub dtgridSiswa_CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles dtgridSiswa.CellMouseClick
        Dim st As New IO.MemoryStream(getFotoByNISN(dtgridSiswa.Rows(e.RowIndex).Cells(0).Value))
        Dim bit As New Bitmap(st)
        PBfoto.SizeMode = PictureBoxSizeMode.StretchImage
        TxtNISN.Text = dtgridSiswa.Rows(e.RowIndex).Cells(0).Value
        TxtNama.Text = dtgridSiswa.Rows(e.RowIndex).Cells(1).Value
        TxtAlamat.Text = dtgridSiswa.Rows(e.RowIndex).Cells(2).Value
        MEtgl.Text = dtgridSiswa.Rows(e.RowIndex).Cells(3).Value
        PBfoto.Image = bit
        LblFoto.Text = PBfoto.ImageLocation
        TxtFoto.Text = dtgridSiswa.Rows(e.RowIndex).Cells(5).Value
        LblFoto.Text = dtgridSiswa.Rows(e.RowIndex).Cells(6).Value
        BtnHapus.Enabled = True
        BtnEdit.Enabled = True
        BtnTambah.Enabled = False
        BtnBatal.Enabled = True
        Call input_aktif()
        BtnBrowse.Enabled = True
    End Sub

    Private Sub BtnHapus_Click(sender As Object, e As EventArgs) Handles BtnHapus.Click
        Try
            Call koneksi()
            Dim str As String
            str = "delete from tbl_siswa where NISN = '" & TxtNISN.Text & "'"
            cmd = New MySqlCommand(str, conn)
            cmd.ExecuteNonQuery()
            MessageBox.Show("Data Siswa Berhasil Dihapus.")
        Catch ex As Exception
            MessageBox.Show("Data Siswa Gagal Dihapus.")
        End Try
        Call tampilSiswa()
        Call input_nonaktif()
        Call tombol_awal()
    End Sub

    Private Sub BtnEdit_Click(sender As Object, e As EventArgs) Handles BtnEdit.Click
        Dim tgl As Date
        Dim foto() As Byte = IO.File.ReadAllBytes(LblFoto.Text)
        tgl = MEtgl.Text
        Try
            Call koneksi()
            Dim str As String
            str = "update tbl_siswa set Nama=?,Alamat=?,Tgl_Lahir=?,Foto_Siswa=?, Nama_File=?, Path_File=? where NISN = '" & TxtNISN.Text & "'"
            Dim cmd As New MySqlCommand(str, conn)
            With cmd
                .Parameters.Clear()
                .Parameters.Add(New MySqlParameter("Nama", MySqlDbType.Text)).Value = TxtNama.Text ' Nama
                .Parameters.Add(New MySqlParameter("Alamat", MySqlDbType.Text)).Value = TxtAlamat.Text ' alamat
                .Parameters.Add(New MySqlParameter("Tgl_Lahir", MySqlDbType.Text)).Value = Format(tgl, "yyyy/MM/dd") ' tgl lahir
                .Parameters.Add(New MySqlParameter("Foto_Siswa", MySqlDbType.Binary)).Value = foto ' foto
                .Parameters.Add(New MySqlParameter("Nama_File", MySqlDbType.Text)).Value = TxtFoto.Text ' nama foto
                .Parameters.Add(New MySqlParameter("Path_File", MySqlDbType.Text)).Value = LblFoto.Text ' lokasi foto
                .ExecuteNonQuery()
                conn.Close()
            End With
            MessageBox.Show("Update Data Siswa Berhasil Dilakukan", "informasi", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        Call tampilSiswa()
        Call input_nonaktif()
        Call tombol_awal()
    End Sub

    Private Sub BtnBatal_Click(sender As Object, e As EventArgs) Handles BtnBatal.Click
        Call tampilSiswa()
        Call tombol_awal()
        Call input_nonaktif()
        Call bersih()
    End Sub

    Private Sub BtnBrowse_Click(sender As Object, e As EventArgs) Handles BtnBrowse.Click
        On Error Resume Next
        OpenFileDialog1.Filter = "JPG files(*.jpg)|*.jpg|JPEG Files(*.jpeg)|*.jpeg|GIF FIles(*.gif)|*.gif|PNG FIles(*.png)|*.png|BMP Files(*.bmp)|*.bmp|TIFF Files(*.tiff)|*.tiff"
        OpenFileDialog1.FileName = ""
        If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            PBfoto.SizeMode = PictureBoxSizeMode.StretchImage
            PBfoto.Image = New Bitmap(OpenFileDialog1.FileName)
            pathfile = OpenFileDialog1.FileName
            TxtFoto.Text = pathfile.Substring(pathfile.LastIndexOf("\") + 1)
            LblFoto.Text = OpenFileDialog1.FileName
            PBfoto.Image = Image.FromFile(LblFoto.Text)
        End If
    End Sub

End Class


Modul ujikom ini dibuat untuk panduan siswa SMK Informatika Sumedang ketika menghadapi Ujikom. Untuk program lebih lengkap nya bisa request melalui email.

Comments

  1. Gan request program penilaiannya, tolong dikirim ke email dotnet1985@gmail.com. Thank's

    ReplyDelete
  2. Betarena Prediction – Betarena Prediction for December - Casinofib 1XBET 1XBET 우리카지노 우리카지노 9279Racecapper: Horse Racing Tips & Betting Offers

    ReplyDelete

Post a Comment

Popular posts from this blog

Analisis SWOT IFE EFE CPM dan QSPM Pada Amazy (Perusahaan Makanan Siap Saji) Sumedang

Profil DInas Pekerjaan Umum Kabupaten Sumedang