public static int GetIntSettingValue(LMYFrameWorkMVC.Common.LookUps.SettingsKeys settingKey) { if ((CacheHelper.GetValue(new CacheMemberKey() { CacheKey = LookUps.CacheKeys.Settings, ObjectId = settingKey.ToString() }) is bool)) { return(Convert.ToInt32(CacheHelper.GetValue(new CacheMemberKey() { CacheKey = LookUps.CacheKeys.Settings, ObjectId = settingKey.ToString() }))); } using (DAL.LMYFrameWorkMVCEntities dbContext = new DAL.LMYFrameWorkMVCEntities(false)) { //return dbContext.Settings.AsNoTracking().Where(x => x.Key == settingKey.ToString()).FirstOrDefault().Value; return(Convert.ToInt32(CacheHelper.Insert(new CacheMemberKey() { CacheKey = LookUps.CacheKeys.Settings, ObjectId = settingKey.ToString() }, Convert.ToInt32(dbContext.Settings.Where(x => x.Key == settingKey.ToString()).FirstOrDefault().Value)))); } }
public static bool GetBoolSettingValue(LMYFrameWorkMVC.Common.LookUps.SettingsKeys settingKey) { if ((CacheHelper.GetValue(new CacheMemberKey() { CacheKey = LookUps.CacheKeys.Settings, ObjectId = settingKey.ToString() }) is bool)) { return((bool)CacheHelper.GetValue(new CacheMemberKey() { CacheKey = LookUps.CacheKeys.Settings, ObjectId = settingKey.ToString() })); } using (DAL.LMYFrameWorkMVCEntities dbContext = new DAL.LMYFrameWorkMVCEntities(false)) { //return dbContext.Settings.AsNoTracking().Where(x => x.Key == settingKey.ToString()).FirstOrDefault().Value; return((bool)CacheHelper.Insert(new CacheMemberKey() { CacheKey = LookUps.CacheKeys.Settings, ObjectId = settingKey.ToString() }, dbContext.Settings.Where(x => x.Key == settingKey.ToString()).FirstOrDefault().Value.ToLower() == "true" ? true : false)); } }
public static string GetSettingValue(LMYFrameWorkMVC.Common.LookUps.SettingsKeys settingKey) { //if (settingKey.ToString() exists in cache) if ((CacheHelper.GetValue(new CacheMemberKey() { CacheKey = LookUps.CacheKeys.Settings, ObjectId = settingKey.ToString() }) is string)) { return(CacheHelper.GetValue(new CacheMemberKey() { CacheKey = LookUps.CacheKeys.Settings, ObjectId = settingKey.ToString() }).ToString()); } using (LMYFrameWorkMVCEntities dbContext = new DAL.LMYFrameWorkMVCEntities(false)) { //return dbContext.Settings.AsNoTracking().Where(x => x.Key == settingKey.ToString()).FirstOrDefault().Value; return(CacheHelper.Insert(new CacheMemberKey() { CacheKey = LookUps.CacheKeys.Settings, ObjectId = settingKey.ToString() }, dbContext.Settings.Where(x => x.Key == settingKey.ToString()).FirstOrDefault().Value).ToString()); } }