/// <summary> /// 删除Material00表记录 /// </summary> /// <param name="page">当前页面指针</param> /// <param name="id">记录的主键值</param> /// <param name="isAddUseLog">是否添加用户操作日志</param> public override void Delete(Page page, int id, bool isAddUseLog = true) { //设置Sql语句 var sql = string.Format("delete from {0} where {1} = {2}", Material00Table.TableName, Material00Table.Id, id); //删除 var delete = new DeleteHelper(); delete.Delete(sql); //判断是否启用缓存 if (CommonBll.IsUseCache()) { //删除缓存 DelCache(id); } if (isAddUseLog) { //添加用户操作记录 UseLogBll.GetInstence().Save(page, "{0}删除了Material00表id为【" + id + "】的记录!"); } }
/// <summary> /// 删除Branch表所有记录 /// </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}", BranchTable.TableName); //删除 var delete = new DeleteHelper(); delete.Delete(sql); //判断是否启用缓存 if (CommonBll.IsUseCache()) { //清空当前表所有缓存记录 DelAllCache(); } if (isAddUseLog) { //添加用户操作记录 UseLogBll.GetInstence().Save(page, "{0}删除了Branch表所有记录!"); } }
/// <summary> /// 从IIS缓存中获取HEAD_SHOP_PAY_HISTORY表记录 /// </summary> /// <param name="isCache">是否从缓存中读取</param> public IList <DataAccess.Model.HEAD_SHOP_PAY_HISTORY> GetList(bool isCache = true) { try { //判断是否使用缓存 if (CommonBll.IsUseCache() && isCache) { //检查指定缓存是否过期——缓存当天有效,第二天自动清空 if (CommonBll.CheckCacheIsExpired(const_CacheKey_Date)) { //删除缓存 DelAllCache(); } //从缓存中获取DataTable var obj = CacheHelper.GetCache(const_CacheKey); //如果缓存为null,则查询数据库 if (obj == null) { var list = GetList(false); //将查询出来的数据存储到缓存中 CacheHelper.SetCache(const_CacheKey, list); //存储当前时间 CacheHelper.SetCache(const_CacheKey_Date, DateTime.Now); return(list); } //缓存中存在数据,则直接返回 else { return((IList <DataAccess.Model.HEAD_SHOP_PAY_HISTORY>)obj); } } else { //定义临时实体集 IList <DataAccess.Model.HEAD_SHOP_PAY_HISTORY> list = null; //获取全表缓存加载条件表达式 var exp = GetExpression <HEAD_SHOP_PAY_HISTORY>(); //如果条件为空,则查询全表所有记录 if (exp == null) { //从数据库中获取所有记录 var all = HEAD_SHOP_PAY_HISTORY.All(); list = all == null ? null : Transform(all.ToList()); } else { //从数据库中查询出指定条件的记录,并转换为指定实体集 var all = HEAD_SHOP_PAY_HISTORY.Find(exp); list = all == null ? null : Transform(all); } return(list); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取HEAD_SHOP_PAY_HISTORY表记录时出现异常", e); } return(null); }