Exemplo n.º 1
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public int Add(Statistics entity, IDbTransaction tran)
        {
            string sql = @"insert into [Statistics]
                               ([type], [objectid], [appcount], [productconfig], [createtime])
                               values
                               (@type, @objectid, @appcount, @productconfig, @createtime)";

            object param = new
            {
                type = entity.Type,
                objectid = entity.Objectid,
                appcount = entity.Appcount,
                productconfig = entity.Productconfig,
                createtime = entity.Createtime
            };
            int count = tran.Connection.Execute(sql, param, tran);
            return count;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public int Add(Statistics entity)
        {
            string sql = @"insert into [Statistics]
                               ([type], [objectid], [appcount], [productconfig], [createtime])
                               values
                               (@type, @objectid, @appcount, @productconfig, @createtime)";

            object param = new
            {
                type = entity.Type,
                objectid = entity.Objectid,
                appcount = entity.Appcount,
                productconfig = entity.Productconfig,
                createtime = entity.Createtime
            };

            using (IDbConnection conn = OpenConnection())
            {
                int count = conn.Execute(sql, param);
                return count;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public ResultSet Add(Statistics entity)
        {
            Func<Statistics, ResultStatus> validate = (_entity) =>
            {
                return new ResultStatus();
            };

            Func<Statistics, ResultStatus> op = (_entity) =>
            {
                int ret = new StatisticsDal().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);
        }