Ejemplo n.º 1
0
        public ActionResult EditarTicket(int id)
        {
            var entity = TicketBusiness.Create(id);

            TicketModel model = new TicketModel();

            model.TicketEntity = new TicketEntity();
            model.TicketEntity = entity;

            model.TicketAnexoModel = new TicketAnexoModel();
            model.TicketAnexoModel.TicketAnexoEntity = new TicketAnexoEntity()
            {
                TicketId = entity.TicketId
            };
            model.TicketAnexoModel.TicketAnexoList = TicketBusiness.PesquisarAnexoPorTicket(entity.TicketId).ToList();

            model.TicketAndamentoModel = new TicketAndamentoModel();
            model.TicketAndamentoModel.TicketAndamentoEntity = new TicketAndamentoEntity()
            {
                TicketId = entity.TicketId
            };
            model.TicketAndamentoModel.TicketAndamentoList = TicketBusiness.PesquisarAndamentoPorTicket(entity.TicketId, 1).ToList();

            return(View("PrincipalTicket", model));
        }
Ejemplo n.º 2
0
        //////////////////////////////////////////////
        //////////////   TICKET ANEXO   //////////////
        //////////////////////////////////////////////

        public ActionResult _TicketAnexo()
        {
            var model = new TicketModel();

            model.TicketEntity = new TicketEntity();
            model.TicketAnexoModel.TicketAnexoEntity.TicketId = model.TicketEntity.TicketId;
            return(View(TicketBusiness.PesquisarAnexoPorTicket(model.TicketEntity.TicketId).ToList()));
        }
Ejemplo n.º 3
0
        public ActionResult SalvarArquivo(IEnumerable <HttpPostedFileBase> files, TicketAnexoEntity entity)
        {
            TicketModel      model2 = new TicketModel();
            TicketAnexoModel model  = new TicketAnexoModel();

            model.TicketAnexoEntity = entity;

            if (files != null)
            {
                foreach (var file in files)
                {
                    string fileName = "";

                    string path = Server.MapPath("~/Arquivos/Ticket/Anexo/");
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    // Verify that the user selected a file
                    if (file != null && file.ContentLength > 0)
                    {
                        // extract only the fielname
                        fileName = Path.GetFileNameWithoutExtension(file.FileName) + "-" + entity.TicketId + Path.GetExtension(file.FileName);

                        path = Path.Combine(path, fileName);

                        if (System.IO.File.Exists(path))
                        {
                            path     = GetFileName(path);
                            fileName = Path.GetFileName(path);
                        }
                        file.SaveAs(path);
                        if (ModelState.IsValid)
                        {
                            var entity2 = new TicketAnexoEntity();
                            entity2.TicketId       = entity.TicketId;
                            entity2.Observacao     = entity.Observacao;
                            entity2.CaminhoArquivo = "~/Arquivos/Ticket/Anexo/" + fileName;
                            // entity2.TpArq = Path.GetExtension(fileName);
                            new TicketAnexoBusiness().Salvar(entity2, this.UsuarioId);
                        }
                    }
                }
            }

            model.TicketAnexoEntity = new TicketAnexoEntity()
            {
                TicketId = entity.TicketId
            };
            //context.TicketAnexoEntity.Where(a => a.TicketId == entity.TicketId)
            model.TicketAnexoList = TicketBusiness.PesquisarAnexoPorTicket(entity.TicketId).ToList();

            return(PartialView("_TicketAnexo", model));
        }