/// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/3/11 15:09:43</remarks>
        public bool Update(TemplateActivityexprizeEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_TemplateActivityexprize_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@ExcitingId", DbType.Int32, entity.ExcitingId);
            database.AddInParameter(commandWrapper, "@GroupId", DbType.Int32, entity.GroupId);
            database.AddInParameter(commandWrapper, "@ExStep", DbType.Int32, entity.ExStep);
            database.AddInParameter(commandWrapper, "@PrizeType", DbType.Int32, entity.PrizeType);
            database.AddInParameter(commandWrapper, "@SubType", DbType.Int32, entity.SubType);
            database.AddInParameter(commandWrapper, "@ThirdType", DbType.Int32, entity.ThirdType);
            database.AddInParameter(commandWrapper, "@MinPower", DbType.Int32, entity.MinPower);
            database.AddInParameter(commandWrapper, "@MaxPower", DbType.Int32, entity.MaxPower);
            database.AddInParameter(commandWrapper, "@Count", DbType.Int32, entity.Count);
            database.AddInParameter(commandWrapper, "@Strength1", DbType.Int32, entity.Strength1);
            database.AddInParameter(commandWrapper, "@Strength2", DbType.Int32, entity.Strength2);
            database.AddInParameter(commandWrapper, "@IsBinding", DbType.Boolean, entity.IsBinding);


            int results = 0;

            if (trans != null)
            {
                results = database.ExecuteNonQuery(commandWrapper, trans);
            }
            else
            {
                results = database.ExecuteNonQuery(commandWrapper);
            }


            return(Convert.ToBoolean(results));
        }
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>TemplateActivityexprizeEntity</returns>
        /// <remarks>2016/3/11 15:09:43</remarks>
        public TemplateActivityexprizeEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

            DbCommand commandWrapper = database.GetStoredProcCommand("P_TemplateActivityexprize_GetById");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx);


            TemplateActivityexprizeEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
        /// <summary>
        /// 将IDataReader的当前记录读取到TemplateActivityexprizeEntity 对象
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public TemplateActivityexprizeEntity LoadSingleRow(IDataReader reader)
        {
            var obj = new TemplateActivityexprizeEntity();

            obj.Idx        = (System.Int32)reader["Idx"];
            obj.ExcitingId = (System.Int32)reader["ExcitingId"];
            obj.GroupId    = (System.Int32)reader["GroupId"];
            obj.ExStep     = (System.Int32)reader["ExStep"];
            obj.PrizeType  = (System.Int32)reader["PrizeType"];
            obj.SubType    = (System.Int32)reader["SubType"];
            obj.ThirdType  = (System.Int32)reader["ThirdType"];
            obj.MinPower   = (System.Int32)reader["MinPower"];
            obj.MaxPower   = (System.Int32)reader["MaxPower"];
            obj.Count      = (System.Int32)reader["Count"];
            obj.Strength1  = (System.Int32)reader["Strength1"];
            obj.Strength2  = (System.Int32)reader["Strength2"];
            obj.IsBinding  = (System.Boolean)reader["IsBinding"];

            return(obj);
        }
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2016/3/11 15:09:43</remarks>
 public bool Update(TemplateActivityexprizeEntity entity)
 {
     return(Update(entity, null));
 }
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2016/3/11 15:09:43</remarks>
 public bool Insert(TemplateActivityexprizeEntity entity)
 {
     return(Insert(entity, null));
 }
Example #6
0
        public static bool Update(TemplateActivityexprizeEntity templateActivityexprizeEntity, DbTransaction trans = null)
        {
            var provider = new TemplateActivityexprizeProvider();

            return(provider.Update(templateActivityexprizeEntity, trans));
        }