Exemplo n.º 1
0
        /// <summary>
        /// Метод подсчета бюджета
        /// </summary>
        public void CalculateBudget()
        {
            double AllIncome  = 0;
            double AllExpense = 0;
            double AllGoal    = 0;

            for (int i = 0; i < personalBudget.Incomes.Count; i++)
            {
                AllIncome += Convert.ToDouble(personalBudget.Incomes[i].SumIncome);
            }

            for (int i = 0; i < personalBudget.Expenses.Count; i++)
            {
                AllExpense += Convert.ToDouble(personalBudget.Expenses[i].SumExpense);
            }

            for (int i = 0; i < personalBudget.Goals.Count; i++)
            {
                AllGoal += Convert.ToDouble(personalBudget.Goals[i].SumAlredy);
            }

            personalBudget.PersonalCash.Sum     = (AllIncome - AllExpense - AllGoal).ToString();
            personalBudget.PersonalCash.ValueID = "RUB";

            BudgetShowL.Content = personalBudget.PersonalCash.Sum;
            ValueForm value_form = new ValueForm(this);

            ValueShowL.Content = value_form.ValueGet(personalBudget.PersonalCash.ValueID);
            value_form.Close();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Нажатие на кнопку "Сменить валюту"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BudgetBTN_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();
            ValueForm winV = new ValueForm(this);

            winV.Closed += Window_Closed;
            winV.Show();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Конструктор главного окна
        /// </summary>
        /// <param name="user">Данные о пользователе</param>
        public MainWindow(Dictionary <string, string> user)
        {
            Username       = user.Last().Key;
            Pass           = user.Last().Value;
            Report         = "";
            personalBudget = new PersonalBudget();

            InitializeComponent();

            UsernameL.Header    = "Пользователь: " + Username;
            BudgetShowL.Content = Math.Round(Convert.ToDouble(personalBudget.PersonalCash.Sum), 2).ToString();

            ValueForm value_form = new ValueForm(this);

            ValueShowL.Content = value_form.ValueGet(personalBudget.PersonalCash.ValueID);
            value_form.Close();

            UpdateBillCB();
            BillInCB.SelectedIndex  = 0;
            BillOutCB.SelectedIndex = 0;

            UpdateInCB();
            CategoryInCB.SelectedIndex = 0;

            UpdateOutCB();
            CategoryOutCB.SelectedIndex = 0;

            INdataGrid.ItemsSource = personalBudget.Incomes;
            EXdataGrid.ItemsSource = personalBudget.Expenses;
            TAdataGrid.ItemsSource = personalBudget.Goals;

            LoadUserInfo();

            INdataGrid.Items.Refresh();
            EXdataGrid.Items.Refresh();
            TAdataGrid.Items.Refresh();
        }