private void btnReset_Click(object sender, EventArgs e)
 {
     txtHarga.Text      = "";
     txtNamaPaket.Text  = "";
     CmbViewVendor.Text = "";
     CmbViewVendor.Focus();
     lblID.Show();
     txtID.Hide();
 }
 public frmPaket()
 {
     koneksi   = KoneksiDB.Koneksi.getKoneksi();
     impPaket  = new ImpPaket();
     impVendor = new ImpVendor();
     entPaket  = new EntPaket();
     InitializeComponent();
     cmbVendor();
     CmbViewVendor.Focus();
 }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            txtID.Enabled = false;
            if (txtNamaPaket.Text == "" || txtHarga.Text == "" || CmbViewVendor.Text == "")
            {
                MessageBox.Show("Form harus diisi !");
                CmbViewVendor.Focus();
            }
            else
            {
                id_paket  = Int16.Parse(txtID.Text);
                harga     = Int32.Parse(txtHarga.Text);
                id_vendor = Int32.Parse(CmbViewVendor.Text);
                entPaket.setNamaPaket(txtNamaPaket.Text);
                entPaket.setHarga(harga);
                entPaket.setIDVendor(id_vendor);

                status = impPaket.updatePaket(entPaket, id_paket);

                if (status == false)
                {
                    MessageBox.Show("Update Failed !!");
                    txtNamaPaket.Text  = "";
                    txtHarga.Text      = "";
                    CmbViewVendor.Text = "";
                    CmbViewVendor.Focus();
                }
                else
                {
                    MessageBox.Show("Update Success !!");
                    txtNamaPaket.Text  = "";
                    txtHarga.Text      = "";
                    CmbViewVendor.Text = "";
                    CmbViewVendor.Focus();
                }
                viewPaket();
            }
        }
        private void btnInput_Click(object sender, EventArgs e)
        {
            if (txtNamaPaket.Text == "" || txtHarga.Text == "" || CmbViewVendor.Text == "")
            {
                MessageBox.Show("Form harus diisi !");
                CmbViewVendor.Focus();
            }
            else
            {
                id_vendor = Int32.Parse(CmbViewVendor.Text);
                harga     = Int32.Parse(txtHarga.Text);
                entPaket.setNamaPaket(txtNamaPaket.Text);
                entPaket.setHarga(harga);
                entPaket.setIDVendor(id_vendor);

                status = impPaket.insertPaket(entPaket);

                if (status == false)
                {
                    MessageBox.Show("Input Failed !!");
                    txtNamaPaket.Text  = "";
                    txtHarga.Text      = "";
                    CmbViewVendor.Text = "";
                    CmbViewVendor.Focus();
                }
                else
                {
                    MessageBox.Show("Input Success !!");
                    txtNamaPaket.Text  = "";
                    txtHarga.Text      = "";
                    CmbViewVendor.Text = "";
                    CmbViewVendor.Focus();
                }
                viewPaket();
            }
        }