Exemple #1
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public ResultSet Add(TimeSale entity)
        {
            Func <TimeSale, ResultStatus> validate = (_entity) =>
            {
                return(new ResultStatus());
            };

            Func <TimeSale, ResultStatus> op = (_entity) =>
            {
                int ret = new TimeSaleDal().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));
        }
Exemple #2
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public int Add(TimeSale entity, IDbTransaction tran)
        {
            string sql = @"insert into [TimeSale]
                               ([objectId], [addTime], [salePrice], [classId], [orderId])
                               values
                               (@objectId, @addTime, @salePrice, @classId, @orderId)";

            object param = new
            {
                objectId  = entity.ObjectId,
                addTime   = entity.AddTime,
                salePrice = entity.SalePrice,
                classId   = entity.ClassId,
                orderId   = entity.OrderId
            };
            int count = tran.Connection.Execute(sql, param, tran);

            return(count);
        }
Exemple #3
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public int Add(TimeSale entity)
        {
            string sql = @"insert into [TimeSale]
                               ([objectId], [addTime], [salePrice], [classId], [orderId])
                               values
                               (@objectId, @addTime, @salePrice, @classId, @orderId)";

            object param = new
            {
                objectId  = entity.ObjectId,
                addTime   = entity.AddTime,
                salePrice = entity.SalePrice,
                classId   = entity.ClassId,
                orderId   = entity.OrderId
            };

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