public void Nuevo(Alumno Aux) { AccesoDatos.AccesoDatos datos = new AccesoDatos.AccesoDatos(); //AccesoDatos datos = new AccesoDatos(); try { datos.SetearQuery("insert into Alumno (Legajo,Nombre,Apellido,Telefono,Email,Direccion,Ciudad,CodigoPostal) values (@Legajo,@Nombre,@Apellido,@Telefono,@Email,@Direccion,@Ciudad,@CodigoPostal)"); datos.agregarParametro("@Legajo", Aux.Legajo); datos.agregarParametro("@Nombre", Aux.Nombre); datos.agregarParametro("@Apellido", Aux.Apellido); datos.agregarParametro("@Telefono", Aux.Telefono); datos.agregarParametro("@Email", Aux.Email); datos.agregarParametro("@Direccion", Aux.Dirreccion.Direccion); datos.agregarParametro("@Ciudad", Aux.Dirreccion.Ciudad); datos.agregarParametro("@CodigoPostal", Aux.Dirreccion.CodPostal); //datos.agregarParametro("@estado", 1); datos.EjecutarAccion(); } catch (Exception ex) { throw ex; } finally { datos.CerrarConexion(); } }
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 void Eliminar(long IdAlumno, long IdComision) { AccesoDatos.AccesoDatos accesoDatos = new AccesoDatos.AccesoDatos(); try { accesoDatos.SetearQuery("delete [DetComisionAlumnos] where IdAlumno = @Id and idComision = @IdCom"); accesoDatos.Clear(); accesoDatos.agregarParametro("@Id", IdAlumno); accesoDatos.agregarParametro("@IdCom", IdComision); accesoDatos.EjecutarAccion(); //accesoDatos.SetearQuery("delete [Comentario] where IdAlumno = @Id and idComision = @IdCom"); //accesoDatos.Clear(); //accesoDatos.agregarParametro("@Id", IdAlumno); //accesoDatos.agregarParametro("@IdCom", IdComision); //accesoDatos.EjecutarAccion(); //accesoDatos.SetearQuery("delete [Instancia] where Id = @Id"); //accesoDatos.Clear(); //accesoDatos.agregarParametro("@Id", IdAlumno); //accesoDatos.agregarParametro("@IdCom", IdComision); accesoDatos.EjecutarAccion(); } catch (Exception ex) { throw ex; } finally { accesoDatos.CerrarConexion(); } }
public void Agregar(ASA.Models.Comentario Aux, long idComision, long IdInstancia, long IdAlumno) { AccesoDatos.AccesoDatos datos = new AccesoDatos.AccesoDatos(); //Aux = new Comentario(); //AccesoDatos datos = new AccesoDatos(); try { datos.SetearQuery("insert into Comentario values (@idComision, @IdInstancia, @IdAlumno, @Descripcion, @FechaAlta, @FechaModificacion, @Nota)"); datos.agregarParametro("@idComision", idComision); datos.agregarParametro("@IdInstancia", IdInstancia); datos.agregarParametro("@IdAlumno", IdAlumno); datos.agregarParametro("@Descripcion", Aux.Descripcion); datos.agregarParametro("@FechaAlta", DateTime.Now); datos.agregarParametro("@FechaModificacion", DateTime.Now); datos.agregarParametro("@Nota", Aux.Nota); //datos.agregarParametro("@estado", 1); datos.EjecutarAccion(); } 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 void NuevoComAlu(long IdCom, long IdAlu) { AccesoDatos.AccesoDatos datos = new AccesoDatos.AccesoDatos(); //AccesoDatos datos = new AccesoDatos(); try { datos.SetearQuery("insert into DetComisionAlumnos (idComision,IdAlumno) values( @IdComision,@IdAlumno)"); datos.agregarParametro("@IdComision", IdCom); datos.agregarParametro("@IdAlumno", IdAlu); datos.EjecutarAccion(); } 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 void Modificar(ASA.Models.Comentario Aux) { AccesoDatos.AccesoDatos datos = new AccesoDatos.AccesoDatos(); //Aux = new Comentario(); try { datos.SetearQuery("update Comentario set Descripcion = @Desc , FechaModificacion = @FMod where Id = @Id"); datos.agregarParametro("@Desc", Aux.Descripcion); datos.agregarParametro("@FMod", DateTime.Now); datos.agregarParametro("@Id", Aux.Id); //datos.agregarParametro("@estado", 1); datos.EjecutarAccion(); } 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(); } }