예제 #1
0
        private void WasteSubmit_Click(object sender, RoutedEventArgs e)
        {
            if (AmountTextBox.Text != "")
            {
                if (CategoriesCombobox.SelectedIndex > -1)
                {
                    int Amount = Convert.ToInt32(AmountTextBox.Text);
                    Amount *= -1;

                    string        category = CategoriesCombobox.SelectedValue.ToString();
                    string        desc     = DescriptionVar.Text.ToString();
                    Classes.Posts post     = new Classes.Posts();

                    bool result = post.AddNewPost(Amount, category, "no", desc, user.email, user.userId);
                    if (result)
                    {
                        UpdateBalance(Amount);
                        var info = new Info();
                        MaterialDesignThemes.Wpf.DialogHost.Show(info);
                    }
                    else
                    {
                        MessageBox.Show("An error occured.");
                    }
                }
            }
        }
예제 #2
0
        private void ProfitSubmit_Click(object sender, RoutedEventArgs e)
        {
            if (AmountTextBox.Text != "")
            {
                int           Amount = Convert.ToInt32(AmountTextBox.Text);
                string        desc   = DescriptionVar.Text.ToString();
                Classes.Posts post   = new Classes.Posts();

                bool result = post.AddNewPost(Amount, "profit", "yes", desc, user.email, user.userId);
                if (result)
                {
                    UpdateBalance(Amount);
                    var info = new Info();
                    MaterialDesignThemes.Wpf.DialogHost.Show(info);
                }
                else
                {
                    MessageBox.Show("An error occured.");
                }
            }
        }