private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { if (dGVHocSinh.RowCount == 0) { bindingNavigatorDeleteItem.Enabled = true; } DataRow m_Row = m_HocSinhCtrl.ThemDongMoi(); m_Row["MaHocSinh"] = "HS" + quyDinh.LaySTT(dGVHocSinh.Rows.Count + 1); m_Row["HoTen"] = ""; m_Row["GioiTinh"] = false; m_Row["NgaySinh"] = DateTime.Today; m_Row["NoiSinh"] = ""; m_HocSinhCtrl.ThemHocSinh(m_Row); bindingNavigatorHocSinh.BindingSource.MoveLast(); }
private void simpleButtonThem_Click(object sender, EventArgs e) { if (_isAddButton) { _Disable_Control(editing: true); DataRow m_Row = m_HocSinhCtrl.ThemDongMoi(); m_Row["MaHocSinh"] = "HS" + quyDinh.LaySTT1(dGVHocSinh.Rows.Count + 1); m_Row["HoTen"] = ""; m_Row["GioiTinh"] = false; m_Row["NgaySinh"] = DateTime.Today; m_Row["Email"] = ""; m_Row["DiaChi"] = ""; m_HocSinhCtrl.ThemHocSinh(m_Row); bindingNavigatorHocSinh.BindingSource.MoveLast(); } else { _Disable_Control(editing: false); m_HocSinhCtrl.HienThi(dGVHocSinh, bindingNavigatorHocSinh); } }