private void btnLuu_Click(object sender, EventArgs e) { if (txtTenNV.Text.Trim().Length == 0) { MessageBox.Show("Vui lòng nhập thông tin đầy đủ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Nhanvienobj nvObj = new Nhanvienobj(); addData(nvObj); if (flagLuu == 0) { if (nvCtr.AddData(nvObj)) { MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Thêm không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (nvCtr.UpdData(nvObj)) { MessageBox.Show("Sửa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Sửa không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } NhanVien_Load_1(sender, e); }
private void btnLuu_Click(object sender, EventArgs e) { if (!SaveValidatetion()) { MessageBox.Show("Nhập đầy đủ thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } NhanVienObj nvObj = new NhanVienObj(); addData(nvObj); if (flagLuu == 0) { if (nvCtr.AddData(nvObj)) { MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Thêm không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (nvCtr.UpdData(nvObj)) { MessageBox.Show("Sửa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Sửa không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } frmNhanVien_Load(sender, e); }
private void btnLuuNV_Click(object sender, EventArgs e) { NhanVienObj nvobj = new NhanVienObj(); GanDuLieu(nvobj); if (flag == 0) { if (nvctr.AddData(nvobj)) { MessageBox.Show("Thêm thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Thêm thất bại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (nvctr.UpdData(nvobj)) { MessageBox.Show("Sửa thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Sửa thất bại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } FrmNhanVien_Load(sender, e); }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { NhanVienObj nvObj = new NhanVienObj(); addData(nvObj); if (flagLuu == 0) { if (nvCtr.AddData(nvObj)) { MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Thêm không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (nvCtr.UpdData(nvObj)) { MessageBox.Show("Sửa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Sửa không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } frmNhanVienn_Load(sender, e); }
private void btnSaveNV_Click(object sender, EventArgs e) { NhanVienObj nvObj = new NhanVienObj(); addData(nvObj); if (flagLuu == 0) { if (nvCtr.AddData(nvObj)) { MessageBox.Show("Thêm thành công", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Thêm thất bại!!!!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (flagLuu == 1) { if (nvCtr.UpdData(nvObj)) { MessageBox.Show("Sửa thành công", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Sửa không thành công!!!!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } Form1_Load(sender, e); }