private void ApproveAction(string command, int appItemId) { if (command != "Pass" && command != "Reject") { WebUtil.ShowError(this, "无效操作"); return; } bool approved = false; //MagicToolBar的事件 using (ISession session = new Session()) { try { session.BeginTransaction(); if (appItemId > 0) { if (command == "Pass") { OrderApproveItem.Approve(session, appItemId, this.txtAppNote.Value.Trim()); } else if (command == "Reject") { OrderApproveItem.Reject(session, appItemId, this.txtAppNote.Value.Trim()); } approved = true; } else { foreach (RepeaterItem item in this.repeatControl.Items) { HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox; if (chk != null && chk.Checked && Cast.Int(chk.Value) > 0) { int appId = Cast.Int(chk.Value, 0); if (appId > 0) { if (command == "Pass") { OrderApproveItem.Approve(session, appId, this.txtAppNote.Value.Trim()); } else if (command == "Reject") { OrderApproveItem.Reject(session, appId, this.txtAppNote.Value.Trim()); } approved = true; } } } } session.Commit(); } catch (Exception err) { session.Rollback(); WebUtil.ShowError(this, err.Message, 300, 100); } if (approved) { WebUtil.ShowMsg(this, "选择的单据已经完成签核处理", "操作成功"); this.QueryAndBindData(session, this.magicPagerMain.CurrentPageIndex, this.magicPagerMain.PageSize, false); } } }