Example #1
0
        public void Liquidar(string postedData)
        {
            RepositorioPadrao <Titulo> repo;
            TituloViewModel            viewModel = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize <TituloViewModel>(postedData);

            if (viewModel.Categoria.Direcao == DirecaoCategoria.Recebimento)
            {
                repo = new RepositorioRecebimento();
            }
            else
            {
                repo = new RepositorioPagamento();
            }


            if (viewModel.TituloRecorrenteId != null && (viewModel.Valor == null || viewModel.Valor == 0))
            {
                viewModel.Valor = viewModel.Liquidacoes.Sum(l => l.Valor);
            }

            if (ModelState.IsValid)
            {
                var novoTitulo = viewModel.ToModel();
                repo.Incluir(novoTitulo);
            }
        }
        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 })));
        }
Example #3
0
        public ActionResult RecebimentoPessoaJsonGrafico()
        {
            int id = Convert.ToInt32(Session["user"].ToString());

            List <Object> datas = new RepositorioRecebimento().RecebimentoPessoaJsonFormat(id);

            return(Content(JsonConvert.SerializeObject(new { data = datas }, Formatting.Indented)));
        }
Example #4
0
        public ActionResult PreencherFullCalendarRecebimento()
        {
            int id = Convert.ToInt32(Session["user"].ToString());

            List <Object> recebimentos = new RepositorioRecebimento().FullcalendarRecebimento(id);

            return(Content(JsonConvert.SerializeObject(new { events = recebimentos }, Formatting.Indented)));
        }
Example #5
0
        public ActionResult Editar(int id)
        {
            Recebimento recebimento = new RepositorioRecebimento().ObterPeloIdRecebimento(id);

            ViewBag.Recebimento  = recebimento;
            ViewBag.TituloPagina = "Editar - Recebimentos";
            return(View());
        }
Example #6
0
        public ActionResult Index()
        {
            List <Recebimento> recebimentos = new RepositorioRecebimento().ObterTodosRecebimento();

            ViewBag.Recebimentos = recebimentos;
            ViewBag.TituloPagina = "Recebimentos";
            return(View());
        }
Example #7
0
 public ActionResult Store(Recebimento recebimento)
 {
     if (ModelState.IsValid)
     {
         int identificador = new RepositorioRecebimento().CadastrarRecebimento(recebimento);
         return(RedirectToAction("Index", new { id = identificador }));
     }
     return(View("Index"));
 }
Example #8
0
        public ActionResult Excluir(int id)
        {
            bool apagado = new RepositorioRecebimento().ExcluirRecebimento(id);

            if (apagado)
            {
                return(RedirectToAction("Index"));
            }
            return(View("Index"));
        }
Example #9
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 })));
        }
Example #10
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);
        }
Example #11
0
        public static void EnviarBoletoPorEmail(int tituloId, string nomeArquivo, int modeloBoletoId, string emailDestinatario, string AssuntoEmail, string TextoEmail)
        {
            var titulo         = new RepositorioRecebimento().BuscarPorId(tituloId);
            var emailRemetente = titulo.Empresa.EmailFinanceiro;

            var boletoGeradoId = new RepositorioBoletoGerado().Listar(b => b.TituloId == titulo.Id).FirstOrDefault().Id.ToString();

            TextoEmail = TextoEmail.Replace("#tokenBoleto#", EnderecoHost() + "/AtualizacaoBoleto?tokenBoleto=" + Criptografia.Encriptar(boletoGeradoId));

            var boleto = Util.GerarBoletoBancario(tituloId, modeloBoletoId);
            var pdf    = StringToPdf(boleto.MontaHtmlEmbedded(false, true));
            var anexos = new List <Stream>();

            anexos.Add(pdf);
            var email = new Email(emailDestinatario, TextoEmail, AssuntoEmail, emailRemetente, anexos, new List <string>()
            {
                Path.GetFileName(nomeArquivo)
            });

            email.DispararMensagem();
        }
Example #12
0
        public static void EnviarBoletoPorEmail(LoteBoleto loteBoleto, string nomeArquivo)
        {
            string         emailDestinatario = "";
            string         emailRemetente    = "";
            BoletoBancario boleto            = null;
            var            modeloBoleto      = new RepositorioModeloBoleto().BuscarPorId(loteBoleto.ModeloBoletoId);
            string         boletoGeradoId    = null;

            if (loteBoleto.TituloId != null)
            {
                var titulo = new RepositorioRecebimento().BuscarPorId((int)loteBoleto.TituloId);
                emailDestinatario = loteBoleto.EmailDestinatario;
                emailRemetente    = titulo.Empresa.EmailFinanceiro;
                boleto            = Util.GerarBoletoBancario((int)loteBoleto.TituloId, loteBoleto.ModeloBoletoId);
                boletoGeradoId    = new RepositorioBoletoGerado().Listar(b => b.TituloId == titulo.Id).FirstOrDefault().Id.ToString();
            }
            if (loteBoleto.TituloRecorrenteId != null)
            {
                var titulo = new RepositorioTituloRecorrente().BuscarPorId((int)loteBoleto.TituloRecorrenteId);
                emailDestinatario = loteBoleto.EmailDestinatario;
                emailRemetente    = titulo.Empresa.EmailFinanceiro;
                boleto            = Util.GerarBoletoBancario((int)loteBoleto.TituloRecorrenteId, loteBoleto.Valor, loteBoleto.DataVencimento, loteBoleto.ModeloBoletoId);
                boletoGeradoId    = new RepositorioBoletoGerado().Listar(b => b.TituloRecorrenteId == titulo.Id && b.DataVencimento == loteBoleto.DataVencimento).FirstOrDefault().Id.ToString();
            }

            var pdf    = StringToPdf(boleto.MontaHtmlEmbedded(false, true));
            var anexos = new List <Stream>();

            anexos.Add(pdf);

            modeloBoleto.TextoEmail = modeloBoleto.TextoEmail.Replace("#tokenBoleto#", EnderecoHost() + "/AtualizacaoBoleto?tokenBoleto=" + Criptografia.Encriptar(boletoGeradoId));

            var email = new Email(emailDestinatario, modeloBoleto.TextoEmail, modeloBoleto.AssuntoEmail, emailRemetente, anexos, new List <string>()
            {
                Path.GetFileName(nomeArquivo)
            });

            email.DispararMensagem();
        }
Example #13
0
        public ActionResult ObterTodosJson()
        {
            List <Recebimento> recebimento = new RepositorioRecebimento().ObterTodosRecebimento();

            return(Content(JsonConvert.SerializeObject(new { data = recebimento })));
        }