Пример #1
0
    protected void DDLNivel_SelectedIndexChanged(object sender, EventArgs e)
    {
        string mensaje;

        try
        {
            string edif = DDLEdificio.SelectedValue.ToString();
            string niv  = DDLNivel.SelectedValue.ToString();

            DataSet ds = new DataSet();
            ds = Logica.Aulas(niv, edif);



            if (ds.Tables[0].Rows.Count != 0)
            {
                GVMostrar.DataSource = ds;
                GVMostrar.DataBind();
                lblMensaje.Text = "";
            }
            else
            {
                mensaje         = "<div class='card-panel red lighten-2'>";
                mensaje        += "<span class='white-text center-align'>No hay aulas inscritas en este nivel</span>";
                mensaje        += "</div>";
                lblMensaje.Text = mensaje;
            }
        }
        catch
        {
            mensaje         = "<div class='card-panel red lighten-2'>";
            mensaje        += "<span class='white-text center-align'>Los dos datos son necesarios</span>";
            mensaje        += "</div>";
            lblMensaje.Text = mensaje;
        }
    }
Пример #2
0
        public void llenarGrid()
        {
            bool  bandera1 = false, bandera2 = false;
            Match match;

            if (db.matriculaConEspacio(txtFiltrarMatricula.Text))
            {
                bandera1 = true;
            }
            else
            {
                verModal("Error", "El campo matrícula no tiene el formato correcto");
                bandera1 = false;
            }
            if (!string.IsNullOrEmpty(txtFiltarFechaIncio.Text))
            {
                match = Regex.Match(txtFiltarFechaIncio.Text, @"^(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)\d\d$");
                if (match.Success)
                {
                    bandera1 = true;
                    vacio    = true;
                }
                else
                {
                    verModal("Error", "La fecha inicio no tiene el formato dd/mm/aaaa");
                }
            }
            else
            {
                bandera1 = true;
            }


            if (!string.IsNullOrEmpty(txtFiltrarFechaFin.Text))
            {
                match = Regex.Match(txtFiltrarFechaFin.Text, @"^(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)\d\d$");
                if (match.Success)
                {
                    bandera2 = true;
                    if (vacio)
                    {
                        if (Convert.ToDateTime(txtFiltarFechaIncio.Text) <= Convert.ToDateTime(txtFiltrarFechaFin.Text))
                        {
                            bandera2 = true;
                        }
                        else
                        {
                            verModal("Error", "La fecha inicio no puede ser mayor a la fecha fin");
                            bandera2 = false;
                        }
                    }
                }
                else
                {
                    verModal("Alerta", "La fecha inicio no tiene el formato dd/mm/aaaa");
                }
            }
            else
            {
                bandera2 = true;
            }



            if (bandera1 && bandera2)
            {
                if (txtFiltrarMatricula.Text != "" && ddlFiltrarPeriodo.SelectedValue == "-1" && txtFiltarFechaIncio.Text == "" && txtFiltrarFechaFin.Text == "")//1
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",null,null";
                }
                if (txtFiltrarMatricula.Text == "" && ddlFiltrarPeriodo.SelectedValue != "-1" && txtFiltarFechaIncio.Text == "" && txtFiltrarFechaFin.Text == "")//2
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",null,null ";
                }
                if (txtFiltrarMatricula.Text == "" && ddlFiltrarPeriodo.SelectedValue == "-1" && txtFiltarFechaIncio.Text != "" && txtFiltrarFechaFin.Text == "")//3
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",'" + db.convertirFecha(txtFiltarFechaIncio.Text) + "', null";
                }
                if (txtFiltrarMatricula.Text == "" && ddlFiltrarPeriodo.SelectedValue == "-1" && txtFiltarFechaIncio.Text == "" && txtFiltrarFechaFin.Text != "")//4
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",null ,'" + db.convertirFecha(txtFiltrarFechaFin.Text) + "'";
                }
                if (txtFiltrarMatricula.Text != "" && ddlFiltrarPeriodo.SelectedValue != "-1" && txtFiltarFechaIncio.Text == "" && txtFiltrarFechaFin.Text == "")//5
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",null ,null";
                }
                if (txtFiltrarMatricula.Text != "" && ddlFiltrarPeriodo.SelectedValue == "-1" && txtFiltarFechaIncio.Text != "" && txtFiltrarFechaFin.Text == "")//6
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",'" + db.convertirFecha(txtFiltarFechaIncio.Text) + "' ,null";
                }
                if (txtFiltrarMatricula.Text != "" && ddlFiltrarPeriodo.SelectedValue == "-1" && txtFiltarFechaIncio.Text == "" && txtFiltrarFechaFin.Text != "")//7
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",null ,'" + db.convertirFecha(txtFiltrarFechaFin.Text) + "'";
                }
                if (txtFiltrarMatricula.Text == "" && ddlFiltrarPeriodo.SelectedValue != "-1" && txtFiltarFechaIncio.Text != "" && txtFiltrarFechaFin.Text == "")//8
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",'" + db.convertirFecha(txtFiltarFechaIncio.Text) + "' ,null";
                }
                if (txtFiltrarMatricula.Text == "" && ddlFiltrarPeriodo.SelectedValue != "-1" && txtFiltarFechaIncio.Text == "" && txtFiltrarFechaFin.Text != "")//9
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",null ,'" + db.convertirFecha(txtFiltrarFechaFin.Text) + "'";
                }
                if (txtFiltrarMatricula.Text == "" && ddlFiltrarPeriodo.SelectedValue == "-1" && txtFiltarFechaIncio.Text != "" && txtFiltrarFechaFin.Text != "")//10
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",'" + db.convertirFecha(txtFiltarFechaIncio.Text) + "' ,'" + db.convertirFecha(txtFiltrarFechaFin.Text) + "'";
                }
                if (txtFiltrarMatricula.Text != "" && ddlFiltrarPeriodo.SelectedValue != "-1" && txtFiltarFechaIncio.Text != "" && txtFiltrarFechaFin.Text == "")//11
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",'" + db.convertirFecha(txtFiltarFechaIncio.Text) + "' , null";
                }
                if (txtFiltrarMatricula.Text != "" && ddlFiltrarPeriodo.SelectedValue != "-1" && txtFiltarFechaIncio.Text == "" && txtFiltrarFechaFin.Text != "")//12
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",null, '" + db.convertirFecha(txtFiltrarFechaFin.Text) + "'";
                }
                if (txtFiltrarMatricula.Text == "" && ddlFiltrarPeriodo.SelectedValue != "-1" && txtFiltarFechaIncio.Text != "" && txtFiltrarFechaFin.Text != "")//13
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",'" + db.convertirFecha(txtFiltarFechaIncio.Text) + "', '" + db.convertirFecha(txtFiltrarFechaFin.Text) + "'";
                }
                if (txtFiltrarMatricula.Text != "" && ddlFiltrarPeriodo.SelectedValue == "-1" && txtFiltarFechaIncio.Text != "" && txtFiltrarFechaFin.Text != "")//14
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",'" + db.convertirFecha(txtFiltarFechaIncio.Text) + "', '" + db.convertirFecha(txtFiltrarFechaFin.Text) + "'";
                }
                if (txtFiltrarMatricula.Text != "" && ddlFiltrarPeriodo.SelectedValue != "-1" && txtFiltarFechaIncio.Text != "" && txtFiltrarFechaFin.Text != "")//15
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",'" + db.convertirFecha(txtFiltarFechaIncio.Text) + "', '" + db.convertirFecha(txtFiltrarFechaFin.Text) + "'";
                }
                if (txtFiltrarMatricula.Text == "" && ddlFiltrarPeriodo.SelectedValue == "-1" && txtFiltarFechaIncio.Text == "" && txtFiltrarFechaFin.Text == "")//15
                {
                    query = "sp_muestra_alumnos_exentos '" + txtFiltrarMatricula.Text + "'," + ddlFiltrarPeriodo.SelectedValue + ",null,null ";
                }

                dt = db.getQuery(conexionBecarios, query);
                if (dt.Rows.Count > 0)
                {
                    GVMostrar.DataSource = dt;
                    GVMostrar.DataBind();
                }
                else
                {
                    verModal("Alerta", "No hay información existente");
                    GVMostrar.DataSource = null;
                    GVMostrar.DataBind();
                }
            }
        }
Пример #3
0
    protected void btnEliminar_Click(object sender, EventArgs e)
    {
        string edif = DDLEdificio.SelectedValue.ToString();
        string niv  = DDLNivel.SelectedValue.ToString();
        string mensaje;
        string part2cod = "";

        switch (niv)
        {
        case "n1":
            part2cod = "10";
            break;

        case "n2":
            part2cod = "20";
            break;

        case "n3":
            part2cod = "30";
            break;

        case "n4":
            part2cod = "40";
            break;

        case "n5":
            part2cod = "50";
            break;

        default:
            part2cod = "";
            break;
        }

        int fcod = Logica.cod(niv, edif);

        if (fcod == 0)
        {
            mensaje         = "<div class='card-panel red lighten-2'>";
            mensaje        += "<span class='white-text center-align'>No hay aulas que eliminar</span>";
            mensaje        += "</div>";
            lblMensaje.Text = mensaje;
        }
        else
        {
            string num = Convert.ToString(Logica.cod(niv, edif));

            string Id = edif + part2cod + num;

            if (Logica.Eliminar(Id))
            {
                mensaje         = "<div class='card-panel green lighten-2'>";
                mensaje        += "<span class='white-text center-align'>Datos eliminados con exito</span>";
                mensaje        += "</div>";
                lblMensaje.Text = mensaje;
                DataSet ds = new DataSet();
                ds = Logica.Aulas(niv, edif);



                if (ds.Tables[0].Rows.Count != 0)
                {
                    GVMostrar.DataSource = ds;
                    GVMostrar.DataBind();
                }
                else
                {
                    mensaje              = "<div class='card-panel red lighten-2'>";
                    mensaje             += "<span class='white-text center-align'>Ya no hay aulas inscritas en este nivel</span>";
                    mensaje             += "</div>";
                    lblMensaje.Text      = mensaje;
                    GVMostrar.DataSource = ds;
                    GVMostrar.DataBind();
                }
            }
            else
            {
                mensaje         = "<div class='card-panel red lighten-2'>";
                mensaje        += "<span class='white-text center-align'>Ocurrio un problema durante la eliminacion</span>";
                mensaje        += "</div>";
                lblMensaje.Text = mensaje;
            }
        }
    }