public ActionResult TASInstructorEditar(string SubCompania, string InstructorNroLicencia, string MensajeError = "") { TASInstructorInterfaceClient TASInstructor = new TASInstructorInterfaceClient(); TASInstructorSet setTASInstructor = new TASInstructorSet(); setTASInstructor = TASInstructor.WebSeleccionar(SubCompania, InstructorNroLicencia, (string)Session["Sesion"], (string)Session["SesionSubCompania"]); ViewBag.ltSexo = new SelectList( new List <ListItem> { new ListItem { Text = "Femenino", Value = "F", Selected = setTASInstructor.ltTASInstructor.First().Sexo == "F" ? true : false }, new ListItem { Text = "Masculino", Value = "M", Selected = setTASInstructor.ltTASInstructor.First().Sexo == "M" ? true : false }, }, "Value", "Text", setTASInstructor.ltTASInstructor.First().Sexo);; //ltSexo.Where(x => x.Value == setTASInstructor.ltTASInstructor.First().Sexo).First().Selected = true; //ViewBag.ltSexo = ltSexo; var ltVacunaAntitetanica = new SelectList( new List <ListItem> { new ListItem { Text = "En Progreso", Value = "1", Selected = setTASInstructor.ltTASInstructor.First().VacunaAntitetanica == "1" ? true : false }, new ListItem { Text = "Completa", Value = "2", Selected = setTASInstructor.ltTASInstructor.First().VacunaAntitetanica == "2" ? true : false }, }, "Value", "Text", setTASInstructor.ltTASInstructor.First().VacunaAntitetanica); //var etVacunaAntitetanica = ltVacunaAntitetanica.Where(x => x.Value == valueVacunaAntitetanica).FirstOrDefault(); //etVacunaAntitetanica.Selected = true; ViewBag.ltVacunaAntitetanica = ltVacunaAntitetanica; ViewBag.MensajeError = MensajeError; return(View(setTASInstructor)); }
public ActionResult TASInstructorEditar(TASInstructorSet setTASInstructor, string Sexo, string VacunaAntitetanica) { long NumError = 0; string InstructorNroLicencia = string.Empty; string MensajeError = string.Empty; TASInstructorInterfaceClient TASInstructor = new TASInstructorInterfaceClient(); if (setTASInstructor.ltTASInstructor != null) { TASInstructorEntity etTASInstructor = setTASInstructor.ltTASInstructor.First(); if (etTASInstructor.InstructorNroLicencia == null || etTASInstructor.InstructorNroLicencia == "") { NumError = 1; MensajeError += "Debe existir un NroLicencia. "; } //if (etTASInstructor.Programa == null || etTASInstructor.Programa == "") //{ // NumError = 1; // MensajeError += "Debe seleccionar un Programa. "; //} if (NumError == 0) { TASInstructorSet setTASInstructorEdit = TASInstructor.WebSeleccionar((string)Session["SesionSubCompania"], etTASInstructor.InstructorNroLicencia, (string)Session["Sesion"], (string)Session["SesionSubCompania"]); TASInstructorEntity etTASInstructorEdit = setTASInstructorEdit.ltTASInstructor.First(); etTASInstructorEdit.SubCompania = (string)Session["SesionSubCompania"]; etTASInstructorEdit.Fecha = DateTime.Now; //CodigoTAS Same as EstudianteCI etTASInstructorEdit.CodigoTAS = etTASInstructor.InstructorNroLicencia == null ? "" : etTASInstructor.InstructorNroLicencia; etTASInstructorEdit.Nombre1 = etTASInstructor.Nombre1 == null ? "" : etTASInstructor.Nombre1; etTASInstructorEdit.Nombre2 = etTASInstructor.Nombre2 == null ? "" : etTASInstructor.Nombre2; etTASInstructorEdit.Apellido1 = etTASInstructor.Apellido1 == null ? "" : etTASInstructor.Apellido1; etTASInstructorEdit.Apellido2 = etTASInstructor.Apellido2 == null ? "" : etTASInstructor.Apellido2; etTASInstructorEdit.LugarNacimiento = etTASInstructor.LugarNacimiento == null ? "" : etTASInstructor.LugarNacimiento; etTASInstructorEdit.Sexo = Sexo == null ? "" : Sexo; etTASInstructorEdit.FechaNacimiento = etTASInstructor.FechaNacimiento; etTASInstructorEdit.Nacionalidad = etTASInstructor.Nacionalidad == null ? "" : etTASInstructor.Nacionalidad; etTASInstructorEdit.EstadoCivil = etTASInstructor.EstadoCivil == null ? "" : etTASInstructor.EstadoCivil; etTASInstructorEdit.Domicilio = etTASInstructor.Domicilio == null ? "" : etTASInstructor.Domicilio; etTASInstructorEdit.Telefono = etTASInstructor.Telefono == null ? "" : etTASInstructor.Telefono; etTASInstructorEdit.Correo = etTASInstructor.Correo == null ? "" : etTASInstructor.Correo; etTASInstructorEdit.Formacion = etTASInstructor.Formacion == null ? "" : etTASInstructor.Formacion; etTASInstructorEdit.Cursos = etTASInstructor.Cursos == null ? "" : etTASInstructor.Cursos; etTASInstructorEdit.ExperienciaLaboral = etTASInstructor.ExperienciaLaboral == null ? "" : etTASInstructor.ExperienciaLaboral; etTASInstructorEdit.ExperienciaInstruccion = etTASInstructor.ExperienciaInstruccion == null ? "" : etTASInstructor.ExperienciaInstruccion; etTASInstructorEdit.VacunaAntitetanica = VacunaAntitetanica == null ? "" : VacunaAntitetanica; etTASInstructorEdit.Observaciones = etTASInstructor.Observaciones == null ? "" : etTASInstructor.Observaciones; etTASInstructorEdit.UEstado = TASInstructorService.Estado.Modified; InstructorNroLicencia = etTASInstructor.InstructorNroLicencia; NumError = TASInstructor.WebGuardar(setTASInstructorEdit, false, (string)Session["Sesion"], (string)Session["SesionSubCompania"]); } } else { NumError = 1; MensajeError = "Ocurrio un error al intentar guardar. Intente nuevamente."; } if (NumError == 0) { return(RedirectToAction("TASInstructorLista")); } else { var ltSexo = new SelectList( new List <ListItem> { new ListItem { Text = "Femenino", Value = "F" }, new ListItem { Text = "Masculino", Value = "M" }, }, "Value", "Text"); ViewBag.ltSexo = ltSexo; var ltVacunaAntitetanica = new SelectList( new List <ListItem> { new ListItem { Text = "En Progreso", Value = "1" }, new ListItem { Text = "Completa", Value = "2" }, }, "Value", "Text"); ViewBag.ltVacunaAntitetanica = ltVacunaAntitetanica; ViewBag.MensajeError = MensajeError; return(View(setTASInstructor)); } }