public void SaveSetting(Guid id, SettingsKeys sk, string value) { AppSettings setting = new AppSettings(id) { Key = sk, Value = value }; _settingsRepository.Save(setting); }
public void Save(SettingsViewModel settingsViewModel) { AppSettings setting = new AppSettings(settingsViewModel.Id) { Key = (SettingsKeys)settingsViewModel.SettingKey, Value = settingsViewModel.Value }; _settingsRepository.Save(setting); }
private static string SetQuantityFormat(AppSettings allowDecimal) { bool allow = false; if (allowDecimal != null && bool.TryParse(allowDecimal.Value, out allow) && allow) { return @"^(?=.*[0-9])(\d{0,10})?(?:\.\d{0,2})?$"; } else { return @"^(?=.*[0-9])(\d{0,10})$"; } }
public SettingsViewModel Map(AppSettings s) { var Keys = from Enum e in Enum.GetValues(typeof(SettingsKeys)) select new { Key = e, Value = e.ToString() }; var settingViewModel= new SettingsViewModel { SettingKey = (int) s.Key, Value = s.Value, Id = s.Id, IsActive = s._Status == EntityStatus.Active ? true : false, }; //settingViewModel.KeyList = new SelectList(Keys, "key", "Value"); return settingViewModel; }
/// <summary> /// Dependency-injected application settings which are then passed on to other components. /// </summary> public TransitApiController() { if (bool.Parse(ConfigurationManager.AppSettings["UseAzureStorage"])) { var appSettings = new AppSettings(ConfigurationManager.AppSettings); _repository = new AzureTransitRepository(appSettings); } else { var filePath = HostingEnvironment.MapPath("~"); _repository = new MemoryTransitRepository(filePath); } _client = new TransitClient(); _getCurrentTime = () => TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTimeOffset.Now, "Pacific Standard Time"); }
public void SetDeleted(Guid id) { AppSettings appSettings = new AppSettings(id); _settingsRepository.SetAsDeleted(appSettings); }
public void SetActive(Guid id) { AppSettings appSettings = new AppSettings(id); _settingsRepository.SetActive(appSettings); }
public ActionResult NewReportRound(TeamReportRound round) { if (ModelState.IsValid) { if (round.StartTime >= round.EndTime || round.EndTime <= DateTime.Now) { TempData["Alert"] = "请检查时间输入是否有误!"; return View(round); } var appSettings = new AppSettings(); appSettings.ReportRoundName = round.Name; appSettings.ReportStartTime = round.StartTime; appSettings.ReportEndTime = round.EndTime; foreach (var team in db.Teams) { team.ReportUpdated = false; } db.SaveChanges(); TempData["Alert"] = string.Format("新建场次【{0}】成功,允许上传时间为{1}-{2}!", round.Name, round.StartTime, round.EndTime); return RedirectToAction("Reports"); } return View(round); }