private void btnThem_Click(object sender, EventArgs e) { if (ThieuDuLieu(true)) { return; } SetDataIndex(-1); long re = bus.Insert(itemIndex); if (re > 0) { MessageBox.Show("Thành công.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadData(); } else { if (re == -2) { MessageBox.Show("Trùng mã, vui lòng nhập lại!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("Không thành công.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public bool DonViTinh_Insert(DonViTinh inp) { try { return(DonViTinh_bus.Insert(inp)); } catch (Exception ex) { throw ex; } }
private void btnLuu_Click(object sender, EventArgs e) { if (ValidateData()) { obj.TenDonViTinh = txtTenDonViTinh.Text; obj.GhiChu = txtGhiChu.Text; bus.Insert(obj); XtraMessageBox.Show("Thêm đơn vị tính thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }