Beispiel #1
0
 public UpdateSiswa()
 {
     InitializeComponent();
     siswa         = new Entity.EntSiswa();
     siswaDao      = Factory.Factory.getSiswaDao();
     txt_POIN.Text = "0";
 }
Beispiel #2
0
        public Boolean InsertSiswa(Entity.EntSiswa es)
        {
            status = false;
            try
            {
                query = "insert into Siswa values ('" + es.getNIS() +
                        "','" + es.getNama() + "','" + es.getGender() +
                        "','" + es.getTemLahir() + "','" + es.getTglLahir() +
                        "','" + es.getAlamat() + "','" + es.getKelas() +
                        "','" + es.getPoint() + "')";

                OpenConnection();

                command             = koneksi.CreateCommand();
                command.CommandText = query;
                command.ExecuteNonQuery();
                status = true;
            }
            catch (SqlException se)
            {
                Console.WriteLine("Error" + se);
            }
            finally
            {
                CloseConnection();
            }

            return(status);
        }
Beispiel #3
0
        public Boolean UpdateSiswa(Entity.EntSiswa es)
        {
            status = false;
            try
            {
                query = "Update Siswa set NamaSiswa = '" + es.getNama() + "', Gender = '" + es.getGender() +
                        "', TempatLahir ='" + es.getTemLahir() + "', TanggalLahir = '" + es.getTglLahir() +
                        "', Alamat ='" + es.getAlamat() + "',Kelas = '" + es.getKelas() +
                        "',Point = '" + es.getPoint() + "' where NIS = '" + es.getNIS() + "'";

                OpenConnection();
                command             = koneksi.CreateCommand();
                command.CommandText = query;
                command.ExecuteNonQuery();
                status = true;
                koneksi.Close();
            }
            catch (SqlException se)
            {
                Console.WriteLine("Error" + se);
            }
            finally
            {
                CloseConnection();
            }

            return(status);
        }
Beispiel #4
0
        public Boolean UpdatePointSiswa(Entity.EntSiswa es, Entity.EntDaftarSanksi ek)
        {
            status = false;
            try
            {
                point = "update siswa set Point = point + (select point from DaftarSanksi where [Kode Aturan] = '" + ek.getKodeAturan() + "' ) where nis = '" + es.getNIS() + "'";
                OpenConnection();
                command             = koneksi.CreateCommand();
                command.CommandText = point;
                command.ExecuteNonQuery();
                status = true;
                koneksi.Close();
            }
            catch (SqlException se)
            {
                Console.WriteLine("Error" + se);
            }
            finally
            {
                CloseConnection();
            }

            return(status);
        }