private void gridView1_RowCountChanged(object sender, EventArgs e) { string t = gridView1.GetRowCellValue(gridView1.RowCount - 1, "TenDonVi").ToString(); if (_donViBLL.KiemTraTenDonViTonTai(t) == false) { _donViBLL.ThemDonViMoi(t); LoadDataSource(); } }
private void btn_ThemMoi_Click(object sender, EventArgs e) { if (txt_TenDonVi.Text == null) { Utils.Notification.Error("Bạn chưa nhập tên đơn vị."); return; } if (_donViBLL.KiemTraTenDonViTonTai(txt_TenDonVi.Text)) { Utils.Notification.Error("Tên đơn vị đã tồn tại."); return; } _donViBLL.ThemDonViMoi(txt_TenDonVi.Text); Utils.Notification.Success("Thêm đơn vị mới thành công."); txt_TenDonVi.Text = ""; }