Exemplo n.º 1
0
        public ActionResult GastosPessoaGrafico()
        {
            int           id    = Convert.ToInt32(Session["user"].ToString());
            List <Object> datas = new RepositorioGastos().GraficoGastosMensais(id);

            return(Content(JsonConvert.SerializeObject(new { data = datas }, Formatting.Indented)));
        }
        public async Task <ActionResult> CadastroGastosModalPessoas(Gastos gasto)
        {
            int id = Convert.ToInt32(Session["user"].ToString());

            int deuCerto = new RepositorioGastos().CadastrarGastos(gasto, id);


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

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

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

            return(Content(JsonConvert.SerializeObject(new { gasto })));
        }
Exemplo n.º 3
0
        public ActionResult TabelaGastos()
        {
            //fazer um vetor para pesquisa por coluna
            string[] colunasNomes = new string[3];
            colunasNomes[0] = "car.conta ";
            colunasNomes[1] = "cat.nome ";
            colunasNomes[2] = "gas.valor ";

            string start       = Request.QueryString["start"];
            string length      = Request.QueryString["length"];
            string draw        = Request.QueryString["draw"];
            string search      = '%' + Request.QueryString["search[value]"] + '%';
            string orderColumn = Request.QueryString["order[0][column]"];
            string orderDir    = Request.QueryString["order[0][dir]"];

            orderColumn = colunasNomes[Convert.ToInt32(orderColumn)];

            int id = Convert.ToInt32(Session["user"].ToString());

            RepositorioGastos repositorio = new RepositorioGastos();
            List <Gastos>     gastos      = repositorio.ObterTodosParaJson(start, length, search, orderColumn, orderDir, id);

            int countGastos = repositorio.ContabilizarGastos();
            int countFilter = repositorio.ContabilizarGastosFiltrados(search);

            return(Content(JsonConvert.SerializeObject(new
            {
                data = gastos,
                draw = draw,
                recordsTotal = countGastos,
                recordsFiltered = countFilter
            })));
        }
Exemplo n.º 4
0
        public ActionResult PreencherFullCalendar()
        {
            int id = Convert.ToInt32(Session["user"].ToString());

            List <Object> gastos = new RepositorioGastos().FullCalendarGastos(id);

            return(Content(JsonConvert.SerializeObject(new { events = gastos }, Formatting.Indented)));
        }
Exemplo n.º 5
0
        public ActionResult CadastroModalGastos(Gastos gastos)
        {
            int id = Convert.ToInt32(Session["user"].ToString());

            int ids = new RepositorioGastos().CadastrarGastos(gastos, id);

            return(Content(JsonConvert.SerializeObject(new { id = ids })));
        }
Exemplo n.º 6
0
        public ActionResult Index()
        {
            List <Gastos> gastos = new RepositorioGastos().ObterTodosGastos();

            ViewBag.Gastos       = gastos;
            ViewBag.TituloPagina = "Gastos";
            return(View());
        }
Exemplo n.º 7
0
        public async Task <ActionResult> ExcluirGastos(int id)
        {
            bool apagado = new RepositorioGastos().ExcluirGastos(id);

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

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

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

            return(Content(JsonConvert.SerializeObject(new { apagado })));
        }
Exemplo n.º 8
0
        public ActionResult UpdateGastos(Gastos gastos)
        {
            bool alterado = new RepositorioGastos().AlterarGastos(gastos);

            return(Content(JsonConvert.SerializeObject(new { alterado })));
        }
Exemplo n.º 9
0
        public ActionResult EditarGastos(int id)
        {
            Gastos gastos = new RepositorioGastos().ObterPeloIdGastos(id);

            return(Content(JsonConvert.SerializeObject(new { gastos })));
        }
Exemplo n.º 10
0
        public ActionResult ObterTodosJson()
        {
            List <Gastos> gastos = new RepositorioGastos().ObterTodosGastos();

            return(Content(JsonConvert.SerializeObject(new { data = gastos })));
        }
Exemplo n.º 11
0
        public ActionResult Update(Gastos gastos)
        {
            bool alterado = new RepositorioGastos().AlterarGastos(gastos);

            return(null);
        }
Exemplo n.º 12
0
        public ActionResult ExcluirGastos(int id)
        {
            bool apagado = new RepositorioGastos().ExcluirGastos(id);

            return(View());
        }