/// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/1/19 14:54:27</remarks>
        public bool Update(ConfigSynthesiscardEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigSynthesiscard_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@CardLevel", DbType.Int32, entity.CardLevel);
            database.AddInParameter(commandWrapper, "@Coin", DbType.Int32, entity.Coin);
            database.AddInParameter(commandWrapper, "@ProtectPoint", DbType.Int32, entity.ProtectPoint);


            int results = 0;

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

            entity.Idx = (System.Int32)database.GetParameterValue(commandWrapper, "@Idx");

            return(Convert.ToBoolean(results));
        }
        /// <summary>
        /// 将IDataReader的当前记录读取到ConfigSynthesiscardEntity 对象
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public ConfigSynthesiscardEntity LoadSingleRow(IDataReader reader)
        {
            var obj = new ConfigSynthesiscardEntity();

            obj.Idx          = (System.Int32)reader["Idx"];
            obj.CardLevel    = (System.Int32)reader["CardLevel"];
            obj.Coin         = (System.Int32)reader["Coin"];
            obj.ProtectPoint = (System.Int32)reader["ProtectPoint"];

            return(obj);
        }
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>ConfigSynthesiscardEntity</returns>
        /// <remarks>2016/1/19 14:54:27</remarks>
        public ConfigSynthesiscardEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

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


            ConfigSynthesiscardEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
예제 #4
0
        public static bool Update(ConfigSynthesiscardEntity configSynthesiscardEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new ConfigSynthesiscardProvider(zoneId);

            return(provider.Update(configSynthesiscardEntity, trans));
        }
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2016/1/19 14:54:27</remarks>
 public bool Update(ConfigSynthesiscardEntity entity)
 {
     return(Update(entity, null));
 }
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2016/1/19 14:54:27</remarks>
 public bool Insert(ConfigSynthesiscardEntity entity)
 {
     return(Insert(entity, null));
 }