Esempio n. 1
0
        /// <summary>
        /// 记录异常日志
        /// </summary>
        /// <param name="ex"></param>
        public virtual void InsertLog(Exception ex, string Errorclass)
        {
            System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(ex, true);
            string            fileName          = trace.GetFrame(trace.FrameCount - 1).GetFileName();
            string            methodName        = trace.GetFrame(trace.FrameCount - 1).GetMethod().Name;
            int               lineNumber        = trace.GetFrame(trace.FrameCount - 1).GetFileLineNumber();
            SecLogErrorEntity err = new SecLogErrorEntity();

            err.LogTime = DateTime.Now;

            err.LogErrorId = Guid.NewGuid().ToString();
            UserDomain user = WebCaching.CurrentUser as UserDomain;

            err.CreatedBy        = user != null ? user.CasUserEntity.UserAccount : "1";
            err.CreateTime       = DateTime.Now;
            err.LastModifiedBy   = user != null ? user.CasUserEntity.UserAccount : "1";
            err.Ip               = WebCaching.CurrentIP;
            err.MachineName      = Dns.GetHostName();
            err.Message          = ex.Message;
            err.StackTrace       = ex.StackTrace; //+relationData;
            err.LastModifiedTime = DateTime.Now;
            if (WebCaching.CurrentContext == null || WebCaching.CurrentContext.Request == null)
            {
            }
            else
            {
                int i = WebCaching.CurrentContext.Request.Path.LastIndexOf('/');
                if (i != -1)
                {
                    err.Pagename = WebCaching.CurrentContext.Request.Path.Substring(i + 1);
                }
            }
            DataAccess.Insert(err);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取错误日志Domain
        /// </summary>
        /// <param name="logErrorId"></param>
        /// <returns></returns>
        public virtual LogErrorDomain GetLogErrorDomain(string logErrorId)
        {
            SecLogErrorEntity errorEty = GetById <SecLogErrorEntity>(logErrorId);

            if (errorEty == null)
            {
                return(null);
            }
            return(new LogErrorDomain(errorEty));
        }
 public ActionResult Edit(SecLogErrorEntity entity, string id)
 {
     if (!IsPost)
     {
         entity = SystemService.LogErrorService.LogErrorDomainCreate().SecLogErrorEntity;
         if (!string.IsNullOrEmpty(id))
         {
             entity = SystemService.LogErrorService.GetById <SecLogErrorEntity>(id);
         }
     }
     return(View(entity));
 }
Esempio n. 4
0
        /// <summary>
        /// 创建领域对象
        /// </summary>
        /// <returns></returns>
        public virtual LogErrorDomain LogErrorDomainCreate()
        {
            SecLogErrorEntity errorEty = new SecLogErrorEntity();

            errorEty.LogErrorId  = Guid.NewGuid().ToString();
            errorEty.Message     = string.Empty;
            errorEty.StackTrace  = string.Empty;
            errorEty.MachineName = string.Empty;
            errorEty.Ip          = string.Empty;
            //errorEty.LogTime = SystemService.ParameterService.GetSqlDateTimeNow();
            errorEty.LastModifiedBy = string.Empty;
            //errorEty.LastModifiedTime = SystemService.ParameterService.GetSqlDateTimeNow();
            return(new LogErrorDomain(errorEty));
        }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="strError"></param>
        /// <param name="relationData"></param>
        public virtual void InsertLog(string strError, string relationData)
        {
            SecLogErrorEntity err = new SecLogErrorEntity();

            err.LogTime = DateTime.Now;

            // SystemService.ParameterService.GetSqlDateTimeNow();
            UserDomain user = WebCaching.CurrentUser as UserDomain;

            err.CreatedBy      = user != null ? user.CasUserEntity.UserAccount : "1";
            err.CreateTime     = DateTime.Now;
            err.LogErrorId     = Guid.NewGuid().ToString();
            err.LastModifiedBy = CurrentUser.CasUserEntity.UserAccount;
            err.Ip             = WebCaching.CurrentIP;
            err.MachineName    = Dns.GetHostName();
            err.Message        = strError;
            err.StackTrace     = strError + relationData;
            DataAccess.Insert(err);
        }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="errorEntity">错误日志</param>
 public LogErrorDomain(SecLogErrorEntity errorEntity)
     : base(errorEntity)
 {
 }