Beispiel #1
0
        /// <summary>
        /// 将IDataReader的当前记录读取到ConfigCrowdscoreEntity 对象
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public ConfigCrowdscoreEntity LoadSingleRow(IDataReader reader)
        {
            var obj = new ConfigCrowdscoreEntity();

            obj.Idx   = (System.Int32)reader["Idx"];
            obj.Score = (System.Int32)reader["Score"];

            return(obj);
        }
Beispiel #2
0
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>ConfigCrowdscoreEntity</returns>
        /// <remarks>2016-08-15 16:43:22</remarks>
        public ConfigCrowdscoreEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

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


            ConfigCrowdscoreEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
Beispiel #3
0
        /// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016-08-15 16:43:22</remarks>
        public bool Update(ConfigCrowdscoreEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigCrowdscore_Update");

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


            int results = 0;

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


            return(Convert.ToBoolean(results));
        }
Beispiel #4
0
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2016-08-15 16:43:22</remarks>
 public bool Update(ConfigCrowdscoreEntity entity)
 {
     return(Update(entity, null));
 }
Beispiel #5
0
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2016-08-15 16:43:22</remarks>
 public bool Insert(ConfigCrowdscoreEntity entity)
 {
     return(Insert(entity, null));
 }
        public static bool Update(ConfigCrowdscoreEntity configCrowdscoreEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new ConfigCrowdscoreProvider(zoneId);

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