private void btnUpdate_Click(object sender, EventArgs e) { try { if (this.grvDeclarationList.SelectedRows.Count > 0) { int selectedIndex = grvDeclarationList.SelectedRows[0].Index; // gets the RowID from the first column in the grid long ID = long.Parse(grvDeclarationList[0, selectedIndex].Value.ToString()); tblDeclaration declaration = DeclarationFactory.GetByID(ID); if (declaration == null) { MessageBox.Show("Tờ khai này không còn tồn tại trong Cơ Sở Dữ Liệu. Bạn hãy kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } frmUpdateDeclarationFiles frm = new frmUpdateDeclarationFiles(_userInfo, this, ID); frm.MdiParent = this.MdiParent; frm.Show(); } else { MessageBox.Show("Bạn cần chọn một bản ghi để cập nhật", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { logger.Error(ex.ToString()); if (GlobalInfo.IsDebug) MessageBox.Show(ex.ToString()); } }
private void grvDeclarationList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (_userInfo.UserPermission.Contains(ConstantInfo.PERMISSON_CAP_NHAT_THONG_TIN_LUU_TRU_HO_SO_TO_KHAI) == false) { return; } try { if (this.grvDeclarationList.SelectedRows.Count > 0) { int selectedIndex = grvDeclarationList.SelectedRows[0].Index; // gets the RowID from the first column in the grid long ID = long.Parse(grvDeclarationList[0, selectedIndex].Value.ToString()); tblDeclaration declaration = DeclarationFactory.GetByID(ID); if (declaration == null) { MessageBox.Show("Tờ khai này không còn tồn tại trong Cơ Sở Dữ Liệu. Bạn hãy kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } frmUpdateDeclarationFiles frm = new frmUpdateDeclarationFiles(_userInfo, this, ID); frm.MdiParent = this.MdiParent; frm.Show(); } else { MessageBox.Show("Bạn cần chọn một bản ghi để cập nhật", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { logger.Error(ex.ToString()); if (GlobalInfo.IsDebug) MessageBox.Show(ex.ToString()); } }