public ActionResult Post(bool IsNew, Detalle_Documentos_RequeridosModel varDetalle_Documentos_Requeridos) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Documentos_RequeridosApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_Documentos_RequeridosInfo = new Detalle_Documentos_Requeridos { Clave = varDetalle_Documentos_Requeridos.Clave , Nombre = varDetalle_Documentos_Requeridos.Nombre }; result = !IsNew? _IDetalle_Documentos_RequeridosApiConsumer.Update(Detalle_Documentos_RequeridosInfo, null, null).Resource.ToString() : _IDetalle_Documentos_RequeridosApiConsumer.Insert(Detalle_Documentos_RequeridosInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(int Id = 0, int consult = 0) { int ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0; var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 45383); ViewBag.Permission = permission; var varDetalle_Documentos_Requeridos = new Detalle_Documentos_RequeridosModel(); ViewBag.ObjectId = "45383"; ViewBag.Operation = "New"; ViewBag.IsNew = true; if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0")) { ViewBag.IsNew = false; ViewBag.Operation = "Update"; if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Documentos_RequeridosApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_Documentos_RequeridosData = _IDetalle_Documentos_RequeridosApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Documentos_Requeridoss[0]; if (Detalle_Documentos_RequeridosData == null) { return(HttpNotFound()); } varDetalle_Documentos_Requeridos = new Detalle_Documentos_RequeridosModel { Clave = (int)Detalle_Documentos_RequeridosData.Clave , Nombre = Detalle_Documentos_RequeridosData.Nombre , NombreNombre_Completo = CultureHelper.GetTraduction(Convert.ToString(Detalle_Documentos_RequeridosData.Nombre), "Detalle_de_Solicitud_Requerido") ?? (string)Detalle_Documentos_RequeridosData.Nombre_Detalle_de_Solicitud_Requerido.Nombre_Completo }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDetalle_Documentos_Requeridos)); }
public ActionResult AddDetalle_Documentos_Requeridos(int rowIndex = 0, int functionMode = 0, int id = 0) { int ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0; ViewBag.currentRowIndex = rowIndex; ViewBag.functionMode = functionMode; ViewBag.Consult = false; var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 45383); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDetalle_Documentos_RequeridosApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_Documentos_RequeridosModel varDetalle_Documentos_Requeridos = new Detalle_Documentos_RequeridosModel(); if (id.ToString() != "0") { var Detalle_Documentos_RequeridossData = _IDetalle_Documentos_RequeridosApiConsumer.ListaSelAll(0, 1000, "Detalle_Documentos_Requeridos.Clave=" + id, "").Resource.Detalle_Documentos_Requeridoss; if (Detalle_Documentos_RequeridossData != null && Detalle_Documentos_RequeridossData.Count > 0) { var Detalle_Documentos_RequeridosData = Detalle_Documentos_RequeridossData.First(); varDetalle_Documentos_Requeridos = new Detalle_Documentos_RequeridosModel { Clave = Detalle_Documentos_RequeridosData.Clave , Nombre = Detalle_Documentos_RequeridosData.Nombre , NombreNombre_Completo = CultureHelper.GetTraduction(Convert.ToString(Detalle_Documentos_RequeridosData.Nombre), "Detalle_de_Solicitud_Requerido") ?? (string)Detalle_Documentos_RequeridosData.Nombre_Detalle_de_Solicitud_Requerido.Nombre_Completo }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } return(PartialView("AddDetalle_Documentos_Requeridos", varDetalle_Documentos_Requeridos)); }