private void btnOK_Click(object sender, EventArgs e) { try { if (checkInput()) { switch (function) { case "add": objLoaiTaiSan = new LoaiTaiSan(); setDataObj(); if (objLoaiTaiSan.add() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Thêm loại tài sản thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Guid id = objLoaiTaiSan.id; reLoadAndSelectNode(id); } else { XtraMessageBox.Show("Thêm loại tài sản không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case "edit": setDataObj(); if (objLoaiTaiSan.update() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Sửa loại tài sản thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Guid id = objLoaiTaiSan.id; reLoadAndSelectNode(id); } else { XtraMessageBox.Show("Sửa loại tài sản không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; } } } catch (Exception ex) { Debug.WriteLine(this.Name + "->btnOk_Click: " + ex.Message); } }