/// <summary> /// Retrieves the arma profile. /// </summary> /// <param name="profile">The profile.</param> private void RetrieveArmaProfile(Profile profile) { profile.ArmaProfile = _armaProfileDao.Get(profile); if (profile.ArmaProfile == null) { profile.ArmaProfile = new ArmaProfile(); _armaProfileDao.Save(profile); } }
/// <summary> /// Retrieves the basic configuration. /// </summary> /// <param name="profile">The profile.</param> private void RetrieveBasicConfig(Profile profile) { profile.BasicConfig = _basicDao.Get(profile); if (profile.BasicConfig == null) { profile.BasicConfig = new BasicConfig(); _basicDao.Save(profile); } }
/// <summary> /// Retrieves the server configuration. /// </summary> /// <param name="profile">The profile.</param> private void RetrieveServerConfig(Profile profile) { profile.ServerConfig = _serverDao.Get(profile); if (profile.ServerConfig == null) { profile.ServerConfig = new ServerConfig(); _serverDao.Save(profile); } }
public ConfigItem Save(string curItemId, ConfigItem item, NodeVisit visit) { ValidateByRole(visit, SystemRoleType.Admin); ParsingHelper.ValidateKey(item.Id); if (!item.IsEditable) { throw new InvalidOperationException("The item cannot be saved since it is not editable."); } ConfigItem saveItem = new ConfigItem(item); saveItem.ModifiedById = visit.Account.Id; saveItem.Value = _cryptographyProvider.Encrypt(item.Value); lock (_lockObject) { TransactionTemplate.Execute(delegate { _configDao.Save(curItemId, saveItem); lock (_lockObject) { if (!string.IsNullOrEmpty(curItemId)) { if (_configItems.ContainsKey(curItemId.ToUpper())) { _configItems.Remove(curItemId.ToUpper()); } } _configItems[item.Id.ToUpper()] = item; } ActivityManager.LogAudit(NodeMethod.None, null, visit, "{0} updated configuration value: {1}.", visit.Account.NaasAccount, saveItem.ToString()); return(null); }); item.ModifiedById = saveItem.ModifiedById; item.ModifiedOn = saveItem.ModifiedOn; } return(item); }
public void SaveConfig(config config) { dao.Save(config); }