/// <summary> /// 显示消息提示对话框,并进行页面后退 /// </summary> /// <param name="ex">错误信息</param> public void ShowMessage(Exception ex) { ZhuJi.Log.IDAL.ILogging logging = new ZhuJi.Log.NHibernateDAL.Logging(); logging.WriteException(ex); StringBuilder Builder = new StringBuilder(); Builder.Append("<script language=\"javascript\" defer>"); Builder.AppendFormat("alert(\"{0}\");", ex.Message.Replace("\r", "").Replace("\n", "\\r\\n")); Builder.Append("history.go(-1);"); Builder.Append("</script>"); ClientScriptManager cs = this.Page.ClientScript; cs.RegisterStartupScript(this.Page.GetType(), "message", Builder.ToString()); }
/// <summary> /// 拦截 /// </summary> /// <param name="invocation">IInvocation</param> /// <param name="args">参数</param> /// <returns></returns> public override object Intercept(IInvocation invocation, params object[] args) { try { PreProceed(invocation, args); object ret; //事务判断 if (IsTransaction) { using (TransactionScope ts = new TransactionScope()) { try { ret = invocation.Proceed(args); ts.Complete(); } catch (Exception ex) { throw (ex); } } } else { ret = invocation.Proceed(args); } PostProceed(invocation, ref ret, args); return(ret); } catch (Exception ex) { //日志判断 if (IsErrorLog) { ZhuJi.Log.IDAL.ILogging log = new ZhuJi.Log.NHibernateDAL.Logging(); log.WriteException(ex); } throw ex; } }
/// <summary> /// ��ʾ��Ϣ��ʾ�Ի�������ҳ����� /// </summary> /// <param name="ex">������Ϣ</param> public void ShowMessage(Exception ex) { ZhuJi.Log.IDAL.ILogging logging = new ZhuJi.Log.NHibernateDAL.Logging(); logging.WriteException(ex); StringBuilder Builder = new StringBuilder(); Builder.Append("<script language=\"javascript\" defer>"); Builder.AppendFormat("alert(\"{0}\");", ex.Message.Replace("\r", "").Replace("\n", "\\r\\n")); Builder.Append("history.go(-1);"); Builder.Append("</script>"); ClientScriptManager cs = this.Page.ClientScript; cs.RegisterStartupScript(this.Page.GetType(), "message", Builder.ToString()); }
/// <summary> /// ���� /// </summary> /// <param name="invocation">IInvocation</param> /// <param name="args">����</param> /// <returns></returns> public override object Intercept(IInvocation invocation, params object[] args) { try { PreProceed(invocation, args); object ret; //�����ж� if (IsTransaction) { using (TransactionScope ts = new TransactionScope()) { try { ret = invocation.Proceed(args); ts.Complete(); } catch (Exception ex) { throw (ex); } } } else { ret = invocation.Proceed(args); } PostProceed(invocation, ref ret, args); return ret; } catch (Exception ex) { //��־�ж� if (IsErrorLog) { ZhuJi.Log.IDAL.ILogging log = new ZhuJi.Log.NHibernateDAL.Logging(); log.WriteException(ex); } throw ex; } }