Esempio n. 1
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public int Add(QiangGou entity, IDbTransaction tran)
        {
            string sql = @"insert into [QiangGou]
                               ([objectid], [addTime], [lastModifyer], [qgPrice], [adId], [orderId], [endTime])
                               values
                               (@objectid, @addTime, @lastModifyer, @qgPrice, @adId, @orderId, @endTime)";

            object param = new
            {
                objectid = entity.Objectid,
                addTime = entity.AddTime,
                lastModifyer = entity.LastModifyer,
                qgPrice = entity.QgPrice,
                adId = entity.AdId,
                orderId = entity.OrderId,
                endTime = entity.EndTime
            };
            int count = tran.Connection.Execute(sql, param, tran);
            return count;
        }
Esempio n. 2
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public ResultSet Add(QiangGou entity)
        {
            Func<QiangGou, ResultStatus> validate = (_entity) =>
            {
                return new ResultStatus();
            };

            Func<QiangGou, ResultStatus> op = (_entity) =>
            {
                int ret = new QiangGouDal().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);
        }
Esempio n. 3
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public int Add(QiangGou entity)
        {
            string sql = @"insert into [QiangGou]
                               ([objectid], [addTime], [lastModifyer], [qgPrice], [adId], [orderId], [endTime])
                               values
                               (@objectid, @addTime, @lastModifyer, @qgPrice, @adId, @orderId, @endTime)";

            object param = new
            {
                objectid = entity.Objectid,
                addTime = entity.AddTime,
                lastModifyer = entity.LastModifyer,
                qgPrice = entity.QgPrice,
                adId = entity.AdId,
                orderId = entity.OrderId,
                endTime = entity.EndTime
            };

            using (IDbConnection conn = OpenConnection())
            {
                int count = conn.Execute(sql, param);
                return count;
            }
        }
Esempio n. 4
0
        public int Update(QiangGou entity)
        {
            //GetUpdateSql2
              string sql = @"update [QiangGou] set objectid=@objectid, addTime=@addTime, lastModifyer=@lastModifyer, qgPrice=@qgPrice, adId=@adId, orderId=@orderId, endTime=@endTime  where id=@id ";
               object param = new
            {
               id = entity.Id,
               objectid = entity.Objectid,
               addTime = entity.AddTime,
               lastModifyer = entity.LastModifyer,
               qgPrice = entity.QgPrice,
               adId = entity.AdId,
               orderId = entity.OrderId,
               endTime = entity.EndTime
            };

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