public IActionResult Despesa(double valor, int idSelecionado, DateTime data, string descricao, string saveBtn, string saveBtn2)
        {
            DespesaBLL bll     = new DespesaBLL();
            Despesa    despesa = new Despesa();

            if (saveBtn2 == "Deletar")
            {
                despesa.idDespesa  = idSelecionado;
                ViewData["result"] = bll.Delete(despesa);
                return(View());
            }
            if (idSelecionado != 0)
            {
                despesa.idDespesa = idSelecionado;
                despesa.Data      = data;
                despesa.Valor     = valor;
                despesa.Descricao = descricao;

                ViewData["result"] = bll.Update(despesa);
                return(View());
            }


            if (saveBtn == "Salvar")
            {
                despesa.Data       = data;
                despesa.Valor      = valor;
                despesa.Descricao  = descricao;
                ViewData["result"] = bll.Insert(despesa);
                return(View());
            }
            return(View());
        }
Пример #2
0
        public string ExcluirDespesa(int codigo)
        {
            DespesaBLL desBLL = new DespesaBLL();

            MLL.Despesa despesa = desBLL.ObterPorId(codigo);

            return(desBLL.ExcluirDespesa(despesa));
        }
Пример #3
0
        public string CarregarDespesa(int codDespesa)
        {
            DespesaBLL desBLL = new DespesaBLL();

            ViewBag.StatusDespesa = desBLL.ObterStatusDespesa().ToString();
            ViewBag.listaFormaPag = desBLL.ObterFormaPag().ToString();

            return(desBLL.CarregarDespesa(codDespesa).ToString());
        }
Пример #4
0
        public string DespesasCadastradas(int codVigencia, int codUser)
        {
            DespesaBLL desBLL = new DespesaBLL();

            ViewBag.StatusDespesa = desBLL.ObterStatusDespesa().ToString();
            ViewBag.listaFormaPag = desBLL.ObterFormaPag().ToString();

            return(desBLL.DespesasCadastradas(codVigencia, codUser).ToString());
        }
        public ActionResult EditarVigencia()
        {
            VigenciaBLL vigBLL = new VigenciaBLL();

            MLL.Vigencia vigencia = vigBLL.ObterPorId(Convert.ToInt32(Request.QueryString["codigo"]));

            DespesaBLL desBLL = new DespesaBLL();

            ViewBag.StatusDespesa = desBLL.ObterStatusDespesa().ToString();
            ViewBag.listaFormaPag = desBLL.ObterFormaPag().ToString();

            return(View(vigencia));
        }
        private void BtnSalvarDespesa_Click(object sender, EventArgs e)
        {
            try
            {
                DespesaBLL bll = new DespesaBLL();

                if (this.dto == null)//cadastrar
                {
                    DespesaDTO dto = new DespesaDTO();
                    dto.Descricao        = txtDescricaoDespesa.Text;
                    dto.Valor            = mskValor.Text;
                    dto.CategoriaDespesa = (int)cboCategoriaDespesa.SelectedValue;
                    dto.Conta            = (int)cboConta.SelectedValue;
                    dto.DataVencimanto   = Convert.ToDateTime(mskVencimento.Text);
                    dto.Observacao       = txtObservacaoDespesa.Text;

                    if (txtDescricaoDespesa.Text == "" || mskValor.Text == "" || (int)cboCategoriaDespesa.SelectedValue <= 0 || mskVencimento.Text == "")
                    {
                        MessageBox.Show("Não é possivel salvar essa despesa, pois campos obrigatorios não foram preencido\n\nPreencha os campos com *.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    else
                    {
                        bll.Inserir(dto);
                        MessageBox.Show("Despesa cadastrada com sucesso! ", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LimparCampos();
                        txtDescricaoDespesa.Focus();
                    }
                }
                else//alterar
                {
                    this.dto.Descricao        = txtDescricaoDespesa.Text;
                    this.dto.Valor            = mskValor.Text;
                    this.dto.CategoriaDespesa = (int)cboCategoriaDespesa.SelectedValue;
                    this.dto.Conta            = (int)cboConta.SelectedValue;
                    this.dto.DataVencimanto   = Convert.ToDateTime(mskVencimento.Text);
                    this.dto.Observacao       = txtObservacaoDespesa.Text;
                    bll.Atualizar(this.dto);
                    LimparCampos();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Preencha os campos necessário.{ex.Message}", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                LimparCampos();
            }
        }
Пример #7
0
 // GET DATA
 //------------------------------------------------------------------------------------------------------------
 private void ObterDados(object sender, EventArgs e)
 {
     try
     {
         // --- Ampulheta ON
         Cursor.Current = Cursors.WaitCursor;
         DespesaBLL dBLL = new DespesaBLL();
         listTitular = dBLL.GetTitularList(true);
         PreencheListagem();
     }
     catch (Exception ex)
     {
         AbrirDialog("Uma exceção ocorreu ao Obter os Dados da listagem..." + "\n" +
                     ex.Message, "Exceção", DialogType.OK, DialogIcon.Exclamation);
     }
     finally
     {
         // --- Ampulheta OFF
         Cursor.Current = Cursors.Default;
     }
 }
        public IActionResult Finances(int idSelecionado, int idSelecionadoDispesa, string saveBtn2)

        {
            if (saveBtn2 == "Deletar")
            {
                if (idSelecionado != 0)
                {
                    PagamentoBLL bll = new PagamentoBLL();
                    Pagamento    pg  = new Pagamento();
                    pg.Id = idSelecionado;

                    ViewData["resultB"] = bll.Delete(pg);
                }
                if (idSelecionadoDispesa != 0)
                {
                    DespesaBLL bll     = new DespesaBLL();
                    Despesa    dispesa = new Despesa();
                    dispesa.idDespesa = idSelecionadoDispesa;

                    ViewData["resultA"] = bll.Delete(dispesa);
                }
            }
            return(View());
        }
Пример #9
0
 public void Setup()
 {
     bll  = new DespesaBLL();
     str  = string.Empty;
     data = DateTime.Now;
 }
Пример #10
0
        public string EditarDespesa(string obj)
        {
            DespesaBLL desBLL = new DespesaBLL();

            return(desBLL.EditarDespesa(obj).ToString());
        }
Пример #11
0
        public string CadastrarDespesa(string obj)
        {
            DespesaBLL desBLL = new DespesaBLL();

            return(desBLL.CadastrarDespesa(obj).ToString());
        }