/// <summary> /// Adds input from form to DebtDictionary and resets form. /// </summary> /// <param name="newDebtName"></param> /// <param name="newDebtAmt"></param> /// <param name="newDebtMinPymnt"></param> private void AddNewDebt(string newDebtName, double newDebtAmt, double newDebtMinPymnt) { var OtherNewDebt = new Debt(newDebtName, newDebtAmt, newDebtMinPymnt); NewDebtDict.Add(newDebtAmt, OtherNewDebt); ResetForm(); }
/// <summary> /// Adds input from form to DebtDictionary, resets form, and Hide extra for debt textbox/label. /// </summary> /// <param name="newDebtName"></param> /// <param name="newDebtAmt"></param> /// <param name="newDebtMinPymnt"></param> private void InitializeFirstDebt(string newDebtName, double newDebtAmt, double newDebtMinPymnt) { var NewDebt = new Debt(newDebtName, newDebtAmt, newDebtMinPymnt); NewDebtDict = new DebtDictionary((double.Parse(ExtraForDebtTextBox.Text))); NewDebtDict.Add(newDebtAmt, NewDebt); ResetForm(); HideExtraForDebt(); }
/// <summary> /// Function to add inputs from form to the Dicttionary by checking for an already existing key and adding to the List if a duplicate Key. /// </summary> /// <param name="debtAmount"></param> /// <param name="newDebt"></param> public void Add(double debtAmount, Debt newDebt) { if (_internalDebtDictionary.ContainsKey(debtAmount)) { List <Debt> list = _internalDebtDictionary[debtAmount]; if (list.Contains(newDebt) == false) { list.Add(newDebt); } } else { List <Debt> list = new List <Debt> { newDebt }; _internalDebtDictionary.Add(debtAmount, list); } }