public ActionResult VerNotificacao(NotificacaoViewModel vm)
        {
            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            if (ModelState.IsValid)
            {
                try
                {
                    // Executa a operação
                    NOTIFICACAO item          = Mapper.Map <NotificacaoViewModel, NOTIFICACAO>(vm);
                    USUARIO     usuarioLogado = (USUARIO)Session["UserCredentials"];
                    item.NOTI_IN_VISTA = 1;
                    item.NOTI_DT_VISTA = DateTime.Now;
                    objetoAntes        = item;
                    Int32 volta = baseApp.ValidateEdit(item, objetoAntes);

                    // Verifica retorno
                    Session["MensNotificacao"] = 0;

                    // Sucesso
                    return(RedirectToAction("CarregarBase", "BaseAdmin"));
                }
                catch (Exception ex)
                {
                    ViewBag.Message = ex.Message;
                    return(View(vm));
                }
            }
            else
            {
                return(View(vm));
            }
        }
        public ActionResult FiltrarNotificacao(NOTIFICACAO item)
        {
            try
            {
                // Executa a operação
                if ((String)Session["Ativa"] == null)
                {
                    return(RedirectToAction("Login", "ControleAcesso"));
                }
                Int32 idAss = (Int32)Session["IdAssinante"];
                List <NOTIFICACAO> listaObj = new List <NOTIFICACAO>();
                Int32 volta = baseApp.ExecuteFilter(item.CANO_CD_ID, item.NOTI_NM_TITULO, item.NOTI_DT_EMISSAO, item.NOTI_TX_TEXTO, idAss, out listaObj);
                Session["FiltroNotificacao"] = item;

                // Verifica retorno
                if (volta == 1)
                {
                    Session["MensNotificacao"] = 1;
                    ModelState.AddModelError("", SMS_Resource.ResourceManager.GetString("M0016", CultureInfo.CurrentCulture));
                }

                // Sucesso
                Session["MensNotificacao"] = 0;
                listaMaster = listaObj;
                Session["ListaNotificacao"] = listaObj;
                return(RedirectToAction("MontarTelaNotificacao"));
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
                return(RedirectToAction("MontarTelaNotificacao"));
            }
        }
        public ActionResult ReativarNotificacao(Int32 id)
        {
            USUARIO usuario = new USUARIO();

            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            if ((USUARIO)Session["UserCredentials"] != null)
            {
                usuario = (USUARIO)Session["UserCredentials"];

                // Verfifica permissão
                if (usuario.PERFIL.PERF_SG_SIGLA != "ADM")
                {
                    Session["MensAcesso"] = 2;
                    return(RedirectToAction("CarregarBase", "BaseAdmin"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Int32 idAss = (Int32)Session["IdAssinante"];

            // Prepara view
            NOTIFICACAO          item = baseApp.GetItemById(id);
            NotificacaoViewModel vm   = Mapper.Map <NOTIFICACAO, NotificacaoViewModel>(item);

            return(View(vm));
        }
        public ActionResult ReativarNotificacao(NotificacaoViewModel vm)
        {
            try
            {
                if ((String)Session["Ativa"] == null)
                {
                    return(RedirectToAction("Login", "ControleAcesso"));
                }
                Int32 idAss = (Int32)Session["IdAssinante"];

                // Executa a operação
                USUARIO     usuarioLogado = (USUARIO)Session["UserCredentials"];
                NOTIFICACAO item          = Mapper.Map <NotificacaoViewModel, NOTIFICACAO>(vm);
                Int32       volta         = baseApp.ValidateReativar(item, usuarioLogado, idAss);

                // Verifica retorno

                // Sucesso
                listaMaster = new List <NOTIFICACAO>();
                Session["ListaNotificacao"] = null;
                Session["MensNotificacao"]  = 0;
                return(RedirectToAction("MontarTelaNotificacaoGeral"));
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
                return(View(vm));
            }
        }
        public ActionResult UploadFileNotificacaoGeral(HttpPostedFileBase file)
        {
            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Int32 idNot = (Int32)Session["IdVolta"];
            Int32 idAss = (Int32)Session["IdAssinante"];

            if (file == null)
            {
                ModelState.AddModelError("", SMS_Resource.ResourceManager.GetString("M0019", CultureInfo.CurrentCulture));
                return(RedirectToAction("VoltarAnexoNoticia"));
            }

            NOTIFICACAO item     = baseApp.GetById(idNot);
            USUARIO     usu      = (USUARIO)Session["UserCredentials"];
            var         fileName = Path.GetFileName(file.FileName);

            if (fileName.Length > 100)
            {
                ModelState.AddModelError("", SMS_Resource.ResourceManager.GetString("M0024", CultureInfo.CurrentCulture));
                return(RedirectToAction("VoltarAnexoNotificacaoGeral"));
            }
            String caminho = "/Imagens/" + idAss.ToString() + "/Notificacao/" + item.NOTI_CD_ID.ToString() + "/Anexos/";
            String path    = Path.Combine(Server.MapPath(caminho), fileName);

            file.SaveAs(path);

            //Recupera tipo de arquivo
            extensao = Path.GetExtension(fileName);
            String a = extensao;

            // Gravar registro
            NOTIFICACAO_ANEXO foto = new NOTIFICACAO_ANEXO();

            foto.NOAN_AQ_ARQUIVO = "~" + caminho + fileName;
            foto.NOAN_DT_ANEXO   = DateTime.Today;
            foto.NOAN_IN_ATIVO   = 1;
            Int32 tipo = 3;

            if (extensao.ToUpper() == ".JPG" || extensao.ToUpper() == ".GIF" || extensao.ToUpper() == ".PNG" || extensao.ToUpper() == ".JPEG")
            {
                tipo = 1;
            }
            if (extensao.ToUpper() == ".MP4" || extensao.ToUpper() == ".AVI" || extensao.ToUpper() == ".MPEG")
            {
                tipo = 2;
            }
            foto.NOAN_IN_TIPO   = tipo;
            foto.NOAN_NM_TITULO = fileName;
            foto.NOTI_CD_ID     = item.NOTI_CD_ID;

            item.NOTIFICACAO_ANEXO.Add(foto);
            objetoAntes = item;
            Int32 volta = baseApp.ValidateEdit(item, objetoAntes);

            return(RedirectToAction("VoltarAnexoNotificacaoGeral"));
        }
Пример #6
0
        public Int32 CreateNotificacao(NOTIFICACAO noti, USUARIO usuarioLogado)
        {
            try
            {
                //Completa campos
                USUARIO adm = _usuarioService.GetSindico(usuarioLogado.ASSI_CD_ID);
                noti.ASSI_CD_ID       = usuarioLogado.ASSI_CD_ID;
                noti.CANO_CD_ID       = 1;
                noti.NOTI_DT_EMISSAO  = DateTime.Today.Date;
                noti.NOTI_DT_VALIDADE = DateTime.Today.Date.AddDays(30);
                noti.NOTI_DT_VISTA    = null;
                noti.NOTI_IN_ATIVO    = 1;
                noti.NOTI_IN_STATUS   = 1;
                noti.NOTI_IN_NIVEL    = 1;
                noti.NOTI_IN_VISTA    = 0;
                noti.NOTI_NM_TITULO   = "Solicição de Alteração de Cadastro";
                noti.USUA_CD_ID       = adm.USUA_CD_ID;

                // Gera Notificação
                Int32 volta = _notiService.Create(noti);

                //// Recupera template e-mail
                //String header = _usuarioService.GetTemplate("SOLCAD").TEMP_TX_CABECALHO;
                //String body = _usuarioService.GetTemplate("SOLCAD").TEMP_TX_CORPO;
                //String data = _usuarioService.GetTemplate("SOLCAD").TEMP_TX_DADOS;

                //// Prepara dados do e-mail
                //header = header.Replace("{Nome}", adm.USUA_NM_NOME);
                //data = data.Replace("{Data}", DateTime.Today.Date.ToLongDateString());
                //data = data.Replace("{Usuario}", usuarioLogado.USUA_NM_NOME);
                //data = data.Replace("{Solicitacao}", noti.NOTI_TX_TEXTO);

                //// Concatena
                //String emailBody = header + body + data;

                //// Prepara e-mail e enviar
                //CONFIGURACAO conf = _usuarioService.CarregaConfiguracao(usuarioLogado.ASSI_CD_ID);
                //Email mensagem = new Email();
                //mensagem.ASSUNTO = "Solicitacao de Alteracao Cadastral";
                //mensagem.CORPO = emailBody;
                //mensagem.DEFAULT_CREDENTIALS = false;
                //mensagem.EMAIL_DESTINO = adm.USUA_NM_EMAIL;
                //mensagem.EMAIL_EMISSOR = conf.CONF_NM_EMAIL_EMISSOO;
                //mensagem.ENABLE_SSL = true;
                //mensagem.NOME_EMISSOR = "Sistema";
                //mensagem.PORTA = conf.CONF_NM_PORTA_SMTP;
                //mensagem.PRIORIDADE = System.Net.Mail.MailPriority.High;
                //mensagem.SENHA_EMISSOR = conf.CONF_NM_SENHA_EMISSOR;
                //mensagem.SMTP = conf.CONF_NM_HOST_SMTP;

                //// Envia e-mail
                //Int32 voltaMail = CommunicationPackage.SendEmail(mensagem);
                return(volta);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public ActionResult Index()
        {
            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            NOTIFICACAO          item = new NOTIFICACAO();
            NotificacaoViewModel vm   = Mapper.Map <NOTIFICACAO, NotificacaoViewModel>(item);

            return(View(vm));
        }
        public ActionResult MontarTelaNotificacao()
        {
            // Carrega listas
            USUARIO usuario = new USUARIO();

            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            if ((USUARIO)Session["UserCredentials"] != null)
            {
                usuario = (USUARIO)Session["UserCredentials"];

                // Verfifica permissão
                if (usuario.PERFIL.PERF_SG_SIGLA != "ADM")
                {
                    Session["MensAcesso"] = 2;
                    return(RedirectToAction("CarregarBase", "BaseAdmin"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Int32 idAss = (Int32)Session["IdAssinante"];

            if ((List <NOTIFICACAO>)Session["ListaNotificacao"] == null)
            {
                listaMaster = baseApp.GetAllItensUser(usuario.USUA_CD_ID, idAss);
                Session["ListaNotificacao"]  = listaMaster;
                Session["FiltroNotificacao"] = null;
            }
            ViewBag.Listas = (List <NOTIFICACAO>)Session["ListaNotificacao"];
            ViewBag.Perfil = usuario.PERFIL.PERF_SG_SIGLA;
            ViewBag.Title  = "Notificações";
            ViewBag.Cats   = new SelectList(baseApp.GetAllCategorias(), "CANO_CD_ID", "CANO_NM_NOME");

            // Indicadores
            ViewBag.Notificacoes = baseApp.GetNotificacaoNovas(usuario.USUA_CD_ID, idAss).Count;

            // Mensagem
            if ((Int32)Session["MensNotificacao"] == 1)
            {
                ModelState.AddModelError("", SMS_Resource.ResourceManager.GetString("M0016", CultureInfo.CurrentCulture));
            }

            // Abre view
            Session["MensNotificacao"]  = 0;
            Session["VoltaNotificacao"] = 1;
            objeto = new NOTIFICACAO();
            objeto.NOTI_DT_EMISSAO = DateTime.Today.Date;
            return(View(objeto));
        }
        public ActionResult SolicitarAlteracao()
        {
            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Int32 idAss = (Int32)Session["IdAssinante"];

            Session["Usuarios"] = baseApp.GetAllUsuarios(idAss);
            NOTIFICACAO noti = new NOTIFICACAO();

            noti.ASSI_CD_ID = idAss;
            return(View(noti));
        }
        public ActionResult SolicitarAlteracao(NOTIFICACAO noti)
        {
            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Int32 idAss = (Int32)Session["IdAssinante"];

            Session["Usuarios"] = baseApp.GetAllUsuarios(idAss);

            // Executa a operação
            USUARIO usuarioLogado = (USUARIO)Session["UserCredentials"];
            Int32   volta         = baseApp.CreateNotificacao(noti, usuarioLogado);

            // Sucesso
            return(RedirectToAction("MontarTelaPerfilUsuario"));
        }
        public ActionResult SlideShowNotificacao()
        {
            // Prepara view
            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Int32 idNot = (Int32)Session["IdVolta"];
            Int32 idAss = (Int32)Session["IdAssinante"];

            NOTIFICACAO item = baseApp.GetItemById(idNot);

            objetoAntes = item;
            NotificacaoViewModel vm = Mapper.Map <NOTIFICACAO, NotificacaoViewModel>(item);

            return(View(vm));
        }
        public ActionResult IncluirNotificacao(NotificacaoViewModel vm)
        {
            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Int32 idAss = (Int32)Session["IdAssinante"];

            ViewBag.Cats = new SelectList(baseApp.GetAllCategorias(), "CANO_CD_ID", "CANO_NM_NOME");
            ViewBag.Usus = new SelectList(usuApp.GetAllItens(idAss), "USUA_CD_ID", "USUA_NM_NOME");
            if (ModelState.IsValid)
            {
                try
                {
                    // Executa a operação
                    NOTIFICACAO item          = Mapper.Map <NotificacaoViewModel, NOTIFICACAO>(vm);
                    USUARIO     usuarioLogado = (USUARIO)Session["UserCredentials"];
                    Int32       volta         = baseApp.ValidateCreate(item, usuarioLogado, idAss);

                    // Verifica retorno

                    // Cria pastas
                    String caminho = "/Imagens/" + idAss.ToString() + "/Notificacao/" + item.NOTI_CD_ID.ToString() + "/Anexos/";
                    Directory.CreateDirectory(Server.MapPath(caminho));

                    // Sucesso
                    listaMaster = new List <NOTIFICACAO>();
                    Session["ListaNotificacao"]   = null;
                    Session["VoltaNotificacao"]   = 1;
                    Session["IdNotificacaoVolta"] = item.NOTI_CD_ID;
                    Session["Notificacao"]        = item;
                    Session["MensNotificacao"]    = 0;
                    return(RedirectToAction("MontarTelaNotificacaoGeral"));
                }
                catch (Exception ex)
                {
                    ViewBag.Message = ex.Message;
                    return(View(vm));
                }
            }
            else
            {
                return(View(vm));
            }
        }
        public ActionResult VerNotificacao(Int32 id)
        {
            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Session["IdVolta"] = id;
            Session["IdVolta"] = id;
            NOTIFICACAO item = baseApp.GetItemById(id);

            item.NOTI_IN_VISTA = 1;
            item.NOTI_DT_VISTA = DateTime.Now;
            objetoAntes        = item;
            Int32 volta = baseApp.ValidateEdit(item, objetoAntes);

            NotificacaoViewModel vm = Mapper.Map <NOTIFICACAO, NotificacaoViewModel>(item);

            return(View(vm));
        }
        public ActionResult IncluirNotificacao()
        {
            USUARIO usuario = new USUARIO();

            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            if ((USUARIO)Session["UserCredentials"] != null)
            {
                usuario = (USUARIO)Session["UserCredentials"];

                // Verfifica permissão
                if (usuario.PERFIL.PERF_SG_SIGLA != "ADM")
                {
                    Session["MensAcesso"] = 2;
                    return(RedirectToAction("CarregarBase", "BaseAdmin"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Int32 idAss = (Int32)Session["IdAssinante"];

            // Prepara listas
            ViewBag.Cats = new SelectList(baseApp.GetAllCategorias(), "CANO_CD_ID", "CANO_NM_NOME");
            ViewBag.Usus = new SelectList(usuApp.GetAllItens(idAss), "USUA_CD_ID", "USUA_NM_NOME");

            // Prepara view
            NOTIFICACAO          item = new NOTIFICACAO();
            NotificacaoViewModel vm   = Mapper.Map <NOTIFICACAO, NotificacaoViewModel>(item);

            vm.NOTI_DT_EMISSAO  = DateTime.Today.Date;
            vm.NOTI_IN_ATIVO    = 1;
            vm.ASSI_CD_ID       = idAss;
            vm.NOTI_DT_VALIDADE = DateTime.Today.Date.AddDays(30);
            vm.NOTI_IN_NIVEL    = 1;
            vm.NOTI_IN_VISTA    = 0;
            return(View(vm));
        }
        public ActionResult EditarNotificacao(Int32 id)
        {
            USUARIO usuario = new USUARIO();

            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            if ((USUARIO)Session["UserCredentials"] != null)
            {
                usuario = (USUARIO)Session["UserCredentials"];

                // Verfifica permissão
                if (usuario.PERFIL.PERF_SG_SIGLA != "ADM")
                {
                    Session["MensAcesso"] = 2;
                    return(RedirectToAction("CarregarBase", "BaseAdmin"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Int32 idAss = (Int32)Session["IdAssinante"];

            // Prepara view
            ViewBag.Cats = new SelectList(baseApp.GetAllCategorias(), "CANO_CD_ID", "CANO_NM_NOME");
            ViewBag.Usus = new SelectList(usuApp.GetAllItens(idAss), "USUA_CD_ID", "USUA_NM_NOME");

            NOTIFICACAO item = baseApp.GetItemById(id);

            objetoAntes            = item;
            Session["Notificacao"] = item;
            Session["IdVolta"]     = id;
            NotificacaoViewModel vm = Mapper.Map <NOTIFICACAO, NotificacaoViewModel>(item);

            return(View(vm));
        }
        public ActionResult EditarNotificacao(NotificacaoViewModel vm)
        {
            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Int32 idAss = (Int32)Session["IdAssinante"];

            ViewBag.Cats = new SelectList(baseApp.GetAllCategorias(), "CANO_CD_ID", "CANO_NM_NOME");
            ViewBag.Usus = new SelectList(usuApp.GetAllItens(idAss), "USUA_CD_ID", "USUA_NM_NOME");
            if (ModelState.IsValid)
            {
                try
                {
                    // Executa a operação
                    USUARIO     usuarioLogado = (USUARIO)Session["UserCredentials"];
                    NOTIFICACAO item          = Mapper.Map <NotificacaoViewModel, NOTIFICACAO>(vm);
                    Int32       volta         = baseApp.ValidateEdit(item, objetoAntes, usuarioLogado, idAss);

                    // Verifica retorno

                    // Sucesso
                    listaMaster = new List <NOTIFICACAO>();
                    Session["ListaNotificacao"] = null;
                    Session["MensNotificacao"]  = 0;
                    return(RedirectToAction("MontarTelaNotificacaoGeral"));
                }
                catch (Exception ex)
                {
                    ViewBag.Message = ex.Message;
                    return(View(vm));
                }
            }
            else
            {
                return(View(vm));
            }
        }
        public ActionResult GerarRelatorioDetalhe()
        {
            // Prepara geração
            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Int32 idAss = (Int32)Session["IdAssinante"];
            Int32 idNot = (Int32)Session["IdVolta"];

            NOTIFICACAO aten = baseApp.GetItemById(idNot);
            String      data = DateTime.Today.Date.ToShortDateString();

            data = data.Substring(0, 2) + data.Substring(3, 2) + data.Substring(6, 4);
            String nomeRel     = "Notificacao_" + aten.NOTI_CD_ID.ToString() + "_" + data + ".pdf";
            Font   meuFont     = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);
            Font   meuFont1    = FontFactory.GetFont("Arial", 9, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);
            Font   meuFont2    = FontFactory.GetFont("Arial", 12, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);
            Font   meuFontBold = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, BaseColor.BLACK);

            // Cria documento
            Document  pdfDoc    = new Document(PageSize.A4, 10, 10, 10, 10);
            PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDoc, Response.OutputStream);

            pdfDoc.Open();

            // Linha horizontal
            Paragraph line1 = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.BLUE, Element.ALIGN_LEFT, 1)));

            pdfDoc.Add(line1);

            // Cabeçalho
            PdfPTable table = new PdfPTable(5);

            table.WidthPercentage     = 100;
            table.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
            table.SpacingBefore       = 1f;
            table.SpacingAfter        = 1f;

            PdfPCell cell = new PdfPCell();

            cell.Border = 0;
            Image image = Image.GetInstance(Server.MapPath("~/Images/LogoSMS.jpg"));

            image.ScaleAbsolute(50, 50);
            cell.AddElement(image);
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph("Notificação - Detalhes", meuFont2))
            {
                VerticalAlignment   = Element.ALIGN_MIDDLE,
                HorizontalAlignment = Element.ALIGN_CENTER
            };
            cell.Border  = 0;
            cell.Colspan = 4;
            table.AddCell(cell);

            pdfDoc.Add(table);

            // Linha Horizontal
            line1 = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.BLUE, Element.ALIGN_LEFT, 1)));
            pdfDoc.Add(line1);
            line1 = new Paragraph("  ");
            pdfDoc.Add(line1);

            // Dados Gerais
            table = new PdfPTable(new float[] { 120f, 120f, 120f, 120f });
            table.WidthPercentage     = 100;
            table.HorizontalAlignment = 0;
            table.SpacingBefore       = 1f;
            table.SpacingAfter        = 1f;

            cell                     = new PdfPCell(new Paragraph("Dados Gerais", meuFontBold));
            cell.Border              = 0;
            cell.Colspan             = 4;
            cell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            table.AddCell(cell);

            cell                     = new PdfPCell(new Paragraph("Destinatário: " + aten.USUARIO.USUA_NM_NOME, meuFont));
            cell.Border              = 0;
            cell.Colspan             = 2;
            cell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            table.AddCell(cell);
            cell                     = new PdfPCell(new Paragraph("Categoria: " + aten.CATEGORIA_NOTIFICACAO.CANO_NM_NOME, meuFont));
            cell.Border              = 0;
            cell.Colspan             = 2;
            cell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            table.AddCell(cell);

            cell                     = new PdfPCell(new Paragraph("Título: " + aten.NOTI_NM_TITULO, meuFont));
            cell.Border              = 0;
            cell.Colspan             = 4;
            cell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            table.AddCell(cell);

            if (aten.NOTI_DT_EMISSAO != null)
            {
                cell                     = new PdfPCell(new Paragraph("Emissão: " + aten.NOTI_DT_EMISSAO.Value.ToShortDateString(), meuFont));
                cell.Border              = 0;
                cell.Colspan             = 1;
                cell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                table.AddCell(cell);
            }
            else
            {
                cell                     = new PdfPCell(new Paragraph("Emissão: -", meuFont));
                cell.Border              = 0;
                cell.Colspan             = 1;
                cell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                table.AddCell(cell);
            }
            if (aten.NOTI_DT_VALIDADE != null)
            {
                cell                     = new PdfPCell(new Paragraph("Validade: " + aten.NOTI_DT_VALIDADE.Value.ToShortDateString(), meuFont));
                cell.Border              = 0;
                cell.Colspan             = 1;
                cell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                table.AddCell(cell);
            }
            else
            {
                cell                     = new PdfPCell(new Paragraph("Validade: -", meuFont));
                cell.Border              = 0;
                cell.Colspan             = 1;
                cell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                table.AddCell(cell);
            }
            if (aten.NOTI_DT_VISTA != null)
            {
                cell                     = new PdfPCell(new Paragraph("Data de Visualização: " + aten.NOTI_DT_VISTA.Value.ToShortDateString(), meuFont));
                cell.Border              = 0;
                cell.Colspan             = 2;
                cell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                table.AddCell(cell);
            }
            else
            {
                cell                     = new PdfPCell(new Paragraph("Data de Visualização: -", meuFont));
                cell.Border              = 0;
                cell.Colspan             = 2;
                cell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                table.AddCell(cell);
            }

            cell                     = new PdfPCell(new Paragraph("Conteúdo: " + aten.NOTI_TX_TEXTO, meuFont));
            cell.Border              = 0;
            cell.Colspan             = 4;
            cell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            table.AddCell(cell);
            pdfDoc.Add(table);

            // Linha Horizontal
            line1 = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.BLUE, Element.ALIGN_LEFT, 1)));
            pdfDoc.Add(line1);

            // Finaliza
            pdfWriter.CloseStream = false;
            pdfDoc.Close();
            Response.Buffer      = true;
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=" + nomeRel);
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Write(pdfDoc);
            Response.End();

            return(RedirectToAction("VoltarAnexoNotificacao"));
        }
Пример #18
0
        public Int32 GenerateNewPassword(String email)
        {
            // Checa email
            if (!ValidarItensDiversos.IsValidEmail(email))
            {
                return(1);
            }
            USUARIO usuario = _usuarioService.RetriveUserByEmail(email);

            if (usuario == null)
            {
                return(2);
            }

            // Verifica se usuário está ativo
            if (usuario.USUA_IN_ATIVO == 0)
            {
                return(3);
            }

            // Verifica se usuário não está bloqueado
            if (usuario.USUA_IN_BLOQUEADO == 1)
            {
                return(4);
            }

            // Gera nova senha
            String senha = Cryptography.GenerateRandomPassword(6);

            // Atauliza objeto
            //usuario.USUA_NM_SENHA = Cryptography.Encode(senha);
            usuario.USUA_NM_SENHA            = senha;
            usuario.USUA_IN_PROVISORIO       = 1;
            usuario.USUA_DT_ALTERACAO        = DateTime.Now;
            usuario.USUA_DT_TROCA_SENHA      = DateTime.Now;
            usuario.USUA_IN_LOGIN_PROVISORIO = 0;

            // Monta log
            LOG log = new LOG();

            log.LOG_DT_DATA     = DateTime.Now;
            log.LOG_NM_OPERACAO = "NewPWD";
            log.ASSI_CD_ID      = usuario.ASSI_CD_ID;
            log.LOG_TX_REGISTRO = senha;
            log.LOG_IN_ATIVO    = 1;

            // Gera Notificação
            NOTIFICACAO noti = new NOTIFICACAO();

            noti.CANO_CD_ID       = 1;
            noti.ASSI_CD_ID       = usuario.ASSI_CD_ID;
            noti.NOTI_DT_EMISSAO  = DateTime.Today;
            noti.NOTI_DT_VALIDADE = DateTime.Today.Date.AddDays(30);
            noti.NOTI_IN_VISTA    = 0;
            noti.NOTI_NM_TITULO   = "Geração de Nova Senha";
            noti.NOTI_IN_ATIVO    = 1;
            noti.NOTI_TX_TEXTO    = "ATENÇÃO: Sua solicitação de nova senha foi atendida em " + DateTime.Today.Date.ToLongDateString() + ". Verifique no seu e-mail cadastrado no sistema.";
            noti.USUA_CD_ID       = usuario.USUA_CD_ID;
            noti.NOTI_IN_STATUS   = 1;
            Int32 volta1 = _notiService.Create(noti);

            // Recupera template e-mail
            String header = _usuarioService.GetTemplate("NEWPWD").TEMP_TX_CABECALHO;
            String body   = _usuarioService.GetTemplate("NEWPWD").TEMP_TX_CORPO;
            String data   = _usuarioService.GetTemplate("NEWPWD").TEMP_TX_DADOS;

            // Prepara dados do e-mail
            header = header.Replace("{Nome}", usuario.USUA_NM_NOME);
            data   = data.Replace("{Data}", usuario.USUA_DT_TROCA_SENHA.Value.ToLongDateString());
            data   = data.Replace("{Senha}", usuario.USUA_NM_SENHA);

            // Concatena
            String emailBody = header + body + data;

            // Prepara e-mail e enviar
            CONFIGURACAO conf     = _usuarioService.CarregaConfiguracao(usuario.ASSI_CD_ID);
            Email        mensagem = new Email();

            mensagem.ASSUNTO             = "Geração de Nova Senha";
            mensagem.CORPO               = emailBody;
            mensagem.DEFAULT_CREDENTIALS = false;
            mensagem.EMAIL_DESTINO       = usuario.USUA_NM_EMAIL;
            mensagem.EMAIL_EMISSOR       = conf.CONF_NM_EMAIL_EMISSOO;
            mensagem.ENABLE_SSL          = true;
            mensagem.NOME_EMISSOR        = "Sistema";
            mensagem.PORTA               = conf.CONF_NM_PORTA_SMTP;
            mensagem.PRIORIDADE          = System.Net.Mail.MailPriority.High;
            mensagem.SENHA_EMISSOR       = conf.CONF_NM_SENHA_EMISSOR;
            mensagem.SMTP = conf.CONF_NM_HOST_SMTP;

            // Envia e-mail
            Int32 voltaMail = CommunicationPackage.SendEmail(mensagem);

            // Atualiza usuario
            Int32 volta = _usuarioService.EditUser(usuario);

            // Retorna sucesso
            return(0);
        }
Пример #19
0
        public Int32 ValidateChangePassword(USUARIO usuario)
        {
            try
            {
                // Checa preenchimento
                if (String.IsNullOrEmpty(usuario.USUA_NM_NOVA_SENHA))
                {
                    return(3);
                }
                if (String.IsNullOrEmpty(usuario.USUA_NM_SENHA_CONFIRMA))
                {
                    return(4);
                }

                // Verifica se senha igual a anterior
                if (usuario.USUA_NM_SENHA == usuario.USUA_NM_NOVA_SENHA)
                {
                    return(1);
                }

                // Verifica se senha foi confirmada
                if (usuario.USUA_NM_NOVA_SENHA != usuario.USUA_NM_SENHA_CONFIRMA)
                {
                    return(2);
                }

                //Completa e acerta campos
                //usuario.USUA_NM_SENHA = Cryptography.Encode(usuario.USUA_NM_NOVA_SENHA);
                usuario.USUA_NM_SENHA            = usuario.USUA_NM_NOVA_SENHA;
                usuario.USUA_DT_TROCA_SENHA      = DateTime.Now.Date;
                usuario.USUA_IN_BLOQUEADO        = 0;
                usuario.USUA_IN_PROVISORIO       = 0;
                usuario.USUA_IN_LOGIN_PROVISORIO = 0;
                usuario.USUA_NR_ACESSOS          = 0;
                usuario.USUA_NR_FALHAS           = 0;
                usuario.USUA_DT_ALTERACAO        = null;
                usuario.USUA_DT_BLOQUEADO        = null;
                usuario.USUA_DT_TROCA_SENHA      = null;
                usuario.USUA_DT_ACESSO           = DateTime.Now;
                usuario.USUA_DT_CADASTRO         = DateTime.Now;
                usuario.USUA_IN_ATIVO            = 1;
                usuario.USUA_DT_ULTIMA_FALHA     = null;
                usuario.ASSI_CD_ID = usuario.ASSI_CD_ID;

                // Gera Notificação
                NOTIFICACAO noti = new NOTIFICACAO();
                noti.CANO_CD_ID       = 1;
                noti.ASSI_CD_ID       = usuario.ASSI_CD_ID;
                noti.NOTI_DT_EMISSAO  = DateTime.Today;
                noti.NOTI_DT_VALIDADE = DateTime.Today.Date.AddDays(30);
                noti.NOTI_IN_VISTA    = 0;
                noti.NOTI_NM_TITULO   = "Alteração de Senha";
                noti.NOTI_IN_ATIVO    = 1;
                noti.NOTI_IN_NIVEL    = 1;
                noti.NOTI_TX_TEXTO    = "ATENÇÃO: A sua senha foi alterada em " + DateTime.Today.Date.ToLongDateString() + ".";
                noti.USUA_CD_ID       = usuario.USUA_CD_ID;
                noti.NOTI_IN_STATUS   = 1;
                Int32 volta1 = _notiService.Create(noti);


                //Monta Log
                LOG log = new LOG
                {
                    LOG_DT_DATA     = DateTime.Now,
                    ASSI_CD_ID      = usuario.ASSI_CD_ID,
                    USUA_CD_ID      = usuario.USUA_CD_ID,
                    LOG_NM_OPERACAO = "ChangePWD",
                    LOG_TX_REGISTRO = Serialization.SerializeJSON <USUARIO>(usuario),
                };

                // Persiste
                return(_usuarioService.EditUser(usuario));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #20
0
        public Int32 ValidateCreate(USUARIO usuario, USUARIO usuarioLogado)
        {
            try
            {
                // Verifica senhas
                if (usuario.USUA_NM_SENHA != usuario.USUA_NM_SENHA_CONFIRMA)
                {
                    return(1);
                }

                // Verifica Email
                if (!ValidarItensDiversos.IsValidEmail(usuario.USUA_NM_EMAIL))
                {
                    return(2);
                }

                // Verifica existencia prévia
                if (_usuarioService.GetByEmail(usuario.USUA_NM_EMAIL) != null)
                {
                    return(3);
                }
                if (_usuarioService.GetByLogin(usuario.USUA_NM_LOGIN) != null)
                {
                    return(4);
                }

                // Verifica admissão e demissão
                if (usuario.USUA_DT_ENTRADA != null)
                {
                    if (usuario.USUA_DT_ENTRADA.Value > DateTime.Today.Date)
                    {
                        return(5);
                    }
                }
                if (usuario.USUA_DT_SAIDA != null)
                {
                    if (usuario.USUA_DT_SAIDA.Value > DateTime.Today.Date)
                    {
                        return(6);
                    }
                    if (usuario.USUA_DS_MOTIVO_SAIDA == null)
                    {
                        return(7);
                    }
                }
                if (usuario.USUA_IN_RESPONSAVEL == 1)
                {
                    if (_usuarioService.GetResponsavel(usuario) != null)
                    {
                        return(8);
                    }
                }

                //Completa campos de usuários
                String senha = Cryptography.GenerateRandomPassword(6);
                usuario.USUA_NM_SENHA = senha;
                usuario.USUA_NM_LOGIN = usuario.USUA_NM_NOME.Substring(0, 4);
                //usuario.USUA_NM_SENHA = Cryptography.Encode(usuario.USUA_NM_SENHA);
                usuario.USUA_IN_BLOQUEADO        = 0;
                usuario.USUA_IN_PROVISORIO       = 0;
                usuario.USUA_IN_LOGIN_PROVISORIO = 0;
                usuario.USUA_NR_ACESSOS          = 0;
                usuario.USUA_NR_FALHAS           = 0;
                usuario.USUA_DT_ALTERACAO        = null;
                usuario.USUA_DT_BLOQUEADO        = null;
                usuario.USUA_DT_TROCA_SENHA      = null;
                usuario.USUA_DT_ACESSO           = DateTime.Now;
                usuario.USUA_DT_CADASTRO         = DateTime.Today.Date;
                usuario.USUA_IN_ATIVO            = 1;
                usuario.USUA_DT_ULTIMA_FALHA     = DateTime.Now;
                usuario.ASSI_CD_ID           = usuarioLogado.ASSI_CD_ID;
                usuario.USUA_DS_MOTIVO_SAIDA = null;
                usuario.USUA_IN_LOGADO       = 0;
                usuario.USUA_NR_MATRICULA    = null;

                // Monta Log
                LOG log = new LOG
                {
                    LOG_DT_DATA     = DateTime.Now,
                    USUA_CD_ID      = usuarioLogado.USUA_CD_ID,
                    ASSI_CD_ID      = usuarioLogado.ASSI_CD_ID,
                    LOG_NM_OPERACAO = "AddUSUA",
                    LOG_TX_REGISTRO = Serialization.SerializeJSON <USUARIO>(usuario),
                    LOG_IN_ATIVO    = 1
                };

                // Persiste
                Int32 volta = _usuarioService.CreateUser(usuario, log);

                // Gerar Notificação
                NOTIFICACAO noti = new NOTIFICACAO();
                noti.CANO_CD_ID       = 1;
                noti.ASSI_CD_ID       = usuario.ASSI_CD_ID;
                noti.NOTI_DT_EMISSAO  = DateTime.Today;
                noti.NOTI_DT_VALIDADE = DateTime.Today.Date.AddDays(30);
                noti.NOTI_IN_VISTA    = 0;
                noti.NOTI_NM_TITULO   = "Criação de Usuário";
                noti.NOTI_IN_ATIVO    = 1;
                noti.NOTI_IN_NIVEL    = 1;
                noti.NOTI_TX_TEXTO    = "ATENÇÃO: Usuário" + usuario.USUA_NM_NOME + " criado em " + DateTime.Today.Date.ToLongDateString() + ". Perfil: " + usuario.PERFIL.PERF_NM_NOME + ". Login: "******". Senha: " + usuario.USUA_NM_SENHA + ". Essa senha é provisória e poderá ser usada apenas uma vez, devendo ser alterada após o primeiro login.";
                noti.USUA_CD_ID       = usuario.USUA_CD_ID;
                noti.NOTI_IN_STATUS   = 1;
                Int32 volta1 = _notiService.Create(noti);

                // Recupera template e-mail
                TEMPLATE template = _usuarioService.GetTemplate("NEWUSR");
                String   header   = template.TEMP_TX_CABECALHO;
                String   body     = template.TEMP_TX_CORPO;
                String   data     = template.TEMP_TX_DADOS;

                // Prepara dados do e-mail
                data = data.Replace("{Nome}", usuario.USUA_NM_NOME);
                data = data.Replace("{Unidade}", usuario.UNIDADE.UNID_NM_EXIBE);
                data = data.Replace("{Perfil}", usuario.PERFIL.PERF_NM_NOME);
                data = data.Replace("{Data}", usuario.USUA_DT_CADASTRO.Value.ToLongDateString());
                data = data.Replace("{Login}", usuario.USUA_NM_LOGIN);
                data = data.Replace("{Senha}", usuario.USUA_NM_SENHA);

                // Concatena
                String emailBody = header + body + data;

                // Prepara e-mail e enviar
                CONFIGURACAO conf     = _usuarioService.CarregaConfiguracao(usuario.ASSI_CD_ID);
                Email        mensagem = new Email();
                mensagem.ASSUNTO             = "Inclusão de Usuário";
                mensagem.CORPO               = emailBody;
                mensagem.DEFAULT_CREDENTIALS = false;
                mensagem.EMAIL_DESTINO       = usuario.USUA_NM_EMAIL;
                mensagem.EMAIL_EMISSOR       = conf.CONF_NM_EMAIL_EMISSOO;
                mensagem.ENABLE_SSL          = true;
                mensagem.NOME_EMISSOR        = "Sistema";
                mensagem.PORTA               = conf.CONF_NM_PORTA_SMTP;
                mensagem.PRIORIDADE          = System.Net.Mail.MailPriority.High;
                mensagem.SENHA_EMISSOR       = conf.CONF_NM_SENHA_EMISSOR;
                mensagem.SMTP = conf.CONF_NM_HOST_SMTP;

                // Envia e-mail
                Int32 voltaMail = CommunicationPackage.SendEmail(mensagem);
                return(volta);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public ActionResult GerarRelatorioLista()
        {
            // Prepara geração
            if ((String)Session["Ativa"] == null)
            {
                return(RedirectToAction("Login", "ControleAcesso"));
            }
            Int32 idAss = (Int32)Session["IdAssinante"];

            String data = DateTime.Today.Date.ToShortDateString();

            data = data.Substring(0, 2) + data.Substring(3, 2) + data.Substring(6, 4);
            String             nomeRel = "NotificacaoLista" + "_" + data + ".pdf";
            List <NOTIFICACAO> lista   = (List <NOTIFICACAO>)Session["ListaNotificacao"];
            NOTIFICACAO        filtro  = (NOTIFICACAO)Session["FiltroNotificacao"];
            Font meuFont  = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);
            Font meuFont1 = FontFactory.GetFont("Arial", 9, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);
            Font meuFont2 = FontFactory.GetFont("Arial", 12, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);

            // Cria documento
            Document  pdfDoc    = new Document(PageSize.A4.Rotate(), 10, 10, 10, 10);
            PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDoc, Response.OutputStream);

            pdfDoc.Open();

            // Linha horizontal
            Paragraph line = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.BLUE, Element.ALIGN_LEFT, 1)));

            pdfDoc.Add(line);

            // Cabeçalho
            PdfPTable table = new PdfPTable(5);

            table.WidthPercentage     = 100;
            table.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
            table.SpacingBefore       = 1f;
            table.SpacingAfter        = 1f;

            PdfPCell cell = new PdfPCell();

            cell.Border = 0;
            Image image = Image.GetInstance(Server.MapPath("~/Images/logoSMS.jpg"));

            image.ScaleAbsolute(50, 50);
            cell.AddElement(image);
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph("Notificações - Listagem", meuFont2))
            {
                VerticalAlignment   = Element.ALIGN_MIDDLE,
                HorizontalAlignment = Element.ALIGN_CENTER
            };
            cell.Border  = 0;
            cell.Colspan = 4;
            table.AddCell(cell);
            pdfDoc.Add(table);

            // Linha Horizontal
            Paragraph line1 = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.BLUE, Element.ALIGN_LEFT, 1)));

            pdfDoc.Add(line1);
            line1 = new Paragraph("  ");
            pdfDoc.Add(line1);

            // Grid
            table = new PdfPTable(new float[] { 50f, 120f, 120f, 50f, 50f, 40f });
            table.WidthPercentage     = 100;
            table.HorizontalAlignment = 0;
            table.SpacingBefore       = 1f;
            table.SpacingAfter        = 1f;

            cell = new PdfPCell(new Paragraph("Notificações selecionadas pelos parametros de filtro abaixo", meuFont1))
            {
                VerticalAlignment = Element.ALIGN_MIDDLE, HorizontalAlignment = Element.ALIGN_LEFT
            };
            cell.Colspan         = 6;
            cell.BackgroundColor = BaseColor.LIGHT_GRAY;
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph("Categoria", meuFont))
            {
                VerticalAlignment   = Element.ALIGN_MIDDLE,
                HorizontalAlignment = Element.ALIGN_LEFT
            };
            cell.BackgroundColor = BaseColor.LIGHT_GRAY;
            table.AddCell(cell);
            cell = new PdfPCell(new Paragraph("Destinatário", meuFont))
            {
                VerticalAlignment   = Element.ALIGN_MIDDLE,
                HorizontalAlignment = Element.ALIGN_LEFT
            };
            cell.BackgroundColor = BaseColor.LIGHT_GRAY;
            table.AddCell(cell);
            cell = new PdfPCell(new Paragraph("Foto", meuFont))
            {
                VerticalAlignment   = Element.ALIGN_MIDDLE,
                HorizontalAlignment = Element.ALIGN_LEFT
            };
            cell.BackgroundColor = BaseColor.LIGHT_GRAY;
            table.AddCell(cell);
            cell = new PdfPCell(new Paragraph("Título", meuFont))
            {
                VerticalAlignment   = Element.ALIGN_MIDDLE,
                HorizontalAlignment = Element.ALIGN_LEFT
            };
            cell.BackgroundColor = BaseColor.LIGHT_GRAY;
            table.AddCell(cell);
            cell = new PdfPCell(new Paragraph("Emissão", meuFont))
            {
                VerticalAlignment   = Element.ALIGN_MIDDLE,
                HorizontalAlignment = Element.ALIGN_LEFT
            };
            cell.BackgroundColor = BaseColor.LIGHT_GRAY;
            table.AddCell(cell);
            cell = new PdfPCell(new Paragraph("Validade", meuFont))
            {
                VerticalAlignment   = Element.ALIGN_MIDDLE,
                HorizontalAlignment = Element.ALIGN_LEFT
            };
            cell.BackgroundColor = BaseColor.LIGHT_GRAY;
            table.AddCell(cell);
            cell = new PdfPCell(new Paragraph("Lida?", meuFont))
            {
                VerticalAlignment   = Element.ALIGN_MIDDLE,
                HorizontalAlignment = Element.ALIGN_LEFT
            };
            cell.BackgroundColor = BaseColor.LIGHT_GRAY;
            table.AddCell(cell);

            foreach (NOTIFICACAO item in lista)
            {
                cell = new PdfPCell(new Paragraph(item.CATEGORIA_NOTIFICACAO.CANO_NM_NOME, meuFont))
                {
                    VerticalAlignment = Element.ALIGN_MIDDLE, HorizontalAlignment = Element.ALIGN_LEFT
                };
                table.AddCell(cell);
                cell = new PdfPCell(new Paragraph(item.USUARIO.USUA_NM_NOME, meuFont))
                {
                    VerticalAlignment = Element.ALIGN_MIDDLE, HorizontalAlignment = Element.ALIGN_LEFT
                };
                table.AddCell(cell);
                if (System.IO.File.Exists(Server.MapPath(item.USUARIO.USUA_AQ_FOTO)))
                {
                    cell  = new PdfPCell();
                    image = Image.GetInstance(Server.MapPath(item.USUARIO.USUA_AQ_FOTO));
                    image.ScaleAbsolute(20, 20);
                    cell.AddElement(image);
                    table.AddCell(cell);
                }
                else
                {
                    cell = new PdfPCell(new Paragraph("-", meuFont))
                    {
                        VerticalAlignment   = Element.ALIGN_MIDDLE,
                        HorizontalAlignment = Element.ALIGN_LEFT
                    };
                    table.AddCell(cell);
                }
                cell = new PdfPCell(new Paragraph(item.NOTI_NM_TITULO, meuFont))
                {
                    VerticalAlignment   = Element.ALIGN_MIDDLE,
                    HorizontalAlignment = Element.ALIGN_LEFT
                };
                table.AddCell(cell);
                cell = new PdfPCell(new Paragraph(item.NOTI_DT_EMISSAO.Value.ToShortDateString(), meuFont))
                {
                    VerticalAlignment   = Element.ALIGN_MIDDLE,
                    HorizontalAlignment = Element.ALIGN_LEFT
                };
                table.AddCell(cell);
                if (item.NOTI_DT_VALIDADE != null)
                {
                    cell = new PdfPCell(new Paragraph(item.NOTI_DT_VALIDADE.Value.ToShortDateString(), meuFont))
                    {
                        VerticalAlignment   = Element.ALIGN_MIDDLE,
                        HorizontalAlignment = Element.ALIGN_LEFT
                    };
                    table.AddCell(cell);
                }
                else
                {
                    cell = new PdfPCell(new Paragraph("-", meuFont))
                    {
                        VerticalAlignment   = Element.ALIGN_MIDDLE,
                        HorizontalAlignment = Element.ALIGN_LEFT
                    };
                    table.AddCell(cell);
                }
                if (item.NOTI_IN_VISTA == 1)
                {
                    cell = new PdfPCell(new Paragraph("Sim", meuFont))
                    {
                        VerticalAlignment   = Element.ALIGN_MIDDLE,
                        HorizontalAlignment = Element.ALIGN_LEFT
                    };
                    table.AddCell(cell);
                }
                else
                {
                    cell = new PdfPCell(new Paragraph("Não", meuFont))
                    {
                        VerticalAlignment   = Element.ALIGN_MIDDLE,
                        HorizontalAlignment = Element.ALIGN_LEFT
                    };
                    table.AddCell(cell);
                }
            }
            pdfDoc.Add(table);

            // Linha Horizontal
            Paragraph line2 = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.BLUE, Element.ALIGN_LEFT, 1)));

            pdfDoc.Add(line2);

            // Rodapé
            Chunk chunk1 = new Chunk("Parâmetros de filtro: ", FontFactory.GetFont("Arial", 10, Font.NORMAL, BaseColor.BLACK));

            pdfDoc.Add(chunk1);

            String parametros = String.Empty;
            Int32  ja         = 0;

            if (filtro != null)
            {
                if (filtro.NOTI_NM_TITULO != null)
                {
                    parametros += "Título: " + filtro.NOTI_NM_TITULO;
                    ja          = 1;
                }
                if (filtro.NOTI_DT_EMISSAO != null)
                {
                    if (ja == 0)
                    {
                        parametros += "Data: " + filtro.NOTI_DT_EMISSAO.Value.ToShortDateString();
                        ja          = 1;
                    }
                    else
                    {
                        parametros += " e Data: " + filtro.NOTI_DT_EMISSAO.Value.ToShortDateString();
                    }
                }
                if (filtro.NOTI_TX_TEXTO != null)
                {
                    if (ja == 0)
                    {
                        parametros += "Conteúdo: " + filtro.NOTI_TX_TEXTO;
                        ja          = 1;
                    }
                    else
                    {
                        parametros += " e Conteúdo: " + filtro.NOTI_TX_TEXTO;
                    }
                }
                if (ja == 0)
                {
                    parametros = "Nenhum filtro definido.";
                }
            }
            else
            {
                parametros = "Nenhum filtro definido.";
            }
            Chunk chunk = new Chunk(parametros, FontFactory.GetFont("Arial", 9, Font.NORMAL, BaseColor.BLACK));

            pdfDoc.Add(chunk);

            // Linha Horizontal
            Paragraph line3 = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.BLUE, Element.ALIGN_LEFT, 1)));

            pdfDoc.Add(line3);

            // Finaliza
            pdfWriter.CloseStream = false;
            pdfDoc.Close();
            Response.Buffer      = true;
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=" + nomeRel);
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Write(pdfDoc);
            Response.End();

            return(RedirectToAction("MontarTelaNotificacaoGeral"));
        }