public ActionResult Post(bool IsNew, Detalle_de_Documentos_de_LegislacionModel varDetalle_de_Documentos_de_Legislacion) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_de_Documentos_de_LegislacionApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_de_Documentos_de_LegislacionInfo = new Detalle_de_Documentos_de_Legislacion { Clave = varDetalle_de_Documentos_de_Legislacion.Clave , ID_de_Dispositivo = varDetalle_de_Documentos_de_Legislacion.ID_de_Dispositivo , Estatus = varDetalle_de_Documentos_de_Legislacion.Estatus }; result = !IsNew? _IDetalle_de_Documentos_de_LegislacionApiConsumer.Update(Detalle_de_Documentos_de_LegislacionInfo, null, null).Resource.ToString() : _IDetalle_de_Documentos_de_LegislacionApiConsumer.Insert(Detalle_de_Documentos_de_LegislacionInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddDetalle_de_Documentos_de_Legislacion(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, 45214); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDetalle_de_Documentos_de_LegislacionApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_de_Documentos_de_LegislacionModel varDetalle_de_Documentos_de_Legislacion = new Detalle_de_Documentos_de_LegislacionModel(); if (id.ToString() != "0") { var Detalle_de_Documentos_de_LegislacionsData = _IDetalle_de_Documentos_de_LegislacionApiConsumer.ListaSelAll(0, 1000, "Detalle_de_Documentos_de_Legislacion.Clave=" + id, "").Resource.Detalle_de_Documentos_de_Legislacions; if (Detalle_de_Documentos_de_LegislacionsData != null && Detalle_de_Documentos_de_LegislacionsData.Count > 0) { var Detalle_de_Documentos_de_LegislacionData = Detalle_de_Documentos_de_LegislacionsData.First(); varDetalle_de_Documentos_de_Legislacion = new Detalle_de_Documentos_de_LegislacionModel { Clave = Detalle_de_Documentos_de_LegislacionData.Clave , ID_de_Dispositivo = Detalle_de_Documentos_de_LegislacionData.ID_de_Dispositivo , Estatus = Detalle_de_Documentos_de_LegislacionData.Estatus , EstatusDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Documentos_de_LegislacionData.Estatus), "Estatus_Detalle_Documentos_Legislacion") ?? (string)Detalle_de_Documentos_de_LegislacionData.Estatus_Estatus_Detalle_Documentos_Legislacion.Descripcion }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IEstatus_Detalle_Documentos_LegislacionApiConsumer.SetAuthHeader(_tokenManager.Token); var Estatus_Detalle_Documentos_Legislacions_Estatus = _IEstatus_Detalle_Documentos_LegislacionApiConsumer.SelAll(true); if (Estatus_Detalle_Documentos_Legislacions_Estatus != null && Estatus_Detalle_Documentos_Legislacions_Estatus.Resource != null) { ViewBag.Estatus_Detalle_Documentos_Legislacions_Estatus = Estatus_Detalle_Documentos_Legislacions_Estatus.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Estatus_Detalle_Documentos_Legislacion", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } return(PartialView("AddDetalle_de_Documentos_de_Legislacion", varDetalle_de_Documentos_de_Legislacion)); }
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, 45214); ViewBag.Permission = permission; var varDetalle_de_Documentos_de_Legislacion = new Detalle_de_Documentos_de_LegislacionModel(); ViewBag.ObjectId = "45214"; 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_de_Documentos_de_LegislacionApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_de_Documentos_de_LegislacionData = _IDetalle_de_Documentos_de_LegislacionApiConsumer.GetByKeyComplete(Id).Resource.Detalle_de_Documentos_de_Legislacions[0]; if (Detalle_de_Documentos_de_LegislacionData == null) { return(HttpNotFound()); } varDetalle_de_Documentos_de_Legislacion = new Detalle_de_Documentos_de_LegislacionModel { Clave = (int)Detalle_de_Documentos_de_LegislacionData.Clave , ID_de_Dispositivo = Detalle_de_Documentos_de_LegislacionData.ID_de_Dispositivo , Estatus = Detalle_de_Documentos_de_LegislacionData.Estatus , EstatusDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Documentos_de_LegislacionData.Estatus), "Estatus_Detalle_Documentos_Legislacion") ?? (string)Detalle_de_Documentos_de_LegislacionData.Estatus_Estatus_Detalle_Documentos_Legislacion.Descripcion }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IEstatus_Detalle_Documentos_LegislacionApiConsumer.SetAuthHeader(_tokenManager.Token); var Estatus_Detalle_Documentos_Legislacions_Estatus = _IEstatus_Detalle_Documentos_LegislacionApiConsumer.SelAll(true); if (Estatus_Detalle_Documentos_Legislacions_Estatus != null && Estatus_Detalle_Documentos_Legislacions_Estatus.Resource != null) { ViewBag.Estatus_Detalle_Documentos_Legislacions_Estatus = Estatus_Detalle_Documentos_Legislacions_Estatus.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Estatus_Detalle_Documentos_Legislacion", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDetalle_de_Documentos_de_Legislacion)); }