private void btnAccept_Click(object sender, EventArgs e) { int selectedCount = lsvOrgApply.SelectedItems.Count; if (selectedCount <= 0) { MessageBox.Show("没有选中的申请!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } try { ShowArchiveContent showDialog = new ShowArchiveContent(); showDialog.CurrentUser = _currentUser; showDialog.Closed += new EventHandler(showDialog_Closed); showDialog.ShowDialog(); } catch (Exception ex) { MessageBox.Show("系统错误:" + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void showDialog_Closed(object sender, EventArgs e) { ShowArchiveContent showArchive = (ShowArchiveContent)sender; if (showArchive.DialogResult != DialogResult.OK) { return; } int selectedCount = lsvOrgApply.SelectedItems.Count; if (selectedCount <= 0) { MessageBox.Show("没有选中的申请!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } List <ListViewItem> permitItems = new List <ListViewItem>(); try { if (showArchive.SelectedNode == null || showArchive.SelectedNode.Tag == null) { return; } foreach (ListViewItem item in lsvOrgApply.SelectedItems) { permitItems.Add(item); _currentUser.PermitApply((int)item.Tag, (int)showArchive.SelectedNode.Tag); } if (selectedCount > 0) { MessageBox.Show("您选择的项目已批准!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadOrgApp(); } } catch (Exception ex) { MessageBox.Show("系统错误:" + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } }