/// <summary> /// 添加一条新记录 /// </summary> /// <param name="ex">错误包</param> /// <returns></returns> public static int Insert(Exception ex) { if ((ex is System.Threading.ThreadAbortException)) { return(-1); } PfmErrorMDL errMdl = new PfmErrorMDL(); if (ex.InnerException != null) { errMdl.ErrTime = System.DateTime.Now; errMdl.ErrPage = string.IsNullOrEmpty(ex.InnerException.HelpLink) == true ? "非法数据!(页面信息)" : ex.InnerException.HelpLink; errMdl.ErrMessage = string.IsNullOrEmpty(ex.InnerException.Message) == true ? "非法数据!(错误信息)" : ex.InnerException.Message; errMdl.ErrTargetSite = string.IsNullOrEmpty(ex.InnerException.TargetSite.ToString()) == true ? "非法数据!(异常方法)" : ex.InnerException.TargetSite.ToString(); errMdl.ErrStackTrace = string.IsNullOrEmpty(ex.InnerException.StackTrace) == true ? "非法数据!(表示形式)" : ex.InnerException.StackTrace; errMdl.ErrSource = string.IsNullOrEmpty(ex.InnerException.Source) == true ? "非法数据!(数据源)" : ex.InnerException.Source; errMdl.ErrIp = GetIPs(); errMdl.ErrName = "未登录"; } else { errMdl.ErrTime = System.DateTime.Now; errMdl.ErrPage = string.IsNullOrEmpty(ex.HelpLink) == true ? "非法数据!(页面信息)" : ex.HelpLink; errMdl.ErrMessage = string.IsNullOrEmpty(ex.Message) == true ? "非法数据!(错误信息)" : ex.Message; errMdl.ErrTargetSite = string.IsNullOrEmpty(ex.TargetSite.ToString()) == true ? "非法数据!(异常方法)" : ex.TargetSite.ToString(); errMdl.ErrStackTrace = string.IsNullOrEmpty(ex.StackTrace) == true ? "非法数据!(表示形式)" : ex.StackTrace; errMdl.ErrSource = string.IsNullOrEmpty(ex.Source) == true ? "非法数据!(数据源)" : ex.Source; errMdl.ErrIp = GetIPs(); errMdl.ErrName = "未登录"; } return(PfmErrorBLL.Insert(errMdl)); }
/// <summary> /// 初始化数据 /// </summary> private void InitializeData() { if (this.svDetailed.Visibility == Visibility.Visible) { this.DetailedBack(); } EntityListener.PfmErrorListener.Instance.Receive(PfmErrorBLL.ISelectPaging(pager.PageSize, pager.PageCurrent, out _dataTotal)); }
/// <summary> /// 清空数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnClearAll_Click(object sender, RoutedEventArgs e) { MessageBoxResult delFlg = MessageBox.Show("您确定要清空错误信息吗?", "提示:", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); if (delFlg == MessageBoxResult.Yes) { PfmErrorBLL.DeleteAll(); this.InitializePaging(); } }