Esempio n. 1
0
        public bool BuscarDocenteUsuario(long Legajo, string Clave)
        {
            AccesoDatos.AccesoDatos Datos = new AccesoDatos.AccesoDatos();
            try
            {
                Datos.SetearQuery("SELECT LegajoDocente, Clave FROM [Valenzuela_DB].[dbo].[Usuario] where LegajoDocente = @LegajoDocente and Clave = @Clave");
                Datos.Clear();
                Datos.agregarParametro("@LegajoDocente", Legajo);
                Datos.agregarParametro("@Clave", Clave);
                Datos.EjecutarLector();


                while (Datos.Lector.Read())
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                Datos.CerrarConexion();
            }
        }
Esempio n. 2
0
 public void Eliminar(long Id)
 {
     AccesoDatos.AccesoDatos accesoDatos = new AccesoDatos.AccesoDatos();
     try
     {
         accesoDatos.SetearQuery("delete [DetComisionInstancia] where IdInstancia = @Id");
         accesoDatos.Clear();
         accesoDatos.agregarParametro("@Id", Id);
         //accesoDatos.EjecutarAccion();
         //accesoDatos.SetearQuery("delete [Comentario] where IdInstancia = @Id");
         //accesoDatos.Clear();
         //accesoDatos.agregarParametro("@Id", Id);
         //accesoDatos.EjecutarAccion();
         //accesoDatos.SetearQuery("delete [Instancia] where Id = @Id");
         //accesoDatos.Clear();
         //accesoDatos.agregarParametro("@Id", Id);
         accesoDatos.EjecutarAccion();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         accesoDatos.CerrarConexion();
     }
 }
Esempio n. 3
0
        //public long Nuevo (Instancia Aux)
        //{
        //    AccesoDatos.AccesoDatos datos = new AccesoDatos.AccesoDatos();
        //    //AccesoDatos datos = new AccesoDatos();
        //    try
        //    {
        //        datos.SetearQuery("insert into Instancia (Nombre,FechaInicio,FechaFin,IdTipoinstancia) values ( @Nombre,@FechaInicio,@FechaFin,@IdTipoinstancia ) select SCOPE_IDENTITY() as total;");
        //        datos.agregarParametro("@Nombre", Aux.Nombre);
        //        datos.agregarParametro("@FechaInicio", Aux.FechaInicio);
        //        datos.agregarParametro("@FechaFin", Aux.FechaFin);
        //        datos.agregarParametro("@IdTipoinstancia", Aux.TipoInstancia.Id);
        //        datos.EjecutarLector();
        //        long ID = new long();
        //        ID = datos.Lector.GetInt64(0);
        //        //datos.agregarParametro("@estado", 1);
        //        datos.EjecutarAccion();
        //        return ID;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //    finally
        //    {
        //        datos.CerrarConexion();
        //    }
        //}


        public long Nuevo(Instancia Aux)
        {
            AccesoDatos.AccesoDatos datos = new AccesoDatos.AccesoDatos();
            //AccesoDatos datos = new AccesoDatos();
            try
            {
                datos.Clear();
                datos.SetearQuery("INSERT INTO Instancia (Nombre,FechaInicio,FechaFin,IdTipoinstancia) VALUES (@Nombre,@FechaInicio,@FechaFin,@IdTipoinstancia) SELECT CAST(scope_identity() AS int);");
                datos.agregarParametro("@Nombre", Aux.Nombre);
                datos.agregarParametro("@FechaInicio", DateTime.Now);
                datos.agregarParametro("@FechaFin", DateTime.Now);
                datos.agregarParametro("@IdTipoinstancia", Aux.TipoInstancia.Id);
                //datos.agregarParametro("@estado", 1);
                //datos.EjecutarAccionSinCerrar();
                long ID = datos.getExecuteScalar();
                return(ID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                datos.CerrarConexion();
            }
        }
Esempio n. 4
0
 public long Nuevo(Comision Aux)
 {
     AccesoDatos.AccesoDatos datos = new AccesoDatos.AccesoDatos();
     //AccesoDatos datos = new AccesoDatos();
     try
     {
         datos.Clear();
         datos.SetearQuery("insert into Comision (IdMateria,IdTurno,IdCuatrimestre,IdDocente,Anio) values (@IdMateria,@IdTurno,@IdCuatrimestre,@IdDocente,@Anio)  SELECT CAST(scope_identity() AS int);");
         datos.agregarParametro("@IdMateria", Aux.Materia.Id);
         datos.agregarParametro("@IdTurno", Aux.Turno.Id);
         datos.agregarParametro("@IdCuatrimestre", Aux.Cuatrimestre.Id);
         datos.agregarParametro("@IdDocente", Aux.docente.Legajo);
         datos.agregarParametro("@Anio", Aux.Anio);
         //datos.agregarParametro("@estado", 1);
         //datos.EjecutarAccionSinCerrar();
         long ID = datos.getExecuteScalar();
         return(ID);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         datos.CerrarConexion();
     }
 }
Esempio n. 5
0
        public List <Models.Instancia> ListarXComision(long Id, string Nombre = "", string Tinstancia = "")
        {
            List <Models.Instancia> Listado = new List <Models.Instancia>();

            Models.Instancia        Aux;
            AccesoDatos.AccesoDatos Datos = new AccesoDatos.AccesoDatos();
            try
            {
                Datos.SetearQuery("exec sp_ComisionInstancia @Id,@Nombre,@Tinstancia;");
                Datos.Clear();
                Datos.agregarParametro("@Id", Id);
                Datos.agregarParametro("@Nombre", "%" + Nombre + "%");
                if (Tinstancia == "Todos")
                {
                    Datos.agregarParametro("@Tinstancia", "%%");
                }
                else
                {
                    Datos.agregarParametro("@Tinstancia", "%" + Tinstancia + "%");
                }

                Datos.EjecutarLector();

                while (Datos.Lector.Read())
                {
                    Aux                      = new Models.Instancia();
                    Aux.Id                   = Datos.Lector.GetInt64(0);
                    Aux.Nombre               = Datos.Lector.GetString(1);
                    Aux.FechaInicio          = Datos.Lector.GetDateTime(2);
                    Aux.FechaFin             = Datos.Lector.GetDateTime(3);
                    Aux.TipoInstancia        = new Models.TipoInstancia();
                    Aux.TipoInstancia.Id     = Datos.Lector.GetInt64(4);
                    Aux.TipoInstancia.Nombre = Datos.Lector.GetString(5);
                    Listado.Add(Aux);
                }

                return(Listado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                Datos.CerrarConexion();
            }
        }
Esempio n. 6
0
 public void Modificar(Instancia Aux)
 {
     AccesoDatos.AccesoDatos accesoDatos = new AccesoDatos.AccesoDatos();
     try
     {
         accesoDatos.SetearQuery("update Instancia set Nombre = @Nombre, FechaInicio = @FechaInicio, FechaFin = @FechaFin, IdTipoinstancia = @TIins  where id = @Id");
         accesoDatos.Clear();
         accesoDatos.agregarParametro("@Nombre", Aux.Nombre);
         accesoDatos.agregarParametro("@FechaInicio", DateTime.Now);
         accesoDatos.agregarParametro("@FechaFin", DateTime.Now);
         accesoDatos.agregarParametro("@TIins", Aux.TipoInstancia.Id);
         accesoDatos.agregarParametro("@Id", Aux.Id);
         accesoDatos.EjecutarAccion();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 7
0
 public void Modificar(Usuario usuario)
 {
     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", usuario.Docente.Legajo);
         datos.agregarParametro("@Nombre", usuario.Docente.Nombre);
         datos.agregarParametro("@Apellido", usuario.Docente.Apellido);
         datos.agregarParametro("@Telefono", usuario.Docente.Telefono);
         datos.agregarParametro("@Email", usuario.Docente.Email);
         datos.agregarParametro("@Direccion", usuario.Docente.Dirreccion.Direccion);
         datos.agregarParametro("@CodigoPostal", usuario.Docente.Dirreccion.CodPostal);
         datos.agregarParametro("@Ciudad", usuario.Docente.Dirreccion.Ciudad);
         datos.EjecutarAccion();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 8
0
        public List <Models.Comision> Listar(int IdDocente, string Materiaa = "", string Turnoo = "", string Cuatrimestree = "", string Anio = "")
        {
            List <Models.Comision> Listado = new List <Models.Comision>();

            Models.Comision Aux;
            DocenteServices docenteServices = new DocenteServices();

            AccesoDatos.AccesoDatos Datos = new AccesoDatos.AccesoDatos();
            try
            {
                Datos.SetearQuery("exec sp_ComisionesDocente @IdDocente,@Materia,@Turno,@Cuatrimestre,@Anio;");
                Datos.Clear();
                Datos.agregarParametro("@IdDocente", IdDocente);
                if (Materiaa == "Todos")
                {
                    Datos.agregarParametro("@Materia", "%%");
                }
                else
                {
                    Datos.agregarParametro("@Materia", Materiaa);
                }

                if (Turnoo == "Todos")
                {
                    Datos.agregarParametro("@Turno", "%%");
                }
                else
                {
                    Datos.agregarParametro("@Turno", Turnoo);
                }

                if (Cuatrimestree == "Todos")
                {
                    Datos.agregarParametro("@Cuatrimestre", "%%");
                }
                else
                {
                    Datos.agregarParametro("@Cuatrimestre", Cuatrimestree);
                }
                Datos.agregarParametro("@Anio", "%" + Anio + "%");
                Datos.EjecutarLector();

                while (Datos.Lector.Read())
                {
                    Aux    = new Models.Comision();
                    Aux.Id = Datos.Lector.GetInt64(0);

                    Aux.Materia        = new Materia();
                    Aux.Materia.Id     = Datos.Lector.GetInt64(1);
                    Aux.Materia.Nombre = Datos.Lector.GetString(2);

                    Aux.Materia.Carrera        = new Carrera();
                    Aux.Materia.Carrera.Id     = Datos.Lector.GetInt64(3);
                    Aux.Materia.Carrera.Nombre = Datos.Lector.GetString(4);

                    Aux.Materia.Carrera.Universidad        = new Universidad();
                    Aux.Materia.Carrera.Universidad.Id     = Datos.Lector.GetInt64(5);
                    Aux.Materia.Carrera.Universidad.Nombre = Datos.Lector.GetString(6);

                    Aux.Turno        = new Turno();
                    Aux.Turno.Id     = Datos.Lector.GetInt64(7);
                    Aux.Turno.Nombre = Datos.Lector.GetString(8);

                    Aux.Cuatrimestre        = new Cuatrimestre();
                    Aux.Cuatrimestre.Id     = Datos.Lector.GetInt64(9);
                    Aux.Cuatrimestre.Nombre = Datos.Lector.GetString(10);

                    Aux.Anio = Datos.Lector.GetInt32(11);

                    //Aux.docente = new Docente();
                    //Aux.docente = docenteServices.BuscarDocente(IdDocente);

                    //ListarAlumnosComision(Aux);

                    //ListarInstanciaComision(Aux);

                    Listado.Add(Aux);
                }
                return(Listado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                Datos.CerrarConexion();
            }
        }