public void Insertar(OfertaSectorEmpresarial ofertaSectorEmpresarial) { using (SqlConnection conexion = new SqlConnection(cadenaConexion)) { SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "OfertaSectorEmpresarial_Insertar"; //Parámetros: cmd.Parameters.Add(new SqlParameter("@IdOferta", ofertaSectorEmpresarial.IdOferta)); cmd.Parameters.Add(new SqlParameter("@SectorEmpresarial", ofertaSectorEmpresarial.SectorEmpresarialIdListaValor)); cmd.Parameters.Add(new SqlParameter("@ExperienciaExcluyente", ofertaSectorEmpresarial.ExperienciaExcluyente)); cmd.Parameters.Add(new SqlParameter("@AniosTrabajados", ofertaSectorEmpresarial.AniosTrabajados)); cmd.Parameters.Add(new SqlParameter("@EstadoOfertaSectorEmpresarial", ofertaSectorEmpresarial.EstadoOfertaSectorEmpresarial.IdListaValor)); cmd.Parameters.Add(new SqlParameter("@CreadoPor", ofertaSectorEmpresarial.CreadoPor)); cmd.Connection = conexion; conexion.Open(); cmd.ExecuteNonQuery(); conexion.Close(); } }
public PartialViewResult _OfertaSectorEmpresarialCrear(OfertaSectorEmpresarial ofertaSector) { if (ModelState.IsValid) { TicketEmpresa ticket = (TicketEmpresa)Session["TicketEmpresa"]; //ofertaSector.IdOferta = 13; //ofertaSector.SectorEmpresarial.IdListaValor = "ABE"; //ofertaSector.ExperienciaExcluyente = false; //ofertaSector.AniosTrabajados = 3; ofertaSector.EstadoOfertaSectorEmpresarial.IdListaValor = "OFSEAC"; //Oferrta sector empresarial activa. ofertaSector.CreadoPor = ticket.Usuario; LNOfertaSectorEmpresarial lnOfertaSector = new LNOfertaSectorEmpresarial(); lnOfertaSector.Insertar(ofertaSector); List<OfertaSectorEmpresarial> lista = lnSector.ObtenerSectoresEmpresariales(ofertaSector.IdOferta, 0); ViewBag.IdOferta = ofertaSector.IdOferta; return PartialView("_OfertaSectorEmpresarial", lista); } else { //Código para ubicar los errores en el ModelState. var errors = ModelState.Select(x => x.Value.Errors) .Where(y => y.Count > 0) .ToList(); int a = 0; } return PartialView("_OfertaSectorEmpresarialCrear", ofertaSector); }
public PartialViewResult _OfertaSectorEmpresarialCrear(int id) { ViewBag.SectorEmpresarialIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_SECTOR_EMPRESARIAL), "IdListaValor", "Valor"); OfertaSectorEmpresarial ofertaSector = new OfertaSectorEmpresarial(); ofertaSector.IdOferta = id; return PartialView("_OfertaSectorEmpresarialCrear", ofertaSector); }
public List<OfertaSectorEmpresarial> ObtenerSectoresEmpresariales(int idOferta, int idOfertaSectorEmpresarial) { List<OfertaSectorEmpresarial> lista = new List<OfertaSectorEmpresarial>(); DataTable dtResultado = adOfertaSectorEmpresarial.ObtenerSectoresEmpresariales(idOferta, idOfertaSectorEmpresarial); foreach (DataRow fila in dtResultado.Rows) { OfertaSectorEmpresarial sector = new OfertaSectorEmpresarial(); sector.IdOfertaSectorEmpresarial = Convert.ToInt32(fila["IdOfertaSectorEmpresarial"]); sector.IdOferta = Convert.ToInt32(fila["IdOferta"]); sector.SectorEmpresarial.Valor = Convert.ToString(fila["SectorEmpresarialDescripcion"]); sector.SectorEmpresarialIdListaValor = Convert.ToString(fila["SectorEmpresarial"]); sector.ExperienciaExcluyente = Convert.ToBoolean(fila["ExperienciaExcluyente"]); sector.AniosTrabajados = Convert.ToInt32(fila["AniosTrabajados"] == System.DBNull.Value ? null : fila["AniosTrabajados"]); sector.EstadoOfertaSectorEmpresarial.Valor = Convert.ToString(fila["EstadoOfertaSectorEmpresarialDescripcion"]); sector.CreadoPor = Convert.ToString(fila["CreadoPor"]); lista.Add(sector); } return lista; }
public void Insertar(OfertaSectorEmpresarial ofertaSector) { adOfertaSectorEmpresarial.Insertar(ofertaSector); }
public void Actualizar(OfertaSectorEmpresarial ofertaSector) { adOfertaSectorEmpresarial.Actualizar(ofertaSector); }
public void Insertar(OfertaSectorEmpresarial ofertaSectorEmpresarial) { lnSector.Insertar(ofertaSectorEmpresarial); }
public PartialViewResult _OfertaSectorEmpresarialEditar(OfertaSectorEmpresarial ofertaSector) { if (ModelState.IsValid) { TicketEmpresa ticket = (TicketEmpresa)Session["TicketEmpresa"]; //ofertaSector.IdOferta = 13; //ofertaSector.SectorEmpresarial.IdListaValor = "ABE222"; //ofertaSector.ExperienciaExcluyente = false; //ofertaSector.AniosTrabajados = 7; //ofertaSector.EstadoOfertaSectorEmpresarial.IdListaValor = "AWE222"; ofertaSector.ModificadoPor = ticket.Usuario; LNOfertaSectorEmpresarial lnOfertaSector = new LNOfertaSectorEmpresarial(); lnOfertaSector.Actualizar(ofertaSector); List<OfertaSectorEmpresarial> lista = lnSector.ObtenerSectoresEmpresariales(ofertaSector.IdOferta, 0); ViewBag.IdOferta = ofertaSector.IdOferta; return PartialView("_OfertaSectorEmpresarial", lista); } //TODO: Validar cuando existe error al grabar. return PartialView("_OfertaSectorEmpresarialEditar", ofertaSector); }
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; }