public JsonResult GetConfigs() { using (var userConfig = new RFConfigActivity(Context, Username)) { return(Json(userConfig.GetConfigs().Select(c => new { Section = c.Section, Item = c.Item, Key = c.Key, UserConfigKeyID = c.UserConfigKeyID, UserConfigValueID = c.UserConfigValueID, Description = c.Description, Environment = c.Environment, Value = c.Value, Version = c.Version, UpdateTime = c.UpdateTime, UpdateUser = c.UpdateUser }))); } }
public JsonResult UpdateConfig(FormCollection collection) { try { if (collection.GetValue("UserConfigKeyID") != null) { using (var configActivity = new RFConfigActivity(Context, Username)) { var userConfigKeyID = Int32.Parse(collection["UserConfigKeyID"]); string environment = collection["Environment"]; string value = collection["Value"]; string section = collection["Section"]; string item = collection["Item"]; string key = collection["Key"]; var path = string.Format("{0}/{1}/{2}", section, item, key); var update = configActivity.UpdateValue(userConfigKeyID, environment, value, Username, path); if (update && section == RFSchedulerTaskDefinition.CONFIG_SECTION) { // force reload scheduler config using (var rfService = new RFServiceClient()) { rfService.RFService.ServiceCommand(RFSchedulerService.SERVICE_NAME, RFSchedulerService.RELOAD_COMMAND, null); } } return(Json(update)); } } } catch (Exception ex) { return(Json(JsonError.Throw("UpdateConfig", ex))); } return(Json(JsonError.Throw("UpdateConfig", "Internal system error."))); }