public async Task RemoveLog(string keepTime) { DateTime operateTime = DateTime.Now; if (keepTime == "7") //保留近一周 { operateTime = DateTime.Now.AddDays(-7); } else if (keepTime == "1") //保留近一个月 { operateTime = DateTime.Now.AddMonths(-1); } else if (keepTime == "3") //保留近三个月 { operateTime = DateTime.Now.AddMonths(-3); } if (HandleLogProvider != Define.CACHEPROVIDER_REDIS) { var expression = ExtLinq.True <LogEntity>(); expression = expression.And(t => t.F_Date <= operateTime); await repository.Delete(expression); } else { var list = HandleLogHelper.HGetAll <LogEntity>(currentuser.CompanyId).Values.ToList(); var strList = list.Where(t => t.F_Date <= operateTime).Select(a => a.F_Id).ToList(); await HandleLogHelper.HDelAsync(currentuser.CompanyId, strList.ToArray()); } }
public async Task <List <LogEntity> > GetList() { if (HandleLogProvider != Define.CACHEPROVIDER_REDIS) { return(repository.IQueryable().ToList()); } else { return(HandleLogHelper.HGetAll <LogEntity>(currentuser.CompanyId).Values.ToList());; } }
public async Task <List <OpenJobLogEntity> > GetLogList(string keyValue) { if (HandleLogProvider != Define.CACHEPROVIDER_REDIS) { return(uniwork.IQueryable <OpenJobLogEntity>().Where(a => a.F_JobId == keyValue).OrderByDesc(a => a.F_CreatorTime).ToList()); } else { return(HandleLogHelper.HGetAll <OpenJobLogEntity>(keyValue).Values.OrderByDescending(a => a.F_CreatorTime).ToList());; } }
public async Task <List <LogEntity> > GetList(Pagination pagination, int timetype, string keyword = "") { //获取数据权限 var result = new List <LogEntity>(); DateTime startTime = DateTime.Now.ToString("yyyy-MM-dd").ToDate(); DateTime endTime = DateTime.Now.ToString("yyyy-MM-dd").ToDate().AddDays(1); switch (timetype) { case 1: break; case 2: startTime = startTime.AddDays(-7); break; case 3: startTime = startTime.AddMonths(-1); break; case 4: startTime = startTime.AddMonths(-3); break; default: break; } if (HandleLogProvider != Define.CACHEPROVIDER_REDIS) { var list = repository.IQueryable(); if (!string.IsNullOrEmpty(keyword)) { list = list.Where(u => u.F_Account.Contains(keyword) || u.F_Description.Contains(keyword) || u.F_ModuleName.Contains(keyword)); } list = list.Where(t => t.F_Date >= startTime && t.F_Date <= endTime); result = await repository.OrderList(list, pagination); } else { result = HandleLogHelper.HGetAll <LogEntity>(currentuser.CompanyId).Values.ToList(); if (!string.IsNullOrEmpty(keyword)) { result = result.Where(u => u.F_Account.Contains(keyword) || u.F_Description.Contains(keyword) || u.F_ModuleName.Contains(keyword)).Where(t => t.F_Date >= startTime && t.F_Date <= endTime).ToList(); } else { result = result.Where(t => t.F_Date >= startTime && t.F_Date <= endTime).ToList(); } pagination.records = result.Count(); result = result.OrderByDescending(a => a.F_CreatorTime).Skip((pagination.page - 1) * pagination.rows).Take(pagination.rows).ToList(); } return(GetFieldsFilterData(result)); }
public async Task DeleteLogForm(string keyValue) { if (HandleLogProvider != Define.CACHEPROVIDER_REDIS) { await uniwork.Delete <OpenJobLogEntity>(a => a.F_JobId == keyValue); } else { string[] list = HandleLogHelper.HGetAll <OpenJobLogEntity>(keyValue).Keys.ToArray(); await HandleLogHelper.HDelAsync(keyValue, list); } }