Exemplo n.º 1
0
        // view de edição
        public ActionResult Detalhes(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ch_chamados chamado = chamadoDal.VerificaExistenciaChamado(id);

            if (chamado == null)
            {
                return(HttpNotFound());
            }

            var dados = chamadoDal.BuscaListaAnexoPorId(id);

            ViewBag.Anexo = dados; // se tiver dados colocar o nome das notas

            if (dados.Count == 0)
            {
                ViewBag.Anexo = null;
            }
            ViewBag.QuantAnexo = dados.Count();

            var msg = chamadoDal.BuscaMensagensPorChamado(id);

            ViewBag.statusE         = new SelectList(chamadoDal.DropDownStatus(), "id", "descs", chamado.statusE);
            ViewBag.Mensagens       = msg;
            ViewBag.NumeroMensagens = msg.Where(x => x.leitura_cli == "N").Count();

            return(View(chamado));
        }
Exemplo n.º 2
0
        public string[] FinalizarChamado(int id)
        {
            ch_chamados chamado = db.ch_chamados.Where(x => x.id == id).FirstOrDefault();

            if (chamado == null)
            {
                utl.SetMensagem("false", "Chamado Invalido", "danger");
                return(utl.GetMensagem());
            }

            if (chamado.statusE == 7)
            {
                utl.SetMensagem("false", "Este chamado já esta finalizado", "danger");
                return(utl.GetMensagem());
            }
            try
            {
                chamado.statusE         = 7;
                chamado.dt_encerramento = DateTime.Now;
                db.Entry(chamado).State = EntityState.Modified;
                db.SaveChanges();
                utl.SetMensagem("true", "Chamado Finalizado", "success");
                return(utl.GetMensagem());
            }
            catch (Exception ex)
            {
                utl.SetMensagem("false", ex.Message, "danger");
                return(utl.GetMensagem());
            }
        }
Exemplo n.º 3
0
        public string[] NovoTicket(ch_chamados c, List <HttpPostedFileBase> postedFile)
        {
            try
            {
                c.emp      = (int)UserLogado.emp;
                c.user_cli = UserLogado.id;
                c.statusE  = 4;

                c.dt_abertura = DateTime.Now;
                db.ch_chamados.Add(c);
                db.SaveChanges();

                // verifica se possue anexos
                if (postedFile.FirstOrDefault() != null)
                {
                    // recupera o chamado para colocar o id
                    var RecuperarChamado = db.ch_chamados.Where(x => x.dt_abertura == c.dt_abertura || x.assunto == c.assunto).FirstOrDefault();
                    // verificar se o chamado reamente existe
                    if (RecuperarChamado != null)
                    {
                        // adiciona de fato na tabela
                        AdicionarAnexos(postedFile, RecuperarChamado.id, "* Chamado Aberto com sucesso !");
                        return(utl.GetMensagem());
                    }
                }

                utl.SetMensagem("true", "Chamado Aberto com sucesso ", "success");
                return(utl.GetMensagem());
            }
            catch (Exception ex)
            {
                utl.SetMensagem("false", ex.Message, "danger");
                return(utl.GetMensagem());
            }
        }
Exemplo n.º 4
0
 public ActionResult Novo([Bind(Include = "postedFile,id,emp,user_cli,prioridade,statusE,tipo,classif,sub_classif,assunto,descricacao,com_copia,user_responsavel")] ch_chamados chamado, List <HttpPostedFileBase> postedFile)
 {
     if (ModelState.IsValid)
     {
         AnalisaMensagem(chamadoDal.NovoTicket(chamado, postedFile));
         return(RedirectToAction("Novo"));
     }
     DropDownNovoTicket();
     return(View(chamado));
 }
Exemplo n.º 5
0
        public ActionResult BuscaChamados(ch_chamados c)
        {
            DateTime Ate = Convert.ToDateTime(c.dt_encerramento);

            List <ch_chamados> ch = new List <ch_chamados>();

            ViewBag.emp              = new SelectList(chamadoDal.DropDownEmpresaTodas(), "id", "descs");
            ViewBag.statusE          = new SelectList(chamadoDal.DropDownStatusTodos(), "id", "descs");
            ViewBag.classif          = new SelectList(chamadoDal.DropDownClassificacoTodos(), "id", "descs");
            ViewBag.user_cli         = new SelectList(chamadoDal.DropDownColaboradorTodos(), "id", "descs");
            ViewBag.user_responsavel = new SelectList(chamadoDal.SuporteResponsavelTodos(), "id", "descs");

            var busca = chamadoDal.BuscaDetalhadaChamados(c, Ate);

            return(View(busca));
        }
Exemplo n.º 6
0
        public ActionResult Novo([Bind(Include = "postedFile,tipo,assunto,prioridade,descricacao,com_copia")] ch_chamados chamado, List <HttpPostedFileBase> postedFile)
        {
            if (ModelState.IsValid)
            {
                AnalisaMensagem(chamadoDal.NovoTicket(chamado, postedFile));
                return(RedirectToAction("Novo/" + chamado.id));
            }

            ViewBag.user_cli         = new SelectList(chamadoDal.DropDownColab(), "id", "nome", chamado.user_cli);
            ViewBag.user_responsavel = new SelectList(chamadoDal.DropDownColab(), "id", "nome", chamado.user_responsavel);
            ViewBag.emp         = new SelectList(chamadoDal.DropDownEmpresa(), "id", "descs", chamado.emp);
            ViewBag.classif     = new SelectList(chamadoDal.DropDownClassificaco(), "id", "descs", chamado.classif);
            ViewBag.prioridade  = new SelectList(chamadoDal.DropDownPrioridade(), "id", "descs", chamado.prioridade);
            ViewBag.statusE     = new SelectList(chamadoDal.DropDownStatus(), "id", "descs", chamado.statusE);
            ViewBag.sub_classif = new SelectList(chamadoDal.DropDownSubClassificacao(), "id", "descs", chamado.sub_classif);
            ViewBag.tipo        = new SelectList(chamadoDal.DropDownTipo(), "id", "descs", chamado.tipo);
            return(View(chamado));
        }
Exemplo n.º 7
0
        public string[] EditarChamado(ch_chamados c)
        {
            try
            {
                ch_chamados Chamado = db.ch_chamados.Where(x => x.id == c.id).FirstOrDefault();
                Chamado.statusE = c.statusE;

                db.Entry(Chamado).State = EntityState.Modified;
                db.SaveChanges();

                utl.SetMensagem("true", "Status Alterado com sucesso", "success");
                return(utl.GetMensagem());
            }
            catch (Exception ex)
            {
                utl.SetMensagem("false", ex.Message, "danger");
                return(utl.GetMensagem());
            }
        }
Exemplo n.º 8
0
        // view de edição
        public ActionResult Detalhes(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ch_chamados chamado = chamadoDal.VerificaExistenciaChamado(id);

            if (chamado == null)
            {
                return(HttpNotFound());
            }

            var dados = chamadoDal.BuscaListaAnexoPorId(id);

            ViewBag.Anexo = dados; // se tiver dados colocar o nome das notas

            if (dados.Count == 0)
            {
                ViewBag.Anexo = null;
            }
            ViewBag.QuantAnexo = dados.Count();

            var msg   = chamadoDal.BuscaMensagensPorChamado(id);
            var colab = db.CAD_COLABORADOR.Where(x => x.id == chamado.user_cli).FirstOrDefault();

            ViewBag.statusE         = new SelectList(chamadoDal.DropDownStatus(), "id", "descs", chamado.statusE);
            ViewBag.Mensagens       = msg;
            ViewBag.NumeroMensagens = msg.Where(x => x.leitura_suporte == "N").Count();

            ViewBag.user_responsavel = new SelectList(chamadoDal.DropDownColab(), "id", "nome", chamado.user_responsavel);
            ViewBag.classif          = new SelectList(chamadoDal.DropDownClassificaco(), "id", "descs", chamado.classif);
            ViewBag.sub_classif      = new SelectList(chamadoDal.DropDownSubClassificacao(), "id", "descs", chamado.sub_classif);

            ViewBag.Ramal   = (colab.ramal != null  ? colab.IN_VOIP.ramal : colab.ramal);
            ViewBag.Ip      = (colab.IN_DESKTOP.ip != null ? colab.IN_DESKTOP.ip : "");
            ViewBag.Celular = (colab.SMARTPHONE != null ? colab.IN_SMARTPHONE.IN_LINHA_MOVEL.DESCS : "");


            return(View(chamado));
        }
Exemplo n.º 9
0
        public List <ch_chamados> BuscaDetalhadaChamados(ch_chamados p, DateTime ate)
        {
            DateTime dt = new DateTime();

            if (p.dt_abertura != dt && ate != dt)
            {
            }
            //DateTime teste2 = dataInicial.ToString("dd/MM/yyyy");
            if (ate == new DateTime())
            {
                ate = DateTime.Now;
            }

            var Buscando = (from ch in db.ch_chamados
                            where (p.id != 0 ? ch.id == p.id : true)
                            where (p.emp != 0 ? ch.emp == p.emp : ch.emp == ch.emp)
                            where (p.statusE != 0 ? ch.statusE == p.statusE : ch.statusE == ch.statusE)
                            where (p.classif != 0 ? ch.classif == p.classif : ch.classif == ch.classif)
                            where (p.user_cli != 0 ? ch.user_cli == p.user_cli : ch.user_cli == ch.user_cli)
                            where (p.user_responsavel != 0 ? ch.user_responsavel == p.user_responsavel : ch.user_responsavel == ch.user_responsavel)
                            where (p.dt_abertura != dt && ate != dt ? ch.dt_abertura >= p.dt_abertura && ch.dt_abertura <= ate : true)
                            select ch);
Exemplo n.º 10
0
 // edita chamado
 public ActionResult Detalhes([Bind(Include = "id,statusE")] ch_chamados chamado)
 {
     AnalisaMensagem(chamadoDal.EditarChamado(chamado));
     return(RedirectToAction("Detalhes/" + chamado.id));
 }