Ejemplo n.º 1
0
        /// <summary>
        /// 删除Article表所有记录
        /// </summary>
        /// <param name="page">当前页面指针</param>
        /// <param name="isAddUseLog">是否添加用户操作日志</param>
        public void DeleteAll(Page page, bool isAddUseLog = true)
        {
            //设置Sql语句
            var sql = string.Format("delete from {0}", ArticleTable.TableName);

            //删除
            var delete = new DeleteHelper();
            delete.Delete(sql);

            //判断是否启用缓存
            if (CommonBll.IsUseCache())
            {
                //清空当前表所有缓存记录
                DelAllCache();
            }

            if (isAddUseLog)
            {
                //添加用户操作记录
                CommonBll.WriteLog("{0}删除了Article表记录!");
                //UseLogBll.GetInstence().Save(page, "{0}删除了Article表所有记录!");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 删除Article表记录
        /// </summary>
        /// <param name="page">当前页面指针</param>
        /// <param name="id">记录的主键值</param>
        /// <param name="isAddUseLog">是否添加用户操作日志</param>
        public void Delete(Page page, int[] id, bool isAddUseLog = true)
        {
            if (id == null) return;
            //将数组转为逗号分隔的字串
            var str = string.Join(",", id);

            //设置Sql语句
            var sql = string.Format("delete from {0} where {1} in ({2})", ArticleTable.TableName,  ArticleTable.Id, str);

            //删除
            var delete = new DeleteHelper();
            delete.Delete(sql);

            //判断是否启用缓存
            if (CommonBll.IsUseCache())
            {
                //删除缓存
                DelCache(id.ToList());
            }

            if (isAddUseLog)
            {
                //添加用户操作记录
                CommonBll.WriteLog("{0}删除了Article表id为【" + str + "】的记录!");
                //UseLogBll.GetInstence().Save(page, "{0}删除了Article表id为【" + str + "】的记录!");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 删除RefTable表指定Taxa_Id的字段值记录
        /// </summary>
        /// <param name="page">当前页面指针</param>
        /// <param name="id">记录的主键值</param>
        public void DeleteByTaxa_Id(Page page, int[] id)
        {
            if (id == null) return;
            //将数组转为逗号分隔的字串
            var str = string.Join(",", id);

            //设置Sql语句
            var sql = string.Format("delete from {0} where {1} in ({2})", RefTableTable.TableName, RefTableTable.Taxa_Id, id);

            //删除
            var delete = new DeleteHelper();
            delete.Delete(sql);

            //判断是否启用缓存
            if (CommonBll.IsUseCache())
            {
                var ids = id.ToList();
                foreach (var i in ids)
                {
                    //删除缓存
                    DelCache(x => x.Taxa_Id == i);
                }
            }

            //添加用户操作记录
            CommonBll.WriteLog("{0}删除了RefTable表Taxa_Id值为【" + str + "】的记录!");
            //UseLogBll.GetInstence().Save(page, "{0}删除了RefTable表Taxa_Id值为【" + str + "】的记录!");
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 删除Article表记录
        /// </summary>
        /// <param name="page">当前页面指针</param>
        /// <param name="id">记录的主键值</param>
        /// <param name="isAddUseLog">是否添加用户操作日志</param>
        public void Delete(Page page, int id, bool isAddUseLog = true)
        {
            //设置Sql语句
            var sql = string.Format("delete from {0} where {1} = {2}", ArticleTable.TableName,  ArticleTable.Id, id);

            //删除
            var delete = new DeleteHelper();
            delete.Delete(sql);

            //判断是否启用缓存
            if (CommonBll.IsUseCache())
            {
                //删除缓存
                DelCache(id);
            }

            if (isAddUseLog)
            {
                //添加用户操作记录
                CommonBll.WriteLog("{0}删除了Article表id为【" + id + "】的记录!");
                //UseLogBll.GetInstence().Save(page, "{0}删除了Article表id为【" + id + "】的记录!");
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 删除RefTable表指定Taxa_Id的字段值记录
        /// </summary>
        /// <param name="page">当前页面指针</param>
        /// <param name="id">记录的主键值</param>
        public void DeleteByTaxa_Id(Page page, int id)
        {
            //设置Sql语句
            var sql = string.Format("delete from {0} where {1} = {2}", RefTableTable.TableName, RefTableTable.Taxa_Id, id);

            //删除
            var delete = new DeleteHelper();
            delete.Delete(sql);

            //判断是否启用缓存
            if (CommonBll.IsUseCache())
            {
                //删除缓存
                DelCache(x => x.Taxa_Id == id);
            }

            //添加用户操作记录
            CommonBll.WriteLog("{0}删除了RefTable表Taxa_Id值为【" + id + "】的记录!");
            //UseLogBll.GetInstence().Save(page, "{0}删除了RefTable表Taxa_Id值为【" + id + "】的记录!");
        }