public Boolean UpdateSanksi(Entity.EntDaftarSanksi es) { status = false; try { query = "Update DaftarSanksi set Kode Aturan = '" + es.getKodeAturan() + "', NamaAturan = '" + es.getNamaAturan() + "', Point ='" + es.getPoint() + "', Sanksi = '" + es.getSanksi() + "'"; 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 InsertSanksi(Entity.EntDaftarSanksi es) { status = false; try { query = "insert into DaftarSanksi values ('" + es.getKodeAturan() + "','" + es.getNamaAturan() + "','" + es.getPoint() + "','" + es.getSanksi() + "')"; OpenConnection(); command = koneksi.CreateCommand(); command.CommandText = query; command.ExecuteNonQuery(); status = true; } 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); }