Beispiel #1
0
        /// <summary>
        /// 删除7天前的日志数据
        /// </summary>
        public int Delete(int dayCount)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from " + databaseprefix + "manager_log ");
            strSql.Append(" where DATEDIFF(day, add_time, getdate()) > " + dayCount);
            return(WriteDataBase.Delete(strSql.ToString()));
        }
Beispiel #2
0
        /// <summary>
        /// 根据实体进行删除
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public virtual bool Delete(T t)
        {
            bool isSuccess = true;

            try
            {
                WriteDataBase.BeginTransaction();
                isSuccess = WriteDataBase.Delete(TableName, "id", t) > 0;
                WriteDataBase.CompleteTransaction();
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                WriteDataBase.CloseSharedConnection();
                isSuccess = false;
            }
            finally
            {
                WriteDataBase.CloseSharedConnection();
            }
            return(isSuccess);
        }
Beispiel #3
0
        /// <summary>
        /// 根据实体进行删除
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool Delete(T t)
        {
            bool isSuccess = true;

            try
            {
                WriteDataBase.BeginTransaction();
                isSuccess = WriteDataBase.Delete(t) > 0;
                WriteDataBase.CompleteTransaction();
            }
            catch (Exception ex)
            {
                log.Info("Delete(T):" + ex);
                isSuccess = false;
                WriteDataBase.AbortTransaction();
                WriteDataBase.CloseSharedConnection();
            }
            finally
            {
                WriteDataBase.CloseSharedConnection();
            }
            return(isSuccess);
        }