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, 45629); ViewBag.Permission = permission; var varDetalle_Vinculacion_Resolucion = new Detalle_Vinculacion_ResolucionModel(); ViewBag.ObjectId = "45629"; 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_Vinculacion_ResolucionApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_Vinculacion_ResolucionData = _IDetalle_Vinculacion_ResolucionApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Vinculacion_Resolucions[0]; if (Detalle_Vinculacion_ResolucionData == null) { return(HttpNotFound()); } varDetalle_Vinculacion_Resolucion = new Detalle_Vinculacion_ResolucionModel { Clave = (int)Detalle_Vinculacion_ResolucionData.Clave , Seleccionar = Detalle_Vinculacion_ResolucionData.Seleccionar.GetValueOrDefault() , Relacion = Detalle_Vinculacion_ResolucionData.Relacion , idRelacion = Detalle_Vinculacion_ResolucionData.idRelacion }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDetalle_Vinculacion_Resolucion)); }
public ActionResult AddDetalle_Vinculacion_Resolucion(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, 45629); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDetalle_Vinculacion_ResolucionApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_Vinculacion_ResolucionModel varDetalle_Vinculacion_Resolucion = new Detalle_Vinculacion_ResolucionModel(); if (id.ToString() != "0") { var Detalle_Vinculacion_ResolucionsData = _IDetalle_Vinculacion_ResolucionApiConsumer.ListaSelAll(0, 1000, "Detalle_Vinculacion_Resolucion.Clave=" + id, "").Resource.Detalle_Vinculacion_Resolucions; if (Detalle_Vinculacion_ResolucionsData != null && Detalle_Vinculacion_ResolucionsData.Count > 0) { var Detalle_Vinculacion_ResolucionData = Detalle_Vinculacion_ResolucionsData.First(); varDetalle_Vinculacion_Resolucion = new Detalle_Vinculacion_ResolucionModel { Clave = Detalle_Vinculacion_ResolucionData.Clave , Seleccionar = Detalle_Vinculacion_ResolucionData.Seleccionar.GetValueOrDefault() , Relacion = Detalle_Vinculacion_ResolucionData.Relacion , idRelacion = Detalle_Vinculacion_ResolucionData.idRelacion }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } return(PartialView("AddDetalle_Vinculacion_Resolucion", varDetalle_Vinculacion_Resolucion)); }
public ActionResult Post(bool IsNew, Detalle_Vinculacion_ResolucionModel varDetalle_Vinculacion_Resolucion) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_Vinculacion_ResolucionApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_Vinculacion_ResolucionInfo = new Detalle_Vinculacion_Resolucion { Clave = varDetalle_Vinculacion_Resolucion.Clave , Seleccionar = varDetalle_Vinculacion_Resolucion.Seleccionar , Relacion = varDetalle_Vinculacion_Resolucion.Relacion , idRelacion = varDetalle_Vinculacion_Resolucion.idRelacion }; result = !IsNew? _IDetalle_Vinculacion_ResolucionApiConsumer.Update(Detalle_Vinculacion_ResolucionInfo, null, null).Resource.ToString() : _IDetalle_Vinculacion_ResolucionApiConsumer.Insert(Detalle_Vinculacion_ResolucionInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }