/// <summary> /// 获取字典分类名称 /// </summary> /// <returns></returns> public static IEnumerable <string> RetrieveCategories() => CacheManager.GetOrAdd(RetrieveCategoryDataKey, key => DbContextManager.Create <Dict>().RetrieveCategories());
/// <summary> /// /// </summary> /// <returns></returns> public static string RetrieveWebFooter() => DbContextManager.Create <Dict>().RetrieveWebFooter();
/// <summary> /// 根据角色ID指派应用程序 /// </summary> /// <param name="roleId"></param> /// <returns></returns> public static IEnumerable <App> RetrievesByRoleId(string roleId) => CacheManager.GetOrAdd(string.Format("{0}-{1}", RetrieveAppsByRoleIdDataKey, roleId), key => DbContextManager.Create <App>()?.RetrievesByRoleId(roleId), RetrieveAppsByRoleIdDataKey) ?? new App[0];
/// <summary> /// 根据指定用户名获得授权应用程序集合 /// </summary> /// <param name="userName"></param> /// <returns></returns> public static IEnumerable <string> RetrievesByUserName(string?userName) => string.IsNullOrEmpty(userName) ? new string[0] : CacheManager.GetOrAdd($"{DbHelper.RetrieveAppsByUserNameDataKey}-{userName}", key => DbContextManager.Create <App>()?.RetrievesByUserName(userName), RetrieveAppsByUserNameDataKey) ?? new string[0];
/// <summary> /// 获取Header处显示的消息列表 /// </summary> /// <param name="userName"></param> /// <returns></returns> public static IEnumerable <Message> Retrieves(string?userName) => (string.IsNullOrEmpty(userName) ? new Message[0] : CacheManager.GetOrAdd(RetrieveMessageDataKey, key => (DbContextManager.Create <Message>()?.RetrieveHeaders(userName) ?? new Message[0]))).OrderByDescending(n => n.SendTime);
/// <summary> /// /// </summary> /// <param name="po"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <returns></returns> public static Page <Exceptions> RetrievePages(PaginationOption po, DateTime?startTime, DateTime?endTime) => DbContextManager.Create <Exceptions>()?.RetrievePages(po, startTime, endTime) ?? new Page <Exceptions>() { Items = new List <Exceptions>() };
/// <summary> /// 获得指定IP历史访问记录 /// </summary> /// <param name="po"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="ip"></param> /// <returns></returns> public static Page <Trace> Retrieves(PaginationOption po, DateTime?startTime, DateTime?endTime, string ip) => DbContextManager.Create <Trace>().RetrievePages(po, startTime, endTime, ip);
/// <summary> /// 获取头像路径 /// </summary> /// <returns></returns> public static string RetrieveIconFolderPath() => DbContextManager.Create <Dict>().RetrieveIconFolderPath();
/// <summary> /// /// </summary> /// <param name="ex"></param> /// <param name="additionalInfo"></param> /// <returns></returns> public static void Log(Exception ex, NameValueCollection additionalInfo) { var ret = DbContextManager.Create<Exceptions>()?.Log(ex, additionalInfo) ?? false; if (ret) CacheManager.Clear(RetrieveExceptionsDataKey); }
/// <summary> /// 保存需要重置用户 /// </summary> /// <returns></returns> public static bool Save(ResetUser user) { user.ResetTime = DateTime.Now; return(DbContextManager.Create <ResetUser>()?.Save(user) ?? false); }
/// <summary> /// 保存任務方法 /// </summary> /// <param name="task"></param> /// <returns></returns> public static bool Save(Task task) => DbContextManager.Create <Task>()?.Save(task) ?? false;
/// <summary> /// 查詢所有任務 /// </summary> /// <returns></returns> public static IEnumerable <Task> Retrieves() => CacheManager.GetOrAdd(RetrieveTasksDataKey, key => DbContextManager.Create <Task>()?.Retrieves()) ?? new Task[0];
/// <summary> /// /// </summary> /// <param name="msg"></param> /// <returns></returns> public static bool Save(Message msg) => DbContextManager.Create <Message>()?.Save(msg) ?? false;
/// <summary> /// 获得系统中配置的可以使用的网站样式 /// </summary> /// <returns></returns> public static IEnumerable <BootstrapDict> RetrieveThemes() => DbContextManager.Create <Dict>().RetrieveThemes();
/// <summary> /// 获得指定IP历史访问记录 /// </summary> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="ip"></param> /// <returns></returns> public static IEnumerable <Trace> RetrieveAll(DateTime?startTime, DateTime?endTime, string ip) => DbContextManager.Create <Trace>().RetrieveAll(startTime, endTime, ip);
/// <summary> /// 获得网站设置中的当前样式 /// </summary> /// <returns></returns> public static string RetrieveActiveTheme() => DbContextManager.Create <Dict>().RetrieveActiveTheme();
/// <summary> /// 查询一周内所有异常 /// </summary> /// <returns></returns> public static IEnumerable <Exceptions> Retrieves() => CacheManager.GetOrAdd(RetrieveExceptionsDataKey, key => DbContextManager.Create <Exceptions>()?.Retrieves()) ?? new Exceptions[0];
/// <summary> /// 获得默认的前台首页地址,默认为~/Home/Index /// </summary> /// <param name="appCode">应用程序编码</param> /// <returns></returns> public static string RetrieveHomeUrl(string appCode) => DbContextManager.Create <Dict>().RetrieveHomeUrl(appCode);
/// <summary> /// 标旗 /// </summary> /// <param name="userName"></param> /// <returns></returns> public static IEnumerable <Message> Mark(string?userName) => string.IsNullOrEmpty(userName) ? new Message[0] : DbContextManager.Create <Message>()?.Mark(userName) ?? new Message[0];