protected void MagicItemCommand(object sender, MagicItemEventArgs e) { if (e.CommandName == "Delete") { try { using (ISession session = new Session()) { session.BeginTransaction(); try { for (int i = 0; i < this.rptSDHead.Items.Count; i++) { System.Web.UI.HtmlControls.HtmlInputCheckBox objCheckBox = this.rptSDHead.Items[i].FindControl("checkbox") as System.Web.UI.HtmlControls.HtmlInputCheckBox; if (objCheckBox.Checked) { INVCheckHead.Delete(session, objCheckBox.Attributes["value"].Trim()); } } session.Commit(); QueryAndBindData(session, 1, this.magicPagerMain.PageSize, true); } catch (Exception ex) { session.Rollback(); throw ex; } } } catch (Exception ex) { WebUtil.ShowError(this, "删除失败,请与管理员联系!\r\n失败信息:" + ex.Message); return; } } }