public IEnumerable <DistributionKey> GetBudgetsDistributionKeys(string budgetId) { if (HasLoaded == false) { throw new Exception("Not loaded"); } List <DistributionKey> DistributionKeys; if (_keys.TryGetValue(budgetId.ToString(), out DistributionKeys) == false) { _keys[budgetId] = DistributionKeys = new List <DistributionKey>(); } return(DistributionKeys.OrderBy(d => d.Name)); }
void UpdateDistributionKey(string budget, string id, string name, string description) { if (string.IsNullOrWhiteSpace(name)) { return; } List <DistributionKey> DistributionKeys; if (_keys.TryGetValue(budget, out DistributionKeys) == false) { _keys[budget] = DistributionKeys = new List <DistributionKey>(); } var DistributionKey = DistributionKeys.Single(s => s.Id == id); DistributionKey.Name = name; DistributionKey.Description = description; }
void AddDistributionKey(string budget, string id, string name, string description) { if (string.IsNullOrWhiteSpace(name)) { return; } List <DistributionKey> DistributionKeys; if (_keys.TryGetValue(budget, out DistributionKeys) == false) { _keys[budget] = DistributionKeys = new List <DistributionKey>(); } if (DistributionKeys.Any(c => c.Id == id) == false) { DistributionKeys.Add(new DistributionKey { Id = id, Name = name, Description = description }); } }