Pages

TUGAS KULIAH - UAS WEB PEMROGRAMAN II

eForm Karyawan


Deskripsi 

eForm Karyawan ini diperuntukan untuk memperbarui data karyawan di seuatu perusahaan agar proses update data karyawan lebih mudah, cepat, dan paperless. Aplikasi berbasis web ini terintergrasi dengan database dan mempunyai Login Page dengna menggunakan ID Pegawai.
Form ini meliputi :
  • ID Pegawai
  • Nama
  • NPWP
  • Alamat
  • Jabatan
  • Status Perkawinan
  • Golongan Darah
  • No Tlp
  • Tempat, dan tanggal lahir
  • Email

Fungsi dari Form ini di isi setiap setahu sekali agar data HR pada perusahaan tersebut selalu update informasi karyawannya muatan tiap data langsung terekap kedalam database selain mengupdate data karyawan, eForm ini juga berfungsi untuk menambahkan karyawan baru agar terdaftar

Komponen Aplikasi
  • Label
  • Dropdown List
  • Button
Screenshoot Jawaban



Screenshoot Application






Video Tutorial

Source Code

Imports System.Data
Imports System.Data.OleDb

Public Class _Default
Inherits Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

End Sub


Protected Sub Login1_Authenticate(sender As Object, e As AuthenticateEventArgs) Handles Login1.Authenticate
Dim koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Kampus\ProjWeb06TPLE004\dbPegawai.accdb"
Dim objKoneksi As New OleDb.OleDbConnection(koneksi)
Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM tblUser WHERE tp_idPegawai = '" & Login1.UserName & "' AND password = '" & Login1.Password & "' ", objKoneksi)

objKoneksi.Open()

Dim ehe As OleDbDataReader = cmd.ExecuteReader()
If (ehe.Read() = True) Then
MsgBox("Login Berhasil !")
Response.Redirect("~/master.aspx")
Else
MsgBox("Salah Memasukan Username atau Password !")
End If
End Sub


Protected Sub LoginButton_Click(sender As Object, e As EventArgs)
Dim koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Kampus\ProjWeb06TPLE004\dbPegawai.accdb"
Dim objKoneksi As New OleDb.OleDbConnection(koneksi)
Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM tblUser WHERE tp_idPegawai = '" & Login1.UserName & "' AND password = '" & Login1.Password & "' ", objKoneksi)

objKoneksi.Open()

Dim ehe As OleDbDataReader = cmd.ExecuteReader()
If (ehe.Read() = True) Then
MsgBox("Login Berhasil !")
Response.Redirect("~/master.aspx")
Else
MsgBox("Salah Memasukan Username atau Password !")
End If
End Sub
End Class

/////

Imports System.Data
Imports System.Data.OleDb

Public Class LihatData
Inherits System.Web.UI.Page
Dim koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Kampus\ProjWeb06TPLE004\dbPegawai.accdb"
Dim objKoneksi As New OleDb.OleDbConnection(koneksi)
Dim xReader As OleDbDataReader

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub btnCari_Click(sender As Object, e As EventArgs) Handles btnCari.Click
If Not Len(txtID.Text) = 0 Then
objKoneksi.Open()
Dim oCMD As New OleDb.OleDbCommand("SELECT * FROM tblPegawai WHERE tp_idPegawai='" & txtID.Text & "'", objKoneksi)
xReader = oCMD.ExecuteReader()
If xReader.HasRows Then
xReader.Read()
txtNama.Text = xReader("tp_Nama")
txtNPWP.Text = xReader("tp_npwp")
txtJabatan.Text = xReader("tp_Jabatan")
txtAlamat.Text = xReader("tp_Alamat")
txtPhone.Text = xReader("tp_pNumber")
DDStatus.SelectedItem.Text = xReader("tp_statusPK")
DDGender.SelectedItem.Text = xReader("tp_jenisK")
DDBlood.SelectedItem.Text = xReader("tp_golongan")
txtTTL.Text = xReader("tp_tempatLhr")
txtTGL.Text = xReader("tp_tanggalLhr")
txtEmail.Text = xReader("tp_email")
btnUpdate.Enabled = True
Else
MsgBox("ID Pegawai yang dicari tidak terdaftar", MsgBoxStyle.Information, "e-Form Karyawan")
End If
xReader.Close()
End If
End Sub

Protected Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click
objKoneksi.Open()
Dim Tambah As String = "UPDATE tblPegawai SET tp_Nama='" & txtNama.Text & "', tp_npwp='" & txtNPWP.Text & "', tp_Alamat='" & txtAlamat.Text & "', tp_Jabatan='" & txtJabatan.Text & "',tp_pNumber='" & txtPhone.Text & "', tp_StatusPK='" & DDStatus.SelectedItem.Value.ToString & "',tp_jenisK='" & DDGender.SelectedItem.Value.ToString & "',tp_golongan='" & DDBlood.SelectedItem.Value.ToString & "',tp_email='" & txtEmail.Text & "' WHERE tp_idPegawai='" & txtID.Text & "'; "
Dim xCMD = New OleDbCommand(Tambah, objKoneksi)
xCMD.ExecuteNonQuery()
MsgBox("Data Berhasil di Update", MsgBoxStyle.Information, "eForm Karyawan")
Response.Redirect(Request.Url.AbsoluteUri)
objKoneksi.Close()

End Sub
End Class

/////

Imports System.Data
Imports System.Data.OleDb
Imports word = Microsoft.Office.Interop.Word
Imports excel = Microsoft.Office.Interop.Excel




Public Class master

Inherits System.Web.UI.Page
Dim koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Kampus\ProjWeb06TPLE004\dbPegawai.accdb"
Dim objKoneksi As New OleDb.OleDbConnection(koneksi)
Dim xReader As OleDbDataReader

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
If Not Len(txtID.Text) = 0 Then
objKoneksi.Open()
Dim oCMD As New OleDb.OleDbCommand("SELECT * FROM tblPegawai WHERE tp_idPegawai='" & txtID.Text & "'", objKoneksi)
xReader = oCMD.ExecuteReader()
If xReader.HasRows Then
xReader.Read()
txtID.Text = xReader("tp_idPegawai")
txtNama.Text = xReader("tp_Nama")
txtNPWP.Text = xReader("tp_npwp")
txtJabatan.Text = xReader("tp_Jabatan")
txtAlamat.Text = xReader("tp_Alamat")
txtPhone.Text = xReader("tp_pNumber")
DDsp.SelectedItem.Text = xReader("tp_statusPK")
DDjK.SelectedItem.Text = xReader("tp_jenisK")
DDgol.SelectedItem.Text = xReader("tp_golongan")
txtTempatL.Text = xReader("tp_tempatLhr")
txtTanggalL.Text = xReader("tp_tanggalLhr")
txtEmail.Text = xReader("tp_email")

MsgBox("ID Pegawai Sudah Ada", MsgBoxStyle.Critical, "eForm Karyawan")
Else
Dim Tambah As String = "INSERT INTO tblPegawai VALUES ('" & txtID.Text & "', '" & txtNama.Text & "', '" & txtNPWP.Text & "','" & txtAlamat.Text & "','" & txtJabatan.Text & "','" & txtPhone.Text & "', '" & DDsp.Text & "','" & DDjK.Text & "','" & DDgol.Text & "','" & txtTempatL.Text & "','" & txtTanggalL.Text & "','" & txtEmail.Text & "')"
Dim xCMD = New OleDbCommand(Tambah, objKoneksi)
xCMD.ExecuteNonQuery()
MsgBox("Data Berhasil Ditambhakan", MsgBoxStyle.Information, "eForm Karyawan")
Response.Redirect(Request.Url.AbsoluteUri)
End If
xReader.Close()
objKoneksi.Close()
End If
End Sub

Protected Sub txtID_TextChanged(sender As Object, e As EventArgs) Handles txtID.TextChanged

End Sub

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles btnClear.Click
Response.Redirect(Request.Url.AbsoluteUri)
End Sub

'Protected Sub btnExcel_Click(sender As Object, e As EventArgs) Handles btnExcel.Click
' Dim aplikasiExcel As New excel.Application
' Dim fileExcelnya As excel.Workbook
' fileExcelnya = aplikasiExcel.Workbooks.Open("D:\Kampus\ProjWeb06TPLE004\UTS.xlsx")

' aplikasiExcel.Range("A2").Insert()
' aplikasiExcel.Range("B2").Insert()
' aplikasiExcel.Range("C2").Insert()
' aplikasiExcel.Range("D2").Insert()
' aplikasiExcel.Range("E2").Insert()
' aplikasiExcel.Range("F2").Insert()
' aplikasiExcel.Range("G2").Insert()
' aplikasiExcel.Range("H2").Insert()
' aplikasiExcel.Range("I2").Insert()
' aplikasiExcel.Range("J2").Insert()
' aplikasiExcel.Range("K2").Insert()
' aplikasiExcel.Range("L2").Insert()


' aplikasiExcel.Range("A2").Value = txtID.Text
' aplikasiExcel.Range("B2").Value = txtNama.Text
' aplikasiExcel.Range("C2").Value = txtNPWP.Text
' aplikasiExcel.Range("D2").Value = txtAlamat.Text
' aplikasiExcel.Range("E2").Value = txtJabatan.Text
' aplikasiExcel.Range("F2").Value = txtPhone.Text
' aplikasiExcel.Range("G2").Value = DDsp.SelectedItem.Text
' aplikasiExcel.Range("H2").Value = DDjK.SelectedItem.Text
' aplikasiExcel.Range("I2").Value = DDgol.SelectedItem.Text
' aplikasiExcel.Range("J2").Value = txtTempatL.Text
' aplikasiExcel.Range("K2").Value = txtTanggalL.Text
' aplikasiExcel.Range("L2").Value = txtEmail.Text


' fileExcelnya.Save()
' MsgBox("Berhasil disimpan di Excel", MsgBoxStyle.Information, "eForm Karyawan")
' aplikasiExcel.Visible = True

' Response.Redirect(Request.Url.AbsoluteUri)
'End Sub

'Protected Sub btnPrntWord_Click(sender As Object, e As EventArgs) Handles btnPrntWord.Click
' Dim Aplikasinya As New word.Application
' Dim Dokumennya As word.Document

' Dokumennya = Aplikasinya.Documents.Open("D:\Kampus\ProjWeb06TPLE004\PrintUTS.docx")

' Dokumennya.Bookmarks("idpegawai").Select()
' Aplikasinya.Selection.TypeText(txtID.Text)

' Dokumennya.Bookmarks("nama").Select()
' Aplikasinya.Selection.TypeText(txtNama.Text)

' Dokumennya.Bookmarks("npwp").Select()
' Aplikasinya.Selection.TypeText(txtNPWP.Text)

' Dokumennya.Bookmarks("alamat").Select()
' Aplikasinya.Selection.TypeText(txtAlamat.Text)

' Dokumennya.Bookmarks("jabatan").Select()
' Aplikasinya.Selection.TypeText(txtJabatan.Text)

' Dokumennya.Bookmarks("phone").Select()
' Aplikasinya.Selection.TypeText(txtPhone.Text)

' Dokumennya.Bookmarks("status").Select()
' Aplikasinya.Selection.TypeText(DDsp.SelectedItem.Text)

' Dokumennya.Bookmarks("jenisKelamin").Select()
' Aplikasinya.Selection.TypeText(DDjK.SelectedItem.Text)

' Dokumennya.Bookmarks("golonganDarah").Select()
' Aplikasinya.Selection.TypeText(DDgol.SelectedItem.Text)

' Dokumennya.Bookmarks("tempat").Select()
' Aplikasinya.Selection.TypeText(txtTempatL.Text)

' Dokumennya.Bookmarks("tl").Select()
' Aplikasinya.Selection.TypeText(txtTanggalL.Text & "-")

' Dokumennya.Bookmarks("email").Select()
' Aplikasinya.Selection.TypeText(txtEmail.Text)

' Dokumennya.Save()
' MsgBox("Berhasil di export, siap untuk di cetak")

' Aplikasinya.Visible = True
'End Sub
End Class




No comments:

Post a Comment

What's on your mind