public JenisKontrakModel GetData(IJenisKontrakKey key) { JenisKontrakModel result = null; var sql = @" SELECT JenisKontrakID, JenisKontrakName FROM OFTA_JenisKontrak WHERE JenisKontrakID = @JenisKontrakID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@JenisKontrakID", key.JenisKontrakID, SqlDbType.VarChar); conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) { return(null); } dr.Read(); result = new JenisKontrakModel { JenisKontrakID = dr["JenisKontrakID"].ToString(), JenisKontrakName = dr["JenisKontrakName"].ToString() }; } } return(result); }
public void Delete(IJenisKontrakKey key) { // INPUT VALIDATION if (key is null) { throw new ArgumentException("JENIS KONTRAK ID empty"); } // REPO-OP _jenisKontrakDal.Delete(key); }
public JenisKontrakModel GetData(IJenisKontrakKey key) { // INPUT VALIDATION if (key is null) { throw new ArgumentException("JENIS KONTRAK ID empty"); } // REPO-OP var result = _jenisKontrakDal.GetData(key); // RETURN return(result); }
public void Delete(IJenisKontrakKey key) { var sql = @" DELETE OFTA_JenisKontrak WHERE JenisKontrakID = @JenisKontrakID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@JenisKontrakID", key.JenisKontrakID, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }