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 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 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 Modificar(Alumno alumno) { AccesoDatos.AccesoDatos datos = new AccesoDatos.AccesoDatos(); try { datos.SetearQuery("Update Alumno set Legajo = @Legajo,Nombre = @Nombre,Apellido = @Apellido,Telefono = @Telefono,Email = @Email,Direccion = @Direccion,Ciudad = @Ciudad,CodigoPostal = @CodigoPostal where Legajo = @Legajo"); datos.Clear(); datos.agregarParametro("@Legajo", alumno.Legajo); datos.agregarParametro("@Nombre", alumno.Nombre); datos.agregarParametro("@Apellido", alumno.Apellido); datos.agregarParametro("@Telefono", alumno.Telefono); datos.agregarParametro("@Email", alumno.Email); datos.agregarParametro("@Direccion", alumno.Dirreccion.Direccion); datos.agregarParametro("@CodigoPostal", alumno.Dirreccion.CodPostal); datos.agregarParametro("@Ciudad", alumno.Dirreccion.Ciudad); datos.EjecutarAccion(); } catch (Exception ex) { throw ex; } }
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(); } }