private void tolSpCannel_Click(object sender, EventArgs e) { DSHD.CancelCurrentEdit(); tblCTHD.RejectChanges(); capNhat = false; enableButton(); }
private void tolSpInsert_Click(object sender, EventArgs e) { DSHD.AddNew(); DSCTHD.AddNew(); capNhat = true; enableButton(); }
private void tolSpDelete_Click(object sender, EventArgs e) { try { DSHD.RemoveAt(DSHD.Position); daCTHD.Update(tblCTHD); tblCTHD.AcceptChanges(); } catch (SqlException ex) { tblCTHD.RejectChanges(); MessageBox.Show("Xóa thất bại!!!"); } }
private void tolSpSave_Click(object sender, EventArgs e) { // chay thu di try { DSHD.EndCurrentEdit(); dahd.Update(tblhoadon); tblhoadon.AcceptChanges(); DSCTHD.EndCurrentEdit(); daCTHD.Update(tblCTHD); tblCTHD.AcceptChanges(); capNhat = false; enableButton(); } catch (Exception ex) { tblCTHD.RejectChanges(); MessageBox.Show(ex.Message); } }