Ejemplo n.º 1
0
        /// <summary>
        /// Busca dentro de las instalaciones los nombres similares a @p_palabra
        /// </summary>
        /// <param name="p_palabra">String a buscar</param>
        /// <returns></returns>
        public DataTable search(String p_palabra)
        {
            DataTable dtReturn = new DataTable("Instalaciones");
            dtReturn.Columns.Add("Identificacion");
            dtReturn.Columns.Add("Nombre");
            dtReturn.Columns.Add("Descripcion");
            cUDGDFINSTALACIONNegocios cInstalaciones = new cUDGDFINSTALACIONNegocios(0, "", 0, "");
            DataTable dtBase = cInstalaciones.SeleccionarTodos();
        
            foreach (DataRow drRow in dtBase.Rows)
            {
                if (this.Compute(drRow[1].ToString(), p_palabra) <= 7)
                    dtReturn.Rows.Add(drRow[0].ToString(), drRow[1].ToString(), drRow[2].ToString());
            }

            return dtReturn;
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
           
            if (!IsPostBack)
            {

                //rellena el dropdown list de las instalaciones
                cUDGDFINSTALACIONNegocios instalacion = new cUDGDFINSTALACIONNegocios(0, "", 0, "");
                DataTable datos_instalaciones = instalacion.SeleccionarTodos();

                for (int i = 0; i < datos_instalaciones.Rows.Count; i++)
                {
                    ListItem li = new ListItem(datos_instalaciones.Rows[i][1].ToString(), datos_instalaciones.Rows[i][0].ToString());
                    ddl_instalaciones.Items.Add(li);

                }
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int iID_EVENTO = int.Parse(Request.QueryString["id"].ToString());

            // Carga la informacion
            if (!IsPostBack)
            {
                cUDGDFCURSONegocios cCurso = new cUDGDFCURSONegocios(0, "", 0, "");
                cUDGDFINSTALACIONNegocios cInstalacion = new cUDGDFINSTALACIONNegocios(0, "", 0, "");

                DataRow drInformacion = cCurso.Seleccionar_Con_ID(iID_EVENTO).Rows[0];
                DataTable _dtInstalaciones = cInstalacion.SeleccionarTodos();

                // Carga las instalaciones
                foreach (DataRow dtLocalRow in _dtInstalaciones.Rows)
                {
                    drp_INSTALACION.Items.Add(dtLocalRow[1].ToString());
                    if (dtLocalRow[1].ToString().CompareTo(drInformacion[16].ToString()) == 0)
                        drp_INSTALACION.SelectedIndex = drp_INSTALACION.Items.Count - 1;
                }

                // Establece los ID de la informacion mostrada para los edit
                lbl_ID_CURSO.Text = drInformacion[0].ToString();
                lbl_ID_INSTALACION.Text = drInformacion[2].ToString();
                lbl_ID_RESERVACION.Text = drInformacion[1].ToString();
                lbl_NOM_CURSO.Text = drInformacion[3].ToString();

                // Establece los campos textbox
                txt_NOMBRE.Text = drInformacion[3].ToString();
                txt_PROFESOR.Text = drInformacion[4].ToString();
                txt_FEC_INICIO.Text = ((DateTime)drInformacion[12]).ToShortDateString();
                txt_FEC_FIN.Text = ((DateTime)drInformacion[13]).ToShortDateString();

                String[] sHRA_INICIO = drInformacion[14].ToString().Split(':');
                String[] sHRA_FIN = drInformacion[15].ToString().Split(':');

                if (int.Parse(sHRA_INICIO[0]) >= 12)
                {
                    if (int.Parse(sHRA_INICIO[0])-12 < 10)
                        txt_HRA_INICIO.Text = "0" + (int.Parse(sHRA_INICIO[0]) - 12) + ":" + sHRA_INICIO[1];
                    else
                        txt_HRA_INICIO.Text = (int.Parse(sHRA_INICIO[0]) - 12) + ":" + sHRA_INICIO[1];
                    drp_TIME_INIT.SelectedIndex = 1;
                }
                else
                {
                    if (int.Parse(sHRA_INICIO[0]) < 10)
                        txt_HRA_INICIO.Text = "0" + int.Parse(sHRA_INICIO[0]) + ":" + sHRA_INICIO[1];
                    else
                        txt_HRA_INICIO.Text = int.Parse(sHRA_INICIO[0]) + ":" + sHRA_INICIO[1];
                }

                if (int.Parse(sHRA_FIN[0]) >= 12)
                {
                    if (int.Parse(sHRA_FIN[0])-12 < 10)
                        txt_HRA_FIN.Text = "0" + (int.Parse(sHRA_FIN[0]) - 12) + ":" + sHRA_FIN[1];
                    else
                        txt_HRA_FIN.Text = (int.Parse(sHRA_FIN[0]) - 12) + ":" + sHRA_FIN[1];
                    drp_TIME_FIN.SelectedIndex = 1;
                }
                else
                {
                    if (int.Parse(sHRA_FIN[0]) < 10)
                        txt_HRA_FIN.Text = "0" + (int.Parse(sHRA_FIN[0])) + ":" + sHRA_FIN[1];
                    else
                        txt_HRA_FIN.Text = (int.Parse(sHRA_FIN[0])) + ":" + sHRA_FIN[1];
                }

                // Establece los campos checkbox
                chk_LUNES.Checked = (Boolean)drInformacion[5];
                chk_MARTES.Checked = (Boolean)drInformacion[6];
                chk_MIERCOLES.Checked = (Boolean)drInformacion[7];
                chk_JUEVES.Checked = (Boolean)drInformacion[8];
                chk_VIERNES.Checked = (Boolean)drInformacion[9];
                chk_SABADO.Checked = (Boolean)drInformacion[10];
                chk_DOMINGO.Checked = (Boolean)drInformacion[11];
            }
        }
Ejemplo n.º 4
0
        protected void btnGenerar_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    RequiredFieldValidator1.Visible = false;
                    RequiredFieldValidator4.Visible = false;
                    DateValidator2.Visible = false;
                    RegularExpressionValidator1.Visible = false;
                    int Fechas = -1000;
                    Fechas = validaFechas(Convert.ToDateTime(txtInicio.Text.ToString()), Convert.ToDateTime(txtFin.Text.ToString()));

                    if (Fechas == 1)
                    {

                        if (rb_tipoReporte.SelectedValue.Equals("1"))
                        {
                            //CREA REPORTE DE RESERVACIONES
                            cReporte rptReservaciones = new cReporte(true, txtInicio.Text, txtFin.Text);
                            if (rblOpciones.SelectedItem.Text.CompareTo("Documento Web") == 0)
                            {
                                if (rb_tipo.SelectedValue.Equals("1"))
                                {
                                    //crea reporte de reservaciones individual web
                                    datos_generales.Visible = false;
                                    rptReservaciones._sidinstalacion = Int32.Parse(ddl_instalaciones.SelectedValue.ToString());
                                    Root.Reports.Report rptFile = rptReservaciones.Generar_i();
                                    Root.Reports.RT.ResponsePDF(rptFile, this);
                                }
                                else
                                {
                                    //crea reporte de reservaciones general web
                                    datos_generales.Visible = false;
                                    Root.Reports.Report rptFile = rptReservaciones.Generar();
                                    Root.Reports.RT.ResponsePDF(rptFile, this);
                                }
                            }
                            else
                            {
                                if (rb_tipo.SelectedValue.Equals("1"))
                                {
                                    //crea reporte de reservaciones individual pdf
                                    datos_generales.Visible = false;
                                    rptReservaciones._sidinstalacion = Int32.Parse(ddl_instalaciones.SelectedValue.ToString());
                                    Root.Reports.Report rptFile = rptReservaciones.Generar_i();

                                    MemoryStream stream = new MemoryStream();
                                    rptFile.formatter.Create(rptFile, stream);
                                    Response.Clear();
                                    Response.ContentType = "application/pdf";
                                    Response.AddHeader("content-Disposition: attachment; filename=" + txtInicio.Text.Replace("/", "") + "  " + txtFin.Text.Replace("/", ""), "Reporte.pdf");
                                    Response.BinaryWrite(stream.ToArray());
                                    Response.Flush();
                                    stream.Close();
                                    Response.End();
                                }
                                else
                                {
                                    //crea reporte de reservaciones general pdf
                                    datos_generales.Visible = false;
                                    Root.Reports.Report rptFile = rptReservaciones.Generar();

                                    MemoryStream stream = new MemoryStream();
                                    rptFile.formatter.Create(rptFile, stream);
                                    Response.Clear();
                                    Response.ContentType = "application/pdf";
                                    Response.AddHeader("content-Disposition: attachment; filename=" + txtInicio.Text.Replace("/", "") + "  " + txtFin.Text.Replace("/", ""), "Reporte.pdf");
                                    Response.BinaryWrite(stream.ToArray());
                                    Response.Flush();
                                    stream.Close();
                                    Response.End();
                                }
                            }
                        }
                        else
                        {
                            //CREAR REPORTE DE ESTADISTICAS
                            if (rblOpciones.SelectedItem.Text.CompareTo("Documento Web") == 0)
                            {
                                if (rb_tipo.SelectedValue.Equals("1"))
                                {
                                    //consulta informacion
                                    cUDGDFINSTALACIONNegocios instalacion = new cUDGDFINSTALACIONNegocios(0, "", 0, "");
                                    instalacion.ID_INSTALACION = Int32.Parse(ddl_instalaciones.SelectedValue.ToString());
                                    DataTable datos_instalaciones = instalacion.SeleccionarUno();

                                    data01.DataSource = CreateDataSource(datos_instalaciones);
                                    data01.DataBind();
                                    datos_generales.Visible = true;
                                }
                                else
                                {
                                    //consulta informacion
                                    cUDGDFINSTALACIONNegocios instalacion = new cUDGDFINSTALACIONNegocios(0, "", 0, "");
                                    DataTable datos_instalaciones = instalacion.SeleccionarTodos();

                                    data01.DataSource = CreateDataSource(datos_instalaciones);
                                    data01.DataBind();
                                    datos_generales.Visible = true;
                                }
                            }
                            else
                            {
                                if (rb_tipo.SelectedValue.Equals("1"))
                                {
                                    //crea reporte de esdisticas individual pdf 

                                    datos_generales.Visible = false;

                                    //consulta información individual
                                    cUDGDFINSTALACIONNegocios instalacion = new cUDGDFINSTALACIONNegocios(0, "", 0, "");
                                    instalacion.ID_INSTALACION = Int32.Parse(ddl_instalaciones.SelectedValue.ToString());
                                    DataTable datos_instalaciones = instalacion.SeleccionarUno();

                                    cReporte rptReservaciones = new cReporte(true, txtInicio.Text, txtFin.Text);
                                    Root.Reports.Report rptFile = rptReservaciones.GenerarEstadisticas(datos_instalaciones);

                                    // Inicia la descarga del archivo
                                    MemoryStream stream = new MemoryStream();
                                    rptFile.formatter.Create(rptFile, stream);
                                    Response.Clear();
                                    Response.ContentType = "application/pdf";
                                    Response.AddHeader("content-Disposition: attachment; filename=" + txtInicio.Text.Replace("/", "") + "  " + txtFin.Text.Replace("/", ""), "ReporteEstaditicas.pdf");
                                    Response.BinaryWrite(stream.ToArray());
                                    Response.Flush();
                                    stream.Close();
                                    Response.End();
                                }
                                else
                                {
                                    //crea reporte de esdisticas general pdf 

                                    datos_generales.Visible = false;

                                    //consulta informacion general
                                    cUDGDFINSTALACIONNegocios instalacion = new cUDGDFINSTALACIONNegocios(0, "", 0, "");
                                    DataTable datos_instalaciones = instalacion.SeleccionarTodos();

                                    cReporte rptReservaciones = new cReporte(true, txtInicio.Text, txtFin.Text);
                                    Root.Reports.Report rptFile = rptReservaciones.GenerarEstadisticas(datos_instalaciones);

                                    // Inicia la descarga del archivo
                                    MemoryStream stream = new MemoryStream();
                                    rptFile.formatter.Create(rptFile, stream);
                                    Response.Clear();
                                    Response.ContentType = "application/pdf";
                                    Response.AddHeader("content-Disposition: attachment; filename=" + txtInicio.Text.Replace("/", "") + "  " + txtFin.Text.Replace("/", ""), "ReporteEstaditicas.pdf");
                                    Response.BinaryWrite(stream.ToArray());
                                    Response.Flush();
                                    stream.Close();
                                    Response.End();
                                }

                            }
                        }
                    }

                    if (Fechas == -1) {
                        Response.Redirect("/frmErrorFechas.aspx", true);
                       
                    }
                }
            }

            catch (Exception)
            {
            } 
        }