/// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="ciExceptionEntity">实体</param>
        public string AddEntity(CiExceptionEntity ciExceptionEntity)
        {
            var sequence = string.Empty;

            this.Identity = false;
            var sqlBuilder = new SQLBuilder(DBProvider, this.Identity, this.ReturnId);

            sqlBuilder.BeginInsert(this.CurrentTableName, CiExceptionTable.FieldId);
            if (!this.Identity)
            {
                if (string.IsNullOrEmpty(ciExceptionEntity.Id))
                {
                    sequence             = BusinessLogic.NewGuid();
                    ciExceptionEntity.Id = sequence;
                }
                sqlBuilder.SetValue(CiExceptionTable.FieldId, ciExceptionEntity.Id);
            }
            this.SetEntity(sqlBuilder, ciExceptionEntity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(CiExceptionTable.FieldCreateUserId, UserInfo.Id);
                sqlBuilder.SetValue(CiExceptionTable.FieldCreateBy, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(CiExceptionTable.FieldCreateOn);
            if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.SqlServer || DBProvider.CurrentDbType == CurrentDbType.Access))
            {
                sequence = sqlBuilder.EndInsert().ToString();
            }
            else
            {
                sqlBuilder.EndInsert();
            }
            return(sequence);
        }
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="ciExceptionEntity">实体</param>
        public int UpdateEntity(CiExceptionEntity ciExceptionEntity)
        {
            var sqlBuilder = new SQLBuilder(DBProvider);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, ciExceptionEntity);
            sqlBuilder.SetWhere(CiExceptionTable.FieldId, ciExceptionEntity.Id);
            return(sqlBuilder.EndUpdate());
        }
        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="id">主键</param>
        /// <returns>实体</returns>
        public CiExceptionEntity GetEntity(UserInfo userInfo, string id)
        {
            CiExceptionEntity entity = null;
            var parameter            = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, string.Empty);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var manager = new CiExceptionManager(dbProvider, userInfo);
                entity      = manager.GetEntity(id);
            });

            return(entity);
        }
        /// <summary>
        /// 添加异常数据
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">实体</param>
        /// <param name="statusCode">返回状态码</param>
        /// <param name="statusMessage">返回状态信息</param>
        /// <returns>主键</returns>
        public string Add(UserInfo userInfo, CiExceptionEntity entity, out string statusCode, out string statusMessage)
        {
            string returnValue   = string.Empty;
            string returnCode    = string.Empty;
            string returnMessage = string.Empty;
            var    parameter     = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, string.Empty);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var manager   = new CiExceptionManager(dbProvider, userInfo);
                returnValue   = manager.AddEntity(entity);
                returnMessage = manager.GetStateMessage(returnCode);
            });
            statusCode    = returnCode;
            statusMessage = returnMessage;
            return(returnValue);
        }
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="sqlBuilder">SQL语句生成器</param>
 /// <param name="ciExceptionEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, CiExceptionEntity ciExceptionEntity)
 {
     sqlBuilder.SetValue(CiExceptionTable.FieldEventId, ciExceptionEntity.EventId);
     sqlBuilder.SetValue(CiExceptionTable.FieldCategory, ciExceptionEntity.Category);
     sqlBuilder.SetValue(CiExceptionTable.FieldPriority, ciExceptionEntity.Priority);
     sqlBuilder.SetValue(CiExceptionTable.FieldSeverity, ciExceptionEntity.Severity);
     sqlBuilder.SetValue(CiExceptionTable.FieldTitle, ciExceptionEntity.Title);
     sqlBuilder.SetValue(CiExceptionTable.FieldTimestamp, ciExceptionEntity.Timestamp);
     sqlBuilder.SetValue(CiExceptionTable.FieldMachineName, ciExceptionEntity.MachineName);
     sqlBuilder.SetValue(CiExceptionTable.FieldAppDomainName, ciExceptionEntity.AppDomainName);
     sqlBuilder.SetValue(CiExceptionTable.FieldProcessId, ciExceptionEntity.ProcessId);
     sqlBuilder.SetValue(CiExceptionTable.FieldProcessName, ciExceptionEntity.ProcessName);
     sqlBuilder.SetValue(CiExceptionTable.FieldThreadName, ciExceptionEntity.ThreadName);
     sqlBuilder.SetValue(CiExceptionTable.FieldWin32ThreadId, ciExceptionEntity.Win32ThreadId);
     sqlBuilder.SetValue(CiExceptionTable.FieldMessage, ciExceptionEntity.Message);
     sqlBuilder.SetValue(CiExceptionTable.FieldFormattedMessage, ciExceptionEntity.FormattedMessage);
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="ciExceptionEntity">实体</param>
 /// <returns>主键</returns>
 public string Add(CiExceptionEntity ciExceptionEntity)
 {
     return(this.AddEntity(ciExceptionEntity));
 }
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="ciExceptionEntity">实体</param>
 public int Update(CiExceptionEntity ciExceptionEntity)
 {
     return(this.UpdateEntity(ciExceptionEntity));
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="ciExceptionEntity">实体</param>
 /// <param name="identity">自增量方式</param>
 /// <param name="returnId">返回主键</param>
 /// <returns>主键</returns>
 public string Add(CiExceptionEntity ciExceptionEntity, bool identity, bool returnId)
 {
     this.Identity = identity;
     this.ReturnId = returnId;
     return(this.AddEntity(ciExceptionEntity));
 }