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

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

            return(obj);
        }
Exemplo n.º 2
0
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>DicGiftpackEntity</returns>
        /// <remarks>2016/2/16 16:51:33</remarks>
        public DicGiftpackEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

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


            DicGiftpackEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/2/16 16:51:33</remarks>
        public bool Update(DicGiftpackEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_DicGiftpack_Update");

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


            int results = 0;

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


            return(Convert.ToBoolean(results));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2016/2/16 16:51:33</remarks>
 public bool Update(DicGiftpackEntity 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/2/16 16:51:33</remarks>
 public bool Insert(DicGiftpackEntity entity)
 {
     return(Insert(entity, null));
 }
Exemplo n.º 6
0
        public static bool Update(DicGiftpackEntity dicGiftpackEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new DicGiftpackProvider(zoneId);

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