예제 #1
0
        public static List <Matricula> searchMatriculas(string Text, Int64 pIdSucursal, int pLimit, string opc)
        {
            List <Matricula> lista = new List <Matricula>();

            using (MySqlConnection _con = new Conexion().Conectar())
            {
                try
                {
                    _con.Open();

                    MySqlCommand comando = new MySqlCommand("select m.* from matricula as m inner join curso as c on c.Id =m.IdCurso " +
                                                            "inner join year as y on y.Id=c.IdYear inner join estudiante as e on e.Id=m.IdEstudiante inner join persona as p " +
                                                            "on p.Id=e.IdPersona where( Upper(p.Nombre) like '%" + Text.ToUpper() + "%' or Upper(e.Telefono) like '%" + Text.ToUpper() +
                                                            "%' or Upper(e.TelEmergencia) like '%" + Text.ToUpper() + "%' or Upper(e.ParentEmergencia) like '%" + Text.ToUpper() +
                                                            "%') and (c.IdSucursal=@pIdSucursal) " + (opc != "ingreso" ? " and m.Estado='A' " : "") + " order by Id asc limit @pLimit", _con);

                    comando.Parameters.AddWithValue("@pLimit", pLimit);
                    comando.Parameters.AddWithValue("@pIdSucursal", pIdSucursal);

                    MySqlDataReader _reader = comando.ExecuteReader();
                    while (_reader.Read())
                    {
                        Matricula item = new Matricula(
                            _reader.GetInt64(0),
                            _reader.GetString(1),
                            _reader.GetString(2),
                            _reader.GetInt32(3),
                            _reader.GetString(4),
                            _reader.GetInt64(5),
                            _reader.GetInt64(6),
                            EstudianteDAL.getEstudianteById(_reader.GetInt64(6)),
                            CuotaDAL.getCuotasByIdMatricula(_reader.GetInt64(0), 50),
                            DetMatriculaDAL.getDetsmatriculaByIdMatricula(_reader.GetInt64(0), 2)
                            );

                        lista.Add(item);
                    }
                    _reader.Close();
                }
                catch (Exception ex)
                {
                    _con.Close();
                    throw ex;
                }
                finally
                {
                    _con.Close();
                }
            }
            return(lista);
        }
예제 #2
0
        public static Matricula verificarMatriculado(Int64 pIdCurso, Int64 IdEstudiante)
        {
            Matricula item = null;

            using (MySqlConnection _con = new Conexion().Conectar())
            {
                try
                {
                    _con.Open();
                    MySqlCommand cmdGetItemById = new MySqlCommand("select * from matricula where IdCurso=@pIdCurso and IdEstudiante=@IdEstudiante", _con);
                    cmdGetItemById.Parameters.AddWithValue("@pIdCurso", pIdCurso);
                    cmdGetItemById.Parameters.AddWithValue("@IdEstudiante", IdEstudiante);

                    MySqlDataReader _reader = cmdGetItemById.ExecuteReader();
                    while (_reader.Read())
                    {
                        item = new Matricula(
                            _reader.GetInt64(0),
                            _reader.GetString(1),
                            _reader.GetString(2),
                            _reader.GetInt32(3),
                            _reader.GetString(4),
                            _reader.GetInt64(5),
                            _reader.GetInt64(6),
                            EstudianteDAL.getEstudianteById(_reader.GetInt64(6)),
                            CuotaDAL.getCuotasByIdMatricula(_reader.GetInt64(0), 50),
                            DetMatriculaDAL.getDetsmatriculaByIdMatricula(_reader.GetInt64(0), 2)
                            );
                    }
                    _reader.Close();
                }
                catch (Exception ex)
                {
                    _con.Close();
                    throw ex;
                }
                finally
                {
                    _con.Close();
                }
            }
            return(item);
        }
예제 #3
0
        public Userest getUserestById(int pId)
        {
            Userest item = null;

            using (MySqlConnection _con = new Conexion().Conectar())
            {
                try
                {
                    _con.Open();
                    MySqlCommand cmdGetItemById = new MySqlCommand("select * from userest where Id=@pId", _con);
                    cmdGetItemById.Parameters.AddWithValue("@pId", pId);
                    MySqlDataReader _reader = cmdGetItemById.ExecuteReader();
                    while (_reader.Read())
                    {
                        item = new Userest(
                            _reader.GetInt64(0),
                            _reader.GetString(1),
                            _reader.GetString(2),
                            _reader.GetString(3),
                            _reader.GetString(4),
                            _reader.GetInt64(5),
                            _reader.GetInt64(6),
                            EstudianteDAL.getEstudianteById(_reader.GetInt64(6))
                            );
                    }
                    _reader.Close();
                }
                catch (Exception ex)
                {
                    _con.Close();
                    throw ex;
                }
                finally
                {
                    _con.Close();
                }
            }
            return(item);
        }