Beispiel #1
0
        private void MainIncFormButton_Click(object sender, RoutedEventArgs e)
        {
            CheckIsANumInc();

            ExpDesc newAction = new ExpDesc();

            newAction.typeOfAction      = "Inc";
            newAction.note              = noteFormFieldInc.Text;
            newAction.countOfAction     = Convert.ToDouble(IncFormField.Text);
            newAction.actionStringCount = newAction.getAStringInc();

            int temp = -1;

            for (int i = 0; i < radioBtnInc.Length; i++)
            {
                if (radioBtnInc[i] == true)
                {
                    temp = i;
                    break;
                }
            }

            switch (temp)
            {
            case 0:
                AllInc.salary += Convert.ToDouble(IncFormField.Text);
                break;

            case 1:
                AllInc.freelance += Convert.ToDouble(IncFormField.Text);
                break;

            case 2:
                AllInc.sell += Convert.ToDouble(IncFormField.Text);
                break;

            case 3:
                AllInc.rent += Convert.ToDouble(IncFormField.Text);
                break;

            default:
                MessageBox.Show("Выберите категорию траты");
                break;
            }

            addingNewAction();
            LastActions[LastActions.Length - 1] = newAction;

            AddIncWindow.Visibility = Visibility.Hidden;
            AllInc.showIncOnMain(SalaryIncLabel, FreelanceIncLabel, SellIncLabel, RentIncLabel,
                                 allExpValueIncomes, allIncValue);
        }
Beispiel #2
0
        private void MainFormButton_Click(object sender, RoutedEventArgs e)
        {
            CheckIsANum();

            ExpDesc newAction = new ExpDesc();

            newAction.typeOfAction      = "Exp";
            newAction.note              = noteFormField.Text;
            newAction.countOfAction     = Convert.ToDouble(expFormField.Text);
            newAction.actionStringCount = newAction.getAString();

            int temp = -1;

            for (int i = 0; i < radioBtn.Length; i++)
            {
                if (radioBtn[i] == true)
                {
                    temp = i;
                    break;
                }
            }

            switch (temp)
            {
            case 0:
                AllExp.car += Convert.ToDouble(expFormField.Text);
                break;

            case 1:
                AllExp.house += Convert.ToDouble(expFormField.Text);
                break;

            case 2:
                AllExp.sport += Convert.ToDouble(expFormField.Text);
                break;

            case 3:
                AllExp.eat += Convert.ToDouble(expFormField.Text);
                break;

            case 4:
                AllExp.buy += Convert.ToDouble(expFormField.Text);
                break;

            case 5:
                AllExp.health += Convert.ToDouble(expFormField.Text);
                break;

            case 6:
                AllExp.restaurant += Convert.ToDouble(expFormField.Text);
                break;

            case 7:
                AllExp.hobbies += Convert.ToDouble(expFormField.Text);
                break;

            default:
                MessageBox.Show("Выберите категорию траты");
                break;
            }

            addingNewAction();
            LastActions[LastActions.Length - 1] = newAction;

            AddExpWindow.Visibility = Visibility.Hidden;
            AllExp.showExpsOnMain(CarExpLabel, HouseExpLabel, sportExpLabel, EatExpLabel,
                                  RestaurantExpLabel, HobbiesExpLabel, BuyExpLabel, HealthExpLabel, allExpValue,
                                  allExpValueIncExp);
        }
Beispiel #3
0
        public void showActions()
        {
            if (LastActions[LastActions.Length - 1] == null)
            {
                Action1.Visibility = Visibility.Hidden;
            }
            else
            {
                ExpDesc newAction = new ExpDesc();
                try
                {
                    newAction = (ExpDesc)LastActions[LastActions.Length - 1];
                } catch
                {
                    newAction = JsonConvert.DeserializeObject <ExpDesc>(LastActions[LastActions.Length - 1].ToString());
                }

                NoteOfAction1.Content  = newAction.note;
                DateOfAction1.Content  = newAction.getAStringDate();
                ValueOfAction1.Content = newAction.actionStringCount;
                if (newAction.typeOfAction == "Inc")
                {
                    ValueOfAction1.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#6EA8BC"));
                }
                else
                {
                    ValueOfAction1.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#DB71BD"));
                }

                Action1.Visibility = Visibility.Visible;
            }

            if (LastActions[5] == null)
            {
                Action2.Visibility = Visibility.Hidden;
            }
            else
            {
                ExpDesc newAction = new ExpDesc();
                try
                {
                    newAction = (ExpDesc)LastActions[5];
                }
                catch
                {
                    newAction = JsonConvert.DeserializeObject <ExpDesc>(LastActions[5].ToString());
                }

                NoteOfAction2.Content  = newAction.note;
                DateOfAction2.Content  = newAction.getAStringDate();
                ValueOfAction2.Content = newAction.actionStringCount;
                if (newAction.typeOfAction == "Inc")
                {
                    ValueOfAction2.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#6EA8BC"));
                }
                else
                {
                    ValueOfAction2.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#DB71BD"));
                }

                Action2.Visibility = Visibility.Visible;
            }

            if (LastActions[4] == null)
            {
                Action3.Visibility = Visibility.Hidden;
            }
            else
            {
                ExpDesc newAction = new ExpDesc();
                try
                {
                    newAction = (ExpDesc)LastActions[4];
                }
                catch
                {
                    newAction = JsonConvert.DeserializeObject <ExpDesc>(LastActions[4].ToString());
                }

                NoteOfAction3.Content  = newAction.note;
                DateOfAction3.Content  = newAction.getAStringDate();
                ValueOfAction3.Content = newAction.actionStringCount;
                if (newAction.typeOfAction == "Inc")
                {
                    ValueOfAction3.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#6EA8BC"));
                }
                else
                {
                    ValueOfAction3.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#DB71BD"));
                }

                Action3.Visibility = Visibility.Visible;
            }

            if (LastActions[3] == null)
            {
                Action4.Visibility = Visibility.Hidden;
            }
            else
            {
                ExpDesc newAction = new ExpDesc();
                try
                {
                    newAction = (ExpDesc)LastActions[3];
                }
                catch
                {
                    newAction = JsonConvert.DeserializeObject <ExpDesc>(LastActions[3].ToString());
                }

                NoteOfAction4.Content  = newAction.note;
                DateOfAction4.Content  = newAction.getAStringDate();
                ValueOfAction4.Content = newAction.actionStringCount;
                if (newAction.typeOfAction == "Inc")
                {
                    ValueOfAction4.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#6EA8BC"));
                }
                else
                {
                    ValueOfAction4.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#DB71BD"));
                }

                Action4.Visibility = Visibility.Visible;
            }

            if (LastActions[2] == null)
            {
                Action5.Visibility = Visibility.Hidden;
            }
            else
            {
                ExpDesc newAction = new ExpDesc();
                try
                {
                    newAction = (ExpDesc)LastActions[2];
                }
                catch
                {
                    newAction = JsonConvert.DeserializeObject <ExpDesc>(LastActions[2].ToString());
                }

                NoteOfAction5.Content  = newAction.note;
                DateOfAction5.Content  = newAction.getAStringDate();
                ValueOfAction5.Content = newAction.actionStringCount;
                if (newAction.typeOfAction == "Inc")
                {
                    ValueOfAction5.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#6EA8BC"));
                }
                else
                {
                    ValueOfAction5.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#DB71BD"));
                }

                Action5.Visibility = Visibility.Visible;
            }

            if (LastActions[1] == null)
            {
                Action6.Visibility = Visibility.Hidden;
            }
            else
            {
                ExpDesc newAction = new ExpDesc();
                try
                {
                    newAction = (ExpDesc)LastActions[1];
                }
                catch
                {
                    newAction = JsonConvert.DeserializeObject <ExpDesc>(LastActions[1].ToString());
                }

                NoteOfAction6.Content  = newAction.note;
                DateOfAction6.Content  = newAction.getAStringDate();
                ValueOfAction6.Content = newAction.actionStringCount;
                if (newAction.typeOfAction == "Inc")
                {
                    ValueOfAction6.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#6EA8BC"));
                }
                else
                {
                    ValueOfAction6.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#DB71BD"));
                }

                Action6.Visibility = Visibility.Visible;
            }

            if (LastActions[0] == null)
            {
                Action7.Visibility = Visibility.Hidden;
            }
            else
            {
                ExpDesc newAction = new ExpDesc();
                try
                {
                    newAction = (ExpDesc)LastActions[0];
                }
                catch
                {
                    newAction = JsonConvert.DeserializeObject <ExpDesc>(LastActions[0].ToString());
                }

                NoteOfAction7.Content  = newAction.note;
                DateOfAction7.Content  = newAction.getAStringDate();
                ValueOfAction7.Content = newAction.actionStringCount;
                if (newAction.typeOfAction == "Inc")
                {
                    ValueOfAction7.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#6EA8BC"));
                }
                else
                {
                    ValueOfAction7.Foreground = new System.Windows.Media.SolidColorBrush((Color)ColorConverter.ConvertFromString("#DB71BD"));
                }

                Action7.Visibility = Visibility.Visible;
            }
        }