public bool updateSuCo(DTO_SuCo suCo) { try { conn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_UpdateDataIntoSuCo"; cmd.Parameters.AddWithValue("maSC", suCo.maSC); cmd.Parameters.AddWithValue("maNV", suCo.maNV); cmd.Parameters.AddWithValue("tenSC", suCo.tenSC); cmd.Parameters.AddWithValue("loai", suCo.loaiSC); cmd.Parameters.AddWithValue("thietHai", suCo.thietHai); if (cmd.ExecuteNonQuery() > 0) { return(true); } } catch (Exception) { } finally { conn.Close(); } return(false); }
private void btLuu_Click(object sender, EventArgs e) { if (cmbMaNV.Text != "" && txtMaSC.Text != "" && txtTenSC.Text != "" && txtThiethai.Text != "" && cmbLoaiSC.Text != "") { DTO_SuCo sc = new DTO_SuCo(txtMaSC.Text, cmbMaNV.Text, txtTenSC.Text, cmbLoaiSC.SelectedIndex, txtThiethai.Text); if (busSuCo.insertSuCo(sc)) { MessageBox.Show("Thêm thành công"); LoadGridView_SuCo(); CloseText(); } } else { MessageBox.Show("Mời nhập đầy đủ"); } }
public bool updateSuCo(DTO_SuCo suCo) { return(dalSuCo.updateSuCo(suCo)); }
public bool insertSuCo(DTO_SuCo suCo) { return(dalSuCo.insertSuCo(suCo)); }