Beispiel #1
0
    private void CarregarTela()
    {
        try
        {
            List <Arquivos> lstArquivos = new List <Arquivos>();

            ddlIdioma.DataSource     = DOIdioma.Listar();
            ddlIdioma.DataTextField  = "Nome";
            ddlIdioma.DataValueField = "Id";
            ddlIdioma.DataBind();

            ddlTipoLayout.Items.Insert(0, new ListItem("Download por lote", "0"));
            ddlTipoLayout.Items.Insert(1, new ListItem("Download único", "1"));
            ddlTipoLayout.Items.Insert(2, new ListItem("Download podcast", "2"));
            ddlTipoLayout.Items.Insert(2, new ListItem("Download vídeos", "3"));

            ddltipoArquivo.DataSource = DOTipoArquivo.Listar(new TipoArquivo()
            {
                Relatorio = null
            });
            ddltipoArquivo.DataTextField  = "Descricao";
            ddltipoArquivo.DataValueField = "Id";
            ddltipoArquivo.DataBind();

            ddltipoArquivo.Items.Insert(0, new ListItem("Selecione o tipo de arquivo", "-1"));
            ddltipoArquivo.SelectedIndex = 0;

            ddlArquivo.Items.Insert(0, new ListItem("Selecione o arquivo", "-1"));
            ddlArquivo.SelectedIndex = 0;

            if (ddltipoArquivo.SelectedIndex > 0)
            {
                ddlArquivo.Enabled = true;
            }
            else
            {
                ddlArquivo.Enabled = false;
            }

            ddlFiltros.Items.Insert(0, new ListItem("Não", "0"));
            ddlFiltros.Items.Insert(1, new ListItem("Sim", "1"));
            ddlFiltros.SelectedIndex = 0;

            //grvArquivos.DataSource = DOModArquivo.Listar(new ModArquivo() { ConteudoId = Convert.ToInt32(Request.QueryString["Conteudo"]) });
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Beispiel #2
0
 private void CarregarTipoRelatorio()
 {
     try
     {
         ddlTipoRelatorio.DataSource = DOTipoArquivo.Listar(new TipoArquivo()
         {
             Relatorio = true
         });
         ddlTipoRelatorio.DataTextField  = "Descricao";
         ddlTipoRelatorio.DataValueField = "Id";
         ddlTipoRelatorio.DataBind();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    protected void grdDados_RowDataBound1(object sender, GridViewRowEventArgs e)
    {
        try
        {
            switch (e.Row.RowType)
            {
            case DataControlRowType.Header:
                break;

            case DataControlRowType.Footer:
                break;

            case DataControlRowType.DataRow:

                Relatorio relatorio = (Relatorio)e.Row.DataItem;

                Label lblTipoRelatorio = (Label)e.Row.FindControl("lblTipoRelatorio");
                lblTipoRelatorio.Text = DOTipoArquivo.Obter(new TipoArquivo()
                {
                    Id = relatorio.TipoRelatorio.Id
                }).Descricao;

                break;

            case DataControlRowType.Separator:
                break;

            case DataControlRowType.Pager:
                break;

            case DataControlRowType.EmptyDataRow:
                break;

            default:
                break;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Beispiel #4
0
    protected void grdDados_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            switch (e.Row.RowType)
            {
            case DataControlRowType.Header:
                e.Row.Cells[2].Visible = false;
                break;

            case DataControlRowType.Footer:
                break;

            case DataControlRowType.DataRow:
                e.Row.Cells[2].Visible = false;

                Label lblTipoArquivo = (Label)e.Row.FindControl("lblTipoArquivoId");
                lblTipoArquivo.Text = DOTipoArquivo.Obter(new TipoArquivo()
                {
                    Id = Convert.ToInt32(e.Row.Cells[2].Text)
                }).Descricao;

                break;

            case DataControlRowType.Separator:
                break;

            case DataControlRowType.Pager:
                break;

            case DataControlRowType.EmptyDataRow:
                break;

            default:
                break;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Beispiel #5
0
    private void CarregarTipoNoticia()
    {
        try
        {
            this.ddlTipoNoticia.DataSource = DOTipoArquivo.Listar(new TipoArquivo()
            {
                Noticia = true
            });
            this.ddlTipoNoticia.DataTextField  = "Descricao";
            this.ddlTipoNoticia.DataValueField = "ID";
            this.ddlTipoNoticia.DataBind();

            this.ddlTipoNoticia.Items.Insert(0, new ListItem("Selecione o tipo de notícia", "-1"));
            this.ddlTipoNoticia.SelectedIndex = 0;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    private void CarregarTipoComunicado()
    {
        try
        {
            ddlTipoComunicado.DataSource = DOTipoArquivo.Listar(new TipoArquivo()
            {
                Comunicado = true
            });                                                                                           //DoTipoComunicado.Listar();
            ddlTipoComunicado.DataTextField  = "Descricao";
            ddlTipoComunicado.DataValueField = "Id";
            ddlTipoComunicado.DataBind();

            ddlTipoComunicado.Items.Insert(0, new ListItem("Selecione o tipo de comunicado", "-1"));
            ddlTipoComunicado.SelectedIndex = 0;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Beispiel #7
0
    private void CarregarTipoArquivo()
    {
        try
        {
            ddlTipoArquivo.DataSource = DOTipoArquivo.Listar(new TipoArquivo()
            {
                Relatorio = null
            });
            ddlTipoArquivo.DataTextField  = "Descricao";
            ddlTipoArquivo.DataValueField = "Id";
            ddlTipoArquivo.DataBind();

            ddlTipoArquivo.Items.Insert(0, "Todos os tipos de arquivos");
            ddlTipoArquivo.SelectedIndex = 0;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    protected void grvArquivos_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        switch (e.Row.RowType)
        {
        case DataControlRowType.Header:
            e.Row.Cells[0].Visible = false;
            break;

        case DataControlRowType.Footer:
            break;

        case DataControlRowType.DataRow:
            e.Row.Cells[0].Visible = false;
            var arq = (Arquivos)e.Row.DataItem;

            arq = DOArquivos.Obter(arq);

            Label lblTipoArquivo = (Label)e.Row.FindControl("lblTipoArquivo");
            lblTipoArquivo.Text = DOTipoArquivo.Obter(new TipoArquivo()
            {
                Id = Convert.ToInt32(arq.TipoArquivoId)
            }).Descricao;



            break;

        case DataControlRowType.Separator:
            break;

        case DataControlRowType.Pager:
            break;

        case DataControlRowType.EmptyDataRow:
            break;

        default:
            break;
        }
    }
    private void CarregarTipoComunicado()
    {
        try
        {
            ddlTipoComunicado.DataSource = DOTipoArquivo.Listar(new TipoArquivo()
            {
                Comunicado = true
            });                                                                                           //DoTipoComunicado.Listar();
            ddlTipoComunicado.DataTextField  = "Descricao";
            ddlTipoComunicado.DataValueField = "Id";
            ddlTipoComunicado.DataBind();

            ddlTipoComunicado.Items.Insert(0, new ListItem()
            {
                Value = "-1", Text = Resources.Comunicados.SelecioneTipoComunicado
            });
        }
        catch (Exception ex)
        {
            throw;
        }
    }
    private void PreencheDadosTela(Noticia pObjNoticia, RepeaterItemEventArgs e)
    {
        try
        {
            var item = e.Item.DataItem as Noticia;
            item.TipoArquivo = DOTipoArquivo.Obter(item.TipoArquivo);
            Label lblVer = (Label)e.Item.FindControl("lblVer");
            if (item.TipoArquivo.Descricao == "Entrevistas")
            {
                lblVer.Text = Resources.Noticias.VerEntrevista;
            }
            else
            {
                lblVer.Text = Resources.Noticias.VerNoticia;
            }

            Image img = (Image)e.Item.FindControl("imgNoticia");
            img.ImageUrl = DOArquivos.Obter(new Arquivos()
            {
                Id = pObjNoticia.Capa.Id
            }).Caminho;

            Label lblDataNoticia = (Label)e.Item.FindControl("lblDataNoticia");
            lblDataNoticia.Text = pObjNoticia.DataNoticia.ToShortDateString();

            Label lblDataNoticialMobil = (Label)e.Item.FindControl("lblDataNoticiaMobil");
            lblDataNoticialMobil.Text = pObjNoticia.DataNoticia.ToShortDateString();

            Label lblTitulo = (Label)e.Item.FindControl("lblTitulo");
            lblTitulo.Text = pObjNoticia.Titulo;

            Label lblResumo = (Label)e.Item.FindControl("lblResumo");
            lblResumo.Text = pObjNoticia.Resumo.Replace("<p>", "").Replace("</p>", "").Replace("&nbsp;", "");
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    private void CarregaTipoNoticia(DropDownList pDDL)
    {
        Noticia noticia = null;

        try
        {
            noticia             = new Noticia();
            noticia.Destaque    = true;
            noticia.TipoArquivo = new TipoArquivo()
            {
                Noticia = true
            };
            pDDL.DataSource     = DOTipoArquivo.Listar(noticia.TipoArquivo);
            pDDL.DataTextField  = "Descricao";
            pDDL.DataValueField = "Id";
            pDDL.DataBind();
            pDDL.Items.Insert(0, new ListItem(Resources.Textos.Texto_Selecione, "0"));
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Beispiel #12
0
    private void CarregarObjetos(Utilitarios.TipoTransacao objTipoTransacao, Noticia objNoticia = null)
    {
        switch (objTipoTransacao)
        {
        case Utilitarios.TipoTransacao.Limpar:
            ddlIdioma.SelectedIndex         = 0;
            ddlSubTipoNoticia.SelectedIndex = 0;
            txtTituloNoticia.Text           = string.Empty;
            txtDataNoticia.Text             = string.Empty;
            txtFonte.Text       = string.Empty;
            txtResumo.Value     = string.Empty;
            txtIntegra.Value    = string.Empty;
            chkDestaque.Text    = Resources.Noticias.LabelDestaque;
            chkDestaque.Checked = false;
            //ddlArquivoCapa.SelectedIndex = 0;
            imgCapa.Visible = false;
            hdnCapaId.Value = string.Empty;
            break;

        case Utilitarios.TipoTransacao.Salvar:
            if (gobjNoticia == null)
            {
                gobjNoticia = new Noticia();
            }

            if (hdnNoticiaId.Value != null)
            {
                gobjNoticia.ID = int.Parse(hdnNoticiaId.Value.ToString());
            }

            gobjNoticia.Titulo      = txtTituloNoticia.Text;
            gobjNoticia.IdiomaId    = Convert.ToInt32(ddlIdioma.SelectedValue);
            gobjNoticia.TipoArquivo = DOTipoArquivo.Obter(new TipoArquivo()
            {
                Id = Convert.ToInt32(ddlTipoNoticia.SelectedValue)
            });
            gobjNoticia.TipoNoticia = DoTipoNoticia.Obter(new TipoNoticia()
            {
                ID = Convert.ToInt32(ddlSubTipoNoticia.SelectedValue)
            });
            gobjNoticia.DataNoticia = DateTime.Parse(txtDataNoticia.Text);
            gobjNoticia.Fonte       = txtFonte.Text;
            gobjNoticia.Resumo      = txtResumo.Value.ToString();
            gobjNoticia.Integra     = txtIntegra.Value;
            gobjNoticia.Destaque    = chkDestaque.Checked;
            gobjNoticia.Usuario     = UsuarioLogado();
            gobjNoticia.StatusId    = (int)Utilitarios.Status.Criado;

            if (uplCapa.HasFile)
            {
                gobjNoticia.Capa = SalvarArquivo();
            }
            else
            {
                gobjNoticia.Capa = new Arquivos()
                {
                    Id = Convert.ToInt32(hdnCapaId.Value)
                };
                rfvCapa.ValidationGroup = "";
            }
            //gobjNoticia.Arquivos = listaArquivos;

            //gobjNoticia.Capa = DOArquivos.Obter(new Arquivos() {  Id= })
            //gobjNoticia.Capa = DOArquivos.Obter(new Arquivos() { Id = Convert.ToInt32(ddlArquivoCapa.SelectedValue) });
            break;

        //Carregar Dados do Link
        case Utilitarios.TipoTransacao.Carregar:

            ddlIdioma.SelectedValue         = gobjNoticia.IdiomaId.ToString();
            ddlIdioma.Enabled               = false;
            ddlTipoNoticia.SelectedValue    = gobjNoticia.TipoArquivo.Id.ToString();
            ddlSubTipoNoticia.SelectedValue = gobjNoticia.TipoNoticia.ID.ToString();
            hdnNoticiaId.Value              = gobjNoticia.ID.ToString();
            txtTituloNoticia.Text           = gobjNoticia.Titulo;
            txtDataNoticia.Text             = gobjNoticia.DataNoticia.ToShortDateString();
            txtFonte.Text       = gobjNoticia.Fonte;
            txtResumo.Value     = gobjNoticia.Resumo;
            txtIntegra.Value    = gobjNoticia.Integra;
            chkDestaque.Checked = gobjNoticia.Destaque;
            if (gobjNoticia.Capa != null)
            {
                gobjNoticia.Capa = DOArquivos.Obter(gobjNoticia.Capa);
                //ddlArquivoCapa.SelectedValue = gobjNoticia.Capa.Id.ToString();
                hdnCapaId.Value  = gobjNoticia.Capa.Id.ToString();
                imgCapa.ImageUrl = gobjNoticia.Capa.Caminho;
                imgCapa.Visible  = true;
            }
            break;
        }
    }
Beispiel #13
0
    private void ObterConteudo()
    {
        IdConteudo = Convert.ToInt32(this.Parent.ID.Replace("CTT_", string.Empty));
        IdIdioma   = 1;

        HttpCookie cookie = Request.Cookies["_culture"];

        if (cookie != null)
        {
            IdIdioma = Convert.ToInt32(cookie.Value);
        }

        ConteudoPagina conteudo = new ConteudoPagina()
        {
            ConteudoId = IdConteudo
        };

        ModRelatorio modRelatorio = new ModRelatorio()
        {
            Conteudo = conteudo
        };

        List <ModRelatorio> lModRelatorio = DOModRelatorio.Listar(modRelatorio);

        System.Text.StringBuilder sbTipoRelartorio = new System.Text.StringBuilder();
        sbTipoRelartorio.Append("<ul>");
        foreach (ModRelatorio mRelatorio in lModRelatorio)
        {
            sbTipoRelartorio.Append("<li>");
            sbTipoRelartorio.Append("<a href='#'>");
            sbTipoRelartorio.Append(DOTipoArquivo.Obter(new TipoArquivo()
            {
                Id = mRelatorio.TipoRelatorio.ID
            }).Descricao);
            sbTipoRelartorio.Append("</a>");
            sbTipoRelartorio.Append("</li>");
        }
        sbTipoRelartorio.Append("</ul>");

        ModComunicado modComunicado = new ModComunicado()
        {
            ConteudoId = conteudo.ConteudoId
        };
        List <ModComunicado> lModComunicado = DOModComunicado.Listar(modComunicado);

        System.Text.StringBuilder sbTipoComunicado = new System.Text.StringBuilder();
        sbTipoComunicado.Append("<ul>");
        foreach (ModComunicado mComunicado in lModComunicado)
        {
            sbTipoComunicado.Append("<li>");
            sbTipoComunicado.Append("<a href='#'>");
            sbTipoComunicado.Append(DoComunicado.Obter(new Comunicado()
            {
                ID = mComunicado.ComunicadoId
            }).Titulo);
            sbTipoComunicado.Append("</a>");
            sbTipoComunicado.Append("</li>");
        }
        sbTipoComunicado.Append("</ul>");

        litComunicado.Text    = sbTipoComunicado.ToString();
        litTipoRelatorio.Text = sbTipoRelartorio.ToString();

        if (lModRelatorio.Count > 0 || lModComunicado.Count > 0)
        {
            divSemConteudo.Visible = false;
            divComCOnteudo.Visible = true;
        }
        else
        {
            divSemConteudo.Visible = true;
            divComCOnteudo.Visible = false;
        }
    }
    private void CarregarObjetos(Utilitarios.TipoTransacao objTipoTransacao, Noticia objNoticia = null)
    {
        switch (objTipoTransacao)
        {
        //Nova noticia
        case Utilitarios.TipoTransacao.Limpar:
            ddlIdioma.SelectedIndex = 0;
            txtTituloNoticia.Text   = string.Empty;
            txtDataNoticia.Text     = string.Empty;
            txtFonte.Text           = string.Empty;
            txtResumo.Value         = string.Empty;
            txtIntegra.Value        = string.Empty;
            chkDestaque.Text        = Resources.Noticias.LabelDestaque;
            chkDestaque.Checked     = false;
            //pnlFormArquivos.Visible = false;
            //pnlGridArquivos.Visible = false;
            break;

        //Carregar Dados da notícia
        case Utilitarios.TipoTransacao.Salvar:
            if (gobjNoticia == null)
            {
                gobjNoticia = new Noticia();
            }

            if (hdnNoticiaId.Value != null)
            {
                gobjNoticia.ID = int.Parse(hdnNoticiaId.Value.ToString());
            }

            gobjNoticia.Titulo      = txtTituloNoticia.Text;
            gobjNoticia.IdiomaId    = Convert.ToInt32(ddlIdioma.SelectedValue);
            gobjNoticia.TipoArquivo = DOTipoArquivo.Obter(new TipoArquivo()
            {
                Id = Convert.ToInt32(ddlTipoNoticia.SelectedValue)
            });
            gobjNoticia.TipoNoticia = DoTipoNoticia.Obter(new TipoNoticia()
            {
                ID = Convert.ToInt32(ddlTipoNoticia.SelectedValue)
            });
            gobjNoticia.DataNoticia = DateTime.Parse(txtDataNoticia.Text);
            gobjNoticia.Fonte       = txtFonte.Text;
            gobjNoticia.Resumo      = txtResumo.Value.ToString();
            gobjNoticia.Integra     = txtIntegra.Value;
            gobjNoticia.Destaque    = chkDestaque.Checked;
            gobjNoticia.Usuario     = UsuarioLogado();
            gobjNoticia.StatusId    = (int)Utilitarios.Status.Criado;
            gobjNoticia.Arquivos    = listaArquivos;

            break;

        //Carregar Dados do Link
        case Utilitarios.TipoTransacao.Carregar:

            ddlIdioma.SelectedValue      = gobjNoticia.IdiomaId.ToString();
            ddlIdioma.Enabled            = false;
            ddlTipoNoticia.SelectedValue = gobjNoticia.TipoNoticia.ID.ToString();
            hdnNoticiaId.Value           = gobjNoticia.ID.ToString();
            txtTituloNoticia.Text        = gobjNoticia.Titulo;
            txtDataNoticia.Text          = gobjNoticia.DataNoticia.ToShortDateString();
            txtFonte.Text       = gobjNoticia.Fonte;
            txtResumo.Value     = gobjNoticia.Resumo;
            txtIntegra.Value    = gobjNoticia.Integra;
            chkDestaque.Checked = gobjNoticia.Destaque;

            gobjNoticia.Arquivos = CarregarArquivos(gobjNoticia);
            //grdArquivos.DataSource = gobjNoticia.Arquivos;
            //grdArquivos.DataBind();
            //pnlFormArquivos.Visible = true;
            //pnlGridArquivos.Visible = true;

            break;
        }
    }
Beispiel #15
0
    private void CarregarObjetos(Utilitarios.TipoTransacao objTipoTransacao, Relatorio objNoticia = null)
    {
        switch (objTipoTransacao)
        {
        //Nova noticia
        case Utilitarios.TipoTransacao.Limpar:
            ddlIdioma.SelectedIndex        = 0;
            ddlTipoRelatorio.SelectedIndex = 0;
            txtTituloRelatorio.Text        = string.Empty;
            txtDescricaoRelatorio.Text     = string.Empty;
            txtDataRelatorio.Text          = string.Empty;
            Session["Arquivos"]            = new List <Arquivos>();
            break;

        //Carregar Dados da notícia
        case Utilitarios.TipoTransacao.Salvar:
            if (gobjrelatorio == null)
            {
                gobjrelatorio = new Relatorio();
            }

            if (hdnRelatoriosId.Value != null)
            {
                gobjrelatorio.ID = int.Parse(hdnRelatoriosId.Value.ToString());
            }

            gobjrelatorio.IdiomaId      = Convert.ToInt32(ddlIdioma.SelectedValue);
            gobjrelatorio.Titulo        = txtTituloRelatorio.Text;
            gobjrelatorio.Descricao     = txtDescricaoRelatorio.Text;
            gobjrelatorio.TipoRelatorio = DOTipoArquivo.Obter(new TipoArquivo()
            {
                Id = Convert.ToInt32(ddlTipoRelatorio.SelectedValue)
            });
            gobjrelatorio.UsuarioCadastro    = UsuarioLogado();
            gobjrelatorio.UsuarioAtualizacao = UsuarioLogado();
            gobjrelatorio.DataRelatorio      = Convert.ToDateTime(txtDataRelatorio.Text);
            gobjrelatorio.DataCadastro       = System.DateTime.Now;
            gobjrelatorio.DataAtualizacao    = System.DateTime.Now;
            gobjrelatorio.StatusId           = (int)Utilitarios.Status.Criado;
            gobjrelatorio.Arquivos           = (List <Arquivos>)Session["Arquivos"];
            break;

        //Carregar Dados do Link
        case Utilitarios.TipoTransacao.Carregar:

            ddlIdioma.SelectedValue        = gobjrelatorio.IdiomaId.ToString();
            ddlIdioma.Enabled              = false;
            ddlTipoRelatorio.SelectedValue = gobjrelatorio.TipoRelatorio.Id.ToString();
            txtTituloRelatorio.Text        = gobjrelatorio.Titulo;
            txtDescricaoRelatorio.Text     = gobjrelatorio.Descricao;
            txtDataRelatorio.Text          = gobjrelatorio.DataCadastro.ToShortDateString();

            Session["Arquivos"] = CarregarArquivoRelatorio(gobjrelatorio.ID);

            grdArquivos.DataSource = (List <Arquivos>)Session["Arquivos"];
            grdArquivos.DataBind();
            pnlFormArquivos.Visible = true;
            pnlGridArquivos.Visible = true;

            break;
        }
    }