/// <summary> /// 在 Html 中直接使用 /// </summary> /// <param name="htmlhelper"></param> /// <param name="key"></param> /// <returns></returns> public static string Option(this System.Web.UI.Page page, string key) { if (IsModify) { if(Options==null) { Options=new Dictionary<string, string>(); } else { Options.Clear(); } ISiteOptionService siteOptionService = new SiteOptionService(); var data = siteOptionService.GetSiteOption(); foreach (var siteOptionInfo in data) { if(Options.ContainsKey(siteOptionInfo.OptionKey)) { Options[siteOptionInfo.OptionKey] = siteOptionInfo.OptionValue; } else { Options.Add(siteOptionInfo.OptionKey,siteOptionInfo.OptionValue); } } IsModify = false; } return Options[key]; }
static SiteConfigManager() { if (Options == null) { Options = new Dictionary<string, string>(); } else { Options.Clear(); } ISiteOptionService siteOptionService = new SiteOptionService(); var data = siteOptionService.GetSiteOption(); foreach (var siteOptionInfo in data) { if(Options.ContainsKey(siteOptionInfo.OptionKey)) { Options[siteOptionInfo.OptionKey] = siteOptionInfo.OptionValue; } else { Options.Add(siteOptionInfo.OptionKey,siteOptionInfo.OptionValue); } } }
public object GetSiteConfig() { ISiteOptionService siteOptionService = new SiteOptionService(); var data = siteOptionService.GetSiteOption(); // 每页显示记录数 int pageSize = 10; // 记录总数 int rowCount = data.Count; // 总页数 int pageCount = rowCount % pageSize == 0 ? rowCount / pageSize : rowCount / pageSize + 1; var resultObj = new JQGridDataResult { // 总页数 PageCount = pageCount, // 当前页 PageIndex = 1, // 总记录数 Total = rowCount, // 数据 Data = data }; return resultObj; }