Example #1
0
        private void radButton1_Click(object sender, EventArgs e)
        {
            string nama = textBoxNama.Text;
            string kelas = comboBoxKelas.Text;

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

                string ubah = "update tsiswa set nama = @nama, kelas = @kelas where nis = @nis";

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

                cmd.Parameters.AddWithValue("@nis", nis);
                cmd.Parameters.AddWithValue("@nama", nama);
                cmd.Parameters.AddWithValue("@kelas", kelas);

                int insertResult = cmd.ExecuteNonQuery();

                if (insertResult == 1)
                {
                    MessageBox.Show("Sukses");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Failed");
                }

                koneksi.koneksiDB.Close();
            }
        }
Example #2
0
        //
        //Akhir Data Surat
        //
        //
        //Data Pendaftaran
        //
        private void BindDataDaftar()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();

            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select daf.id_daftar as ID, daf.nis as NIS, sis.nama as Nama, sis.kelas as Kelas, " +
                                "daf.jenis as Jenis, daf.jumlah as Jumlah, daf.tanggal as 'Tanggal Bayar', tu.nama as 'Nama TU' " +
                                "from tdaftar as daf " +
                                "join tsiswa as sis on(sis.nis = daf.nis) " +
                                "join ttu as tu on(tu.id_tu = daf.id_tu)";

                MySqlCommand cmd = new MySqlCommand(select, koneksi.koneksiDB);
                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridPendaftaran.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }
Example #3
0
 public FormLogin()
 {
     InitializeComponent();
     this.WindowState = FormWindowState.Maximized;
     //strConnection = ConfigurationManager.ConnectionStrings["AdministrasiConnectionString"].ConnectionString;
     koneksi = new Koneksi();
 }
Example #4
0
        private void radButtonSimpan_Click(object sender, EventArgs e)
        {
            string nama = textBoxNama.Text;
            string password = textBoxPassword.Text;

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

                string ubah = "update ttu set nama = @nama, password = @password where id_tu = @id";

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

                cmd.Parameters.AddWithValue("@id", id);
                cmd.Parameters.AddWithValue("@nama", nama);
                cmd.Parameters.AddWithValue("@password", password);

                int insertResult = cmd.ExecuteNonQuery();

                if (insertResult == 1)
                {
                    MessageBox.Show("Sukses");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Failed");
                }

                koneksi.koneksiDB.Close();
            }
        }
Example #5
0
        private void radButtonUbah_Click(object sender, EventArgs e)
        {
            string jumlah = textJumlah.Text;

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

                string ubah = "update ttabungan set jumlah = @jumlah where id_tabung = @id";

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

                cmd.Parameters.AddWithValue("@id", int.Parse(id));
                cmd.Parameters.AddWithValue("@jumlah", int.Parse(jumlah));

                int insertResult = cmd.ExecuteNonQuery();

                if (insertResult == 1)
                {
                    MessageBox.Show("Sukses");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Failed");
                }

                koneksi.koneksiDB.Close();
            }
        }
        private void ButtonAmbil_Click(object sender, EventArgs e)
        {
            string jumlah = TextJumlah.Text;

            koneksi = new Koneksi();

            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string ubah = "update ttotal set total = (total - @jumlah) where nis = @id";

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

                cmd.Parameters.AddWithValue("@id", int.Parse(nis));
                cmd.Parameters.AddWithValue("@jumlah", int.Parse(jumlah));

                int insertResult = cmd.ExecuteNonQuery();

                if (insertResult == 1)
                {
                    MessageBox.Show("Sukses");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Failed");
                }

                koneksi.koneksiDB.Close();
            }
        }
Example #7
0
        private void ButtonAmbil_Click(object sender, EventArgs e)
        {
            DateTime date   = DateTime.Now;
            string   jumlah = TextJumlah.Text;

            if (int.Parse(saldo) < int.Parse(jumlah))
            {
                MessageBox.Show("Saldo Anda Tidak Cukup", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                koneksi = new Koneksi();

                using (koneksi.koneksiDB)
                {
                    koneksi.koneksiDB.Open();

                    string ubah   = "update ttotal set total = (total - @jumlah) where nis = @id";
                    string insert = "insert into ttabungankeluar (nis,jumlah,tanggal,id_tu) values (@nis,@jumlah,@tanggal,@id_tu)";

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

                    cmd.Parameters.AddWithValue("@id", int.Parse(nis));
                    cmd.Parameters.AddWithValue("@jumlah", int.Parse(jumlah));
                    cmdi.Parameters.AddWithValue("@nis", nis);
                    cmdi.Parameters.AddWithValue("@jumlah", jumlah);
                    cmdi.Parameters.AddWithValue("@tanggal", date);
                    cmdi.Parameters.AddWithValue("@id_tu", idTU);

                    int insertResult = cmd.ExecuteNonQuery();
                    cmdi.ExecuteNonQuery();

                    if (insertResult == 1)
                    {
                        MessageBox.Show("Sukses");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Failed");
                    }

                    koneksi.koneksiDB.Close();
                }
            }
        }
Example #8
0
        private void radButtonSimpan_Click(object sender, EventArgs e)
        {
            DateTime date = DateTime.Now;

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

            string noSurat = textBoxNoSurat.Text;
            string lampiran = textBoxLampiran.Text;
            string perihal = textBoxPerihal.Text;
            string jenis = comboBoxJenis.Text;
            string pengirim = textBoxPengirim.Text;
            string tanggal = strDate;

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

                string insert = "insert into tsurat(id_tu,no_surat,lampiran,perihal,jenis,pengirim,tanggal) values (@id,@no_surat,@lampiran,@perihal,@jenis,@pengirim,@tanggal)";

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

                cmd.Parameters.AddWithValue("@id", int.Parse(idTU));
                cmd.Parameters.AddWithValue("@no_surat", noSurat);
                cmd.Parameters.AddWithValue("@lampiran", lampiran);
                cmd.Parameters.AddWithValue("@perihal", perihal);
                cmd.Parameters.AddWithValue("@jenis", jenis);
                cmd.Parameters.AddWithValue("@pengirim", pengirim);
                cmd.Parameters.AddWithValue("@tanggal", tanggal);

                int insertResult = cmd.ExecuteNonQuery();

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

                koneksi.koneksiDB.Close();
            }
        }
        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();
            }
        }
Example #10
0
        private void radButtonTambah_Click(object sender, EventArgs e)
        {
            DateTime date = DateTime.Now;

            string id          = textBoxID.Text;
            string nama        = textBoxNama.Text;
            string password    = textBoxPassword.Text;
            string passwordmd5 = md5_enkripsi(password);

            if (statusID(textBoxID.Text) == true)
            {
                MessageBox.Show("ID " + id + " sudah ada", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                //SqlConnection connection = new SqlConnection(strConnection);
                koneksi = new Koneksi();
                using (koneksi.koneksiDB)
                {
                    koneksi.koneksiDB.Open();

                    string insert = "insert into ttu (id_tu,nama,password,tanggal) values (@id, @nama, @password, @tanggal)";

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

                    cmd.Parameters.AddWithValue("@id", id);
                    cmd.Parameters.AddWithValue("@nama", nama);
                    cmd.Parameters.AddWithValue("@password", passwordmd5);
                    cmd.Parameters.AddWithValue("@tanggal", date);

                    int inserResult = cmd.ExecuteNonQuery();

                    if (inserResult == 1)
                    {
                        MessageBox.Show("Sukses");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Gagal");
                    }

                    koneksi.koneksiDB.Close();
                }
            }
        }
        private void radButtonSimpan_Click(object sender, EventArgs e)
        {
            DateTime date = DateTime.Now;

            string nis   = textBoxNIS.Text;
            string nama  = textBoxNama.Text;
            string kelas = comboBoxKelas.Text;

            if (statusNIS(textBoxNIS.Text) == true)
            {
                MessageBox.Show("NIS " + nis + " sudah ada", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                //SqlConnection connection = new SqlConnection(strConnection);
                koneksi = new Koneksi();
                using (koneksi.koneksiDB)
                {
                    koneksi.koneksiDB.Open();

                    string insert = "insert into tsiswa (nis,nama,kelas,tanggal) values (@nis, @nama, @kelas, @tanggal)";

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

                    cmd.Parameters.AddWithValue("@nis", nis);
                    cmd.Parameters.AddWithValue("@nama", nama);
                    cmd.Parameters.AddWithValue("@kelas", kelas);
                    cmd.Parameters.AddWithValue("@tanggal", date);

                    int inserResult = cmd.ExecuteNonQuery();

                    if (inserResult == 1)
                    {
                        MessageBox.Show("Sukses");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Gagal");
                    }

                    koneksi.koneksiDB.Close();
                }
            }
        }
        private void radButtonSimpan_Click(object sender, EventArgs e)
        {
            DateTime date = DateTime.Now;

            string noSurat  = textBoxNoSurat.Text;
            string lampiran = textBoxLampiran.Text;
            string perihal  = textBoxPerihal.Text;
            string jenis    = comboBoxJenis.Text;
            string pengirim = textBoxPengirim.Text;

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

                string insert = "insert into tsurat(id_tu,no_surat,lampiran,perihal,jenis,pengirim,tanggal) values (@id,@no_surat,@lampiran,@perihal,@jenis,@pengirim,@tanggal)";

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

                cmd.Parameters.AddWithValue("@id", int.Parse(idTU));
                cmd.Parameters.AddWithValue("@no_surat", noSurat);
                cmd.Parameters.AddWithValue("@lampiran", lampiran);
                cmd.Parameters.AddWithValue("@perihal", perihal);
                cmd.Parameters.AddWithValue("@jenis", jenis);
                cmd.Parameters.AddWithValue("@pengirim", pengirim);
                cmd.Parameters.AddWithValue("@tanggal", date);

                int insertResult = cmd.ExecuteNonQuery();

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

                koneksi.koneksiDB.Close();
            }
        }
Example #13
0
        private void BindDataSiswa()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();
            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select nis as NIS, nama as Nama, kelas as Kelas from tsiswa";

                MySqlCommand    cmd    = new MySqlCommand(select, koneksi.koneksiDB);
                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridSiswa.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }
Example #14
0
        private void BindDataSiswa()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();
            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select nis as NIS, nama as Nama, kelas as Kelas from tsiswa";

                MySqlCommand cmd = new MySqlCommand(select, koneksi.koneksiDB);
                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridSiswa.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }
Example #15
0
        private void radButtonUbah_Click(object sender, EventArgs e)
        {
            string noSurat  = textBoxNoSurat.Text;
            string lampiran = textBoxLampiran.Text;
            string perihal  = textBoxPerihal.Text;
            string jenis    = comboBoxJenis.Text;
            string pengirim = textBoxPengirim.Text;

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

                string ubah = "update tsurat set no_surat = @no_surat, lampiran = @lampiran, perihal = @perihal, jenis = @jenis, pengirim = @pengirim where id_surat = @id";

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

                cmd.Parameters.AddWithValue("@id", int.Parse(id));
                cmd.Parameters.AddWithValue("@no_surat", noSurat);
                cmd.Parameters.AddWithValue("@lampiran", lampiran);
                cmd.Parameters.AddWithValue("@perihal", perihal);
                cmd.Parameters.AddWithValue("@jenis", jenis);
                cmd.Parameters.AddWithValue("@pengirim", pengirim);

                int insertResult = cmd.ExecuteNonQuery();

                if (insertResult == 1)
                {
                    MessageBox.Show("Sukses");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Failed");
                }

                koneksi.koneksiDB.Close();
            }
        }
        private void radButtonTambah_Click(object sender, EventArgs e)
        {
            DateTime date = DateTime.Now;

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

            string jumlah = textJumlah.Text;
            string tanggal = strDate;

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

                string insert = "insert into ttabungan(nis,jumlah,tanggal,id_tu) values (@nis,@jumlah,@tanggal,@id_tu)";

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

                cmd.Parameters.AddWithValue("@nis", int.Parse(id));
                cmd.Parameters.AddWithValue("@jumlah", int.Parse(jumlah));
                cmd.Parameters.AddWithValue("@tanggal", tanggal);
                cmd.Parameters.AddWithValue("@id_tu", int.Parse(idTU));

                int insertResult = cmd.ExecuteNonQuery();

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

                koneksi.koneksiDB.Close();
            }
        }
        private void Total()
        {
            if (statusTotalTabungan(int.Parse(id)) == true)
            {
                koneksi = new Koneksi();
                using (koneksi.koneksiDB)
                {
                    koneksi.koneksiDB.Open();

                    string ubah = "update ttotal set total = (select sum(jumlah) from ttabungan where nis = @nis) where nis = @nis";

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

                    cmd.Parameters.AddWithValue("@nis", int.Parse(id));

                    int insertResult = cmd.ExecuteNonQuery();

                    koneksi.koneksiDB.Close();
                }
            }
            else
            {
                koneksi = new Koneksi();
                using (koneksi.koneksiDB)
                {
                    koneksi.koneksiDB.Open();

                    string insert = "insert into ttotal(nis,total) values (@nis,(select sum(jumlah) from ttabungan where nis = @nis))";

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

                    cmd.Parameters.AddWithValue("@nis", int.Parse(id));

                    int insertResult = cmd.ExecuteNonQuery();

                    koneksi.koneksiDB.Close();
                }
            }
        }
Example #18
0
        private void radButtonTambah_Click(object sender, EventArgs e)
        {
            DateTime date = DateTime.Now;
            string tanggal = date.ToString("dd-MM-yyyy");

            string id = textBoxID.Text;
            string nama = textBoxNama.Text;
            string password = textBoxPassword.Text;

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

                string insert = "insert into ttu (id_tu,nama,password,tanggal) values (@id, @nama, @password, @tanggal)";

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

                cmd.Parameters.AddWithValue("@id", id);
                cmd.Parameters.AddWithValue("@nama", nama);
                cmd.Parameters.AddWithValue("@password", password);
                cmd.Parameters.AddWithValue("@tanggal", tanggal);

                int inserResult = cmd.ExecuteNonQuery();

                if (inserResult == 1)
                {
                    MessageBox.Show("Sukses");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Gagal");
                }

                koneksi.koneksiDB.Close();
            }
        }
Example #19
0
        //
        //// Akhir Navigasi Laporan
        //

        //
        //Akhir Navigasi
        //

        //
        //Data Tata Usaha
        //
        private void BindDataTU()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();

            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select id_tu as 'ID Tata Usaha', nama as Nama, date_format(tanggal,'%d-%m-%Y') as 'Tanggal Daftar' from ttu";

                MySqlCommand    cmd    = new MySqlCommand(select, koneksi.koneksiDB);
                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridTu.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }
Example #20
0
        private void radButtonSimpan_Click(object sender, EventArgs e)
        {
            DateTime date = DateTime.Now;
            string tanggal = date.ToString("dd-MM-yyyy");

            string nis = textBoxNIS.Text;
            string nama = textBoxNama.Text;
            string kelas = comboBoxKelas.Text;

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

                string insert = "insert into tsiswa (nis,nama,kelas,tanggal) values (@nis, @nama, @kelas, @tanggal)";

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

                cmd.Parameters.AddWithValue("@nis", nis);
                cmd.Parameters.AddWithValue("@nama", nama);
                cmd.Parameters.AddWithValue("@kelas", kelas);
                cmd.Parameters.AddWithValue("@tanggal", tanggal);

                int inserResult = cmd.ExecuteNonQuery();

                if (inserResult == 1)
                {
                    MessageBox.Show("Sukses");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Gagal");
                }

                koneksi.koneksiDB.Close();
            }
        }
Example #21
0
        private Boolean statusID(string id)
        {
            id = id.ToUpper();

            //SqlConnection connection = new SqlConnection(strConnection);
            //connection.Open();
            koneksi = new Koneksi();
            koneksi.koneksiDB.Open();
            string          select = "SELECT id_tu from ttu";
            MySqlCommand    cmd    = new MySqlCommand(select, koneksi.koneksiDB);
            MySqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                if ((reader.GetString(0).ToString().ToUpper() == id))
                {
                    return(true);
                }
            }
            koneksi.koneksiDB.Close();
            return(false);
        }
        private void radButtonUbah_Click(object sender, EventArgs e)
        {
            string jumlahUbah = textJumlah.Text;

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

                string ubah   = "update ttabungan set jumlah = @jumlahUbah where id_tabung = @id";
                string update = "update ttotal set total = (total - @jumlah) + @jumlahUbah where nis = @id";

                MySqlCommand cmd  = new MySqlCommand(ubah, koneksi.koneksiDB);
                MySqlCommand cmd1 = new MySqlCommand(update, koneksi.koneksiDB);

                cmd.Parameters.AddWithValue("@id", int.Parse(id));
                cmd.Parameters.AddWithValue("@jumlahUbah", int.Parse(jumlahUbah));
                cmd1.Parameters.AddWithValue("@id", int.Parse(nis));
                cmd1.Parameters.AddWithValue("@jumlahUbah", int.Parse(jumlahUbah));
                cmd1.Parameters.AddWithValue("@jumlah", int.Parse(jumlah));

                int insertResult = cmd.ExecuteNonQuery();
                cmd1.ExecuteNonQuery();

                if (insertResult == 1)
                {
                    MessageBox.Show("Sukses");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Failed");
                }

                koneksi.koneksiDB.Close();
            }
        }
Example #23
0
        //
        //Akhir Data Tabungan Keluar
        //

        //
        //Tabungan Total
        //
        private void BindDataTotalTabungan()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();

            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select sis.nis as NIS, sis.nama as Nama, sis.kelas as Kelas, tab.total as Total from ttotal as tab " +
                                "join tsiswa as sis on(sis.nis = tab.nis)";

                MySqlCommand    cmd    = new MySqlCommand(select, koneksi.koneksiDB);
                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridTabunganSaldo.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }
Example #24
0
        private void BindDataTotalPendaftaran()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();

            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select sum(jumlah) as 'Total Uang Pendaftaran' from tdaftar";

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

                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridView1.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }
Example #25
0
        private void BindDataTotalPembayaran()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();

            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select sum(total) as 'Total Pembayaran' from tpembayaran";

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

                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridView1.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }
        private void radButtonTambah_Click(object sender, EventArgs e)
        {
            DateTime date = DateTime.Now;

            string jumlah = textJumlah.Text;

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

                string insert = "insert into ttabungan(nis,jumlah,tanggal,id_tu) values (@nis,@jumlah,@tanggal,@id_tu)";

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

                cmd.Parameters.AddWithValue("@nis", int.Parse(id));
                cmd.Parameters.AddWithValue("@jumlah", int.Parse(jumlah));
                cmd.Parameters.AddWithValue("@tanggal", date);
                cmd.Parameters.AddWithValue("@id_tu", int.Parse(idTU));

                int insertResult = cmd.ExecuteNonQuery();

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

                koneksi.koneksiDB.Close();
            }
        }
Example #27
0
        private void BindDataTotalTabunganKeluar()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();

            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select sum(jumlah) as Total from ttabungankeluar where nis = @nis";

                MySqlCommand cmd = new MySqlCommand(select, koneksi.koneksiDB);
                cmd.Parameters.AddWithValue("@nis", nis);

                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridView1.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }
        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();
            }
        }
Example #29
0
        private void radButtonUbah_Click(object sender, EventArgs e)
        {
            string noSurat = textBoxNoSurat.Text;
            string lampiran = textBoxLampiran.Text;
            string perihal = textBoxPerihal.Text;
            string jenis = comboBoxJenis.Text;
            string pengirim = textBoxPengirim.Text;

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

                string ubah = "update tsurat set no_surat = @no_surat, lampiran = @lampiran, perihal = @perihal, jenis = @jenis, pengirim = @pengirim where id_surat = @id";

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

                cmd.Parameters.AddWithValue("@id", int.Parse(id));
                cmd.Parameters.AddWithValue("@no_surat", noSurat);
                cmd.Parameters.AddWithValue("@lampiran", lampiran);
                cmd.Parameters.AddWithValue("@perihal", perihal);
                cmd.Parameters.AddWithValue("@jenis", jenis);
                cmd.Parameters.AddWithValue("@pengirim", pengirim);

                int insertResult = cmd.ExecuteNonQuery();

                if (insertResult == 1)
                {
                    MessageBox.Show("Sukses");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Failed");
                }

                koneksi.koneksiDB.Close();
            }
        }
Example #30
0
        private void radButtonTambah_Click(object sender, EventArgs e)
        {
            DateTime date = DateTime.Now;

            string jenis  = comboJenis.Text;
            string jumlah = labelJumlah.Text;

            if (comboJenis.Text == "Daftar Baru" && (kelas == "2" || kelas == "3" || kelas == "4" || kelas == "5" || kelas == "6"))
            {
                MessageBox.Show("Kelas " + kelas + " tidak bisa daftar baru", "Pesan Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            if (comboJenis.Text == "Daftar Baru")
            {
                //SqlConnection connection = new SqlConnection(strConnection);
                koneksi = new Koneksi();
                using (koneksi.koneksiDB)
                {
                    koneksi.koneksiDB.Open();

                    string insert = "insert into tdaftar(nis,jenis,jumlah,tanggal,id_tu) values (@nis,@jenis,@jumlah,@tanggal,@id_tu)";

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

                    cmd.Parameters.AddWithValue("@nis", int.Parse(id));
                    cmd.Parameters.AddWithValue("@jenis", jenis);
                    cmd.Parameters.AddWithValue("@jumlah", int.Parse(jumlah));
                    cmd.Parameters.AddWithValue("@tanggal", date);
                    cmd.Parameters.AddWithValue("@id_tu", int.Parse(idTU));

                    int insertResult = cmd.ExecuteNonQuery();

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

                    koneksi.koneksiDB.Close();
                }
            }
            else if (comboJenis.Text == "Daftar Ulang" && radCheckAuto.Checked == true)
            {
                //SqlConnection connection = new SqlConnection(strConnection);
                koneksi = new Koneksi();
                using (koneksi.koneksiDB)
                {
                    koneksi.koneksiDB.Open();

                    string insert = "insert into tdaftar(nis,jenis,jumlah,tanggal,id_tu) values (@nis,@jenis,@jumlah,@tanggal,@id_tu)";
                    string update = "update tsiswa set kelas = kelas + 1 where nis = @nis";

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

                    cmd.Parameters.AddWithValue("@nis", int.Parse(id));
                    cmd.Parameters.AddWithValue("@jenis", jenis);
                    cmd.Parameters.AddWithValue("@jumlah", int.Parse(jumlah));
                    cmd.Parameters.AddWithValue("@tanggal", date);
                    cmd.Parameters.AddWithValue("@id_tu", int.Parse(idTU));
                    cmdi.Parameters.AddWithValue("@nis", int.Parse(id));

                    int insertResult = cmd.ExecuteNonQuery();
                    cmdi.ExecuteNonQuery();

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

                    koneksi.koneksiDB.Close();
                }
            }
            else if (comboJenis.Text == "Daftar Ulang" && radCheckAuto.Checked == false)
            {
                //SqlConnection connection = new SqlConnection(strConnection);

                koneksi = new Koneksi();
                using (koneksi.koneksiDB)
                {
                    koneksi.koneksiDB.Open();

                    string insert = "insert into tdaftar(nis,jenis,jumlah,tanggal,id_tu) values (@nis,@jenis,@jumlah,@tanggal,@id_tu)";
                    string update = "update tsiswa set kelas = @kelas where nis = @nis";

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

                    cmd.Parameters.AddWithValue("@nis", int.Parse(id));
                    cmd.Parameters.AddWithValue("@jenis", jenis);
                    cmd.Parameters.AddWithValue("@jumlah", int.Parse(jumlah));
                    cmd.Parameters.AddWithValue("@tanggal", date);
                    cmd.Parameters.AddWithValue("@id_tu", int.Parse(idTU));
                    cmdi.Parameters.AddWithValue("@nis", int.Parse(id));
                    cmdi.Parameters.AddWithValue("@kelas", int.Parse(comboBoxKelas.Text));

                    int insertResult = cmd.ExecuteNonQuery();
                    cmdi.ExecuteNonQuery();

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

                    koneksi.koneksiDB.Close();
                }
            }
        }
Example #31
0
        //
        ////Akhir Tombol Tambah
        //

        //
        ////Tombol Hapus
        //
        private void radButtonHapus_Click(object sender, EventArgs e)
        {
            if (tombol == "siswa")
            {
                string       namaHapus = nama;
                string       title     = "Pesan Konfirmasi";
                string       messsage  = "Anda yakin data dengan nama " + namaHapus.Trim() + " akan dihapus ?";
                DialogResult result    = MessageBox.Show(messsage, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    return;
                }

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

                    string delete = "delete from tsiswa where nis = @nis";

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

                    cmd.Parameters.AddWithValue("@nis", id);

                    int insertResult = cmd.ExecuteNonQuery();

                    if (insertResult == 1)
                    {
                        MessageBox.Show("Sukses");
                    }
                    else
                    {
                        MessageBox.Show("Failed");
                    }

                    koneksi.koneksiDB.Close();
                    BindDataSiswa();
                }
            }
            else if (tombol == "pembayaran")
            {
                string       namaHapus = nama;
                string       title     = "Pesan Konfirmasi";
                string       messsage  = "Anda yakin data dengan nama " + namaHapus.Trim() + " akan dihapus ?";
                DialogResult result    = MessageBox.Show(messsage, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    return;
                }

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

                    string delete = "delete from tpembayaran where id_pembayaran = @id";

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

                    cmd.Parameters.AddWithValue("@id", idtab);

                    int insertResult = cmd.ExecuteNonQuery();

                    if (insertResult == 1)
                    {
                        MessageBox.Show("Sukses");
                    }
                    else
                    {
                        MessageBox.Show("Failed");
                    }

                    koneksi.koneksiDB.Close();
                    BindDataPembayaran();
                }
            }
            else if (tombol == "surat")
            {
                string       surat    = noSurat;
                string       title    = "Pesan Konfirmasi";
                string       messsage = "Anda yakin data dengan No Surat " + surat.Trim() + " akan dihapus ?";
                DialogResult result   = MessageBox.Show(messsage, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    return;
                }

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

                    string delete = "delete from tsurat where id_surat = @id";

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

                    cmd.Parameters.AddWithValue("@id", id);

                    int insertResult = cmd.ExecuteNonQuery();

                    if (insertResult == 1)
                    {
                        MessageBox.Show("Sukses");
                    }
                    else
                    {
                        MessageBox.Show("Failed");
                    }

                    koneksi.koneksiDB.Close();
                    BindDataSurat();
                }
            }
            else if (tombol == "pendaftaran")
            {
                string       namaHapus = nama;
                string       title     = "Pesan Konfirmasi";
                string       messsage  = "Anda yakin data dengan nama " + namaHapus.Trim() + " akan dihapus ?";
                DialogResult result    = MessageBox.Show(messsage, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    return;
                }

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

                    string delete = "delete from tdaftar where id_daftar = @id";

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

                    cmd.Parameters.AddWithValue("@id", idtab);

                    int insertResult = cmd.ExecuteNonQuery();

                    if (insertResult == 1)
                    {
                        MessageBox.Show("Sukses");
                    }
                    else
                    {
                        MessageBox.Show("Failed");
                    }

                    koneksi.koneksiDB.Close();
                    BindDataDaftar();
                }
            }
            else if (tombol == "tabungan")
            {
                string       namaHapus = nama;
                string       title     = "Pesan Konfirmasi";
                string       messsage  = "Anda yakin data dengan nama " + namaHapus.Trim() + " akan dihapus ?";
                DialogResult result    = MessageBox.Show(messsage, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    return;
                }

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

                    string delete = "delete from ttabungan where id_tabung = @id";
                    string update = "update ttotal set total = total - @jumlah where nis = @id";

                    MySqlCommand cmd  = new MySqlCommand(delete, koneksi.koneksiDB);
                    MySqlCommand cmdi = new MySqlCommand(update, koneksi.koneksiDB);

                    cmd.Parameters.AddWithValue("@id", idtab);
                    cmdi.Parameters.AddWithValue("@id", idtab);
                    cmdi.Parameters.AddWithValue("@jumlah", jumlah);

                    int insertResult = cmd.ExecuteNonQuery();
                    cmdi.ExecuteNonQuery();

                    if (insertResult == 1)
                    {
                        MessageBox.Show("Sukses");
                    }
                    else
                    {
                        MessageBox.Show("Failed");
                    }

                    koneksi.koneksiDB.Close();
                    BindDataTabungan();
                }
            }
            else if (tombol == "tabungankeluar")
            {
                string       namaHapus = nama;
                string       title     = "Pesan Konfirmasi";
                string       messsage  = "Anda yakin data dengan nama " + namaHapus.Trim() + " akan dihapus ?";
                DialogResult result    = MessageBox.Show(messsage, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    return;
                }

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

                    string delete = "delete from ttabungankeluar where id_tabung_keluar = @id";

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

                    cmd.Parameters.AddWithValue("@id", idtab);

                    int insertResult = cmd.ExecuteNonQuery();

                    if (insertResult == 1)
                    {
                        MessageBox.Show("Sukses");
                    }
                    else
                    {
                        MessageBox.Show("Failed");
                    }

                    koneksi.koneksiDB.Close();
                    BindDataTabunganKeluar();
                }
            }
        }
Example #32
0
        private void BindDataTotalTabungan()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();

            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select total as Total from ttotal where nis = @nis";

                MySqlCommand cmd = new MySqlCommand(select, koneksi.koneksiDB);
                cmd.Parameters.AddWithValue("@nis", nis);

                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridView1.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }
        private void radButtonUbah_Click(object sender, EventArgs e)
        {
            string cathering = checkBoxCathering.Text;

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

                string ubah = "update tpembayaran set cathering = @cathering, bulan = @bulan where id_pembayaran = @id";

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

                cmd.Parameters.AddWithValue("@id", int.Parse(id));
                cmd.Parameters.AddWithValue("@cathering", cathering);

                int insertResult = cmd.ExecuteNonQuery();

                if (insertResult == 1)
                {
                    MessageBox.Show("Sukses");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Failed");
                }

                koneksi.koneksiDB.Close();
            }
        }
Example #34
0
        //
        //Akhir Data Siswa
        //
        //
        //Data Pembayaran
        //
        private void BindDataPembayaran()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();

            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select pem.id_pembayaran as ID, pem.nis as NIS, sis.nama as Nama, sis.kelas as Kelas, " +
                                "pem.spp as SPP, pem.cathering as Cathering, pem.marching_band as 'Marching Band', pem.bulan as Bulan , " +
                                "pem.total as Total, pem.tanggal as 'Tanggal Bayar', tu.nama as 'Nama TU' " +
                                "from tpembayaran as pem " +
                                "join tsiswa as sis on(pem.nis = sis.nis)" +
                                "join ttu as tu on(pem.id_tu = tu.id_tu)";

                MySqlCommand cmd = new MySqlCommand(select, koneksi.koneksiDB);
                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridPembayaran.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }
        private void Total()
        {
            if (statusTotalTabungan(int.Parse(id)) == true)
            {
                koneksi = new Koneksi();
                using (koneksi.koneksiDB)
                {
                    koneksi.koneksiDB.Open();

                    string ubah = "update ttotal set total = (select sum(jumlah) from ttabungan where nis = @nis) where nis = @nis";

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

                    cmd.Parameters.AddWithValue("@nis", int.Parse(id));

                    int insertResult = cmd.ExecuteNonQuery();

                    koneksi.koneksiDB.Close();
                }
            }
            else
            {
                koneksi = new Koneksi();
                using (koneksi.koneksiDB)
                {
                    koneksi.koneksiDB.Open();

                    string insert = "insert into ttotal(nis,total) values (@nis,(select sum(jumlah) from ttabungan where nis = @nis))";

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

                    cmd.Parameters.AddWithValue("@nis", int.Parse(id));

                    int insertResult = cmd.ExecuteNonQuery();

                    koneksi.koneksiDB.Close();
                }
            }
        }
Example #36
0
        //
        ////Akhir Tombol Refresh
        //
        //
        ////Tombol Hapus
        //
        private void radButtonHapus_Click(object sender, EventArgs e)
        {
            if (tombol == "tu")
            {
                string namaHapus = nama;
                string title = "Pesan Konfirmasi";
                string messsage = "Anda yakin data dengan nama " + namaHapus.Trim() + " akan dihapus ?";
                DialogResult result = MessageBox.Show(messsage, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    return;
                }

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

                    string delete = "delete from ttu where id_tu = @id";

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

                    cmd.Parameters.AddWithValue("@id", id);

                    int insertResult = cmd.ExecuteNonQuery();

                    if (insertResult == 1)
                    {
                        MessageBox.Show("Sukses");
                    }
                    else
                    {
                        MessageBox.Show("Failed");
                    }

                    koneksi.koneksiDB.Close();
                    BindDataTU();
                }
            }
            else if (tombol == "siswa")
            {
                string namaHapus = nama;
                string title = "Pesan Konfirmasi";
                string messsage = "Anda yakin data dengan nama " + namaHapus.Trim() + " akan dihapus ?";
                DialogResult result = MessageBox.Show(messsage, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    return;
                }

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

                    string delete = "delete from tsiswa where nis = @nis";

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

                    cmd.Parameters.AddWithValue("@nis", id);

                    int insertResult = cmd.ExecuteNonQuery();

                    if (insertResult == 1)
                    {
                        MessageBox.Show("Sukses");
                    }
                    else
                    {
                        MessageBox.Show("Failed");
                    }

                    koneksi.koneksiDB.Close();
                    BindDataSiswa();
                }
            }
            else if (tombol == "pembayaran")
            {
                string namaHapus = nama;
                string title = "Pesan Konfirmasi";
                string messsage = "Anda yakin data dengan nama " + namaHapus.Trim() + " akan dihapus ?";
                DialogResult result = MessageBox.Show(messsage, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    return;
                }

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

                    string delete = "delete from tpembayaran where id_pembayaran = @id";

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

                    cmd.Parameters.AddWithValue("@id", idtab);

                    int insertResult = cmd.ExecuteNonQuery();

                    if (insertResult == 1)
                    {
                        MessageBox.Show("Sukses");
                    }
                    else
                    {
                        MessageBox.Show("Failed");
                    }

                    koneksi.koneksiDB.Close();
                    BindDataPembayaran();
                }
            }
            else if (tombol == "surat")
            {
                string surat = noSurat;
                string title = "Pesan Konfirmasi";
                string messsage = "Anda yakin data dengan No Surat " + surat.Trim() + " akan dihapus ?";
                DialogResult result = MessageBox.Show(messsage, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    return;
                }

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

                    string delete = "delete from tsurat where id_surat = @id";

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

                    cmd.Parameters.AddWithValue("@id", id);

                    int insertResult = cmd.ExecuteNonQuery();

                    if (insertResult == 1)
                    {
                        MessageBox.Show("Sukses");
                    }
                    else
                    {
                        MessageBox.Show("Failed");
                    }

                    koneksi.koneksiDB.Close();
                    BindDataSurat();
                }
            }
            else if (tombol == "pendaftaran")
            {
                string namaHapus = nama;
                string title = "Pesan Konfirmasi";
                string messsage = "Anda yakin data dengan nama " + namaHapus.Trim() + " akan dihapus ?";
                DialogResult result = MessageBox.Show(messsage, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    return;
                }

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

                    string delete = "delete from tdaftar where id_daftar = @id";

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

                    cmd.Parameters.AddWithValue("@id", idtab);

                    int insertResult = cmd.ExecuteNonQuery();

                    if (insertResult == 1)
                    {
                        MessageBox.Show("Sukses");
                    }
                    else
                    {
                        MessageBox.Show("Failed");
                    }

                    koneksi.koneksiDB.Close();
                    BindDataDaftar();
                }
            }
            else if (tombol == "tabungan")
            {
                string namaHapus = nama;
                string title = "Pesan Konfirmasi";
                string messsage = "Anda yakin data dengan nama " + namaHapus.Trim() + " akan dihapus ?";
                DialogResult result = MessageBox.Show(messsage, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    return;
                }

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

                    string delete = "delete from ttabungan where id_tabung = @id";

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

                    cmd.Parameters.AddWithValue("@id", idtab);

                    int insertResult = cmd.ExecuteNonQuery();

                    if (insertResult == 1)
                    {
                        MessageBox.Show("Sukses");
                    }
                    else
                    {
                        MessageBox.Show("Failed");
                    }

                    koneksi.koneksiDB.Close();
                    BindDataTabungan();
                }
            }
        }
Example #37
0
        //
        //// Akhir Navigasi Tabungan Total
        //
        //
        //Akhir Navigasi
        //
        //
        //Data Tata Usaha
        //
        private void BindDataTU()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();

            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select id_tu as 'ID Tata Usaha', nama as Nama, password as Password, tanggal as 'Tanggal Daftar' from ttu";

                MySqlCommand cmd = new MySqlCommand(select, koneksi.koneksiDB);
                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridTu.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }
Example #38
0
        //
        //Akhir Data Tabungan
        //
        //
        //Tabungan Total
        //
        private void BindDataTotalTabungan()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();

            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select sis.nis as NIS, sis.nama as Nama, sis.kelas as Kelas, tab.total as Total from ttotal as tab "+
                                "join tsiswa as sis on(sis.nis = tab.nis)";

                MySqlCommand cmd = new MySqlCommand(select, koneksi.koneksiDB);
                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridTabunganSaldo.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }
Example #39
0
        //
        //Akhir Data Tabungan
        //
        //
        //Data Tabungan
        //
        private void BindDataTabunganKeluar()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();

            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select tab.id_tabung_keluar as ID, tab.nis as NIS, sis.nama as Nama, sis.kelas as Kelas, " +
                                "tab.jumlah as Jumlah, tab.tanggal as Tanggal, tu.nama as 'Nama TU' " +
                                "from ttabungankeluar as tab " +
                                "join tsiswa as sis on(sis.nis = tab.nis) " +
                                "join ttu as tu on(tu.id_tu = tab.id_tu)";

                MySqlCommand cmd = new MySqlCommand(select, koneksi.koneksiDB);
                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridTabunganKeluar.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }
Example #40
0
        //
        //Akhir Data Pembayaran
        //
        //
        //Data Surat
        //
        private void BindDataSurat()
        {
            //SqlConnection connection = new SqlConnection(strConnection);
            koneksi = new Koneksi();

            using (koneksi.koneksiDB)
            {
                koneksi.koneksiDB.Open();

                string select = "select surat.id_surat as ID, tu.nama as 'Nama TU', surat.no_surat as 'No Surat', surat.lampiran as Lampiran, " +
                                "surat.perihal as Perihal, surat.jenis as Jenis, surat.tanggal as Tanggal,  " +
                                "surat.pengirim as Pengirim " +
                                "from tsurat as surat " +
                                "join ttu as tu on(surat.id_tu = tu.id_tu)";

                MySqlCommand cmd = new MySqlCommand(select, koneksi.koneksiDB);
                MySqlDataReader reader = cmd.ExecuteReader();

                table = new DataTable();
                table.Load(reader);

                radGridSurat.DataSource = table;

                koneksi.koneksiDB.Close();
            }
        }