예제 #1
0
        private void dataGridViewBarang_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try {
                if (e.RowIndex >= 0 && e.ColumnIndex == dataGridViewBarang.Columns.Count - 2)
                {
                    //pilih
                    FormIsiKoleksi formKoleksi = new FormIsiKoleksi();
                    formKoleksi.UpdateTabel(dataGridViewBarang.Rows[e.RowIndex].Cells[0].Value.ToString());
                    form.mainForm.Add(formKoleksi);
                }
                else if (e.RowIndex >= 0 && e.ColumnIndex == dataGridViewBarang.Columns.Count - 1)
                {
                    //hapus
                    Connection con          = new Connection();
                    string     nama_koleksi = dataGridViewBarang.Rows[e.RowIndex].Cells[0].Value.ToString();

                    if (!con.IsKoleksiExist(nama_koleksi))
                    {
                        CustomMessageBox.Show("Koleksi tersebut tidak ada");
                        return;
                    }

                    void Yes()
                    {
                        con.DeleteKoleksi(nama_koleksi);
                        dataGridViewBarang.Rows.RemoveAt(e.RowIndex);
                    }

                    CustomYesNoBox.Show("Apakah anda yakin ingin menghapus koleksi : " + nama_koleksi + "? \n Semua barang pada koleksi tersebut akan ikut terhapus", Yes);
                }
            } catch (Exception ex) {
                CustomMessageBox.Show("Error : " + ex.Message);
            }
        }
예제 #2
0
 public static void Show(string message, YesMethod yesMethod)
 {
     try {
         CustomYesNoBox custom = new CustomYesNoBox(message, yesMethod);
         custom.ShowDialog();
     } catch (Exception ex) {
         CustomMessageBox.Show("Error : " + ex.Message);
     }
 }
예제 #3
0
        private void buttonBayar_Click(object sender, EventArgs e)
        {
            try {
                if (textBoxPembayaran.Text == "")
                {
                    CustomMessageBox.Show("Pembayaran tidak boleh kosong");
                    return;
                }
                ulong hargaTotal = parseHargaTotal();
                ulong pembayaran = ulong.Parse(textBoxPembayaran.Text);

                bool lanjut = false;

                void lanjutkan()
                {
                    lanjut = true;
                }

                if (pembayaran < hargaTotal)
                {
                    CustomYesNoBox.Show("Pembayaran lebih kecil dari harga total, apakah anda yakin ingin melanjutkan?", lanjutkan);
                }
                else
                {
                    lanjut = true;
                }

                if (!lanjut)
                {
                    return;
                }

                FormSelesaiBayar form = new FormSelesaiBayar(hargaTotal, pembayaran);
                form.ShowDialog();

                this.Close();
                formTransaksi.ClearTable();
            } catch (Exception ex) {
                CustomMessageBox.Show("Error : " + ex.Message);
            }
        }
예제 #4
0
        private void dataGridViewTabelBarang_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try {
                if (e.RowIndex >= 0 && e.ColumnIndex == dataGridViewTabelBarang.Columns.Count - 2)
                {
                    //ubah
                    Connection con = new Connection();

                    Barang b = con.GetBarang(dataGridViewTabelBarang.Rows[e.RowIndex].Cells[0].Value.ToString());

                    FormBarang formBarang = new FormBarang();
                    formBarang.InitialisasiEditBarang(b, koleksi, this);
                    formBarang.ShowDialog();
                }
                else if (e.RowIndex >= 0 && e.ColumnIndex == dataGridViewTabelBarang.Columns.Count - 1)
                {
                    //hapus
                    void Hapus()
                    {
                        Connection con       = new Connection();
                        string     no_barang = dataGridViewTabelBarang.Rows[e.RowIndex].Cells[0].Value.ToString();

                        if (con.IsBarangExist(no_barang))
                        {
                            con.DeleteBarang(dataGridViewTabelBarang.Rows[e.RowIndex].Cells[0].Value.ToString());
                            //   dataGridViewTabelBarang.Rows.RemoveAt(e.RowIndex);
                            CustomMessageBox.Show("Barang telah dihapus");
                            UpdateTabel(koleksi.NamaKoleksi);
                        }
                        else
                        {
                            CustomMessageBox.Show("Barang dengan nomor : " + no_barang + " tidak ditemukan, masalah terjadi, harap hubungi elton");
                        }
                    }

                    CustomYesNoBox.Show("Apakah anda yakin untuk menghapus barang ini?", Hapus);
                }
            } catch (Exception ex) {
                CustomMessageBox.Show("Error : " + ex.Message);
            }
        }