private void process_Click(object sender, EventArgs e) { if (prdName.Text == null || string.IsNullOrWhiteSpace(prdName.Text)) { MessageBox.Show("Mohon isi nama perusahaan"); } else { DialogResult result = MessageBox.Show("Menyimpan ke database ? ", "SAVE TO DATABASE", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { prdEditTarget.updToDatabase(idMerek, prdName.Text, Int32.Parse(prdRam.Text), prdInternal.Text, convertToByte(prdImg.Image), Int32.Parse(prdPrice.Text)); form.Close(); EditPrdForm editForm = new EditPrdForm(); editForm.Show(); this.Close(); } } }
private void deleteData_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { string idProduk = listView1.SelectedItems[0].Text; DialogResult result = MessageBox.Show("Data ini sudah tersimpan dari database. Menghapus dari database ?", "Delete", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { Produk prdDelTarget = new Produk(); prdDelTarget.getFromDatabase(Int32.Parse(idProduk)); if (prdDelTarget.delFromDatabase() == false) { MessageBox.Show("Data ini tidak dapat dihapus karena terhubung ke Tabel Transaksi"); } else { EditPrdForm form = new EditPrdForm(); form.Show(); this.Close(); } } } }
private void button3_Click(object sender, EventArgs e) { EditPrdForm form = new EditPrdForm(); form.Show(); }