public Institution AddNewInstitution() { int i = 0; string newNameRef = "New Institution"; string newName = newNameRef; while (InstitutionsDictionary.ContainsKey(newName)) { i++; newName = $"{newNameRef} - {i}"; } AddInstitution(newName); Institution newInstit = GetInstitution(newName); newInstit.AddAccount("New Account"); newInstit.ModifyAmountEventHandler += this.UpdateTotalAmount; return(newInstit); }
public bool ChangeName(string before, string after, NodeAddress nodeTag) { bool test = false; if (nodeTag.NodeType == NodeType.Institution) { if (InstitutionsDictionary.ContainsKey(before) && !InstitutionsDictionary.ContainsKey(after)) { Institution instit_before = GetInstitution(before); instit_before.InstitutionName = after; test = true; } } else { test = GetInstitution(nodeTag.Address[1]).ChangeName(before, after, nodeTag); } return(test); }