public ActionResult AddDetalle_del_Indicio(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, 45185); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDetalle_del_IndicioApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_del_IndicioModel varDetalle_del_Indicio = new Detalle_del_IndicioModel(); if (id.ToString() != "0") { var Detalle_del_IndiciosData = _IDetalle_del_IndicioApiConsumer.ListaSelAll(0, 1000, "Detalle_del_Indicio.Clave=" + id, "").Resource.Detalle_del_Indicios; if (Detalle_del_IndiciosData != null && Detalle_del_IndiciosData.Count > 0) { var Detalle_del_IndicioData = Detalle_del_IndiciosData.First(); varDetalle_del_Indicio = new Detalle_del_IndicioModel { Clave = Detalle_del_IndicioData.Clave , Numero_de_Indicio = Detalle_del_IndicioData.Numero_de_Indicio , Nombre_del_Indicio = Detalle_del_IndicioData.Nombre_del_Indicio , Descripcion_del_Indicio = Detalle_del_IndicioData.Descripcion_del_Indicio , Motivo = Detalle_del_IndicioData.Motivo , Estatus = Detalle_del_IndicioData.Estatus , EstatusDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_del_IndicioData.Estatus), "Estatus_de_Indicio") ?? (string)Detalle_del_IndicioData.Estatus_Estatus_de_Indicio.Descripcion , Ubicacion_de_Indicio = Detalle_del_IndicioData.Ubicacion_de_Indicio }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IEstatus_de_IndicioApiConsumer.SetAuthHeader(_tokenManager.Token); var Estatus_de_Indicios_Estatus = _IEstatus_de_IndicioApiConsumer.SelAll(true); if (Estatus_de_Indicios_Estatus != null && Estatus_de_Indicios_Estatus.Resource != null) { ViewBag.Estatus_de_Indicios_Estatus = Estatus_de_Indicios_Estatus.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Estatus_de_Indicio", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } return(PartialView("AddDetalle_del_Indicio", varDetalle_del_Indicio)); }
public ActionResult Post(bool IsNew, Detalle_del_IndicioModel varDetalle_del_Indicio) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_del_IndicioApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_del_IndicioInfo = new Detalle_del_Indicio { Clave = varDetalle_del_Indicio.Clave , Numero_de_Indicio = varDetalle_del_Indicio.Numero_de_Indicio , Nombre_del_Indicio = varDetalle_del_Indicio.Nombre_del_Indicio , Descripcion_del_Indicio = varDetalle_del_Indicio.Descripcion_del_Indicio , Motivo = varDetalle_del_Indicio.Motivo , Estatus = varDetalle_del_Indicio.Estatus , Ubicacion_de_Indicio = varDetalle_del_Indicio.Ubicacion_de_Indicio }; result = !IsNew? _IDetalle_del_IndicioApiConsumer.Update(Detalle_del_IndicioInfo, null, null).Resource.ToString() : _IDetalle_del_IndicioApiConsumer.Insert(Detalle_del_IndicioInfo, 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, 45185); ViewBag.Permission = permission; var varDetalle_del_Indicio = new Detalle_del_IndicioModel(); ViewBag.ObjectId = "45185"; 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_del_IndicioApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_del_IndicioData = _IDetalle_del_IndicioApiConsumer.GetByKeyComplete(Id).Resource.Detalle_del_Indicios[0]; if (Detalle_del_IndicioData == null) { return(HttpNotFound()); } varDetalle_del_Indicio = new Detalle_del_IndicioModel { Clave = (int)Detalle_del_IndicioData.Clave , Numero_de_Indicio = Detalle_del_IndicioData.Numero_de_Indicio , Nombre_del_Indicio = Detalle_del_IndicioData.Nombre_del_Indicio , Descripcion_del_Indicio = Detalle_del_IndicioData.Descripcion_del_Indicio , Motivo = Detalle_del_IndicioData.Motivo , Estatus = Detalle_del_IndicioData.Estatus , EstatusDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_del_IndicioData.Estatus), "Estatus_de_Indicio") ?? (string)Detalle_del_IndicioData.Estatus_Estatus_de_Indicio.Descripcion , Ubicacion_de_Indicio = Detalle_del_IndicioData.Ubicacion_de_Indicio }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IEstatus_de_IndicioApiConsumer.SetAuthHeader(_tokenManager.Token); var Estatus_de_Indicios_Estatus = _IEstatus_de_IndicioApiConsumer.SelAll(true); if (Estatus_de_Indicios_Estatus != null && Estatus_de_Indicios_Estatus.Resource != null) { ViewBag.Estatus_de_Indicios_Estatus = Estatus_de_Indicios_Estatus.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Estatus_de_Indicio", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDetalle_del_Indicio)); }