Esempio n. 1
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name = "item">要插入的实体对象</param>
        /// <param name="tm">事务管理对象</param>
        /// <return>受影响的行数</return>
        public virtual int Add(SysblacklistEO item, TransactionManager tm = null)
        {
            const string sql = @"INSERT INTO sysblacklist (userId, addTime) VALUES (@userId, @addTime)";

            item.Id = int.Parse(Database.CreateSqlDao(sql)
                                .AddInParameter("@userId", item.UserId != null ?  (object)item.UserId : DBNull.Value, DbType.String, 60)
                                .AddInParameter("@addTime", item.AddTime != null ?  (object)item.AddTime : DBNull.Value, DbType.String, 60)
                                .ExecScalar(tm).ToString());
            return(1);
        }
Esempio n. 2
0
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name = "item">要更新的实体对象</param>
        /// <param name="tm">事务管理对象</param>
        /// <return>受影响的行数</return>
        public virtual int Put(SysblacklistEO item, TransactionManager tm = null)
        {
            const string sql = @"UPDATE sysblacklist SET userId=@userId, addTime=@addTime WHERE id=@OriginalId";

            return(Database.CreateSqlDao(sql)
                   .AddInParameter("@OriginalId", (item.HasOriginal) ? item.OriginalId : item.Id, DbType.Int32, 0)
                   .AddInParameter("@userId", item.UserId != null ?  (object)item.UserId : DBNull.Value, DbType.String, 60)
                   .AddInParameter("@addTime", item.AddTime != null ?  (object)item.AddTime : DBNull.Value, DbType.String, 60)
                   .ExecNonQuery(tm));
        }
Esempio n. 3
0
 /// <summary>
 /// 删除指定实体对应的记录
 /// </summary>
 /// <param name = "item">要删除的实体</param>
 /// <param name="tm">事务管理对象</param>
 /// <return>受影响的行数</return>
 public virtual int Remove(SysblacklistEO item, TransactionManager tm = null)
 {
     return(RemoveByPK(item.Id, tm));
 }