Sabtu, 14 Januari 2017

Aplikasi DS Rent Film Equipment Menggunakan Visual Studio 2012

Pada Kesempatan kali ini saya akan memposting tutorial Aplikasi Rental Alat Shoting. Kenapa saya memilih topik ini karena melihat kantor kakak saya yang bergerak di bidang penyewaan alat shooting tetapi masih di kerjakan secara manual belum terkomputerisasi. Saya membuat aplikasi ini untuk memenuhi nilai Ujian Akhir Semester mata kuliah pemrograman, STMIK Eresha. Disini saya menggunakan visula studio 2012. Langsung saja kita mulai, pertama saya membuat design nya :

1. Design Form Log In :


2. Design Form Menu Utama :




3. Form Customer :


4. Form Equipment :



5. Form Peminjaman


Dan pada kesempatan ini aplikasi yang saya buat sudah terhubung dengan database, disini saya menggunakan Microsoft Access ;

a. Database Table Pelanggan;


b. Database Table Alat ;


c. Database Table Peminjaman ;



Setelah Design dan Database sudah selesai lalu kita mulai untuk source code nyaa :

- Source Code Form Log In

Public Class Form_Login

    Private Sub masuk_Click(sender As Object, e As EventArgs) Handles masuk.Click
        If nama.Text = "" And pwd.Text = "" Then
            MsgBox(" User Name dan Password harus diisi ", MsgBoxStyle.OkOnly, "Confirmation")
        ElseIf nama.Text = "admin" And pwd.Text = "12345" Then
            MsgBox("Welcome To DS Mediatama", MsgBoxStyle.OkOnly, "Info")
            Menu_Utama.Show()
            Me.Hide()
        Else
            MsgBox("User Name atau Password salah", MsgBoxStyle.OkOnly, "Warning")

        End If
    End Sub

    Private Sub Form_Login_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        nama.Text = ""
        pwd.Text = ""
    End Sub
End Class


- Source code form Menu Utama ;

Public Class Menu_Utama

    Private Sub customer_Click(sender As Object, e As EventArgs) Handles customer.Click
        Pelanggan.Show()
    End Sub

    Private Sub alat_Click(sender As Object, e As EventArgs) Handles alat.Click
        FormAlat.Show()
    End Sub

    Private Sub peminjaman_Click(sender As Object, e As EventArgs) Handles peminjaman.Click
        FormPeminjaman.Show()
    End Sub

    Private Sub pengembalian_Click(sender As Object, e As EventArgs)
        FormPengembalian.Show()
    End Sub
End Class

- Source Code form Customer ;

Public Class Pelanggan


    Private Sub ulangi_Click(sender As Object, e As EventArgs) Handles ulangi.Click
        idplgn.Text = ""
        namac.Text = ""
        rblaki.Checked = False
        rbperempuan.Checked = False
        company.Text = ""
        alamat.Text = ""
        telp.Text = ""
        email.Text = ""
    End Sub

    Private Sub utama_Click(sender As Object, e As EventArgs)
        Menu_Utama.Show()
        Me.Hide()
    End Sub

    Private Sub PelangganBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs)
        Me.Validate()
        Me.PelangganBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.DbdsDataSet)

    End Sub

    Private Sub Pelanggan_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DbdsDataSet.Pelanggan' table. You can move, or remove it, as needed.
        Me.PelangganTableAdapter.Fill(Me.DbdsDataSet.Pelanggan)

    End Sub

    Private Sub simpan_Click(sender As Object, e As EventArgs) Handles simpan.Click
        Try
            Dim jenis As String
            If rblaki.Checked Then
                jenis = "Laki-laki"
            ElseIf rbperempuan.Checked Then
                jenis = "Perempuan"
            End If
            Dim simpan As dbdsDataSet.PelangganRow
            simpan = DbdsDataSet.Pelanggan.NewPelangganRow
            simpan.ID_Pelanggan = idplgn.Text
            simpan.Nama = namac.Text
            simpan.Jenis_Kelamin = jenis
            simpan.Company = company.Text
            simpan.Alamat = alamat.Text
            simpan.No_Telepon = telp.Text
            simpan.Email = telp.Text
            DbdsDataSet.Pelanggan.Rows.Add(simpan)
            Me.PelangganTableAdapter.Update(DbdsDataSet)
            Me.PelangganBindingSource.EndEdit()
            MsgBox("Data Saved")
        Catch ex As Exception

        End Try

    End Sub

    Private Sub edit_Click(sender As Object, e As EventArgs) Handles edit.Click
        Try
            Me.PelangganBindingSource.EndEdit()
            Me.PelangganTableAdapter.Update(Me.DbdsDataSet.Pelanggan)
            MsgBox("sukses")
        Catch ex As Exception
            MsgBox("Gagal")

        End Try
    End Sub
End Class


- Source Code form Equipment ;

Public Class FormAlat

    Private Sub ulangi_Click(sender As Object, e As EventArgs) Handles ulangi.Click
        idalat.Text = ""
        merk.Text = ""
        tahun.Text = ""
        seri.Text = ""
        hsewa.Text = ""
        status.Text = ""
    End Sub

    Private Sub utama_Click(sender As Object, e As EventArgs)
        Menu_Utama.Show()
        Me.Hide()
    End Sub

    Private Sub AlatBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs)
        Me.Validate()
        Me.AlatBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.DbdsDataSet)

    End Sub

    Private Sub FormAlat_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DbdsDataSet.Alat' table. You can move, or remove it, as needed.
        Me.AlatTableAdapter.Fill(Me.DbdsDataSet.Alat)

    End Sub

    Private Sub save_Click(sender As Object, e As EventArgs) Handles save.Click
        Try
            Dim alat As dbdsDataSet.AlatRow
            alat = DbdsDataSet.Alat.NewAlatRow
            alat.ID_Alat = idalat.Text
            alat.Merk = merk.Text
            alat.Tahun = tahun.Text
            alat.No_Seri = seri.Text
            alat.Harga_Sewa = hsewa.Text
            alat.Status = status.Text
            DbdsDataSet.Alat.Rows.Add(alat)
            Me.AlatTableAdapter.Update(DbdsDataSet)
            Me.AlatBindingSource.EndEdit()
            MsgBox("Data Saved")

        Catch ex As Exception

        End Try
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Try
            Me.AlatBindingSource.EndEdit()
            Me.AlatTableAdapter.Update(Me.DbdsDataSet.Alat)
            MsgBox("sukses")
        Catch ex As Exception
            MsgBox("Gagal")
        End Try
    End Sub
End Class

- Source Code form Peminjaman ;

Public Class FormPeminjaman

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        No_PeminjamanTextBox.Text = ""
        ID_PelangganTextBox.Text = ""
        NamaTextBox.Text = ""
        ID_AlatTextBox.Text = ""
        MerkTextBox.Text = ""
        TahunTextBox.Text = ""
        No_SeriTextBox.Text = ""
        Harga_SewaTextBox.Text = ""
        StatusTextBox.Text = ""
        Lama_SewaTextBox.Text = ""
        Tanggal_KembaliDateTimePicker.Value = Now
        Uang_MukaTextBox.Text = ""
        Sisa_BayarTextBox.Text = ""
        Total_BayarTextBox.Text = ""
    End Sub

    Private Sub utama_Click(sender As Object, e As EventArgs)
        Menu_Utama.Show()
        Me.Hide()
    End Sub

    Private Sub PeminjamanBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs)
        Me.Validate()
        Me.PeminjamanBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.DbdsDataSet)

    End Sub

    Private Sub FormPeminjaman_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DbdsDataSet.Peminjaman' table. You can move, or remove it, as needed.
        Me.PeminjamanTableAdapter.Fill(Me.DbdsDataSet.Peminjaman)

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Try
            Dim peminjaman As dbdsDataSet.PeminjamanRow
            peminjaman = DbdsDataSet.Peminjaman.NewPeminjamanRow
            peminjaman.No_Peminjaman = No_PeminjamanTextBox.Text
            peminjaman.ID_Pelanggan = ID_PelangganTextBox.Text
            peminjaman.Nama = NamaTextBox.Text
            peminjaman.ID_Alat = ID_AlatTextBox.Text
            peminjaman.Merk = MerkTextBox.Text
            peminjaman.Tahun = TahunTextBox.Text
            peminjaman.No_Seri = No_SeriTextBox.Text
            peminjaman.Harga_Sewa = Harga_SewaTextBox.Text
            peminjaman.Status = StatusTextBox.Text
            peminjaman.Lama_Sewa = Lama_SewaTextBox.Text
            peminjaman.Tanggal_Sewa = Tanggal_SewaDateTimePicker.Text
            peminjaman.Tanggal_Kembali = Tanggal_KembaliDateTimePicker.Text
            peminjaman.Uang_Muka = Uang_MukaTextBox.Text
            peminjaman.Sisa_Bayar = Sisa_BayarTextBox.Text
            peminjaman.Total_Bayar = Total_BayarTextBox.Text
            peminjaman.Tanggal = TanggalDateTimePicker.Text
            DbdsDataSet.Peminjaman.Rows.Add(peminjaman)
            Me.PeminjamanTableAdapter.Update(DbdsDataSet)
            Me.PeminjamanBindingSource.EndEdit()

            MsgBox("Data Saved")
        Catch ex As Exception

        End Try
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Try
            Me.PeminjamanBindingSource.EndEdit()
            Me.PeminjamanTableAdapter.Update(Me.DbdsDataSet.Peminjaman)
            MsgBox("sukses")
        Catch ex As Exception
            MsgBox("Gagal")
        End Try

    End Sub

    Private Sub edit_Click(sender As Object, e As EventArgs) Handles edit.Click
        Try
            PeminjamanBindingSource.RemoveCurrent()
            MsgBox("Data Deleted")
        Catch ex As Exception
            MsgBox("Gagal")

        End Try
    End Sub

    Private Sub ext_Click(sender As Object, e As EventArgs) Handles ext.Click

    End Sub
End Class


Dan berikut adalah hasil run dari aplikasi yang sudah selesai ;




0 komentar:

Posting Komentar