public void AddAction(ExceptionHandlerAction action) { if (action != null) { this.actions.Add(action); } }
public void RemoveAction(ExceptionHandlerAction action) { if (action != null && this.actions.Contains(action)) { this.actions.Remove(action); } }
protected void ExceptionProcessWatch(Exception ex, ExceptionHandlerAction obj, TimeSpan confirm, TimeSpan ignore) { this.ex = ex; if (obj is SmsAction) { if (this.smsConfirmExceptionTime == null) { if (this.smsIgnoreTime != null) { if (DateTime.Now >= ((DateTime)this.smsIgnoreTime).Add(ignore)) { this.smsIgnoreTime = null; ExceptionProcessWatch(ex, obj, confirm, ignore); } } else { this.smsConfirmExceptionTime = DateTime.Now; } } else { if (DateTime.Now >= ((DateTime)this.smsConfirmExceptionTime).Add(confirm)) { this.smsConfirmExceptionTime = null; this.smsIgnoreTime = DateTime.Now; ExceptionHandler(obj); } } } if (obj is EmailAction) { if (this.sEmailConfirmExceptionTime == null) { if (this.sEmailIgnoreTime != null) { if (DateTime.Now >= ((DateTime)this.sEmailIgnoreTime).Add(ignore)) { this.sEmailIgnoreTime = null; ExceptionProcessWatch(ex, obj, confirm, ignore); } } else { this.sEmailConfirmExceptionTime = DateTime.Now; } } else { if (DateTime.Now >= ((DateTime)this.sEmailConfirmExceptionTime).Add(confirm)) { this.sEmailConfirmExceptionTime = null; this.sEmailIgnoreTime = DateTime.Now; ExceptionHandler(obj); } } } if (obj is LogAction) { if (this.sBlogConfirmExceptionTime == null) { if (this.sBlogIgnoreTime != null) { if (DateTime.Now >= ((DateTime)this.sBlogIgnoreTime).Add(ignore)) { this.sBlogIgnoreTime = null; ExceptionProcessWatch(ex, obj, confirm, ignore); } } else { this.sBlogConfirmExceptionTime = DateTime.Now; } } else { if (DateTime.Now >= ((DateTime)this.sBlogConfirmExceptionTime).Add(confirm)) { this.sBlogConfirmExceptionTime = null; this.sBlogIgnoreTime = DateTime.Now; ExceptionHandler(obj); } } } }
protected void ExceptionHandler(ExceptionHandlerAction obj) { obj.Handler(this.ex, this.message); }
protected void ExceptionProcessWatch(Exception ex,ExceptionHandlerAction obj, TimeSpan confirm, TimeSpan ignore) { this.ex = ex; if (obj is SmsAction) { if (this.smsConfirmExceptionTime == null) { if (this.smsIgnoreTime != null) { if (DateTime.Now >= ((DateTime)this.smsIgnoreTime).Add(ignore)) { this.smsIgnoreTime = null; ExceptionProcessWatch(ex,obj, confirm, ignore); } } else { this.smsConfirmExceptionTime = DateTime.Now; } } else { if (DateTime.Now >= ((DateTime)this.smsConfirmExceptionTime).Add(confirm)) { this.smsConfirmExceptionTime = null; this.smsIgnoreTime = DateTime.Now; ExceptionHandler(obj); } } } if (obj is EmailAction) { if (this.sEmailConfirmExceptionTime == null) { if (this.sEmailIgnoreTime != null) { if (DateTime.Now >= ((DateTime)this.sEmailIgnoreTime).Add(ignore)) { this.sEmailIgnoreTime = null; ExceptionProcessWatch(ex,obj, confirm, ignore); } } else { this.sEmailConfirmExceptionTime = DateTime.Now; } } else { if (DateTime.Now >= ((DateTime)this.sEmailConfirmExceptionTime).Add(confirm)) { this.sEmailConfirmExceptionTime = null; this.sEmailIgnoreTime = DateTime.Now; ExceptionHandler(obj); } } } if (obj is LogAction) { if (this.sBlogConfirmExceptionTime == null) { if (this.sBlogIgnoreTime != null) { if (DateTime.Now >= ((DateTime)this.sBlogIgnoreTime).Add(ignore)) { this.sBlogIgnoreTime = null; ExceptionProcessWatch(ex,obj, confirm, ignore); } } else { this.sBlogConfirmExceptionTime = DateTime.Now; } } else { if (DateTime.Now >= ((DateTime)this.sBlogConfirmExceptionTime).Add(confirm)) { this.sBlogConfirmExceptionTime = null; this.sBlogIgnoreTime = DateTime.Now; ExceptionHandler(obj); } } } }
protected void ExceptionHandler(ExceptionHandlerAction obj) { obj.Handler(this.ex,this.message); }