private void detach_Lancamento(Lancamento entity)
		{
			this.SendPropertyChanging();
			entity.Conta = null;
		}
		private void detach_Lancamento(Lancamento entity)
		{
			this.SendPropertyChanging();
			entity.FormaPagamento = null;
		}
		private void attach_Lancamento(Lancamento entity)
		{
			this.SendPropertyChanging();
			entity.Conta = this;
		}
 partial void DeleteLancamento(Lancamento instance);
 partial void UpdateLancamento(Lancamento instance);
 partial void InsertLancamento(Lancamento instance);
Example #7
0
        private void buttonLancar_Click(object sender, EventArgs e)
        {
            Lancamento lancamento = new Lancamento();

            try
            {
                lancamento.dataLancamento = dateTimePicker_A2_DataLancamento.Value;
                lancamento.valor = decimal.Parse(textBox_A2_Valor.Text);
                lancamento.descricao = textBox_A2_Descricao.Text;
                lancamento.idCategoria = Convert.ToInt32(comboBox_A2_Categoria.SelectedValue);

                if (button_A2_Despesa.Enabled)
                {
                    lancamento.tipo = "Receita";
                }
                else if (button_A2_Receita.Enabled)
                {
                    lancamento.tipo = "Despesa";
                    lancamento.idFormaPagamento = Convert.ToInt32(comboBox_A2_FormaPaga.SelectedValue);
                }
                if (dateTimePicker_A2_DataLancamento.Value > DateTime.Now)
                {
                    lancamento.multa = int.Parse(textBox_A2_Multa.Text);
                    lancamento.jurosPorDia = int.Parse(textBox_A2_JurosDia.Text);

                    if (comboBox_A2_Conta.SelectedItem != null)
                    {
                        lancamento.idConta = Convert.ToInt32(comboBox_A2_Conta.SelectedValue);
                    }
                }
                else
                {
                    lancamento.idConta = Convert.ToInt32(comboBox_A2_Conta.SelectedValue);
                    lancamento.status = true;
                }

                //if (idLancamento > -1)
                //{
                //    lancamento.id = idLancamento;
                //    LancamentoController.update(lancamento);
                //    button_A2_DesfazerEdicao.Visible = false;
                //    MessageBox.Show("Lançamento atualizado com sucesso!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //}
                //else
                //{
                    LancamentoController.add(lancamento);
                    MessageBox.Show("Lançamento criado com sucesso!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //}
                AtualizarListaLancamentos();
                limparCampos();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Um dos campos obrigatório foi deixado em branco ou está em um formato inválido!" + ex, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }