Exemple #1
0
        public void Visualizar(Int32 IdNoticia)
        {
            EntNoticia objNoticia = new BllNoticia().ObterPorId(IdNoticia);

            this.ObjectToPage(objNoticia);
            this.Show();
        }
Exemple #2
0
        private Boolean Gravar()
        {
            EntNoticia objNoticia = new EntNoticia();

            if (!this.PageToObject(objNoticia))
            {
                objNoticia.UrlImagem = HddnFldArquivo.Value;
            }

            try
            {
                //Verifica se é Insert ou Update
                if (objNoticia.IdNoticia == 0)
                {
                    objNoticia = new BllNoticia().Inserir(objNoticia);
                    MessageBox(this.Page, "Notícia inserida com sucesso!");
                }
                else
                {
                    new BllNoticia().Alterar(objNoticia);
                    MessageBox(this.Page, "Notícia alterada com sucesso!");
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox(this.Page, "Erro ao tentar Gravar a Notícia!");
                return(false);
            }
        }
Exemple #3
0
        private void PopulaGridNoticia()
        {
            EntNoticia objNoticia = new EntNoticia();

            this.PageToObject(objNoticia);

            ListaGrid = new BllNoticia().ObterPorFiltro(objNoticia);
            this.AtualizaGrid();
        }
Exemple #4
0
        private void ObjectToPage()
        {
            EntNoticia objNoticia = new EntNoticia();

            objNoticia.Noticia = TxtBxTitulo.Text;
            objNoticia.DataCadastroFiltroInicial = StringUtils.ToDate(this.TxtBxDataInicio.Text);
            objNoticia.DataCadastroFiltroFinal   = StringUtils.ToDateFim(this.TxtBxDataFim.Text);

            if (this.EmpresaLogada.IdEmpresaCadastro > 0)
            {
                ListaGrid = new BllNoticia().ObterPorEmpresa(EmpresaLogada.Estado.IdEstado, objPrograma.IdPrograma, objTurma.IdTurma, objNoticia.Noticia, objNoticia.DataCadastroFiltroInicial, objNoticia.DataCadastroFiltroFinal);
            }
            else if (UsuarioLogado.IdUsuario > 0)
            {
                ListaGrid = new BllNoticia().ObterPorFiltrosAdministrativo(UsuarioLogado.IdUsuario, UsuarioLogado.Estado.IdEstado, objPrograma.IdPrograma, objTurma.IdTurma, objNoticia.Noticia, objNoticia.DataCadastroFiltroInicial, objNoticia.DataCadastroFiltroFinal);
            }
        }
Exemple #5
0
        protected void grdNoticia_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                DataKey dk = grdNoticia.DataKeys[e.RowIndex];

                EntNoticia objNoticia = new BllNoticia().ObterPorId(ObjectUtils.ToInt(dk.Value));
                objNoticia.Ativo = !objNoticia.Ativo;

                new BllNoticia().Alterar(objNoticia);
                this.PopulaGridNoticia();

                MessageBox(this, "Notícia alterada com sucesso!");
            }
            catch (Exception)
            {
            }
        }
Exemple #6
0
        private void ObjectToPage()
        {
            List <EntNoticia> listNoticia = null;

            if (EmpresaLogada.IdEmpresaCadastro > 0)
            {
                listNoticia = new BllNoticia().ObterPorEmpresa(EmpresaLogada.Estado.IdEstado, objPrograma.IdPrograma, 0, "", StringUtils.ToDate(""), StringUtils.ToDateFim(""));
            }
            else if (UsuarioLogado.IdUsuario > 0)
            {
                listNoticia = new BllNoticia().ObterPorFiltrosAdministrativo(UsuarioLogado.IdUsuario, UsuarioLogado.Estado.IdEstado, objPrograma.IdPrograma, 0, "", StringUtils.ToDate(""), StringUtils.ToDateFim(""));
            }
            if (listNoticia == null || listNoticia.Count == 0)
            {
                tabelaSemDados.Style.Add("display", "block");
            }
            if (listNoticia != null && listNoticia.Count > 0)
            {
                ImgNoticia1.ImageUrl  = PathDownloadArquivos + listNoticia[0].UrlImagem;
                LblNoticia1.Text      = listNoticia[0].Titulo;
                LblCorpoNoticia1.Text = CortaTexto(listNoticia[0].Noticia);
                HdnNoticia1Id.Value   = listNoticia[0].IdNoticia.ToString();
            }
            else
            {
                linha1a.Visible = false;
            }
            if (listNoticia != null && listNoticia.Count > 1)
            {
                ImgNoticia2.ImageUrl  = "/DownloadArquivos/" + listNoticia[1].UrlImagem;
                LblNoticia2.Text      = listNoticia[1].Titulo;
                LblCorpoNoticia2.Text = CortaTexto(listNoticia[1].Noticia);
                HdnNoticia2Id.Value   = listNoticia[1].IdNoticia.ToString();
            }
            else
            {
                linha2a.Visible = false;
            }
            if (listNoticia != null && listNoticia.Count > 2)
            {
                ImgNoticia3.ImageUrl  = "/DownloadArquivos/" + listNoticia[2].UrlImagem;
                LblNoticia3.Text      = listNoticia[2].Titulo;
                LblCorpoNoticia3.Text = CortaTexto(listNoticia[2].Noticia);
                HdnNoticia3Id.Value   = listNoticia[2].IdNoticia.ToString();
            }
            else
            {
                linha3a.Visible = false;
            }
            if (listNoticia != null && listNoticia.Count > 3)
            {
                ImgNoticia4.ImageUrl  = "/DownloadArquivos/" + listNoticia[3].UrlImagem;
                LblNoticia4.Text      = listNoticia[3].Titulo;
                LblCorpoNoticia4.Text = CortaTexto(listNoticia[3].Noticia);
                HdnNoticia4Id.Value   = listNoticia[3].IdNoticia.ToString();
            }
            else
            {
                linha4a.Visible = false;
            }
        }