private void btnSimpan_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); bool IsPass = true; if (string.IsNullOrEmpty(textBoxNamaMerek.Text)) { sb.Append("- Nama Merek harus diisi \n"); IsPass = false; } if (string.IsNullOrEmpty(textBoxKeterangan.Text)) { sb.Append("- Keterangan harus diisi \n"); IsPass = false; } if (!IsPass) { MessageBox.Show(sb.ToString(), "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var merek = new Merek() { NamaMerek = textBoxNamaMerek.Text, Keterangan = textBoxKeterangan.Text }; merekService.Post(merek); this.ParentForm.dataGridViewMerek.DataSource = merekService.Get(); this.Dispose(); }
public int updMerek(Merek m) { SqlCommand s = new SqlCommand(); s.CommandType = CommandType.Text; s.CommandText = "UPDATE merk SET merk_kend = '" + m.namaMerek + "' where id = '" + m.Id + "' "; return(db.ExeNonQuery(s)); }
public int delMerek(Merek m) { SqlCommand s = new SqlCommand(); s.CommandType = CommandType.Text; s.CommandText = "DELETE from merk WHERE id = '" + m.Id + "' "; return(db.ExeNonQuery(s)); }
public int insertMerek(Merek m) { SqlCommand s = new SqlCommand(); s.CommandType = CommandType.Text; s.CommandText = "INSERT INTO merk VALUES('" + m.namaMerek + "')"; return(db.ExeNonQuery(s)); }
public DataTable viewMerek(Merek m) { SqlCommand s = new SqlCommand(); s.CommandType = CommandType.Text; s.CommandText = "SELECT * FROM merk"; return(db.ExeReader(s)); }
public void Put(Merek merek) { merekRepository.Put(merek); }
public void Delete(Merek merek) { merekRepository.Delete(merek); }