//public JsonResult GetCityDistrito(string idDepartamento, string idProvincia) //{ // LNGeneral lnGeneral = new LNGeneral(); // DataTable dtDistritos = lnGeneral.ObtenerListaValor2(Constantes.IDLISTA_Departamento, Constantes.IDLISTA_Provincia); // List<SelectListItem> li = new List<SelectListItem>(); // for (int i = 0; i <= dtDistritos.Rows.Count - 1; i++) // { // string nombre = dtDistritos.Rows[i]["Distrito"].ToString(); // string valor = dtDistritos.Rows[i]["CodigoDistrito"].ToString(); // SelectListItem item = new SelectListItem() { Text = nombre, Value = valor }; // li.Add(item); // } // return Json(new SelectList(li, "Value", "Text")); //} public JsonResult GetStateProvincia(string IDListaValorPadre) { LNGeneral lnGeneral = new LNGeneral(); DataTable dtProvincia = lnGeneral.Home_ListarDistritos(IDListaValorPadre); List <SelectListItem> li = new List <SelectListItem>(); for (int i = 0; i <= dtProvincia.Rows.Count - 1; i++) { string nombre = dtProvincia.Rows[i]["Valor"].ToString(); string valor = dtProvincia.Rows[i]["IdListaValor"].ToString(); SelectListItem item = new SelectListItem() { Text = nombre, Value = valor }; li.Add(item); } return(Json(new SelectList(li, "Value", "Text"))); }
public ActionResult Registro() { LNGeneral lnGeneral = new LNGeneral(); ViewBag.PaisIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_PAIS), "IdListaValor", "Valor", "PAIPER"); ViewBag.NumeroEmpleadosIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_NRO_EMPLEADOS), "IdListaValor", "Valor"); ViewBag.SectorEmpresarial1IdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_SECTOR_EMPRESARIAL), "IdListaValor", "Valor"); ViewBag.SectorEmpresarial2IdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_SECTOR_EMPRESARIAL), "IdListaValor", "Valor"); ViewBag.SectorEmpresarial3IdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_SECTOR_EMPRESARIAL), "IdListaValor", "Valor"); ViewBag.TipoLocacionIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_TIPO_LOCACION), "IdListaValor", "Valor"); ViewBag.SexoIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_SEXO), "IdListaValor", "Valor"); ViewBag.TipoDocumentoIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_TIPO_DOCUMENTO), "IdListaValor", "Valor"); ViewBag.RolIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_ROL_USUARIO), "IdListaValor", "Valor"); ViewBag.EstadoUsuarioIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_ESTADO_USUARIO), "IdListaValor", "Valor"); //ViewBag.DireccionDepartamentoLocacion = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_Departamento), "IdListaValor", "Valor"); DataTable dtDepartamento = lnGeneral.Home_Departamento(Constantes.IDLISTA_Departamento); List <SelectListItem> li = new List <SelectListItem>(); for (int i = 0; i <= dtDepartamento.Rows.Count - 1; i++) { string nombre = dtDepartamento.Rows[i]["Valor"].ToString(); string valor = dtDepartamento.Rows[i]["IdListaValor"].ToString(); SelectListItem item = new SelectListItem() { Text = nombre, Value = valor }; li.Add(item); } ViewData["Departamento"] = li; return(View()); }
public ActionResult CambiarEstadoPostulante(int idOfertaPostulante, string faseOferta) { TicketEmpresa ticket = (TicketEmpresa)Session["TicketEmpresa"]; LNOferta lnOferta = new LNOferta(); List <OfertaPostulante> lista = new List <OfertaPostulante>(); OfertaPostulante ofertaPostulante = new OfertaPostulante(); ofertaPostulante.IdOfertaPostulante = idOfertaPostulante; ofertaPostulante.ModificadoPor = ticket.Usuario; ofertaPostulante.Seleccionado = true; //Valor agregado por compatibilidad con otro proceso. Se coloca True para indicar que Sí debe actualizar el campo. lista.Add(ofertaPostulante); lnOferta.ActualizarFaseDePostulantes(lista, faseOferta); //Se obtiene la descripción de la oferta: LNGeneral lnGeneral = new LNGeneral(); ListaValor listaValorFase = lnGeneral.ObtenerListaValor(Constantes.IDLISTA_FASE_OFERTA).Where(m => m.IdListaValor == faseOferta).FirstOrDefault(); //Se retorna la descripción de la fase seleccionada. return(Content(listaValorFase.DescripcionValor)); }
public ActionResult Registro(VistaRegistroEmpresa empresa) { LNUsuario lnUsuario = new LNUsuario(); StringBuilder mensajeDeError = new StringBuilder(); if (lnUsuario.ValidarNombreDeUsuario(empresa.CuentaUsuario)) { mensajeDeError.Append("El Nombre de Usuario ya está Registrado<br />"); } if (lnUsuario.ValidarExistenciaEmpresa(empresa.PaisIdListaValor, empresa.IdentificadorTributario)) { mensajeDeError.Append("La Empresa ya se encuentra registrada, por favor comuníquese con nosotros<br />"); } Regex rgx = new Regex(@"^\d{8}$"); if (empresa.TipoDocumentoIdListaValor == "TDDNI") { if (!rgx.IsMatch(empresa.NumeroDocumento)) { mensajeDeError.Append("El Numero de Documento es inválido<br />"); } } if (ModelState.IsValid && mensajeDeError.ToString() == "") { LNEmpresa lnEmpresa = new LNEmpresa(); //Empresa empresa.CreadoPor = empresa.CuentaUsuario; //Usuario anónimo. empresa.EstadoIdListaValor = "EMPRRV"; //Estado de la empresa pendiente de aprobación. //Ubicación empresa.EstadoLocacionIdListaValor = "LOSTNO"; //Estado NO ACTIVA. Se debe activar al momento que UTP active la cuenta. if (empresa.PaisIdListaValor == "PAIPER") { empresa.NombreLocacion = empresa.DireccionLocacion + ", " + empresa.TextDistrito + ", " + empresa.TextoCiudad + ", " + empresa.TextoDepartamento; } else { empresa.NombreLocacion = empresa.DireccionLocacion + ", " + empresa.DireccionDistritoLocacion + ", " + empresa.DireccionCiudadLocacion + ", " + empresa.DireccionDepartamentoLocacion; } //validar si el pais es peru, si es asi entonces: //Usuario empresa.RolIdListaValor = "ROLEAD"; //La cuenta es creada como Rol: "Administrador de Empresa" empresa.EstadoUsuarioIdListaValor = "USEUTP"; //El usuario también se encuenta pendiente de activación. Se debe activar al momento que UTP active la cuenta. byte[] bytes = Encoding.Default.GetBytes(empresa.Contrasena); SHA1 sha = new SHA1CryptoServiceProvider(); byte[] password = sha.ComputeHash(bytes); String spassword = Encoding.Default.GetString(password); empresa.Contrasena = spassword; lnEmpresa.Insertar(empresa); //Enviar mensaje de correo: LNMensaje lnMensaje = new LNMensaje(); DataTable dtUsuarioUTPAdmin = lnMensaje.ObtenerUsuarioAdministradorUTP(); if (dtUsuarioUTPAdmin.Rows.Count > 0) { Mensaje mensaje = new Mensaje(); mensaje.DeUsuarioCorreoElectronico = empresa.EmailUsuario; mensaje.ParaUsuarioCorreoElectronico = Convert.ToString(dtUsuarioUTPAdmin.Rows[0]["CorreoElectronico"]); //Administrador UTP mensaje.Asunto = empresa.NombreComercial + " Empresa registrada en el Portal:"; mensaje.MensajeTexto = "La empresa '" + empresa.NombreComercial + "' se ha registrado en el portal y está a la espera de activación"; LNCorreo.EnviarCorreo(mensaje); } //Si el registro fue exitoso redireccionar a página de resultado. TempData["GuardaRegistroExitoso"] = "Estimado(a) <strong>" + empresa.NombresUsuario + " " + empresa.ApellidosUsuario + "</strong>, muchas gracias por enviarnos su información. En breve recibirá un correo de confirmación con sus datos.</br></br>Nuestro proceso de activación tomará un plazo no mayor a 1 día útil, antes del cual estaremos comunicándole la activación de su Usuario. "; //Aquí debería enviarse un correo return(RedirectToAction("Index")); } else { var errors = ModelState.Select(x => x.Value.Errors) .Where(y => y.Count > 0) .ToList(); //Variable temporal para poner el break int a = 0; } LNGeneral lnGeneral = new LNGeneral(); ViewBag.PaisIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_PAIS), "IdListaValor", "Valor", empresa.PaisIdListaValor); ViewBag.SectorEmpresarial1IdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_SECTOR_EMPRESARIAL), "IdListaValor", "Valor", empresa.SectorEmpresarial1IdListaValor); ViewBag.TipoLocacionIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_TIPO_LOCACION), "IdListaValor", "Valor", empresa.TipoLocacionIdListaValor); ViewBag.TipoDocumentoIdListaValor = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_TIPO_DOCUMENTO), "IdListaValor", "Valor", empresa.TipoDocumentoIdListaValor); ViewBag.DireccionDepartamentoLocacion = new SelectList(lnGeneral.ObtenerListaValor(Constantes.IDLISTA_Departamento), "IdListaValor", "Valor", empresa.DireccionDepartamentoLocacion); ViewBag.MensajeDeError = mensajeDeError; return(View(empresa)); }