Exemple #1
0
        private void ButtonSalvarGanho_Click(object sender, RoutedEventArgs e)
        {
            string categoria = SelectCombo(ComboBoxGanho);
            string dataHoje  = $"{c.ToString("yyyy")}-{c.ToString("MM")}-{c.ToString("dd")}";

            if (textoboxvalorGanho.Text == "")
            {
                textoboxvalorGanho.Text = "0";
            }
            try
            {
                double  formatar    = double.Parse(textoboxvalorGanho.Text);
                Receita ganhoCriado = new Receita(formatar, categoria, dataHoje, descricaoDespesa.Text);
                bool    commit      = ganhoCriado.AdicionarGanho(carteiraLogada.id);
                if (commit == false)
                {
                    MessageBox.Show($"Erro ao adicionar Ganho", "Adicionar Ganho");
                    Zerar();
                }
                else
                {
                    MessageBox.Show("Renda Adicionada Com Sucesso", "Adicionar Ganho");
                    Zerar();
                }
            }
            catch
            {
                MessageBox.Show("Erro ao adicinar Ganho", "ERROR");
            }
        }