public Models.Alumno BuscarAlumno(long Legajo) { Models.Alumno Aux = null; AccesoDatos.AccesoDatos Datos = new AccesoDatos.AccesoDatos(); try { Datos.SetearQuery("SELECT * FROM [Valenzuela_DB].[dbo].[Alumno] where Legajo =" + Legajo); Datos.EjecutarLector(); while (Datos.Lector.Read()) { Aux = new Alumno(); Aux.Legajo = Datos.Lector.GetInt64(0); Aux.Nombre = Datos.Lector.GetString(1); Aux.Apellido = Datos.Lector.GetString(2); Aux.Telefono = Datos.Lector.GetInt32(3); Aux.Email = Datos.Lector.GetString(4); Aux.Dirreccion = new Dirreccion(); Aux.Dirreccion.Direccion = Datos.Lector.GetString(5); Aux.Dirreccion.Ciudad = Datos.Lector.GetString(6); Aux.Dirreccion.CodPostal = Datos.Lector.GetInt32(7); } return(Aux); } catch (Exception ex) { throw ex; } finally { Datos.CerrarConexion(); } }
public List <Models.Cuatrimestre> Listar() { List <Models.Cuatrimestre> Listado = new List <Models.Cuatrimestre>(); Models.Cuatrimestre Aux; AccesoDatos.AccesoDatos Datos = new AccesoDatos.AccesoDatos(); try { Datos.SetearQuery("SELECT[Id],[Nombre] FROM [Valenzuela_DB].[dbo].[Cuatrimestre]"); Datos.EjecutarLector(); while (Datos.Lector.Read()) { Aux = new Models.Cuatrimestre(); Aux.Id = (long)Datos.Lector["id"]; Aux.Nombre = Datos.Lector.GetString(1); Listado.Add(Aux); } return(Listado); } catch (Exception ex) { throw ex; } finally { Datos.CerrarConexion(); } }
public Models.Comentario Comentario(long Id) { List <Models.Comentario> Listado = new List <Models.Comentario>(); Models.Comentario Aux = null; AccesoDatos.AccesoDatos Datos = new AccesoDatos.AccesoDatos(); try { Datos.SetearQuery("SELECT [Id],[Descripcion],[FechaAlta],[FechaModificacion] FROM [Valenzuela_DB].[dbo].[Comentario] where Id = @Id"); Datos.Clear(); Datos.agregarParametro("@Id", Id); Datos.EjecutarLector(); while (Datos.Lector.Read()) { Aux = new Comentario(); Aux.Id = Datos.Lector.GetInt64(0); Aux.Descripcion = Datos.Lector.GetString(1); Aux.FechaAlta = Datos.Lector.GetDateTime(2); Aux.FechaModificacion = Datos.Lector.GetDateTime(3); Listado.Add(Aux); } return(Aux); } catch (Exception ex) { throw ex; } finally { Datos.CerrarConexion(); } }
public List <Models.Materia> Listar() { List <Models.Materia> Listado = new List <Models.Materia>(); Models.Materia Aux; AccesoDatos.AccesoDatos Datos = new AccesoDatos.AccesoDatos(); try { Datos.SetearQuery("SELECT * FROM [Valenzuela_DB].[dbo].[Materia] inner join [Valenzuela_DB].[dbo].[Carrera] on Carrera.Id = Materia.IdCarrera inner join [Valenzuela_DB].[dbo].[Universidad] on Universidad.Id = Carrera.IdUniversidad"); Datos.EjecutarLector(); while (Datos.Lector.Read()) { Aux = new Models.Materia(); Aux.Id = Datos.Lector.GetInt64(0); Aux.Nombre = Datos.Lector.GetString(1); Aux.Carrera = new Models.Carrera(); Aux.Carrera.Id = Datos.Lector.GetInt64(3); Aux.Carrera.Nombre = Datos.Lector.GetString(4); Aux.Carrera.Universidad = new Models.Universidad(); Aux.Carrera.Universidad.Id = Datos.Lector.GetInt64(6); Aux.Carrera.Universidad.Nombre = Datos.Lector.GetString(7); Listado.Add(Aux); } return(Listado); } catch (Exception ex) { throw ex; } finally { Datos.CerrarConexion(); } }
public List <Alumno> ListarAlumnosComision(long comision, string Legajo = "", string Nombre = "", string Apellido = "") { AccesoDatos.AccesoDatos Datos = new AccesoDatos.AccesoDatos(); Alumno Alumno; List <Alumno> alumnos = new List <Alumno>(); try { Datos.SetearQuery("exec sp_ComiAlumnos @IdCom , @Legajo , @Nombre, @Apellido"); Datos.Clear(); Datos.agregarParametro("@IdCom", comision); Datos.agregarParametro("@Legajo", "%" + Legajo + "%"); Datos.agregarParametro("@Nombre", "%" + Nombre + "%"); Datos.agregarParametro("@Apellido", "%" + Apellido + "%"); Datos.EjecutarLector(); while (Datos.Lector.Read()) { Alumno = new Alumno(); Alumno.Legajo = Datos.Lector.GetInt64(1); Alumno.Nombre = Datos.Lector.GetString(2); Alumno.Apellido = Datos.Lector.GetString(3); Alumno.Telefono = Datos.Lector.GetInt32(4); Alumno.Email = Datos.Lector.GetString(5); Alumno.Dirreccion = new Dirreccion(); Alumno.Dirreccion.Direccion = Datos.Lector.GetString(6); Alumno.Dirreccion.Ciudad = Datos.Lector.GetString(7); Alumno.Dirreccion.CodPostal = Datos.Lector.GetInt32(8); alumnos.Add(Alumno); } return(alumnos); } catch (Exception ex) { throw ex; } finally { Datos.CerrarConexion(); } }
public bool BuscarAlumnosComision(long comision, long IdAlumno) { AccesoDatos.AccesoDatos Datos = new AccesoDatos.AccesoDatos(); try { Datos.SetearQuery("SELECT Comision.Id, Alumno.* FROM [Valenzuela_DB].[dbo].[DetComisionAlumnos] inner join Comision on Comision.Id = DetComisionAlumnos.idComision inner join Alumno on Alumno.Legajo = DetComisionAlumnos.IdAlumno where Comision.Id =" + comision + " and Alumno.Legajo = " + IdAlumno + " and DetComisionAlumnos.IdAlumno is not null"); Datos.EjecutarLector(); while (Datos.Lector.Read()) { return(true); } return(false); } catch (Exception ex) { throw ex; } finally { Datos.CerrarConexion(); } }
public bool ProtecEliminar(long id) { AccesoDatos.AccesoDatos Datos = new AccesoDatos.AccesoDatos(); try { Datos.SetearQuery("SELECT * FROM[Valenzuela_DB].[dbo].[Alumno] inner join Comentario on Comentario.IdAlumno = Alumno.Legajo where Alumno.Legajo =" + id); Datos.EjecutarLector(); while (Datos.Lector.Read()) { return(true); } return(false); } catch (Exception ex) { throw ex; } finally { Datos.CerrarConexion(); } }
public List <Models.Alumno> Listar(long Id) { List <Models.Alumno> Listado = new List <Models.Alumno>(); Models.Alumno Aux = null; AccesoDatos.AccesoDatos Datos = new AccesoDatos.AccesoDatos(); try { Datos.SetearQuery("SELECT Comision.Id, Alumno.* FROM[Valenzuela_DB].[dbo].[DetComisionAlumnos] inner join Comision on Comision.Id = DetComisionAlumnos.idComision inner join Alumno on Alumno.Legajo = DetComisionAlumnos.IdAlumno where Comision.Id = '" + Id + "'"); Datos.EjecutarLector(); while (Datos.Lector.Read()) { Aux = new Alumno(); Aux.Legajo = Datos.Lector.GetInt64(1); Aux.Nombre = Datos.Lector.GetString(2); Aux.Apellido = Datos.Lector.GetString(3); Aux.Telefono = Datos.Lector.GetInt32(4); Aux.Email = Datos.Lector.GetString(5); Aux.Dirreccion = new Dirreccion(); Aux.Dirreccion.Direccion = Datos.Lector.GetString(6); Aux.Dirreccion.Ciudad = Datos.Lector.GetString(7); Aux.Dirreccion.CodPostal = Datos.Lector.GetInt32(8); Listado.Add(Aux); } return(Listado); } catch (Exception ex) { throw ex; } finally { Datos.CerrarConexion(); } }
public List <Models.Comentario> ComentariosCIA(long ComId, long InsId, long Legajo) { List <Models.Comentario> Listado = new List <Models.Comentario>(); Models.Comentario Aux = null; AccesoDatos.AccesoDatos Datos = new AccesoDatos.AccesoDatos(); try { Datos.SetearQuery("SELECT [Id],[Descripcion],[FechaAlta],[FechaModificacion],Nota FROM [Valenzuela_DB].[dbo].[Comentario] where IdInstancia = @InsId and idComision = @ComId and IdAlumno = @Legajo order by FechaAlta desc"); Datos.Clear(); Datos.agregarParametro("@ComId", ComId); Datos.agregarParametro("@Legajo", Legajo); Datos.agregarParametro("@InsId", InsId); Datos.EjecutarLector(); while (Datos.Lector.Read()) { Aux = new Comentario(); Aux.Id = Datos.Lector.GetInt64(0); Aux.Descripcion = Datos.Lector.GetString(1); Aux.FechaAlta = Datos.Lector.GetDateTime(2); Aux.FechaModificacion = Datos.Lector.GetDateTime(3); Aux.Nota = Datos.Lector.GetString(4); Listado.Add(Aux); } return(Listado); } catch (Exception ex) { throw ex; } finally { Datos.CerrarConexion(); } }