コード例 #1
0
        public ActionResult TASInstructorNuevo(string MensajeError = "")
        {
            TASInstructorInterfaceClient TASInstructor    = new TASInstructorInterfaceClient();
            TASInstructorSet             setTASInstructor = TASInstructor.WebNuevo((string)Session["Sesion"], (string)Session["SesionSubCompania"]);

            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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        public ActionResult TASInstructorNuevo(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 ingresar un NroLicencia. ";
                }

                //if (VacunaAntitetanica == null || VacunaAntitetanica == "")
                //{
                //    NumError = 1;
                //    MensajeError = "Debe llenar el campo Vacuna Antitetanica.";
                //}

                if (NumError == 0)
                {
                    TASInstructorSet    setTASInstructorNuevo = TASInstructor.WebNuevo((string)Session["Sesion"], (string)Session["SesionSubCompania"]);
                    TASInstructorEntity etTASInstructorNuevo  = setTASInstructorNuevo.ltTASInstructor.First();
                    etTASInstructorNuevo.SubCompania           = (string)Session["SesionSubCompania"];
                    etTASInstructorNuevo.InstructorNroLicencia = etTASInstructor.InstructorNroLicencia == null ? "" : etTASInstructor.InstructorNroLicencia;
                    etTASInstructorNuevo.Fecha = DateTime.Now;
                    //CodigoTAS Same as EstudianteCI
                    etTASInstructorNuevo.CodigoTAS              = etTASInstructor.InstructorNroLicencia == null ? "" : etTASInstructor.InstructorNroLicencia;
                    etTASInstructorNuevo.Nombre1                = etTASInstructor.Nombre1 == null ? "" : etTASInstructor.Nombre1;
                    etTASInstructorNuevo.Nombre2                = etTASInstructor.Nombre2 == null ? "" : etTASInstructor.Nombre2;
                    etTASInstructorNuevo.Apellido1              = etTASInstructor.Apellido1 == null ? "" : etTASInstructor.Apellido1;
                    etTASInstructorNuevo.Apellido2              = etTASInstructor.Apellido2 == null ? "" : etTASInstructor.Apellido2;
                    etTASInstructorNuevo.LugarNacimiento        = etTASInstructor.LugarNacimiento == null ? "" : etTASInstructor.LugarNacimiento;
                    etTASInstructorNuevo.Sexo                   = Sexo == null ? "" : Sexo;
                    etTASInstructorNuevo.FechaNacimiento        = etTASInstructor.FechaNacimiento;
                    etTASInstructorNuevo.Nacionalidad           = etTASInstructor.Nacionalidad == null ? "" : etTASInstructor.Nacionalidad;
                    etTASInstructorNuevo.EstadoCivil            = etTASInstructor.EstadoCivil == null ? "" : etTASInstructor.EstadoCivil;
                    etTASInstructorNuevo.Domicilio              = etTASInstructor.Domicilio == null ? "" : etTASInstructor.Domicilio;
                    etTASInstructorNuevo.Telefono               = etTASInstructor.Telefono == null ? "" : etTASInstructor.Telefono;
                    etTASInstructorNuevo.Correo                 = etTASInstructor.Correo == null ? "" : etTASInstructor.Correo;
                    etTASInstructorNuevo.Formacion              = etTASInstructor.Formacion == null ? "" : etTASInstructor.Formacion;
                    etTASInstructorNuevo.Cursos                 = etTASInstructor.Cursos == null ? "" : etTASInstructor.Cursos;
                    etTASInstructorNuevo.ExperienciaLaboral     = etTASInstructor.ExperienciaLaboral == null ? "" : etTASInstructor.ExperienciaLaboral;
                    etTASInstructorNuevo.ExperienciaInstruccion = etTASInstructor.ExperienciaInstruccion == null ? "" : etTASInstructor.ExperienciaInstruccion;

                    etTASInstructorNuevo.VacunaAntitetanica = VacunaAntitetanica == null ? "" : VacunaAntitetanica;
                    etTASInstructorNuevo.Observaciones      = etTASInstructor.Observaciones == null ? "" : etTASInstructor.Observaciones;

                    etTASInstructorNuevo.UEstado = TASInstructorService.Estado.Added;
                    InstructorNroLicencia        = etTASInstructor.InstructorNroLicencia;
                    NumError = TASInstructor.WebGuardar(setTASInstructorNuevo, true, (string)Session["Sesion"], (string)Session["SesionSubCompania"]);
                }
            }
            else
            {
                NumError     = 1;
                MensajeError = "Ocurrio un error al intentar guardar. Intente nuevamente.";
            }

            if (NumError == 0)
            {
                return(RedirectToAction("TASInstructorEditar", new { SubCompania = (string)Session["SesionSubCompania"], InstructorNroLicencia = InstructorNroLicencia }));
            }
            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));
            }
        }