public JsonResult CrearObjetivo(ObjetivoSSTModel objetivo) { var usuarioActual = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current); if (usuarioActual == null) { return(Json(new { Data = "Su sesión ha finalizado, por favor ingrese nuevamente.", Mensaje = "FinSession" })); } EDObjetivoSST Objetivo = new EDObjetivoSST(); Objetivo.Id_Empresa = usuarioActual.IdEmpresa; Objetivo.Objetivo = objetivo.Descripcion; if (objetivo.EsPorcentaje) { Objetivo.Meta = objetivo.Meta + "%"; } else { Objetivo.Meta = objetivo.Meta; } List <ObjetivoSSTModel> listModel = new List <ObjetivoSSTModel>(); ServiceClient.EliminarParametros(); var resultObjetivosst = ServiceClient.RealizarPeticionesArrayPostJsonRest <EDObjetivoSST>(urlServicioPlanificacion, GrabarObjetivosst, Objetivo); if (resultObjetivosst != null) { if (resultObjetivosst.Count() > 0) { if (resultObjetivosst[0] != null) { listModel = resultObjetivosst.Select(o => new ObjetivoSSTModel { IdObjetivo = o.Id_Objetivo_Empresa, Descripcion = o.Objetivo, Meta = o.Meta }).ToList(); var datos = RenderRazorViewToString("_DetalleObjetivos", listModel); return(Json(new { Data = datos, Mensaje = "OK" })); } else { return(Json(new { Data = "El proceso de creación del objetivo ha fallado", Mensaje = "ERROR" })); } } else { return(Json(new { Data = "El proceso de creación del objetivo ha fallado", Mensaje = "ERROR" })); } } else { return(Json(new { Data = "El proceso de creación del objetivo ha fallado", Mensaje = "ERROR" })); } }
// GET: ObetivoSST public ActionResult ObjetivoSST() { var usuarioActual = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current); if (usuarioActual == null) { ViewBag.Mensaje = "Debe estar autenticado para realizar la evalación."; return(RedirectToAction("Login", "Home")); } ObjetivoSSTModel model = new ObjetivoSSTModel(); model.NitEmpresa = usuarioActual.NitEmpresa; return(View(model)); }