Ejemplo n.º 1
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public int Add(OperateLog entity, IDbTransaction tran)
        {
            string sql = @"insert into [OperateLog]
                               ([module], [objectId], [userId], [userName], [content], [addTime])
                               values
                               (@module, @objectId, @userId, @userName, @content, @addTime)";

            object param = new
            {
                module = entity.Module,
                objectId = entity.ObjectId,
                userId = entity.UserId,
                userName = entity.UserName,
                content = entity.Content,
                addTime = entity.AddTime
            };
            int count = tran.Connection.Execute(sql, param, tran);
            return count;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public ResultSet Add(OperateLog entity)
        {
            Func<OperateLog, ResultStatus> validate = (_entity) =>
            {
                return new ResultStatus();
            };

            Func<OperateLog, ResultStatus> op = (_entity) =>
            {
                int ret = new OperateLogDal().Add(entity);
                if (ret > 0)
                    return new ResultStatus();
                else
                    return new ResultStatus()
                    {
                        Success = false,
                        Code = StatusCollection.AddFailed.Code,
                        Description = StatusCollection.AddFailed.Description
                    };
            };

            return HandleBusiness(entity, op, validate);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public int Add(OperateLog entity)
        {
            string sql = @"insert into [OperateLog]
                               ([module], [objectId], [userId], [userName], [content], [addTime])
                               values
                               (@module, @objectId, @userId, @userName, @content, @addTime)";

            object param = new
            {
                module = entity.Module,
                objectId = entity.ObjectId,
                userId = entity.UserId,
                userName = entity.UserName,
                content = entity.Content,
                addTime = entity.AddTime
            };

            using (IDbConnection conn = OpenConnection())
            {
                int count = conn.Execute(sql, param);
                return count;
            }
        }