Beispiel #1
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name = "item">要插入的实体对象</param>
        /// <param name="tm">事务管理对象</param>
        /// <return>受影响的行数</return>
        public virtual int Add(VipEO item, TransactionManager tm = null)
        {
            const string sql = @"INSERT INTO vip (vipId, vipTimes, vipMoney) VALUES (@vipId, @vipTimes, @vipMoney) ";

            return(Database.CreateSqlDao(sql)
                   .AddInParameter("@vipId", item.VipId, DbType.Int32, 0)
                   .AddInParameter("@vipTimes", item.VipTimes.HasValue ? (object)item.VipTimes.Value : DBNull.Value, DbType.Int32, 0)
                   .AddInParameter("@vipMoney", item.VipMoney.HasValue ? (object)item.VipMoney.Value : DBNull.Value, DbType.Int32, 0)
                   .ExecNonQuery(tm));
        }
Beispiel #2
0
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name = "item">要更新的实体对象</param>
        /// <param name="tm">事务管理对象</param>
        /// <return>受影响的行数</return>
        public virtual int Put(VipEO item, TransactionManager tm = null)
        {
            const string sql = @"UPDATE vip SET vipId=@vipId, vipTimes=@vipTimes, vipMoney=@vipMoney WHERE vipId=@OriginalVipId";

            return(Database.CreateSqlDao(sql)
                   .AddInParameter("@OriginalVipId", (item.HasOriginal) ? item.OriginalVipId : item.VipId, DbType.Int32, 0)
                   .AddInParameter("@vipId", item.VipId, DbType.Int32, 0)
                   .AddInParameter("@vipTimes", item.VipTimes.HasValue ? (object)item.VipTimes.Value : DBNull.Value, DbType.Int32, 0)
                   .AddInParameter("@vipMoney", item.VipMoney.HasValue ? (object)item.VipMoney.Value : DBNull.Value, DbType.Int32, 0)
                   .ExecNonQuery(tm));
        }
Beispiel #3
0
 /// <summary>
 /// 删除指定实体对应的记录
 /// </summary>
 /// <param name = "item">要删除的实体</param>
 /// <param name="tm">事务管理对象</param>
 /// <return>受影响的行数</return>
 public virtual int Remove(VipEO item, TransactionManager tm = null)
 {
     return(RemoveByPK(item.VipId, tm));
 }