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); }
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); }
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); }