Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["Evento"] != null)
        {
            try
            {
                Guid idEvento = new Guid(Request.QueryString["Evento"]);
                //Mengue old code
                HorariosEventoBO heBO = new HorariosEventoBO();
                try
                {
                    EventoBO gerenciadorEventos = new EventoBO();
                    Evento   evento             = gerenciadorEventos.GetEventoById(idEvento);
                    lblTituloEvento.Text = evento.Titulo;

                    List <HorariosEvento> horariosEvento = heBO.GetHorariosEventosByIdDetalhados(idEvento);
                    horariosEvento.Sort();
                    dgHorariosEvento.DataSource = horariosEvento;
                    dgHorariosEvento.DataBind();
                }
                catch (Exception ex)
                {
                    Response.Redirect("~/Default/Erro.aspx?Erro=Erro ao listar horários: " + ex.Message);
                }
            }

            catch (ArgumentNullException)
            {
                Response.Redirect("~/Default/Erro.aspx?Erro=Evento Inválido.");
            }
            catch (FormatException)
            {
                Response.Redirect("~/Default/Erro.aspx?Erro=Evento Inválido.");
            }
            catch (OverflowException)
            {
                Response.Redirect("~/Default/Erro.aspx?Erro=Evento Inválido.");
            }
        }
    }