Esempio n. 1
0
 /// <summary>
 /// 创建一个异常处理
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="db">数据库上下文</param>
 /// <param name="entity">一个异常处理</param>
 /// <returns></returns>
 public bool Create(ref ValidationErrors validationErrors, SysException entity)
 {
     try
     {
         return(repository.Create(entity) == 1);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }
        public virtual bool Create(ref ValidationErrors errors, SysExceptionModel model)
        {
            try
            {
                tbl_SysException entity = m_Rep.GetById(model.Id);
                if (entity != null)
                {
                    errors.Add(Suggestion.PrimaryRepeat);
                    return(false);
                }
                entity            = new tbl_SysException();
                entity.Id         = model.Id;
                entity.HelpLink   = model.HelpLink;
                entity.Message    = model.Message;
                entity.Source     = model.Source;
                entity.StackTrace = model.StackTrace;
                entity.TargetSite = model.TargetSite;
                entity.Data       = model.Data;
                entity.CreateTime = model.CreateTime;


                if (m_Rep.Create(entity))
                {
                    return(true);
                }
                else
                {
                    errors.Add(Suggestion.InsertFail);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message);
                ExceptionHandler.WriteException(ex);
                return(false);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 创建一个异常处理
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="db">数据库上下文</param>
 /// <param name="entity">一个异常处理</param>
 /// <returns></returns>
 public bool Create(ref ValidationErrors validationErrors, SysException entity)
 {
     repository.Create(entity);
     return(true);
 }