Exemple #1
0
        public List <Recebimento> GraficoRecebimentoMensal(int id)
        {
            List <Recebimento> recebimentos = new List <Recebimento>();
            SqlCommand         comando      = new DBconnection().GetConnction();

            comando.CommandText = "SELECT valor, data FROM recebimentos WHERE id_pessoas = @ID";
            comando.Parameters.AddWithValue("@ID", id);

            DataTable tabela = new DataTable();

            tabela.Load(comando.ExecuteReader());

            foreach (DataRow linha in tabela.Rows)
            {
                Recebimento recebimento = new Recebimento()
                {
                    Id        = Convert.ToInt32(linha[0].ToString()),
                    IdPessoas = Convert.ToInt32(linha[1].ToString()),
                    Valor     = Convert.ToDouble(linha[1].ToString()),
                    Data      = Convert.ToDateTime(linha[2].ToString()),
                };
                recebimentos.Add(recebimento);
            }
            return(recebimentos);
        }
 public static IEnumerable <string> ValidarParaExcluir(Recebimento entidade)
 {
     if (entidade == null)
     {
         yield return(Mensagem.EntidadeNaoEncontrada.Formatar(Termo.Recebimento));
     }
 }
Exemple #3
0
        public void RecebimentoDeveEstarInvalido()
        {
            var contaDestino = new ContaBancaria("2", "23", "Invalido");
            var recebimento  = new Recebimento("", contaDestino, "3345478827", 100m, 0m, DateTime.Now.AddDays(-1));

            Assert.True(recebimento.Invalid);
        }
        public async Task <ActionResult> CadastroRecebimento(Recebimento recebimento)
        {
            int id = Convert.ToInt32(Session["user"].ToString());

            int deuCerto = new RepositorioRecebimento().CadastrarRecebimento(recebimento);

            var options = new PusherOptions
            {
                Cluster   = "us2",
                Encrypted = true
            };

            var pusher = new Pusher(
                "604342",
                "3d2e47e4a257a668b2cc",
                "65922eb9b246a4faa9a5",
                options);

            var result = await pusher.TriggerAsync(
                "my-channel",
                "cadastroRecebimento",
                new { message = "hello world" });

            return(Content(JsonConvert.SerializeObject(new { recebimento })));
        }
Exemple #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Data,Total,Status")] Recebimento recebimento)
        {
            if (id != recebimento.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(recebimento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RecebimentoExists(recebimento.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(recebimento));
        }
Exemple #6
0
        public void RecebimentoDeveEstarValido()
        {
            var contaDestino = new ContaBancaria("2", "23", "Corrente");
            var recebimento  = new Recebimento("Lancamento", contaDestino, "3345478827", 100m, 0m, DateTime.Now);

            Assert.True(recebimento.Valid);
        }
Exemple #7
0
        public async Task <Recebimento> Apply(Consolidacao consolidacao, Lancamento lancamento)
        {
            var contaBancaria = _contas.FindAll(new ContaBancaria.ByNumero(lancamento.ContaDestino)).FirstOrDefault();

            if (contaBancaria == null)
            {
                throw new Exception("Conta Bancária inválida");
            }

            if (!contaBancaria.Tipo.Equals(lancamento.TipoConta))
            {
                throw new Exception("Tipo de conta inválido");
            }

            var recebimento = new Recebimento
            {
                ContaBancaria = contaBancaria,
                Em            = lancamento.Em,
                Valor         = lancamento.Valor,
            };

            consolidacao.Recebimentos.Add(recebimento);

            _lancamentos.AddRecebimento(recebimento);

            return(recebimento);
        }
Exemple #8
0
        public Recebimento AddRecebimento(Recebimento recebimento)
        {
            var entity = _unitOfWork.Add(recebimento);

            _unitOfWork.Commit();
            return(entity);
        }
Exemple #9
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Quantidade,ValorUnit,ValorTotal,Data,Status,ProdutoId,UsuarioId,MembroId,FornecedorId")] Recebimento recebimento)
        {
            if (id != recebimento.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(recebimento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RecebimentoExists(recebimento.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FornecedorId"] = new SelectList(_context.Fornecedor, "Id", "Nome", recebimento.FornecedorId);
            ViewData["MembroId"]     = new SelectList(_context.Membro, "Id", "Nome", recebimento.MembroId);
            ViewData["ProdutoId"]    = new SelectList(_context.Produto, "Id", "Nome", recebimento.ProdutoId);
            ViewData["UsuarioId"]    = new SelectList(_context.Usuario, "Id", "Nome", recebimento.UsuarioId);
            return(View(recebimento));
        }
        public string DeleteRecebimento(Recebimento recebimento)
        {
            string        result;
            DBRecebimento db = new DBRecebimento(recebimento);

            result = db.DeleteRecebimento();
            return(result);
        }
Exemple #11
0
        public void DeveSerPossivelConsumirCLiente()
        {
            Cliente cliente     = new Cliente();
            var     connect     = new Connect();
            var     recebimento = new Recebimento(connect.session, "test-receiver", "immobile", cliente);

            recebimento.Run().Wait();
        }
 public RecebimentoTestes()
 {
     _provedorDoTempo = new ProvedorDataHoraSistema();
     _recebimento     = new Recebimento();
     _veiculo         = new FabricaDeVeiculo().ComAPlacaPadrao().Criar();
     _bilhete         = new Bilhete(_ticketId, DateTime.UtcNow, _veiculo);
     _ticket          = new Ticket(_bilhete.TicketId, _bilhete.DataHoraDeEntrada, _bilhete.Veiculo);
 }
        public async Task <ActionResult <Recebimento> > PostRecebimento(Recebimento recebimento)
        {
            recebimento.Id     = new Guid();
            recebimento.Status = "Aguardando Retirada";
            _context.Recebimentos.Add(recebimento);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetRecebimento", new { id = recebimento.Id }, recebimento));
        }
Exemple #14
0
 public ActionResult Store(Recebimento recebimento)
 {
     if (ModelState.IsValid)
     {
         int identificador = new RepositorioRecebimento().CadastrarRecebimento(recebimento);
         return(RedirectToAction("Index", new { id = identificador }));
     }
     return(View("Index"));
 }
        public string SaveRecebimentoIsencao(Recebimento r)
        {
            if (r.AssinaturaAnuidadeId == 0 && r.AssinaturaEventoId == 0)
            {
                return("O identificador da Anuidade ou Evento são inválidos");
            }

            Recebimento _r = new Recebimento()
            {
                RecebimentoId        = r.RecebimentoId,
                AssinaturaAnuidadeId = r.AssinaturaAnuidadeId,
                AssinaturaEventoId   = r.AssinaturaEventoId,
                Observacao           = Functions.AjustaTamanhoString(r.Observacao, 500),
                NotificationCodePS   = r.NotificationCodePS,
                TypePS              = r.TypePS,
                StatusPS            = r.StatusPS,
                LastEventDatePS     = r.LastEventDatePS,
                TypePaymentMethodPS = r.TypePaymentMethodPS,
                CodePaymentMethodPS = r.CodePaymentMethodPS,
                NetAmountPS         = r.NetAmountPS,
                DtVencimento        = r.DtVencimento,
                StatusFBTC          = r.StatusFBTC,
                DtStatusFBTC        = r.DtStatusFBTC,
                OrigemEmissaoTitulo = r.OrigemEmissaoTitulo,
                DtCadastro          = r.DtCadastro,
                Ativo = r.Ativo,
            };



            try
            {
                if (r.RecebimentoId == 0)
                {
                    return(_recebimentoService.InsertRecebimentoIsencao(_r));
                }
                else
                {
                    return(_recebimentoService.UpdateRecebimentoIsencao(r.RecebimentoId, _r));
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }



            try
            {
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #16
0
 public static RecebimentoViewModel TransformarModelEmView(this Recebimento entidade)
 {
     return(new RecebimentoViewModel
     {
         Id = entidade.Id,
         ClienteId = entidade.ClienteId,
         Valor = entidade.Valor,
         FormaRecebimentoId = entidade.FormaRecebimentoId
     });
 }
Exemple #17
0
 public IActionResult Cadastrar(Recebimento r)
 {
     if (ModelState.IsValid)
     {
         _recebimentoService.Cadastrar(r, _usuarioAutenticado.Usuario(User));
         return(RedirectToAction("Index"));
     }
     ModelState.AddModelError("", "Erro ao cadastrar recebimento! Identifique os erros nos campos abaixo e tente novamente.");
     return(View("Cadastro", r));
 }
Exemple #18
0
        public async Task <IActionResult> Create([Bind("Id,Data,Total,Status")] Recebimento recebimento)
        {
            if (ModelState.IsValid)
            {
                _context.Add(recebimento);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(recebimento));
        }
Exemple #19
0
        public bool AlterarRecebimento(Recebimento recebimento)
        {
            SqlCommand comando = new DBconnection().GetConnction();

            comando.CommandText = "UPDATE recebimentos SET valor = @VALOR, data = @DATA WHERE id = @ID";
            //comando.Parameters.AddWithValue("@ID_CATEGORIA", recebimento.Id_recebimento);
            comando.Parameters.AddWithValue("@VALOR", recebimento.Valor);
            comando.Parameters.AddWithValue("@DATAO", recebimento.Data);
            comando.Parameters.AddWithValue("@ID", recebimento.Id);
            return(comando.ExecuteNonQuery() == 1);
        }
Exemple #20
0
        public IActionResult ObterPorId(int id)
        {
            Recebimento recebimento = _recebimentoServico.ObterPorId(id);

            if (recebimento == null)
            {
                return(NotFound());
            }

            return(Ok(recebimento.TransformarModelEmView()));
        }
Exemple #21
0
        public ActionResult CadastroModalRecebimento(Recebimento recebimento, Categoria categoria, Pessoas pessoa)
        {
            int       id            = new RepositorioRecebimento().CadastrarRecebimento(recebimento);
            Categoria novaCategoria = new Categoria()
            {
                IdRecebimento = id,
                Nome          = categoria.Nome.ToString()
            };


            return(Content(JsonConvert.SerializeObject(new { id = id })));
        }
Exemple #22
0
        public ActionResult Update(Recebimento recebimento)
        {
            bool alterado = new RepositorioRecebimento().AlterarRecebimento(recebimento);

            if (alterado == true)
            {
                //return View("Index");
                return(null);
            }
            //            return View("Index");
            return(null);
        }
 public string InsertRecebimento(Recebimento recebimento)
 {
     try
     {
         RecebimentoControle controle = new RecebimentoControle(recebimento);
         string result = controle.testaRecebimento();
         return(result);
     }
     catch (Exception ex)
     {
         throw new Exception("Erro ao tentatar inserir" + " " + ex.Message);
     }
 }
Exemple #24
0
        public int CadastrarRecebimento(Recebimento recebimento)
        {
            SqlCommand comando = new DBconnection().GetConnction();

            comando.CommandText = @"INSERT INTO recebimentos (valor, data, id_pessoas, id_categoria) OUTPUT INSERTED.ID VALUES (@VALOR, @DATA, @IDPESSOA, @IDCATEGORIA)";
            comando.Parameters.AddWithValue("@VALOR", recebimento.Valor);
            comando.Parameters.AddWithValue("@DATA", recebimento.Data);
            comando.Parameters.AddWithValue("@IDPESSOA", recebimento.IdPessoas);
            comando.Parameters.AddWithValue("@IDCATEGORIA", recebimento.IdCategoria);
            int id = Convert.ToInt32(comando.ExecuteScalar().ToString());

            return(id);
        }
 public string UpdateRecebimento(Recebimento recebimento)
 {
     try
     {
         String        result;
         DBRecebimento db = new DBRecebimento(recebimento);
         result = db.UpdateRecebimento();
         return(result);
     }
     catch (Exception ex)
     {
         throw new Exception("Erro ao tentatar atualizar" + " " + ex.Message);
     }
 }
Exemple #26
0
        public async Task <IActionResult> Create([Bind("Id,Quantidade,ValorUnit,ValorTotal,Data,Status,ProdutoId,UsuarioId,MembroId,FornecedorId")] Recebimento recebimento)
        {
            if (ModelState.IsValid)
            {
                _context.Add(recebimento);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FornecedorId"] = new SelectList(_context.Fornecedor, "Id", "Nome", recebimento.FornecedorId);
            ViewData["MembroId"]     = new SelectList(_context.Membro, "Id", "Nome", recebimento.MembroId);
            ViewData["ProdutoId"]    = new SelectList(_context.Produto, "Id", "Nome", recebimento.ProdutoId);
            ViewData["UsuarioId"]    = new SelectList(_context.Usuario, "Id", "Nome", recebimento.UsuarioId);
            return(View(recebimento));
        }
        public List <Recebimento> pegarRecebimentoPorData(string mes, string emailLogado)
        {
            try
            {
                List <Recebimento> listaRecebimento = new List <Recebimento>();

                string sql = "SELECT idRecebimento, cast(CONVERT(varchar(10),dataRecebimento, 103) as date )as dataRecebimento,descricao,categoria,valorRecebimento,status";
                sql += " FROM Recebimento ";
                sql += " WHERE dataRecebimento LIKE @MES and emailCliente = @EMAIL";



                SqlCommand cmd = new SqlCommand(sql, sqlConn);
                cmd.Parameters.AddWithValue("@EMAIL", emailLogado);
                cmd.Parameters.AddWithValue("@MES", "%" + mes + "%");
                SqlDataReader DbReader = cmd.ExecuteReader();
                while (DbReader.Read())
                {
                    int    id;
                    string dataRecebimento;
                    float  valorRecebimento;
                    string categoria, descricao;
                    int    status;

                    id = DbReader.GetInt32(DbReader.GetOrdinal("idRecebimento"));
                    dataRecebimento  = DbReader.GetDateTime(DbReader.GetOrdinal("dataRecebimento")).ToShortDateString();
                    descricao        = DbReader.GetString(DbReader.GetOrdinal("descricao"));
                    categoria        = DbReader.GetString(DbReader.GetOrdinal("categoria"));
                    valorRecebimento = (float)DbReader.GetDouble(DbReader.GetOrdinal("valorRecebimento"));
                    status           = DbReader.GetInt32(DbReader.GetOrdinal("status"));

                    Recebimento recebimento = new Recebimento(id, dataRecebimento, descricao, categoria, valorRecebimento, status);
                    listaRecebimento.Add(recebimento);
                }
                DbReader.Close();
                cmd.Dispose();
                return(listaRecebimento);
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao tentatar Selecionar" + " " + ex.Message);
            }

            finally
            {
                fecharConexao();
            }
        }
        public void QuandoEuAdicionarUmRecebimentoNoCredito()
        {
            //arrange: Criar os objetos necessários
            //         para a execução do teste
            Credito credito = new Credito();
            Tipo recebimentoTipo = Tipo.Esporadico;
            const string nomeRecebimento = "Salário";
            Recebimento recebimento = new Recebimento(nomeRecebimento, recebimentoTipo);

            //act: Ação de executar o que deverá ser testado
            credito.AdicionarRecebimento(recebimento);

            //assert: Garantir que a ação executada está de acordo
            //        com o previsto
            Assert.IsTrue(credito.Recebimentos.Count == 1);
        }
        public void QuandoEuCriarUmRecebimento()
        {
            //arrange
            const string nomeRecebimento = "Aluguel";
            DateTime dataEntrada = DateTime.Now;
            Tipo tipoRecebimento = Tipo.Fixo;

            //act
            //Pausa a Thread atual em milisegundos,
            // neste caso, 2 segundos
            Thread.Sleep(1);
            Recebimento recebimento = new Recebimento(nomeRecebimento, tipoRecebimento);

            //assert
            Assert.IsNotNull(recebimento);
            Assert.AreEqual(recebimento.DataEntrada.Date, dataEntrada.Date);
        }
        public Recebimento SetRecebimento(string objetivoPagamento)
        {
            Recebimento r = new Recebimento()
            {
                RecebimentoId       = 0,
                CodePaymentMethodPS = null,
                NotificationCodePS  = null,
                LastEventDatePS     = null,
                NetAmountPS         = 0,
                StatusPS            = null,
                TypePaymentMethodPS = null,
                TypePS     = null,
                Observacao = "",
                Ativo      = true
            };

            return(r);
        }
        public Pagamento ToPagamento(Recebimento recebimento)
        {
            var pagamento = new Pagamento
            {
                Id = 0,
                PagamentoMensalistaId = Id > 0 ? Id : default(int?),
                DataInsercao          = DataInsercao,
                ValorPago             = Valor,
                DataPagamento         = DataPagamento,
                NumeroRecibo          = CodigoBaixa.ToString(),
                Recebimento           = recebimento,
                FormaPagamento        = FormaPagamento,
                ContaContabil         = null,
                DataEnvio             = DateTime.Now,
                StatusPagamento       = true
            };

            return(pagamento);
        }
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            errorProvider.Clear();
            if (ValidarRecebimento())
            {
                var recebimento = new Recebimento
                {
                    Data            = dtpData.Value.Date,
                    Valor           = Convert.ToDouble(lblTotal0.Text),
                    ContaAReceberId = Convert.ToInt32(dgvContasAReceber.CurrentRow.Cells[0].Value)
                };

                if (txtId.Text == string.Empty)
                {
                    var contaAReceber = this.contaAReceberController.PorId(Convert.ToInt32(dgvContasAReceber.CurrentRow.Cells[0].Value));
                    var aluno         = contaAReceber.Contrato.Aluno;

                    this.recebimentoController.Salvar(recebimento);
                    this.contaAReceberController.AtualizarStatus(contaAReceber, Status.LIQUIDADO);

                    string mensagem = "Olá " + cbxAluno.Text + " o recebimento da sua parcela foi realizado com sucesso! \n" +
                                      "Vencimento: " + dgvContasAReceber.CurrentRow.Cells[2].Value.ToString() + "\n" +
                                      " Valor: " + dgvContasAReceber.CurrentRow.Cells[3].Value.ToString();

                    if (EmailController.EnviarEmail(aluno.Email, "Comprovante de recebimento", mensagem, new ConfiguracaoController().Configuracao()))
                    {
                        MessageBox.Show("Recebimento realizado com sucesso!\n" +
                                        "Enviado para o aluno: " + aluno.Nome +
                                        "\nEmail: " + aluno.Email);
                    }
                    else
                    {
                        MessageBox.Show("Recebimento realizado com sucesso!\n" +
                                        "Mas não foi possível enviar o email, verifique se os dados estão corretos e sua conexão con a internet!");
                    }
                }
                AtualizaDgvRecebimentos();
                InicializaCombobox();
                Limpar();
            }
        }
        public void Adicionar(string nome, int codigoRecebimentoTipo, int codigoCredito)
        {
            //Criou a entidade de recebimento
            var recebimento =
                new Recebimento(nome, (Tipo)codigoRecebimentoTipo);

            //Buscamos o crédito daquele recebimento
            var credito =
                _creditoRepository.GetByCodigo(codigoCredito);

            //Definimos o crédito na entidade
            recebimento.AlterarCredito(credito);

            //Iniciamos o nosso Unit Of Work através da nossa classe
            // BaseApplication
            Begin();

            //Salvamos no banco
            _recebimentoRepository.Add(recebimento);

            //Efetuamos (comitamos) as alterações pelo nosso
            // Unit of Work através da nossa classe BaseApplication
            SaveChanges();
        }
        public void QuandoEuCriarUmRecebimentoONomeDeveraSerObrigatorio()
        {
            //Para alterar o idioma do sistema, utilizamos o CurrentCulture e o CurrentUICulture para informar
            // o idioma desejado
            //System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
            //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");

            //arrange
            string nomeRecebimento = string.Empty;
            Tipo recebimentoTipo = Tipo.Fixo;

            //act
            Recebimento recebimento =
                new Recebimento(nomeRecebimento, recebimentoTipo);

            //assert
        }
 public void AdicionarRecebimento(Recebimento recebimento)
 {
     Recebimentos.Add(recebimento);
 }
 public void Add(Recebimento recebimento)
 {
     _controleFinanceiroContext.Recebimentos.Add(recebimento);
     //Tiramos o SaveChanges, pois estamos utilizando o UoW.
     //_controleFinanceiroContext.SaveChanges();
 }