2018-09-16 19:33:56 +08:00
|
|
|
|
using Bootstrap.Security;
|
2018-10-25 17:52:04 +08:00
|
|
|
|
using Bootstrap.Security.SQLServer;
|
2018-09-16 19:33:56 +08:00
|
|
|
|
using Longbow.Configuration;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Bootstrap.Client.DataAccess
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class DictHelper
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string RetrieveProfilesUrl()
|
|
|
|
|
{
|
|
|
|
|
return RetrieveAppName("个人中心地址");
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string RetrieveSettingsUrl()
|
|
|
|
|
{
|
|
|
|
|
return RetrieveAppName("系统设置地址");
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string RetrieveTitle()
|
|
|
|
|
{
|
|
|
|
|
return RetrieveAppName("网站标题");
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string RetrieveFooter()
|
|
|
|
|
{
|
|
|
|
|
return RetrieveAppName("网站页脚");
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2018-10-25 17:52:04 +08:00
|
|
|
|
private static IEnumerable<BootstrapDict> RetrieveDicts() => BASQLHelper.RetrieveDicts();
|
2018-09-16 19:33:56 +08:00
|
|
|
|
|
|
|
|
|
private static string RetrieveAppName(string name, string defaultValue = "未设置")
|
|
|
|
|
{
|
2018-10-19 23:09:52 +08:00
|
|
|
|
var dicts = RetrieveDicts();
|
|
|
|
|
var platName = dicts.FirstOrDefault(d => d.Category == "应用程序" && d.Code == ConfigurationManager.AppSettings["AppId"])?.Name;
|
2018-09-16 19:33:56 +08:00
|
|
|
|
return dicts.FirstOrDefault(d => d.Category == platName && d.Name == name)?.Code ?? $"{name}{defaultValue}";
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获得网站设置中的当前样式
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string RetrieveActiveTheme()
|
|
|
|
|
{
|
2018-10-19 23:09:52 +08:00
|
|
|
|
var theme = RetrieveDicts().Where(d => d.Name == "使用样式" && d.Category == "当前样式" && d.Define == 0).FirstOrDefault()?.Code;
|
|
|
|
|
return theme == null ? string.Empty : theme.Equals("site.css", StringComparison.OrdinalIgnoreCase) ? string.Empty : theme;
|
2018-09-16 19:33:56 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|