Ejemplo 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();
        }
Ejemplo n.º 2
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();
        }