public ActionResult Post(bool IsNew, Detalle_de_Delito_Mandamiento_JudicialModel varDetalle_de_Delito_Mandamiento_Judicial) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_de_Delito_Mandamiento_JudicialApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_de_Delito_Mandamiento_JudicialInfo = new Detalle_de_Delito_Mandamiento_Judicial { Clave = varDetalle_de_Delito_Mandamiento_Judicial.Clave , Delito = varDetalle_de_Delito_Mandamiento_Judicial.Delito , Modalidad = varDetalle_de_Delito_Mandamiento_Judicial.Modalidad }; result = !IsNew? _IDetalle_de_Delito_Mandamiento_JudicialApiConsumer.Update(Detalle_de_Delito_Mandamiento_JudicialInfo, null, null).Resource.ToString() : _IDetalle_de_Delito_Mandamiento_JudicialApiConsumer.Insert(Detalle_de_Delito_Mandamiento_JudicialInfo, 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_Delito_Mandamiento_Judicial(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, 45665); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDetalle_de_Delito_Mandamiento_JudicialApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_de_Delito_Mandamiento_JudicialModel varDetalle_de_Delito_Mandamiento_Judicial = new Detalle_de_Delito_Mandamiento_JudicialModel(); if (id.ToString() != "0") { var Detalle_de_Delito_Mandamiento_JudicialsData = _IDetalle_de_Delito_Mandamiento_JudicialApiConsumer.ListaSelAll(0, 1000, "Detalle_de_Delito_Mandamiento_Judicial.Clave=" + id, "").Resource.Detalle_de_Delito_Mandamiento_Judicials; if (Detalle_de_Delito_Mandamiento_JudicialsData != null && Detalle_de_Delito_Mandamiento_JudicialsData.Count > 0) { var Detalle_de_Delito_Mandamiento_JudicialData = Detalle_de_Delito_Mandamiento_JudicialsData.First(); varDetalle_de_Delito_Mandamiento_Judicial = new Detalle_de_Delito_Mandamiento_JudicialModel { Clave = Detalle_de_Delito_Mandamiento_JudicialData.Clave , Delito = Detalle_de_Delito_Mandamiento_JudicialData.Delito , DelitoDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Delito_Mandamiento_JudicialData.Delito), "Delito") ?? (string)Detalle_de_Delito_Mandamiento_JudicialData.Delito_Delito.Descripcion , Modalidad = Detalle_de_Delito_Mandamiento_JudicialData.Modalidad , ModalidadDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Delito_Mandamiento_JudicialData.Modalidad), "Modalidad_Delito") ?? (string)Detalle_de_Delito_Mandamiento_JudicialData.Modalidad_Modalidad_Delito.Descripcion }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IModalidad_DelitoApiConsumer.SetAuthHeader(_tokenManager.Token); var Modalidad_Delitos_Modalidad = _IModalidad_DelitoApiConsumer.SelAll(true); if (Modalidad_Delitos_Modalidad != null && Modalidad_Delitos_Modalidad.Resource != null) { ViewBag.Modalidad_Delitos_Modalidad = Modalidad_Delitos_Modalidad.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Modalidad_Delito", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } return(PartialView("AddDetalle_de_Delito_Mandamiento_Judicial", varDetalle_de_Delito_Mandamiento_Judicial)); }
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, 45665); ViewBag.Permission = permission; var varDetalle_de_Delito_Mandamiento_Judicial = new Detalle_de_Delito_Mandamiento_JudicialModel(); ViewBag.ObjectId = "45665"; 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_Delito_Mandamiento_JudicialApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_de_Delito_Mandamiento_JudicialData = _IDetalle_de_Delito_Mandamiento_JudicialApiConsumer.GetByKeyComplete(Id).Resource.Detalle_de_Delito_Mandamiento_Judicials[0]; if (Detalle_de_Delito_Mandamiento_JudicialData == null) { return(HttpNotFound()); } varDetalle_de_Delito_Mandamiento_Judicial = new Detalle_de_Delito_Mandamiento_JudicialModel { Clave = (int)Detalle_de_Delito_Mandamiento_JudicialData.Clave , Delito = Detalle_de_Delito_Mandamiento_JudicialData.Delito , DelitoDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Delito_Mandamiento_JudicialData.Delito), "Delito") ?? (string)Detalle_de_Delito_Mandamiento_JudicialData.Delito_Delito.Descripcion , Modalidad = Detalle_de_Delito_Mandamiento_JudicialData.Modalidad , ModalidadDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Delito_Mandamiento_JudicialData.Modalidad), "Modalidad_Delito") ?? (string)Detalle_de_Delito_Mandamiento_JudicialData.Modalidad_Modalidad_Delito.Descripcion }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IModalidad_DelitoApiConsumer.SetAuthHeader(_tokenManager.Token); var Modalidad_Delitos_Modalidad = _IModalidad_DelitoApiConsumer.SelAll(true); if (Modalidad_Delitos_Modalidad != null && Modalidad_Delitos_Modalidad.Resource != null) { ViewBag.Modalidad_Delitos_Modalidad = Modalidad_Delitos_Modalidad.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Modalidad_Delito", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDetalle_de_Delito_Mandamiento_Judicial)); }