public Status UpdateAppConfigSettingInfo(AppConfigSetting appConfigSetting) { try { var appConfig = _repository.Update(appConfigSetting); _uoWork.SaveChanges(); _status.ReturnedId = appConfig.AppConfigSettingId; _status.IsSuccessful = appConfig.AppConfigSettingId > 0; return(_status); } catch (DbEntityValidationException ex) { ErrorManager.LogApplicationError((ex).StackTrace, (ex).Source, (ex).Message); _status.Message.FriendlyMessage = "Process Failed! Unable update settings "; _status.Message.TechnicalMessage = "Error: " + (ex).Message; _status.Message.MessageCode = "101"; _status.Message.MessageId = 1; return(_status); } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); _status.Message.FriendlyMessage = "Process Failed! Unable update settings "; _status.Message.TechnicalMessage = "Error: " + ex.Message; _status.Message.MessageCode = "101"; _status.Message.MessageId = 1; return(_status); } }
public static ChannelSettings ChannelSettings(this ChannelInfo channelInfo) { var appConfigSettings = new Dictionary <string, AppConfigSetting>(); foreach (ChannelInfoProperty channelProp in channelInfo.Properties.Values) { AppConfigSetting appConfigSetting = channelProp.ToAppConfigSetting(); appConfigSettings.Add(appConfigSetting.Name, appConfigSetting); } return(new ChannelSettings(appConfigSettings)); }
public static void Init() { Debugger.Log("AppConfig", "Init() Path = " + Path); setting = JsonUtils.LoadJsonFromFile <AppConfigSetting>(Path); if (setting == null) { setting = new AppConfigSetting(); setting.EnableMusic = true; setting.BgmVolume = 1; setting.EnableSoundEffect = true; } }
public Status UpdateAppConfigSettingInfo(AppConfigSetting appConfigSetting) { try { return(_appConfigSettingRepository.UpdateAppConfigSettingInfo(appConfigSetting)); } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); _status.Message.FriendlyMessage = "Process Failed! Unable update settings "; _status.Message.TechnicalMessage = "Error: " + ex.Message; _status.Message.MessageCode = "101"; _status.Message.MessageId = 1; return(_status); } }
public static void CopyTo(this AppConfigSetting src, AppConfigSetting dest) { #region Validate parameters if (src == null) { throw new ArgumentNullException(nameof(src)); } if (dest == null) { throw new ArgumentNullException(nameof(dest)); } #endregion mapper.Map <AppConfigSetting, AppConfigSetting>(src, dest); }
private void ProcessAppSettings(BioEnumeratorEntities context) { try { if (!context.AppConfigSettings.Any()) { var appSetting = new AppConfigSetting { FirstTimeLaunch = true }; context.AppConfigSettings.AddOrUpdate(m => m.AppConfigSettingId, appSetting); context.SaveChanges(); } } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); } }
/// <summary> /// /// </summary> /// <param name="stream"></param> public override void Load(Stream stream) { var xmldoc = new XmlDocument(); xmldoc.Load(stream); XmlNodeList nodes = xmldoc.SelectNodes("configuration/connectionStrings/add"); foreach (XmlNode node in nodes) { string name = node.Attributes["name"].Value; string provider = node.Attributes["providerName"].Value; string connString = node.Attributes["connectionString"].Value; var setting = new ConnectionStringSetting(name, connString) { Provider = provider }; _connSettings.Add(setting.Name, setting); } nodes = xmldoc.SelectNodes("configuration/appSettings/add"); foreach (XmlNode node in nodes) { string key = node.Attributes["key"].Value; string value = node.Attributes["value"].Value; string type = node.Attributes["type"]?.Value; string format = node.Attributes["format"]?.Value; string defaultValue = node.Attributes["default"]?.Value; string comment = node.Attributes["comment"]?.Value; bool readOnly = Parser.ParseBool(node.Attributes["readonly"]?.Value, false); bool secret = Parser.ParseBool(node.Attributes["secret"]?.Value, false); var setting = new AppConfigSetting(key, value) { Type = type, Format = format, DefaultValue = defaultValue, Comment = comment, ReadOnly = readOnly, Secret = secret }; _appSettings.Add(setting.Name, setting); //this.Data.Add(key, value); } }
/// <summary> /// /// </summary> /// <param name="_appSettings"></param> public ChannelDescription(IDictionary <string, AppConfigSetting> appSettings) { string prefix = "."; _addinSettings = new Dictionary <string, AppConfigSetting>(appSettings.Where(p => p.Key.StartsWith(prefix))); _properties = new List <ChannelDescriptionProperty>(); foreach (string key in appSettings.Keys.Where(k => !k.StartsWith(prefix))) { AppConfigSetting setting = appSettings[key]; var descProp = new ChannelDescriptionProperty() { Comment = setting.Comment, Format = setting.Format, Default = setting.Default, Name = setting.Name, ReadOnly = setting.ReadOnly, Secret = setting.Secret, Type = setting.Type, Value = setting.Value }; _properties.Add(descProp); } }
//public static AppConfigSetting ToAppConfigSetting(this MicroserviceDescriptionProperty descriptionProperty) //{ // return mapper.Map<MicroserviceDescriptionProperty, AppConfigSetting>(descriptionProperty); //} public static MicroserviceDescriptionProperty ToMicroserviceDescriptionProperty(this AppConfigSetting appConfigSetting) { if (appConfigSetting == null) { throw new ArgumentNullException(nameof(appConfigSetting)); } return(mapper.Map <AppConfigSetting, MicroserviceDescriptionProperty>(appConfigSetting)); }
public static ChannelInfoProperty ToChannelInfoProperty(this AppConfigSetting appSetting) { return(mapper.Map <AppConfigSetting, ChannelInfoProperty>(appSetting)); }