public List <OfertaEstudio> ObtenerEstudiosNoUniversitarios(int idOferta, int idOfertaEstudio)
        {
            List <OfertaEstudio> lista = new List <OfertaEstudio>();

            DataTable dtResultado = adOfertaEstudio.ObtenerEstudios(idOferta, idOfertaEstudio);

            foreach (DataRow fila in dtResultado.Rows)
            {
                OfertaEstudio estudio = new OfertaEstudio();
                estudio.IdOfertaEstudio              = Convert.ToInt32(fila["IdOfertaEstudio"]);
                estudio.IdOferta                     = Convert.ToInt32(fila["IdOferta"]);
                estudio.CicloEstudio                 = Convert.ToInt32(fila["CicloEstudio"] == System.DBNull.Value ? null : fila["CicloEstudio"]);
                estudio.Estudio                      = Convert.ToString(fila["Estudio"]);
                estudio.EstudioTexto                 = Convert.ToString(fila["Estudio"]);
                estudio.TipoDeEstudio.Valor          = Convert.ToString(fila["TipoDeEstudioDescripcion"]);
                estudio.TipoDeEstudioIdListaValor    = Convert.ToString(fila["TipoDeEstudio"]);
                estudio.EstadoDelEstudio.Valor       = Convert.ToString(fila["EstadoDelEstudioDescripcion"]);
                estudio.EstadoDelEstudioIdListaValor = Convert.ToString(fila["EstadoDelEstudio"]);
                estudio.EstadoOfertaEstudio.Valor    = Convert.ToString(fila["EstadoOfertaEstudioDescripcion"]);
                estudio.CreadoPor                    = Convert.ToString(fila["CreadoPor"]);

                lista.Add(estudio);
            }

            return(lista.Where(m => m.TipoDeEstudioIdListaValor != "TEUNIV").ToList());;
        }
Example #2
0
        [ValidateAntiForgeryToken]                                                 // this action takes the viewModel from the modal
        public PartialViewResult _OfertaEstudioEditar(OfertaEstudio ofertaEstudio) //Este es como el submit
        {
            if (ofertaEstudio.TipoDeEstudioIdListaValor != "TEUNIV")
            {
                ModelState.Remove("Estudio"); //Se quita el campo porque tiene null.
                ofertaEstudio.Estudio = ofertaEstudio.EstudioTexto;
            }
            if (ModelState.IsValid)
            {
                TicketEmpresa ticket = (TicketEmpresa)Session["TicketEmpresa"];

                //Datos DEMO
                //ofertaEstudio.IdOferta = 13;
                //ofertaEstudio.CicloEstudio = "AWE2";
                //ofertaEstudio.Estudio = "Estudios2";
                //ofertaEstudio.TipoDeEstudio.IdListaValor = "ABC2";
                //ofertaEstudio.EstadoDelEstudio.IdListaValor = "AWE2";
                //ofertaEstudio.EstadoOfertaEstudio.IdListaValor = "ABC2";
                ofertaEstudio.ModificadoPor = ticket.Usuario;


                lnOfertaEstudio.Actualizar(ofertaEstudio);

                List <OfertaEstudio> lista = lnOfertaEstudio.ObtenerEstudiosNoUniversitarios(ofertaEstudio.IdOferta, idOfertaEstudiosTodos);  //TODO: Obtener el Id de la oferta.

                ViewBag.IdOferta = ofertaEstudio.IdOferta;
                return(PartialView("_OfertaEstudio", lista));
            }

            return(PartialView("_OfertaEstudioEditar", ofertaEstudio));
        }
        public void Actualizar(OfertaEstudio ofertaEstudio)
        {
            using (SqlConnection conexion = new SqlConnection(cadenaConexion))
            {
                SqlCommand cmd = new SqlCommand();

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "OfertaEstudio_Actualizar";

                //Parámetros:
                cmd.Parameters.Add(new SqlParameter("@IdOfertaEstudio", ofertaEstudio.IdOfertaEstudio));
                cmd.Parameters.Add(new SqlParameter("@IdOferta", ofertaEstudio.IdOferta));
                cmd.Parameters.Add(new SqlParameter("@CicloEstudio", ofertaEstudio.CicloEstudio));
                cmd.Parameters.Add(new SqlParameter("@Estudio", ofertaEstudio.Estudio));
                cmd.Parameters.Add(new SqlParameter("@TipoDeEstudio", ofertaEstudio.TipoDeEstudioIdListaValor));
                cmd.Parameters.Add(new SqlParameter("@EstadoDelEstudio", ofertaEstudio.EstadoDelEstudioIdListaValor));
                //cmd.Parameters.Add(new SqlParameter("@EstadoOfertaEstudio", ofertaEstudio.EstadoOfertaEstudio.IdListaValor));
                cmd.Parameters.Add(new SqlParameter("@ModificadoPor", ofertaEstudio.ModificadoPor));

                cmd.Connection = conexion;

                conexion.Open();

                cmd.ExecuteNonQuery();

                conexion.Close();
            }
        }
        public List<OfertaEstudio> ObtenerEstudiosNoUniversitarios(int idOferta, int idOfertaEstudio)
        {
            List<OfertaEstudio> lista = new List<OfertaEstudio>();

            DataTable dtResultado = adOfertaEstudio.ObtenerEstudios(idOferta, idOfertaEstudio);

            foreach (DataRow fila in dtResultado.Rows)
            {
                OfertaEstudio estudio = new OfertaEstudio();
                estudio.IdOfertaEstudio = Convert.ToInt32(fila["IdOfertaEstudio"]);
                estudio.IdOferta = Convert.ToInt32(fila["IdOferta"]);
                estudio.CicloEstudio = Convert.ToInt32(fila["CicloEstudio"] == System.DBNull.Value ? null : fila["CicloEstudio"]);
                estudio.Estudio = Convert.ToString(fila["Estudio"]);
                estudio.EstudioTexto = Convert.ToString(fila["Estudio"]);
                estudio.TipoDeEstudio.Valor = Convert.ToString(fila["TipoDeEstudioDescripcion"]);
                estudio.TipoDeEstudioIdListaValor = Convert.ToString(fila["TipoDeEstudio"]);
                estudio.EstadoDelEstudio.Valor = Convert.ToString(fila["EstadoDelEstudioDescripcion"]);
                estudio.EstadoDelEstudioIdListaValor = Convert.ToString(fila["EstadoDelEstudio"]);
                estudio.EstadoOfertaEstudio.Valor = Convert.ToString(fila["EstadoOfertaEstudioDescripcion"]);
                estudio.CreadoPor = Convert.ToString(fila["CreadoPor"]);

                lista.Add(estudio);
            }

            return lista.Where(m => m.TipoDeEstudioIdListaValor != "TEUNIV").ToList();;
        }
        public ActionResult AgregarCarreras(string codigos)
        {
            LNGeneral lnGeneral = new LNGeneral();
            List<ListaValor> listaCarrerasUTP = lnGeneral.ObtenerListaValor(Constantes.IDLISTA_DE_CARRERA).Where(m => m.IdListaValorPadre == "TEUNIV").ToList();

            //Se obtiene la lista actual:
            List<OfertaEstudio> listaSeleccionados = (List<OfertaEstudio>)(Session["CarrerasSeleccionadas"]);
            List<ListaValor> listaDisponibles = (List<ListaValor>)(Session["CarrerasDisponibles"]);

            string[] listaCodigos = codigos.Split('-');

            for (int i = 0; i < listaCodigos.Length-1; i++)
            {
                //Se busca en la lista de la BD:
                ListaValor carrera = listaCarrerasUTP.Where(m => m.IdListaValor == listaCodigos[i]).FirstOrDefault();
                OfertaEstudio ofertaEstudio = new OfertaEstudio ();
                ofertaEstudio.TipoDeEstudioIdListaValor = "TEUNIV"; // listaCodigos[i]; //aca buscar y traer la lista de la BD.
                ofertaEstudio.CodigoCarrera = listaCodigos[i]; //Este código sirve para tenerlo como clave de la lista. Es el código de la carrera.
                ofertaEstudio.Estudio = carrera.Valor;
                listaSeleccionados.Add(ofertaEstudio);

                //Se quita el codigo de la lista disponible:
                listaDisponibles.RemoveAll(m => m.IdListaValor == listaCodigos[i]);
            }

            //Se vuelve a cargar la lista y se retorna la vista parcial para que se carguen nuevamente los valores.
            Session["CarrerasSeleccionadas"] = listaSeleccionados;
            Session["CarrerasDisponibles"] = listaDisponibles;

            return PartialView("_OfertaEstudiosUTP");
        }
        public PartialViewResult _OfertaEstudioCrear(int id)
        {
            OfertaEstudio ofertaEstudio = new OfertaEstudio();
            ofertaEstudio.IdOferta = id;

            ViewBag.TipoDeEstudioIdListaValor = new SelectList(lnGeneral.ObtenerListaValorOfertaTipoEstudiosEspecificos(Constantes.IDLISTA_TIPO_DE_ESTUDIO), "IdListaValor", "Valor");
            ViewBag.EstadoDelEstudioIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_ESTADO_DEL_ESTUDIO), "IdListaValor", "Valor");
            ViewBag.Estudio = new SelectList(lnGeneral.ObtenerListaValorPorIdPadre(Constantes.TIPO_ESTUDIO_UNIVERSITARIO), "Valor","Valor");

            return PartialView("_OfertaEstudioCrear", ofertaEstudio);
        }
Example #7
0
        [HttpGet] // esta acción devuelve la vista parcial con los datos para cargar el modal.
        public PartialViewResult _OfertaEstudioCrear(int id)
        {
            OfertaEstudio ofertaEstudio = new OfertaEstudio();

            ofertaEstudio.IdOferta = id;

            ViewBag.TipoDeEstudioIdListaValor    = new SelectList(lnGeneral.ObtenerListaValorOfertaTipoEstudiosEspecificos(Constantes.IDLISTA_TIPO_DE_ESTUDIO), "IdListaValor", "Valor");
            ViewBag.EstadoDelEstudioIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_ESTADO_DEL_ESTUDIO), "IdListaValor", "Valor");
            ViewBag.Estudio = new SelectList(lnGeneral.ObtenerListaValorPorIdPadre(Constantes.TIPO_ESTUDIO_UNIVERSITARIO), "Valor", "Valor");

            return(PartialView("_OfertaEstudioCrear", ofertaEstudio));
        }
Example #8
0
        [HttpGet] // esta acción devuelve la vista parcial con los datos para cargar el modal.
        public PartialViewResult _OfertaEstudioEditar(int id)
        {
            //Obtener los datos del modelo de editar y pasarlo como parámetro.
            List <OfertaEstudio> lista = lnOfertaEstudio.ObtenerEstudios(0, id);

            OfertaEstudio ofertaEstudio = lista[0];

            ViewBag.TipoDeEstudioIdListaValor    = new SelectList(lnGeneral.ObtenerListaValorOfertaTipoEstudiosEspecificos(Constantes.IDLISTA_TIPO_DE_ESTUDIO), "IdListaValor", "Valor", ofertaEstudio.TipoDeEstudioIdListaValor);
            ViewBag.EstadoDelEstudioIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_ESTADO_DEL_ESTUDIO), "IdListaValor", "Valor", ofertaEstudio.EstadoDelEstudioIdListaValor);
            ViewBag.Estudio = new SelectList(lnGeneral.ObtenerListaValorPorIdPadre(Constantes.TIPO_ESTUDIO_UNIVERSITARIO), "Valor", "Valor", ofertaEstudio.Estudio);

            return(PartialView("_OfertaEstudioEditar", ofertaEstudio));
        }
Example #9
0
        public PartialViewResult _OfertaEstudioEliminar(int id)
        {
            List <OfertaEstudio> listaEstudios = lnOfertaEstudio.ObtenerEstudios(0, id);

            OfertaEstudio ofertaEstudio = listaEstudios[0];

            lnOfertaEstudio.Eliminar(id);

            List <OfertaEstudio> lista = lnOfertaEstudio.ObtenerEstudiosNoUniversitarios(ofertaEstudio.IdOferta, idOfertaEstudiosTodos);  //TODO: Obtener el Id de la oferta.

            ViewBag.IdOferta = ofertaEstudio.IdOferta;

            return(PartialView("_OfertaEstudio", lista));
        }
        public PartialViewResult _OfertaEstudioCrear(OfertaEstudio ofertaEstudio)
        {
            //Aldo 09FEB: Si el tipo de estudio es distinto a universitario se reemplaza el campo EstudioTexto en Estudio
            //Si el campo TipoDeEstudioIdListaValor es TEUNIV entonces el dato de estudio sí se encuentra en ofertaEstudio.Estudio y no se necesita reemplazar.
            if (ofertaEstudio.TipoDeEstudioIdListaValor != Constantes.TIPO_ESTUDIO_UNIVERSITARIO)
            {
                ModelState.Remove("Estudio"); //Se quita el campo porque tiene null.
                ofertaEstudio.Estudio = ofertaEstudio.EstudioTexto;
            }
            if (ModelState.IsValid)
            {
                TicketEmpresa ticket = (TicketEmpresa)Session["TicketEmpresa"];
                //string usuarioCreacion = ticket.UsuarioNombre;

                //ofertaEstudio.IdOferta = 13;
                //ofertaEstudio.CicloEstudio = "AWE";
                //ofertaEstudio.Estudio = "Estudios";
                //ofertaEstudio.TipoDeEstudio.IdListaValor = "ABC";
                //ofertaEstudio.EstadoDelEstudio.IdListaValor = "AWE";
                ofertaEstudio.EstadoOfertaEstudio.IdListaValor = "OFESAC"; //Estado oferta estudio activa.
                ofertaEstudio.CreadoPor = ticket.Usuario;

                LNOfertaEstudio lnOfertaEstudio = new LNOfertaEstudio();
                lnOfertaEstudio.Insertar(ofertaEstudio);

                List<OfertaEstudio> lista = lnOfertaEstudio.ObtenerEstudiosNoUniversitarios(ofertaEstudio.IdOferta, idOfertaEstudiosTodos);

                ViewBag.IdOferta = ofertaEstudio.IdOferta;

                return PartialView("_OfertaEstudio", lista);
            }
            else
            {
                var errors = ModelState.Select(x => x.Value.Errors)
                           .Where(y => y.Count > 0)
                           .ToList();

                int a = 0;
            }
            return PartialView("_OfertaEstudioCrear", ofertaEstudio);
        }
Example #11
0
        public PartialViewResult _OfertaEstudioCrear(OfertaEstudio ofertaEstudio)
        {
            //Aldo 09FEB: Si el tipo de estudio es distinto a universitario se reemplaza el campo EstudioTexto en Estudio
            //Si el campo TipoDeEstudioIdListaValor es TEUNIV entonces el dato de estudio sí se encuentra en ofertaEstudio.Estudio y no se necesita reemplazar.
            if (ofertaEstudio.TipoDeEstudioIdListaValor != Constantes.TIPO_ESTUDIO_UNIVERSITARIO)
            {
                ModelState.Remove("Estudio"); //Se quita el campo porque tiene null.
                ofertaEstudio.Estudio = ofertaEstudio.EstudioTexto;
            }
            if (ModelState.IsValid)
            {
                TicketEmpresa ticket = (TicketEmpresa)Session["TicketEmpresa"];
                //string usuarioCreacion = ticket.UsuarioNombre;

                //ofertaEstudio.IdOferta = 13;
                //ofertaEstudio.CicloEstudio = "AWE";
                //ofertaEstudio.Estudio = "Estudios";
                //ofertaEstudio.TipoDeEstudio.IdListaValor = "ABC";
                //ofertaEstudio.EstadoDelEstudio.IdListaValor = "AWE";
                ofertaEstudio.EstadoOfertaEstudio.IdListaValor = "OFESAC"; //Estado oferta estudio activa.
                ofertaEstudio.CreadoPor = ticket.Usuario;

                LNOfertaEstudio lnOfertaEstudio = new LNOfertaEstudio();
                lnOfertaEstudio.Insertar(ofertaEstudio);

                List <OfertaEstudio> lista = lnOfertaEstudio.ObtenerEstudiosNoUniversitarios(ofertaEstudio.IdOferta, idOfertaEstudiosTodos);

                ViewBag.IdOferta = ofertaEstudio.IdOferta;

                return(PartialView("_OfertaEstudio", lista));
            }
            else
            {
                var errors = ModelState.Select(x => x.Value.Errors)
                             .Where(y => y.Count > 0)
                             .ToList();

                int a = 0;
            }
            return(PartialView("_OfertaEstudioCrear", ofertaEstudio));
        }
        public Oferta ObtenerPorId(int idOferta)
        {
            Oferta oferta = null;

            //18FEB: Se obtiene las carreras de UTP y se quitan las ya seleccionadas.
            LNGeneral         lnGeneral        = new LNGeneral();
            List <ListaValor> listaCarrerasUTP = lnGeneral.ObtenerListaValor(Constantes.IDLISTA_DE_CARRERA).Where(m => m.IdListaValorPadre == "TEUNIV").ToList(); //Se obtienen todas las carreras


            DataSet dsResultado = adOferta.ObtenerPorId(idOferta);

            //Tabla Index 0: Datos de la oferta.
            if (dsResultado.Tables[0].Rows.Count > 0)
            {
                oferta = new Oferta();

                oferta.IdOferta      = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["IdOferta"]);
                oferta.IdEmpresa     = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["IdEmpresa"]);
                oferta.CargoOfrecido = Convert.ToString(dsResultado.Tables[0].Rows[0]["CargoOfrecido"]);
                oferta.Funciones     = Convert.ToString(dsResultado.Tables[0].Rows[0]["Funciones"]);
                oferta.Competencias  = Convert.ToString(dsResultado.Tables[0].Rows[0]["Competencias"]);

                oferta.TipoTrabajoIdListaValor  = Convert.ToString(dsResultado.Tables[0].Rows[0]["TipoTrabajo"]);
                oferta.TipoTrabajo.Valor        = Convert.ToString(dsResultado.Tables[0].Rows[0]["TipoTrabajoDescripcion"]);
                oferta.TipoCargoIdListaValor    = Convert.ToString(dsResultado.Tables[0].Rows[0]["TipoCargo"]);
                oferta.TipoCargo.Valor          = Convert.ToString(dsResultado.Tables[0].Rows[0]["TipoCargoDescripcion"]);
                oferta.TipoContratoIdListaValor = Convert.ToString(dsResultado.Tables[0].Rows[0]["TipoContrato"]);
                oferta.TipoContrato.Valor       = Convert.ToString(dsResultado.Tables[0].Rows[0]["TipoContratoDescripcion"]);


                oferta.RemuneracionOfrecida = Convert.ToDecimal(dsResultado.Tables[0].Rows[0]["RemuneracionOfrecida"]);
                oferta.Horario     = Convert.ToString(dsResultado.Tables[0].Rows[0]["Horario"]);
                oferta.AreaEmpresa = Convert.ToString(dsResultado.Tables[0].Rows[0]["AreaEmpresa"]);

                if (dsResultado.Tables[0].Rows[0]["NumeroVacantes"] == System.DBNull.Value)
                {
                    oferta.NumeroVacantes = null;
                }
                else
                {
                    oferta.NumeroVacantes = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["NumeroVacantes"]);
                }

                oferta.IdEmpresaLocacion         = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["IdEmpresaLocacion"]);
                oferta.RecibeCorreosIdListaValor = Convert.ToString(dsResultado.Tables[0].Rows[0]["RecibeCorreos"]);
                oferta.FechaFinRecepcionCV       = Convert.ToDateTime(dsResultado.Tables[0].Rows[0]["FechaFinRecepcionCV"]);
                oferta.AreaEmpresa = Convert.ToString(dsResultado.Tables[0].Rows[0]["AreaEmpresa"]);

                if (dsResultado.Tables[0].Rows[0]["DuracionContrato"] == System.DBNull.Value)
                {
                    oferta.DuracionContrato = null;
                }
                else
                {
                    oferta.DuracionContrato = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["DuracionContrato"]);
                }

                oferta.Empresa.NombreComercial = Convert.ToString(dsResultado.Tables[0].Rows[0]["EmpresaNombreComercial"]);
                oferta.NombreLocacion          = Convert.ToString(dsResultado.Tables[0].Rows[0]["NombreLocacion"]);

                oferta.CreadoPor         = Convert.ToString(dsResultado.Tables[0].Rows[0]["CreadoPor"]);
                oferta.ModificadoPor     = Convert.ToString(dsResultado.Tables[0].Rows[0]["ModificadoPor"]);
                oferta.FechaCreacion     = Convert.ToDateTime(dsResultado.Tables[0].Rows[0]["FechaCreacion"]);
                oferta.FechaModificacion = Convert.ToDateTime(dsResultado.Tables[0].Rows[0]["FechaModificacion"]);

                oferta.EstadoOferta = Convert.ToString(dsResultado.Tables[0].Rows[0]["EstadoOferta"]);
                oferta.UsuarioPropietarioEmpresa = Convert.ToString(dsResultado.Tables[0].Rows[0]["UsuarioPropietarioEmpresa"]);
                oferta.FechaPublicacion          = Convert.ToDateTime(dsResultado.Tables[0].Rows[0]["FechaPublicacion"]);

                oferta.CicloMinimoCarreraUTP          = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["CicloMinimoCarreraUTP"]);
                oferta.EstadoCarreraUTP               = Convert.ToString(dsResultado.Tables[0].Rows[0]["EstadoCarreraUTP"]);
                oferta.ExperienciaGeneral             = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["MesesExperienciaTotal"]);
                oferta.ExperienciaPosicionesSimilares = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["MesesExperienciaTipoTrabajo"]);

                //05MAR15: Para las nuevas ofertas este campo siempre está con data. Se agrega la validación para compatibilidad con ofertas anteriores.
                oferta.FechaFinProceso = Convert.ToDateTime(dsResultado.Tables[0].Rows[0]["FechaFinProceso"] == System.DBNull.Value ? new DateTime(1, 1, 1900) : dsResultado.Tables[0].Rows[0]["FechaFinProceso"]);
            }

            //Tabla Index 1: Lista de estudios.
            //Se instancia las listas:
            oferta.ListaEstudios         = new List <OfertaEstudio>();
            oferta.CarrerasSeleccionadas = new List <OfertaEstudio>();
            foreach (DataRow filaEstudio in dsResultado.Tables[1].Rows)
            {
                OfertaEstudio estudio = new OfertaEstudio();
                estudio.IdOfertaEstudio            = Convert.ToInt32(filaEstudio["IdOfertaEstudio"] == System.DBNull.Value ? null : filaEstudio["IdOfertaEstudio"]);
                estudio.IdOferta                   = Convert.ToInt32(filaEstudio["IdOfertaEstudio"] == System.DBNull.Value ? null : filaEstudio["IdOfertaEstudio"]);
                estudio.CicloEstudio               = Convert.ToInt32(filaEstudio["CicloEstudio"] == System.DBNull.Value ? null : filaEstudio["CicloEstudio"]);
                estudio.Estudio                    = Convert.ToString(filaEstudio["Estudio"] == System.DBNull.Value ? null : filaEstudio["Estudio"]);
                estudio.TipoDeEstudio.IdListaValor = Convert.ToString(filaEstudio["TipoDeEstudio"] == System.DBNull.Value ? null : filaEstudio["TipoDeEstudio"]);
                estudio.TipoDeEstudioIdListaValor  = Convert.ToString(filaEstudio["TipoDeEstudio"] == System.DBNull.Value ? null : filaEstudio["TipoDeEstudio"]);
                estudio.TipoDeEstudio.Valor        = Convert.ToString(filaEstudio["TipoDeEstudioDescripcion"]);
                estudio.EstadoDelEstudio.Valor     = Convert.ToString(filaEstudio["EstadoDelEstudioDescripcion"]);
                estudio.EstadoOfertaEstudio.Valor  = Convert.ToString(filaEstudio["EstadoOfertaEstudioDescripcion"]);
                estudio.CreadoPor                  = Convert.ToString(filaEstudio["CreadoPor"]);
                estudio.ModificadoPor              = Convert.ToString(filaEstudio["ModificadoPor"]);
                estudio.FechaCreacion              = Convert.ToDateTime(filaEstudio["FechaCreacion"]);
                estudio.FechaModificacion          = Convert.ToDateTime(filaEstudio["FechaModificacion"]);

                #region Se separan las carrearas universitarias UTP.
                if (estudio.TipoDeEstudio.IdListaValor == "TEUNIV") //Tipo de Estudio Universitario de UTP.
                {
                    var carreraEncontrada = listaCarrerasUTP.Where(m => m.Valor == estudio.Estudio).FirstOrDefault();

                    if (carreraEncontrada != null)
                    {
                        estudio.CodigoCarrera = carreraEncontrada.IdListaValor; //Se guarda el código de la carrera.
                        oferta.CarrerasSeleccionadas.Add(estudio);
                    }
                }
                else //Otros estudios.
                {
                    oferta.ListaEstudios.Add(estudio);
                }
                #endregion
            }

            //Tabla Index 2: Lista de experiencia por sector
            oferta.ListaSectores = new List <OfertaSectorEmpresarial>();
            foreach (DataRow filaSector in dsResultado.Tables[2].Rows)
            {
                OfertaSectorEmpresarial sector = new OfertaSectorEmpresarial();
                sector.IdOfertaSectorEmpresarial = Convert.ToInt32(filaSector["IdOfertaSectorEmpresarial"]);
                sector.IdOferta = Convert.ToInt32(filaSector["IdOferta"]);
                sector.SectorEmpresarial.Valor             = Convert.ToString(filaSector["SectorEmpresarialDescripcion"]);
                sector.AniosTrabajados                     = Convert.ToInt32(filaSector["AniosTrabajados"] == System.DBNull.Value ? null : filaSector["AniosTrabajados"]);
                sector.ExperienciaExcluyente               = Convert.ToBoolean(filaSector["ExperienciaExcluyente"]);
                sector.EstadoOfertaSectorEmpresarial.Valor = Convert.ToString(filaSector["EstadoOfertaSectorEmpresarialDescripcion"]);
                sector.CreadoPor         = Convert.ToString(filaSector["CreadoPor"]);
                sector.ModificadoPor     = Convert.ToString(filaSector["ModificadoPor"]);
                sector.FechaCreacion     = Convert.ToDateTime(filaSector["FechaCreacion"]);
                sector.FechaModificacion = Convert.ToDateTime(filaSector["FechaModificacion"]);

                oferta.ListaSectores.Add(sector);
            }

            //Tabla Index 3: Lista de información adicional
            oferta.ListaInformacionAdicional = new List <OfertaInformacionAdicional>();
            foreach (DataRow filaInfoAdicional in dsResultado.Tables[3].Rows)
            {
                OfertaInformacionAdicional infoAdicional = new OfertaInformacionAdicional();
                infoAdicional.IdOfertaInformacionAdicional = Convert.ToInt32(filaInfoAdicional["IdOfertaInformacionAdicional"]);
                infoAdicional.IdOferta = Convert.ToInt32(filaInfoAdicional["IdOferta"]);
                infoAdicional.TipoConocimiento.Valor  = Convert.ToString(filaInfoAdicional["TipoConocimientoDescripcion"]);
                infoAdicional.Conocimiento            = Convert.ToString(filaInfoAdicional["Conocimiento"]);
                infoAdicional.NivelConocimiento.Valor = Convert.ToString(filaInfoAdicional["NivelConocimientoDescripcion"]);
                infoAdicional.AniosExperiencia        = Convert.ToInt32(filaInfoAdicional["AniosExperiencia"] == System.DBNull.Value ? null : filaInfoAdicional["AniosExperiencia"]);
                infoAdicional.EstadoOfertaInformacionAdicional.Valor = Convert.ToString(filaInfoAdicional["EstadoOfertaInformacionAdicionalDescripcion"]);
                infoAdicional.CreadoPor         = Convert.ToString(filaInfoAdicional["CreadoPor"]);
                infoAdicional.ModificadoPor     = Convert.ToString(filaInfoAdicional["ModificadoPor"]);
                infoAdicional.FechaCreacion     = Convert.ToDateTime(filaInfoAdicional["FechaCreacion"]);
                infoAdicional.FechaModificacion = Convert.ToDateTime(filaInfoAdicional["FechaModificacion"]);

                oferta.ListaInformacionAdicional.Add(infoAdicional);
            }


            //Tabla Index 4: Lista de Postulantes
            oferta.Postulantes = new List <OfertaPostulante>();
            foreach (DataRow filaPostulante in dsResultado.Tables[4].Rows)
            {
                OfertaPostulante postulante = new OfertaPostulante();
                postulante.Alumno.IdAlumno   = Convert.ToInt32(filaPostulante["IdAlumno"]);
                postulante.Alumno.Nombres    = Convert.ToString(filaPostulante["AlumnoNombres"]);
                postulante.Alumno.Apellidos  = Convert.ToString(filaPostulante["AlumnoApellidos"]);
                postulante.FechaPostulacion  = Convert.ToDateTime(filaPostulante["FechaPostulacion"]);
                postulante.FaseOferta.Valor  = Convert.ToString(filaPostulante["FaseOferta"]);
                postulante.NombreCV          = Convert.ToString(filaPostulante["NombreCV"]);
                postulante.NivelDeMatch      = Convert.ToInt32(filaPostulante["NivelDeMatch"]);
                postulante.CreadoPor         = Convert.ToString(filaPostulante["CreadoPor"]);
                postulante.ModificadoPor     = Convert.ToString(filaPostulante["ModificadoPor"]);
                postulante.FechaCreacion     = Convert.ToDateTime(filaPostulante["FechaCreacion"]);
                postulante.FechaModificacion = Convert.ToDateTime(filaPostulante["FechaModificacion"]);

                oferta.Postulantes.Add(postulante);
            }

            //Fases de la oferta
            oferta.OfertaFases = Obtener_OfertaFase(idOferta);


            //Se instancia la lista:
            oferta.CarrerasDisponibles = new List <ListaValor>(); //Esta lista va al lado izquierdo
            //Se recorren las carreras.
            foreach (var carreraUTP in listaCarrerasUTP)
            {
                //Si la carreraUTP ya está seleccionada entonces NO se agrega. Si la búsqueda es null => no está, por lo tanto, sí se agrega.
                if (oferta.CarrerasSeleccionadas.Where(m => m.Estudio == carreraUTP.Valor).FirstOrDefault() == null)
                {
                    ListaValor carreraDisponible = copiarListaValor(carreraUTP);
                    oferta.CarrerasDisponibles.Add(carreraDisponible);
                }
            }

            return(oferta);
        }
 public void Insertar(OfertaEstudio ofertaEstudio)
 {
     lnOfertaEstudio.Insertar(ofertaEstudio);
 }
 public void Actualizar(OfertaEstudio ofertaEstudio)
 {
     adOfertaEstudio.Actualizar(ofertaEstudio);
 }
 public void Insertar(OfertaEstudio ofertaEstudio)
 {
     adOfertaEstudio.Insertar(ofertaEstudio);
 }
        public PartialViewResult _OfertaEstudioEditar(OfertaEstudio ofertaEstudio)
        {
            if (ofertaEstudio.TipoDeEstudioIdListaValor != "TEUNIV")
            {
                ModelState.Remove("Estudio"); //Se quita el campo porque tiene null.
                ofertaEstudio.Estudio = ofertaEstudio.EstudioTexto;
            }
            if (ModelState.IsValid)
            {
                TicketEmpresa ticket = (TicketEmpresa)Session["TicketEmpresa"];

                //Datos DEMO
                //ofertaEstudio.IdOferta = 13;
                //ofertaEstudio.CicloEstudio = "AWE2";
                //ofertaEstudio.Estudio = "Estudios2";
                //ofertaEstudio.TipoDeEstudio.IdListaValor = "ABC2";
                //ofertaEstudio.EstadoDelEstudio.IdListaValor = "AWE2";
                //ofertaEstudio.EstadoOfertaEstudio.IdListaValor = "ABC2";
                ofertaEstudio.ModificadoPor = ticket.Usuario;

                lnOfertaEstudio.Actualizar(ofertaEstudio);

                List<OfertaEstudio> lista = lnOfertaEstudio.ObtenerEstudiosNoUniversitarios(ofertaEstudio.IdOferta, idOfertaEstudiosTodos);  //TODO: Obtener el Id de la oferta.

                ViewBag.IdOferta = ofertaEstudio.IdOferta;
                return PartialView("_OfertaEstudio", lista);
            }

            return PartialView("_OfertaEstudioEditar", ofertaEstudio);
        }
 public void Actualizar(OfertaEstudio ofertaEstudio)
 {
     adOfertaEstudio.Actualizar(ofertaEstudio);
 }
        public Oferta ObtenerPorId(int idOferta)
        {
            Oferta oferta = null;

            //18FEB: Se obtiene las carreras de UTP y se quitan las ya seleccionadas.
            LNGeneral lnGeneral = new LNGeneral();
            List<ListaValor> listaCarrerasUTP = lnGeneral.ObtenerListaValor(Constantes.IDLISTA_DE_CARRERA).Where(m => m.IdListaValorPadre == "TEUNIV").ToList(); //Se obtienen todas las carreras

            DataSet dsResultado = adOferta.ObtenerPorId(idOferta);

            //Tabla Index 0: Datos de la oferta.
            if (dsResultado.Tables[0].Rows.Count > 0)
            {
                oferta = new Oferta();

                oferta.IdOferta = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["IdOferta"]);
                oferta.IdEmpresa = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["IdEmpresa"]);
                oferta.CargoOfrecido = Convert.ToString(dsResultado.Tables[0].Rows[0]["CargoOfrecido"]);
                oferta.Funciones = Convert.ToString(dsResultado.Tables[0].Rows[0]["Funciones"]);
                oferta.Competencias = Convert.ToString(dsResultado.Tables[0].Rows[0]["Competencias"]);

                oferta.TipoTrabajoIdListaValor = Convert.ToString(dsResultado.Tables[0].Rows[0]["TipoTrabajo"]);
                oferta.TipoTrabajo.Valor = Convert.ToString(dsResultado.Tables[0].Rows[0]["TipoTrabajoDescripcion"]);
                oferta.TipoCargoIdListaValor = Convert.ToString(dsResultado.Tables[0].Rows[0]["TipoCargo"]);
                oferta.TipoCargo.Valor = Convert.ToString(dsResultado.Tables[0].Rows[0]["TipoCargoDescripcion"]);
                oferta.TipoContratoIdListaValor = Convert.ToString(dsResultado.Tables[0].Rows[0]["TipoContrato"]);
                oferta.TipoContrato.Valor = Convert.ToString(dsResultado.Tables[0].Rows[0]["TipoContratoDescripcion"]);

                oferta.RemuneracionOfrecida = Convert.ToDecimal(dsResultado.Tables[0].Rows[0]["RemuneracionOfrecida"]);
                oferta.Horario = Convert.ToString(dsResultado.Tables[0].Rows[0]["Horario"]);
                oferta.AreaEmpresa = Convert.ToString(dsResultado.Tables[0].Rows[0]["AreaEmpresa"]);

                if (dsResultado.Tables[0].Rows[0]["NumeroVacantes"] == System.DBNull.Value)
                {
                    oferta.NumeroVacantes = null;
                }
                else
                {
                    oferta.NumeroVacantes = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["NumeroVacantes"]);
                }

                oferta.IdEmpresaLocacion = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["IdEmpresaLocacion"]);
                oferta.RecibeCorreosIdListaValor = Convert.ToString(dsResultado.Tables[0].Rows[0]["RecibeCorreos"]);
                oferta.FechaFinRecepcionCV = Convert.ToDateTime(dsResultado.Tables[0].Rows[0]["FechaFinRecepcionCV"]);
                oferta.AreaEmpresa = Convert.ToString(dsResultado.Tables[0].Rows[0]["AreaEmpresa"]);

                if (dsResultado.Tables[0].Rows[0]["DuracionContrato"] == System.DBNull.Value)
                {
                    oferta.DuracionContrato = null;
                }
                else
                {
                    oferta.DuracionContrato = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["DuracionContrato"]);
                }

                oferta.Empresa.NombreComercial = Convert.ToString(dsResultado.Tables[0].Rows[0]["EmpresaNombreComercial"]);
                oferta.NombreLocacion = Convert.ToString(dsResultado.Tables[0].Rows[0]["NombreLocacion"]);

                oferta.CreadoPor = Convert.ToString(dsResultado.Tables[0].Rows[0]["CreadoPor"]);
                oferta.ModificadoPor = Convert.ToString(dsResultado.Tables[0].Rows[0]["ModificadoPor"]);
                oferta.FechaCreacion = Convert.ToDateTime(dsResultado.Tables[0].Rows[0]["FechaCreacion"]);
                oferta.FechaModificacion = Convert.ToDateTime(dsResultado.Tables[0].Rows[0]["FechaModificacion"]);

                oferta.EstadoOferta = Convert.ToString(dsResultado.Tables[0].Rows[0]["EstadoOferta"]);
                oferta.UsuarioPropietarioEmpresa = Convert.ToString(dsResultado.Tables[0].Rows[0]["UsuarioPropietarioEmpresa"]);
                oferta.FechaPublicacion = Convert.ToDateTime(dsResultado.Tables[0].Rows[0]["FechaPublicacion"]);

                oferta.CicloMinimoCarreraUTP = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["CicloMinimoCarreraUTP"]);
                oferta.EstadoCarreraUTP = Convert.ToString(dsResultado.Tables[0].Rows[0]["EstadoCarreraUTP"]);
                oferta.ExperienciaGeneral = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["MesesExperienciaTotal"]);
                oferta.ExperienciaPosicionesSimilares = Convert.ToInt32(dsResultado.Tables[0].Rows[0]["MesesExperienciaTipoTrabajo"]);

                //05MAR15: Para las nuevas ofertas este campo siempre está con data. Se agrega la validación para compatibilidad con ofertas anteriores.
                oferta.FechaFinProceso = Convert.ToDateTime(dsResultado.Tables[0].Rows[0]["FechaFinProceso"] == System.DBNull.Value ? new DateTime(1, 1, 1900) : dsResultado.Tables[0].Rows[0]["FechaFinProceso"]);
            }

            //Tabla Index 1: Lista de estudios.
            //Se instancia las listas:
            oferta.ListaEstudios = new List<OfertaEstudio>();
            oferta.CarrerasSeleccionadas = new List<OfertaEstudio>();
            foreach (DataRow filaEstudio in dsResultado.Tables[1].Rows)
            {

                OfertaEstudio estudio                   = new OfertaEstudio();
                estudio.IdOfertaEstudio                 = Convert.ToInt32(filaEstudio["IdOfertaEstudio"] == System.DBNull.Value ? null : filaEstudio["IdOfertaEstudio"]);
                estudio.IdOferta                        = Convert.ToInt32(filaEstudio["IdOfertaEstudio"] == System.DBNull.Value ? null : filaEstudio["IdOfertaEstudio"]);
                estudio.CicloEstudio                    = Convert.ToInt32(filaEstudio["CicloEstudio"] == System.DBNull.Value ? null : filaEstudio["CicloEstudio"]);
                estudio.Estudio                         = Convert.ToString(filaEstudio["Estudio"] == System.DBNull.Value ? null : filaEstudio["Estudio"]);
                estudio.TipoDeEstudio.IdListaValor =    Convert.ToString(filaEstudio["TipoDeEstudio"] == System.DBNull.Value ? null : filaEstudio["TipoDeEstudio"]);
                estudio.TipoDeEstudioIdListaValor =     Convert.ToString(filaEstudio["TipoDeEstudio"] == System.DBNull.Value ? null : filaEstudio["TipoDeEstudio"]);
                estudio.TipoDeEstudio.Valor             = Convert.ToString(filaEstudio["TipoDeEstudioDescripcion"]);
                estudio.EstadoDelEstudio.Valor          = Convert.ToString(filaEstudio["EstadoDelEstudioDescripcion"]);
                estudio.EstadoOfertaEstudio.Valor       = Convert.ToString(filaEstudio["EstadoOfertaEstudioDescripcion"]);
                estudio.CreadoPor                       = Convert.ToString(filaEstudio["CreadoPor"]);
                estudio.ModificadoPor                   = Convert.ToString(filaEstudio["ModificadoPor"]);
                estudio.FechaCreacion                   = Convert.ToDateTime(filaEstudio["FechaCreacion"]);
                estudio.FechaModificacion               = Convert.ToDateTime(filaEstudio["FechaModificacion"]);

                #region Se separan las carrearas universitarias UTP.
                if (estudio.TipoDeEstudio.IdListaValor == "TEUNIV") //Tipo de Estudio Universitario de UTP.
                {
                    var carreraEncontrada = listaCarrerasUTP.Where(m => m.Valor == estudio.Estudio).FirstOrDefault();

                    if (carreraEncontrada != null)
                    {
                        estudio.CodigoCarrera = carreraEncontrada.IdListaValor; //Se guarda el código de la carrera.
                        oferta.CarrerasSeleccionadas.Add(estudio);
                    }
                }
                else //Otros estudios.
                {
                    oferta.ListaEstudios.Add(estudio);
                }
                #endregion

            }

            //Tabla Index 2: Lista de experiencia por sector
            oferta.ListaSectores = new List<OfertaSectorEmpresarial>();
            foreach (DataRow filaSector in dsResultado.Tables[2].Rows)
            {
                OfertaSectorEmpresarial sector = new OfertaSectorEmpresarial();
                sector.IdOfertaSectorEmpresarial = Convert.ToInt32(filaSector["IdOfertaSectorEmpresarial"]);
                sector.IdOferta = Convert.ToInt32(filaSector["IdOferta"]);
                sector.SectorEmpresarial.Valor = Convert.ToString(filaSector["SectorEmpresarialDescripcion"]);
                sector.AniosTrabajados = Convert.ToInt32(filaSector["AniosTrabajados"] == System.DBNull.Value ? null : filaSector["AniosTrabajados"]);
                sector.ExperienciaExcluyente = Convert.ToBoolean(filaSector["ExperienciaExcluyente"]);
                sector.EstadoOfertaSectorEmpresarial.Valor = Convert.ToString(filaSector["EstadoOfertaSectorEmpresarialDescripcion"]);
                sector.CreadoPor = Convert.ToString(filaSector["CreadoPor"]);
                sector.ModificadoPor = Convert.ToString(filaSector["ModificadoPor"]);
                sector.FechaCreacion = Convert.ToDateTime(filaSector["FechaCreacion"]);
                sector.FechaModificacion = Convert.ToDateTime(filaSector["FechaModificacion"]);

                oferta.ListaSectores.Add(sector);

            }

            //Tabla Index 3: Lista de información adicional
            oferta.ListaInformacionAdicional = new List<OfertaInformacionAdicional>();
            foreach (DataRow filaInfoAdicional in dsResultado.Tables[3].Rows)
            {
                OfertaInformacionAdicional infoAdicional = new OfertaInformacionAdicional();
                infoAdicional.IdOfertaInformacionAdicional = Convert.ToInt32(filaInfoAdicional["IdOfertaInformacionAdicional"]);
                infoAdicional.IdOferta = Convert.ToInt32(filaInfoAdicional["IdOferta"]);
                infoAdicional.TipoConocimiento.Valor = Convert.ToString(filaInfoAdicional["TipoConocimientoDescripcion"]);
                infoAdicional.Conocimiento = Convert.ToString(filaInfoAdicional["Conocimiento"]);
                infoAdicional.NivelConocimiento.Valor = Convert.ToString(filaInfoAdicional["NivelConocimientoDescripcion"]);
                infoAdicional.AniosExperiencia = Convert.ToInt32(filaInfoAdicional["AniosExperiencia"] == System.DBNull.Value ? null : filaInfoAdicional["AniosExperiencia"]);
                infoAdicional.EstadoOfertaInformacionAdicional.Valor = Convert.ToString(filaInfoAdicional["EstadoOfertaInformacionAdicionalDescripcion"]);
                infoAdicional.CreadoPor = Convert.ToString(filaInfoAdicional["CreadoPor"]);
                infoAdicional.ModificadoPor = Convert.ToString(filaInfoAdicional["ModificadoPor"]);
                infoAdicional.FechaCreacion = Convert.ToDateTime(filaInfoAdicional["FechaCreacion"]);
                infoAdicional.FechaModificacion = Convert.ToDateTime(filaInfoAdicional["FechaModificacion"]);

                oferta.ListaInformacionAdicional.Add(infoAdicional);
            }

            //Tabla Index 4: Lista de Postulantes
            oferta.Postulantes = new List<OfertaPostulante>();
            foreach (DataRow filaPostulante in dsResultado.Tables[4].Rows)
            {
                OfertaPostulante postulante = new OfertaPostulante();
                postulante.Alumno.IdAlumno = Convert.ToInt32(filaPostulante["IdAlumno"]);
                postulante.Alumno.Nombres = Convert.ToString(filaPostulante["AlumnoNombres"]);
                postulante.Alumno.Apellidos = Convert.ToString(filaPostulante["AlumnoApellidos"]);
                postulante.FechaPostulacion = Convert.ToDateTime(filaPostulante["FechaPostulacion"]);
                postulante.FaseOferta.Valor = Convert.ToString(filaPostulante["FaseOferta"]);
                postulante.NombreCV = Convert.ToString(filaPostulante["NombreCV"]);
                postulante.NivelDeMatch = Convert.ToInt32(filaPostulante["NivelDeMatch"]);
                postulante.CreadoPor = Convert.ToString(filaPostulante["CreadoPor"]);
                postulante.ModificadoPor = Convert.ToString(filaPostulante["ModificadoPor"]);
                postulante.FechaCreacion = Convert.ToDateTime(filaPostulante["FechaCreacion"]);
                postulante.FechaModificacion = Convert.ToDateTime(filaPostulante["FechaModificacion"]);

                oferta.Postulantes.Add(postulante);
            }

            //Fases de la oferta
            oferta.OfertaFases = Obtener_OfertaFase(idOferta);

            //Se instancia la lista:
            oferta.CarrerasDisponibles = new List<ListaValor>(); //Esta lista va al lado izquierdo
            //Se recorren las carreras.
            foreach (var carreraUTP in listaCarrerasUTP)
            {
                //Si la carreraUTP ya está seleccionada entonces NO se agrega. Si la búsqueda es null => no está, por lo tanto, sí se agrega.
                if (oferta.CarrerasSeleccionadas.Where(m => m.Estudio == carreraUTP.Valor).FirstOrDefault() == null)
                {
                    ListaValor carreraDisponible = copiarListaValor(carreraUTP);
                    oferta.CarrerasDisponibles.Add(carreraDisponible);
                }
            }

            return oferta;
        }