Esempio n. 1
0
        protected void Calendario_SelectionChanged(object sender, EventArgs e)
        {
            if (Calendario.SelectedDate.Month != Calendario.VisibleDate.Month)
            {
                Calendario.VisibleDate = Calendario.SelectedDate;
            }
            List <WebAppIntranetConsultaEventos_Result> eventos = logica.ConsultaEventos(Calendario.SelectedDate, 0, 3, 0);

            if (eventos.Count == 1)
            {
                lblTituloEvento.Text = eventos.FirstOrDefault().titulo;
                lblFechaInicio.Text  = eventos.FirstOrDefault().fecha_ini.Date.ToString("dd/MMMM/yyyy");
                lblFechaFin.Text     = eventos.FirstOrDefault().fecha_fin.Date.ToString("dd/MMMM/yyyy");
                lblTextoEvento.Text  = eventos.FirstOrDefault().texto;
                lblNumFolEvento.Text = eventos.FirstOrDefault().num_fol.ToString();
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "MuestraEvento();", true);
                Calendario.SelectedDates.Remove(Calendario.SelectedDate);
            }
            else if (eventos.Count > 1)
            {
                lblSeleccionaEventoDia.Text = Calendario.SelectedDate.Date.ToString("D");
                ListaEventos.DataSource     = eventos;
                ListaEventos.DataBind();
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "SeleccionaEvento();", true);
                Calendario.SelectedDates.Remove(Calendario.SelectedDate);
            }
            else
            {
                if (Session["user_cve"] != null)
                {
                    Calendario.SelectedDates.Remove(Calendario.SelectedDate);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "MuestraNuevoEvento();", true);
                }
                else
                {
                    Calendario.SelectedDates.Remove(Calendario.SelectedDate);
                    Response.Write("<script type=\"text/javascript\">alert('No hay eventos para el dia seleccionado');window.location.href = 'Inicio.aspx';</script>");
                }
            }
        }