Exemplo n.º 1
0
        //
        ////Akhir Tombol Ubah
        //


        //
        ////Tombol Refresh
        //
        //private void radButtonRefresh_Click(object sender, EventArgs e)
        //{
        //    BindDataTU();
        //    BindDataSiswa();
        //    BindDataPembayaran();
        //    BindDataSurat();
        //    BindDataDaftar();
        //    BindDataTabungan();
        //}

        //
        ////Akhir Tombol Refresh
        //

        //
        ////Tombol Tambah
        //

        private void radButtonTambah_Click(object sender, EventArgs e)
        {
            if (tombol == "tu")
            {
                TambahTU tambahTU = new TambahTU();
                tambahTU.ShowDialog();
                BindDataTU();
            }
            else if (tombol == "siswa")
            {
                TambahSiswa tambahSiswa = new TambahSiswa();
                tambahSiswa.ShowDialog();
                BindDataSiswa();
            }
            else if (tombol == "pembayaran")
            {
                DataSiswa siswa = new DataSiswa();
                siswa.idTU   = idTU;
                siswa.button = tombol;
                siswa.ShowDialog();
                BindDataPembayaran();
            }
            else if (tombol == "surat")
            {
                TambahSurat surat = new TambahSurat();
                surat.idTU = idTU;
                surat.ShowDialog();
                BindDataSurat();
            }
            else if (tombol == "pendaftaran")
            {
                DataSiswa siswa = new DataSiswa();
                siswa.idTU   = idTU;
                siswa.button = tombol;
                siswa.ShowDialog();
                BindDataDaftar();
            }
            else if (tombol == "tabungan")
            {
                DataSiswa siswa = new DataSiswa();
                siswa.idTU   = idTU;
                siswa.button = tombol;
                siswa.ShowDialog();
                BindDataTabungan();
            }
            else if (tombol == "tabungankeluar")
            {
                DataSiswa siswa = new DataSiswa();
                siswa.idTU   = idTU;
                siswa.button = tombol;
                siswa.ShowDialog();
                BindDataTabunganKeluar();
            }
        }
        private void radButtonTambah_Click(object sender, EventArgs e)
        {
            DateTime date = DateTime.Now;

            string nis       = id;
            string spp       = checkBoxSPP.Text;
            string cathering = checkBoxCathering.Text;
            string marching  = checkBoxMarching.Text;
            string bulan     = comboBoxBulan.Text;
            int    total     = int.Parse(spp) + int.Parse(cathering) + int.Parse(marching);

            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();
            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string insert = "insert into tpembayaran(id_tu,nis,spp,cathering,marching_band,bulan,tanggal,total) values (@id_tu,@nis,@spp,@cathering,@marching_band,@bulan,@tanggal,@total)";

                MySqlCommand cmd = new MySqlCommand(insert, koneksi.koneksiDB);

                cmd.Parameters.AddWithValue("@id_tu", int.Parse(idTU));
                cmd.Parameters.AddWithValue("@nis", id);
                cmd.Parameters.AddWithValue("@spp", int.Parse(spp));
                cmd.Parameters.AddWithValue("@cathering", int.Parse(cathering));
                cmd.Parameters.AddWithValue("@marching_band", int.Parse(marching));
                cmd.Parameters.AddWithValue("@bulan", bulan);
                cmd.Parameters.AddWithValue("@tanggal", date);
                cmd.Parameters.AddWithValue("@total", total);

                int insertResult = cmd.ExecuteNonQuery();

                if (insertResult == 1)
                {
                    MessageBox.Show("Sukses");
                    DataSiswa siswa = new DataSiswa();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Gagal");
                }

                koneksi.koneksiDB.Close();
            }
        }
Exemplo n.º 3
0
 private void radButtonTambah_Click(object sender, EventArgs e)
 {
     if (tombol == "tu")
     {
         TambahTU tambahTU = new TambahTU();
         tambahTU.ShowDialog();
     }
     else if (tombol == "siswa")
     {
         TambahSiswa tambahSiswa = new TambahSiswa();
         tambahSiswa.ShowDialog();
     }
     else if (tombol == "pembayaran")
     {
         DataSiswa siswa = new DataSiswa();
         siswa.idTU = idTU;
         siswa.button = tombol;
         siswa.ShowDialog();
     }
     else if (tombol == "surat")
     {
         TambahSurat surat = new TambahSurat();
         surat.idTU = idTU;
         surat.ShowDialog();
     }
     else if (tombol == "pendaftaran")
     {
         DataSiswa siswa = new DataSiswa();
         siswa.idTU = idTU;
         siswa.button = tombol;
         siswa.ShowDialog();
     }
     else if (tombol == "tabungan")
     {
         DataSiswa siswa = new DataSiswa();
         siswa.idTU = idTU;
         siswa.button = tombol;
         siswa.ShowDialog();
     }
 }
Exemplo n.º 4
0
        private void radButtonTambah_Click(object sender, EventArgs e)
        {
            DateTime date = DateTime.Now;

            string strDate = date.ToString("dd-MM-yyyy");

            string nis = id;
            string spp = checkBoxSPP.Text;
            string cathering = checkBoxCathering.Text;
            string marching = checkBoxMarching.Text;
            string tanggal = strDate;
            string bulan = comboBoxBulan.Text;
            int total = int.Parse(spp) + int.Parse(cathering) + int.Parse(marching);

            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();
            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string insert = "insert into tpembayaran(id_tu,nis,spp,cathering,marching_band,bulan,tanggal,total) values (@id_tu,@nis,@spp,@cathering,@marching_band,@bulan,@tanggal,@total)";

                MySqlCommand cmd = new MySqlCommand(insert, koneksi.koneksiDB);

                cmd.Parameters.AddWithValue("@id_tu", int.Parse(idTU));
                cmd.Parameters.AddWithValue("@nis", id);
                cmd.Parameters.AddWithValue("@spp", int.Parse(spp));
                cmd.Parameters.AddWithValue("@cathering", int.Parse(cathering));
                cmd.Parameters.AddWithValue("@marching_band", int.Parse(marching));
                cmd.Parameters.AddWithValue("@bulan", bulan);
                cmd.Parameters.AddWithValue("@tanggal", tanggal);
                cmd.Parameters.AddWithValue("@total", total);

                int insertResult = cmd.ExecuteNonQuery();

                if (insertResult == 1)
                {
                    MessageBox.Show("Sukses");
                    DataSiswa siswa = new DataSiswa();
                    this.Close();

                }
                else
                {
                    MessageBox.Show("Gagal");
                }

                koneksi.koneksiDB.Close();
            }
        }