public Recurring GetHabit() { double money_saved_2 = 0.0; double.TryParse(moneySaved.Text, out money_saved_2); double money_saved_1 = 0.0; double.TryParse(moneySaved2.Text, out money_saved_1); double how_common_1 = child_form.how_common_1(); double how_common_2 = child_form.how_common_2(); string frequency_1 = child_form.frequency_1(); string frequency_2 = child_form.frequency_2(); double savings = new utils_data.FrequencyTranslator().get_savings( money_saved_1, frequency_1, how_common_1, money_saved_2, frequency_2, how_common_2 ); Recurring Habit_; DateTime date_ended = child_form.end_date(); if (habit_ != null) { habit_.Name = nameEntry.Text; habit_.date_started = child_form.get_start_date(); habit_.money_saved = savings; habit_.date_ended = child_form.get_end_date(); habit_.how_common = child_form.how_common_1(); habit_.frequency = child_form.frequency_1(); habit_.Type = child_form.type(); habit_.frequency_2 = child_form.frequency_2(); habit_.how_common_2 = child_form.how_common_2(); habit_.money_saved_1 = money_saved_1; habit_.money_saved_2 = money_saved_2; Habit_ = habit_; } else { Habit_ = new Recurring { Name = nameEntry.Text, date_started = child_form.get_start_date(), money_saved = savings, date_ended = child_form.get_end_date(), how_common = child_form.how_common_1(), frequency = child_form.frequency_1(), Type = child_form.type(), frequency_2 = child_form.frequency_2(), how_common_2 = child_form.how_common_2(), money_saved_1 = money_saved_1, money_saved_2 = money_saved_2, }; Habit_.stash_to_use = App.Database.GetStashesID(stash_id); } return(Habit_); }
public void set_helper() { double money_saved_2 = 0.0; double.TryParse(moneySaved.Text, out money_saved_2); double money_saved_1 = 0.0; double.TryParse(moneySaved2.Text, out money_saved_1); double how_common_1 = child_form.how_common_1(); double how_common_2 = child_form.how_common_2(); string str1 = child_form.frequency_1(); string str2 = child_form.frequency_2(); if (str1 == "One Time") { Calculator.IsVisible = false; return; } Calculator.IsVisible = true; if (str2 == "Default") { str2 = str1; } if (str1 != "Default") { Better_Choices_1.utils_data.FrequencyTranslator freq = new utils_data.FrequencyTranslator(); string helper_str = freq.helper_string( money_saved_1, str1, how_common_1, money_saved_2, str2, how_common_2 ); Calculator.Text = helper_str; } else { Calculator.Text = "Periodic Savings will be calculated with more data"; } }