private void btn_Them_Click(object sender, EventArgs e) { if (MessageBox.Show("Thêm Tôn giáo ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (!string.IsNullOrWhiteSpace(txt_TenTonGiao.Text)) { oTonGiao.TenTonGiao = txt_TenTonGiao.Text; try { int i = oTonGiao.AddWithReturnID(); MessageBox.Show("Thao tác thêm thành công.\r\n", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); if (i != 0) // them thanh cong { switch (UCCallerName) { case "QLNS_ThongTinNV_Phu": QLNS.UCs.DanhMucThongTin.QLNS_ThongTinNV_Phu.nNewTonGiaoID = i; break; default: break; } ((Form)this.Parent.Parent).Close(); } } catch (Exception ex) { MessageBox.Show("Thao tác thêm không thành công.\r\n" + ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Xin vui lòng điền tên tôn giáo.\r\n", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }