Exemplo n.º 1
0
        /// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/8/19 19:08:17</remarks>
        public bool Update(ConfigArenashopEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigArenashop_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@ItemType", DbType.Int32, entity.ItemType);
            database.AddInParameter(commandWrapper, "@ItemCode", DbType.Int32, entity.ItemCode);
            database.AddInParameter(commandWrapper, "@ItemCount", DbType.Int32, entity.ItemCount);
            database.AddInParameter(commandWrapper, "@Price", DbType.Int32, entity.Price);


            int results = 0;

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


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

            obj.Idx       = (System.Int32)reader["Idx"];
            obj.ItemType  = (System.Int32)reader["ItemType"];
            obj.ItemCode  = (System.Int32)reader["ItemCode"];
            obj.ItemCount = (System.Int32)reader["ItemCount"];
            obj.Price     = (System.Int32)reader["Price"];

            return(obj);
        }
Exemplo n.º 3
0
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>ConfigArenashopEntity</returns>
        /// <remarks>2016/8/19 19:08:17</remarks>
        public ConfigArenashopEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

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


            ConfigArenashopEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2016/8/19 19:08:17</remarks>
 public bool Update(ConfigArenashopEntity entity)
 {
     return(Update(entity, null));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2016/8/19 19:08:17</remarks>
 public bool Insert(ConfigArenashopEntity entity)
 {
     return(Insert(entity, null));
 }
Exemplo n.º 6
0
        public static bool Update(ConfigArenashopEntity configArenashopEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new ConfigArenashopProvider(zoneId);

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