private void buttonHapus_Click(object sender, EventArgs e)
        {
            DialogResult confirm = MessageBox.Show("Data Kategori akan dihapus. Anda Yakin ?", "Konfirmasi", MessageBoxButtons.YesNo);

            if (confirm == DialogResult.Yes)
            {
                Kategori kategori = new Kategori(textBoxKodeKategori.Text, textBoxNamaKategori.Text);

                string hapus = kategori.Delete();

                if (hapus == "1")
                {
                    MessageBox.Show("Data Kategori Berhasl Dihapus", "Info");

                    FormDaftarKategori frm = (FormDaftarKategori)Owner;
                    frm.FormDaftarKategori_Load(buttonHapus, e);

                    textBoxKodeKategori.Text = "";
                    textBoxNamaKategori.Text = "";
                    textBoxKodeKategori.Focus();
                }
                else
                {
                    MessageBox.Show("Gagal Menghapus Kategori, Error : " + hapus);
                }
            }
        }
示例#2
0
        private void kategoriToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormDaftarKategori kategori = new FormDaftarKategori();
            Form form = Application.OpenForms[kategori.Name];

            SingleForm(form, kategori);
        }
        private void buttonSimpan_Click(object sender, EventArgs e)
        {
            try
            {
                Kategori kategori = new Kategori(textBoxKodeKategori.Text, textBoxNamaKategori.Text);
                kategori.Insert();

                frm = (FormDaftarKategori)Owner;
                frm.FormDaftarKategori_Load(buttonSimpan, e);

                MessageBox.Show("Data Kategori Telah Tersimpan", "Info");

                textBoxKodeKategori.Text = kategori.GeneratePrimaryKey();
                textBoxNamaKategori.Text = "";
            }
            catch (Exception error)
            {
                MessageBox.Show("Penyimpanan gagal, Error : " + error.Message, "Info");
            }
        }
示例#4
0
        private void buttonSimpan_Click(object sender, EventArgs e)
        {
            try
            {
                Kategori kategori = new Kategori(textBoxKodeKategori.Text, textBoxNamaKategori.Text);

                kategori.Update();

                FormDaftarKategori frm = (FormDaftarKategori)Owner;
                frm.FormDaftarKategori_Load(buttonSimpan, e);

                MessageBox.Show("Data Kategori Telah Diubah", "Info");


                textBoxKodeKategori.Text = "";
                textBoxNamaKategori.Text = "";
            }
            catch (Exception error)
            {
                MessageBox.Show("Gagal mengubah data, Error : " + error.Message, "Info");
            }
        }