protected void MagicItemCommand(object sender, MagicItemEventArgs e) { if (e.CommandName == "Delete") { #region ɾ³ý using (ISession session = new Session()) { try { bool deleted = false; session.BeginTransaction(); foreach (RepeaterItem item in this.repeatControl.Items) { HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox; if (chk.Checked) { log.DebugFormat("Delete - ÒÆ¿âÃ÷ϸ: ordNum={0}, lineNum={1}", this.OrderNumber, chk.Value); WHTransferLine.Delete(session, this.OrderNumber, chk.Value); deleted = true; } } session.Commit(); this.QueryAndBindData(session, WHTransferHead.Retrieve(session, this.OrderNumber)); WebUtil.ShowMsg(this, "Ñ¡ÔñµÄÃ÷ϸÒѾɾ³ý"); } catch (Exception er) { session.Rollback(); log.Error("Error - ɾ³ýÒÆ¿âÃ÷ϸ: ", er); WebUtil.ShowError(this, er); } } #endregion } else if (e.CommandName == "Release") { #region ·¢²¼ using (ISession session = new Session()) { try { session.BeginTransaction(); WHTransferHead head = WHTransferHead.Retrieve(session, this.OrderNumber); log.DebugFormat("Release - ÒÆ¿âµ¥: {0}", this.OrderNumber); head.Release(session); session.Commit(); WebUtil.ShowMsg(this, "·¢²¼³É¹¦"); this.QueryAndBindData(session, head); this.SetView(head); } catch (Exception er) { session.Rollback(); log.Error("Error - ÒÆ¿âµ¥: ", er); WebUtil.ShowError(this, er); } } #endregion } else if (e.CommandName == "Close") { #region ¹Ø±Õ using (ISession session = new Session()) { try { WHTransferHead head = WHTransferHead.Retrieve(session, this.OrderNumber); session.BeginTransaction(); log.DebugFormat("Close - ÒÆ¿âµ¥: {0}", this.OrderNumber); head.Close(session); session.Commit(); WebUtil.ShowMsg(this, string.Format("ÒÆ¿âµ¥{0}ÒѾ¹Ø±Õ", this.OrderNumber)); this.QueryAndBindData(session, head); this.SetView(head); } catch (Exception er) { session.Rollback(); log.Error("Error - ÒÆ¿âµ¥: ", er); WebUtil.ShowError(this, er); } } #endregion } }