public IniSqlResourceService(SysLangEntity langEntity) { lang_code = langEntity.Code; string Key_Cache = "Lib.App.IniSqlResourceService." + langEntity.ID + "." + langEntity.Code; object obj = HL.Core.Web.Cache.GetValue(Key_Cache); if (obj != null) { listResource = (Dictionary <string, string>)obj; } else { listResource = new Dictionary <string, string>(); List <WebResourceEntity> listSqlResource = WebResourceService.Instance.GetAllByLangID_Cache(langEntity.ID); for (int i = 0; listSqlResource != null && i < listSqlResource.Count; i++) { listResource[listSqlResource[i].Code] = listSqlResource[i].Value; } HL.Core.Web.Cache.SetValue(Key_Cache, listResource); } }
public CPViewPage() { string lang_code = Cookies.GetValue("CP.Lang", true); //ngon ngu mac dinh neu chua co if (lang_code == string.Empty) lang_code = "vi-VN"; CurrentLang = new SysLangEntity(); CurrentLang.Code = lang_code; ResourceService = new IniResourceService(Server.MapPath("~/" + HL.Core.Web.Setting.Sys_CPDir + "/Views/Lang/" + lang_code + ".ini")); }
public CPViewPage() { string lang_code = Cookies.GetValue("CP.Lang", true); //ngon ngu mac dinh neu chua co if (lang_code == string.Empty) { lang_code = "vi-VN"; } CurrentLang = new SysLangEntity(); CurrentLang.Code = lang_code; ResourceService = new IniResourceService(Server.MapPath("~/" + HL.Core.Web.Setting.Sys_CPDir + "/Views/Lang/" + lang_code + ".ini")); }
public CPViewPage() { var langCode = Global.Cookies.GetValue("CP.Lang", true); //ngon ngu mac dinh neu chua co if (langCode?.Length == 0) { langCode = "vi-VN"; } CurrentLang = new SysLangEntity { Code = langCode }; ResourceService = new IniResourceService(Server.MapPath("~/" + Setting.Sys_AdminDir + "/Views/Lang/" + langCode + ".ini")); }
public static string GetValue(string code, string defalt) { SysLangEntity _Lang = SysLangService.Instance.CreateQuery() .Where(o => o.Code == CurrentCode) .ToSingle_Cache(); if (_Lang == null) { return(defalt); } WebResourceEntity _Resource = WebResourceService.Instance.GetByCode_Cache(code, _Lang.ID); if (_Resource != null) { return(_Resource.Value); } IniResourceService _IniResourceService = new IniResourceService(HttpContext.Current.Server.MapPath("~/Views/Lang/" + _Lang.Code + ".ini")); return(_IniResourceService.HL_Core_GetByCode(code, defalt)); }
public IniSqlResourceService(SysLangEntity langEntity) { lang_code = langEntity.Code; string Key_Cache = "Lib.App.IniSqlResourceService." + langEntity.ID + "." + langEntity.Code; object obj = HL.Core.Web.Cache.GetValue(Key_Cache); if (obj != null) listResource = (Dictionary<string, string>)obj; else { listResource = new Dictionary<string, string>(); List<WebResourceEntity> listSqlResource = WebResourceService.Instance.GetAllByLangID_Cache(langEntity.ID); for (int i = 0; listSqlResource != null && i < listSqlResource.Count; i++) { listResource[listSqlResource[i].Code] = listSqlResource[i].Value; } HL.Core.Web.Cache.SetValue(Key_Cache, listResource); } }