Ejemplo n.º 1
0
        public DemandanteModel GetDemandanteModelByUserId(int id)
        {
            SqlConnection dbCon = new SqlConnection("Data Source=PRODUCCION;Initial Catalog=Prueba;Persist Security Info=True;User ID=sa;Password=Nivelsql*55");

            GestorBD.Repositorio  repositorio = new GestorBD.Repositorio(dbCon);
            dtsLecturaDemandantes dts         = new dtsLecturaDemandantes();
            string sql = "SELECT d.*, u.Usuario, u.Nombre, u.Apellido1, u.Apellido2, u.TipoUsuario, e.Nombre TipoIndustriaNombre FROM Demandantes d INNER JOIN Usuarios u ON d.IdUsuario = u.Id INNER JOIN Estudios e ON d.NivelEstudios = e.NivelEstudios WHERE d.IdUsuario = @idUsuario";

            SqlParameter    param    = new SqlParameter("@idUsuario", id);
            DemandanteModel demModel = new DemandanteModel();

            dts.Merge(repositorio.Leer(sql, CommandType.Text, "Demandantes", param));


            if (dts.Demandantes.Rows.Count > 0)
            {
                demModel = MappingLecturaDemandante.ToDemandanteModel(dts.Demandantes, 0);
                return(demModel);
            }
            else
            {
                demModel = null;
                return(demModel);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  Obtiene un objeto DemandanteModel (llamando al procedimiento 'pDemandantesLectura') a partir de una id ofrecida por parámetro.
        /// </summary>
        /// <param name="id"></param>
        /// <returns>Devuelve un objeto DemandanteModel</returns>
        public DemandanteModel GetDemandanteModelByUserId(int id)
        {
            dtsLecturaDemandantes dts   = new dtsLecturaDemandantes();
            SqlParameter          param = new SqlParameter("@idUsuario", id);

            dts.Merge(this.Repo.Leer("pDemandantesLectura", CommandType.StoredProcedure, dts.Demandantes.TableName, param));
            DemandanteModel demModel = dts.Demandantes.ToDemandanteModel();

            if (dts.Demandantes.Rows.Count > 0)
            {
                return(demModel);
            }
            return(null);
        }
Ejemplo n.º 3
0
        public List <DemandanteModel> GetDemandantes()
        {
            List <DemandanteModel> list = new List <DemandanteModel>();
            dtsLecturaDemandantes  dts  = new dtsLecturaDemandantes();

            dts.Merge(this.Repo.Leer("pDemandantesLecturaTodos", CommandType.StoredProcedure, dts.Demandantes.TableName));

            for (int i = 0; i < dts.Demandantes.Rows.Count; i++)
            {
                list.Add(dts.Demandantes.ToDemandanteModelVistaAdmin(i));
            }

            return(list);
        }
Ejemplo n.º 4
0
        public List <DemandanteModel> GetDemandantesInscritosOferta(int idOferta)
        {
            dtsLecturaDemandantes dts   = new dtsLecturaDemandantes();
            SqlParameter          param = new SqlParameter("@idOferta", idOferta);

            dts.Merge(this.Repo.Leer("pDemandanteModelInscrito", CommandType.StoredProcedure, dts.Demandantes.TableName, param));
            List <DemandanteModel> result = new List <DemandanteModel>();

            int i = 0;

            foreach (DataRow dtRow in dts.Demandantes)
            {
                DemandanteModel demModel = new DemandanteModel();
                demModel = MappingLecturaDemandante.ToDemandanteModelVistaAdmin(dts.Demandantes, i);

                result.Add(demModel);
                i++;
            }
            return(result);
        }