public PartialViewResult nuevaExperiencia(int id)
 {
     var model = new ExperienciaModel();
     model.codSol = id;
     model.Empresas = (from c in modelEntity.SAF_EMPRESA.ToList() select new SelectListItem() { Text = c.RAZSOCEMP, Value = c.CODEMP.ToString() }).ToList();
     model.Tipos = (from c in modelEntity.SAF_PARAMETRICA.Where(x => x.CODTIPPAR == 7).ToList() select new SelectListItem() { Text = c.NOMPAR, Value = c.CODPAR.ToString() }).ToList();
     return PartialView("_experiencia", model);
 }
 public PartialViewResult editarExperiencia(int id)
 {
     var experiencia = modelEntity.SAF_SOLEXPERIENCIA.FirstOrDefault(x => x.CODSOLEXP == id);
     var model = new ExperienciaModel();
     model.codSolExp = experiencia.CODSOLEXP;
     model.descSolExp = experiencia.DESSOLEXP;
     model.fechaInicioSolExp = string.Format("{0:dd/MM/yyyy}", experiencia.FECINISOLEXP);
     model.fechaFinSolExp = string.Format("{0:dd/MM/yyyy}", experiencia.FECFINSOLEXP);
     model.numHorasSolExp = experiencia.NUMHORSOLEXP;
     model.codSol = experiencia.CODSOL;
     model.codEmpresa = experiencia.CODEMP;
     model.codTipExp = experiencia.CODTIPEXP;
     model.nombreArchivoExp = experiencia.NOMBLABEL;
     model.codArchivoExp = experiencia.CODARC;
     model.Empresas = (from c in modelEntity.SAF_EMPRESA.ToList() select new SelectListItem() { Text = c.RAZSOCEMP, Value = c.CODEMP.ToString() }).ToList();
     model.Tipos = (from c in modelEntity.SAF_PARAMETRICA.Where(x => x.CODTIPPAR == 7).ToList() select new SelectListItem() { Text = c.NOMPAR, Value = c.CODPAR.ToString() }).ToList();
     return PartialView("_experiencia", model);
 }
        public string guardarExperiencia(ExperienciaModel model)
        {
            try
            {
                var experiencia = new SAF_SOLEXPERIENCIA();
                var filebe = new FileBe();

                if (model.archivoExpFile != null)
                {
                    filebe.NarcCodigo = model.codArchivoExp;
                    filebe.CarcNombre = model.nombreArchivoExp;
                    filebe.FileData = model.archivoExpFile;
                }

                if (model.codSolExp.HasValue)
                    experiencia = modelEntity.SAF_SOLEXPERIENCIA.FirstOrDefault(x => x.CODSOLEXP == model.codSolExp);
                var id = Archivo.RegistrarArchivo(experiencia.CODARC, filebe);

                experiencia.DESSOLEXP = model.descSolExp;
                experiencia.FECINISOLEXP = string.IsNullOrEmpty(model.fechaInicioSolExp) ? new DateTime?() : DateTime.Parse(model.fechaInicioSolExp);
                experiencia.FECFINSOLEXP = string.IsNullOrEmpty(model.fechaFinSolExp) ? new DateTime?() : DateTime.Parse(model.fechaFinSolExp);
                experiencia.NUMHORSOLEXP = model.numHorasSolExp;
                experiencia.FECREG = DateTime.Now;
                experiencia.USUREG = "SYSTEM";
                experiencia.ESTREG = "1";
                experiencia.CODSOL = model.codSol;
                experiencia.CODEMP = model.codEmpresa;
                experiencia.CODTIPEXP = model.codTipExp;
                experiencia.CODARC = id;
                experiencia.NOMBLABEL = model.nombreArchivoExp;
                if (!model.codSolExp.HasValue)
                    modelEntity.SAF_SOLEXPERIENCIA.Add(experiencia);
                modelEntity.SaveChanges();
                return JsonConvert.SerializeObject(new MensajeRespuesta("Se guardó la experiencia satisfactoriamente", true));
            }
            catch (Exception)
            {
                return JsonConvert.SerializeObject(new MensajeRespuesta("No se pudo guardar la experiencia", false));
            }
        }