public void xoaCa(DTO_CALAMVIEC dto) { try { sql = "DELETE FROM CALAMVIEC WHERE MACALAM = @ma"; conn.Open(); cmd = new SqlCommand(sql, conn); cmd.Parameters.AddWithValue("@ma", dto.Macalam); cmd.ExecuteNonQuery(); conn.Close(); } catch (Exception ex) { } }
public void themCa(DTO_CALAMVIEC dto) { try { sql = "INSERT INTO CALAMVIEC VALUES (@giobd, @giokt, @sogio)"; conn.Open(); cmd = new SqlCommand(sql, conn); cmd.Parameters.AddWithValue("@giobd", dto.GioBD); cmd.Parameters.AddWithValue("@giokt", dto.GioKT); cmd.Parameters.AddWithValue("@sogio", dto.Sogio); cmd.ExecuteNonQuery(); conn.Close(); } catch (Exception ex) { } }
public void capnhatCa(DTO_CALAMVIEC dto) { try { sql = "UPDATE CALAMVIEC SET GIOBD = @giobd, GIOKT = @giokt, SOGIO = @sogio WHERE MACALAM = @ma"; conn.Open(); cmd = new SqlCommand(sql, conn); cmd.Parameters.AddWithValue("@giobd", dto.GioBD); cmd.Parameters.AddWithValue("@giokt", dto.GioKT); cmd.Parameters.AddWithValue("@sogio", dto.Sogio); cmd.Parameters.AddWithValue("@ma", dto.Sogio); cmd.ExecuteNonQuery(); conn.Close(); } catch (Exception ex) { } }
public void deleteCa(DTO_CALAMVIEC dto) { dao.xoaCa(dto); }
public void updateCa(DTO_CALAMVIEC dto) { dao.capnhatCa(dto); }
public void addCa(DTO_CALAMVIEC dto) { dao.themCa(dto); }