public ActionResult Post(bool IsNew, Detalle_de_IndiciosModel varDetalle_de_Indicios) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_de_IndiciosApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_de_IndiciosInfo = new Detalle_de_Indicios { Clave = varDetalle_de_Indicios.Clave , Numero_de_Indicio = varDetalle_de_Indicios.Numero_de_Indicio , Nombre_de_Indicio = varDetalle_de_Indicios.Nombre_de_Indicio , Descripcion_de_Indicio = varDetalle_de_Indicios.Descripcion_de_Indicio , Motivo_de_Indicio = varDetalle_de_Indicios.Motivo_de_Indicio , Diligencia = varDetalle_de_Indicios.Diligencia , Ubicacion = varDetalle_de_Indicios.Ubicacion , Estatus = varDetalle_de_Indicios.Estatus }; result = !IsNew? _IDetalle_de_IndiciosApiConsumer.Update(Detalle_de_IndiciosInfo, null, null).Resource.ToString() : _IDetalle_de_IndiciosApiConsumer.Insert(Detalle_de_IndiciosInfo, 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, 45172); ViewBag.Permission = permission; var varDetalle_de_Indicios = new Detalle_de_IndiciosModel(); ViewBag.ObjectId = "45172"; 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_IndiciosApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_de_IndiciosData = _IDetalle_de_IndiciosApiConsumer.GetByKeyComplete(Id).Resource.Detalle_de_Indicioss[0]; if (Detalle_de_IndiciosData == null) { return(HttpNotFound()); } varDetalle_de_Indicios = new Detalle_de_IndiciosModel { Clave = (int)Detalle_de_IndiciosData.Clave , Numero_de_Indicio = Detalle_de_IndiciosData.Numero_de_Indicio , Nombre_de_Indicio = Detalle_de_IndiciosData.Nombre_de_Indicio , Descripcion_de_Indicio = Detalle_de_IndiciosData.Descripcion_de_Indicio , Motivo_de_Indicio = Detalle_de_IndiciosData.Motivo_de_Indicio , Diligencia = Detalle_de_IndiciosData.Diligencia , DiligenciaServicio = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_IndiciosData.Diligencia), "Servicios_Periciales") ?? (string)Detalle_de_IndiciosData.Diligencia_Servicios_Periciales.Servicio , Ubicacion = Detalle_de_IndiciosData.Ubicacion , Estatus = Detalle_de_IndiciosData.Estatus , EstatusDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_IndiciosData.Estatus), "Estatus_de_Indicio") ?? (string)Detalle_de_IndiciosData.Estatus_Estatus_de_Indicio.Descripcion }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IServicios_PericialesApiConsumer.SetAuthHeader(_tokenManager.Token); var Servicios_Pericialess_Diligencia = _IServicios_PericialesApiConsumer.SelAll(true); if (Servicios_Pericialess_Diligencia != null && Servicios_Pericialess_Diligencia.Resource != null) { ViewBag.Servicios_Pericialess_Diligencia = Servicios_Pericialess_Diligencia.Resource.Where(m => m.Servicio != null).OrderBy(m => m.Servicio).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Servicios_Periciales", "Servicio") ?? m.Servicio.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _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_de_Indicios)); }
public ActionResult AddDetalle_de_Indicios(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, 45172); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDetalle_de_IndiciosApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_de_IndiciosModel varDetalle_de_Indicios = new Detalle_de_IndiciosModel(); if (id.ToString() != "0") { var Detalle_de_IndiciossData = _IDetalle_de_IndiciosApiConsumer.ListaSelAll(0, 1000, "Detalle_de_Indicios.Clave=" + id, "").Resource.Detalle_de_Indicioss; if (Detalle_de_IndiciossData != null && Detalle_de_IndiciossData.Count > 0) { var Detalle_de_IndiciosData = Detalle_de_IndiciossData.First(); varDetalle_de_Indicios = new Detalle_de_IndiciosModel { Clave = Detalle_de_IndiciosData.Clave , Numero_de_Indicio = Detalle_de_IndiciosData.Numero_de_Indicio , Nombre_de_Indicio = Detalle_de_IndiciosData.Nombre_de_Indicio , Descripcion_de_Indicio = Detalle_de_IndiciosData.Descripcion_de_Indicio , Motivo_de_Indicio = Detalle_de_IndiciosData.Motivo_de_Indicio , Diligencia = Detalle_de_IndiciosData.Diligencia , DiligenciaServicio = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_IndiciosData.Diligencia), "Servicios_Periciales") ?? (string)Detalle_de_IndiciosData.Diligencia_Servicios_Periciales.Servicio , Ubicacion = Detalle_de_IndiciosData.Ubicacion , Estatus = Detalle_de_IndiciosData.Estatus , EstatusDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_IndiciosData.Estatus), "Estatus_de_Indicio") ?? (string)Detalle_de_IndiciosData.Estatus_Estatus_de_Indicio.Descripcion }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IServicios_PericialesApiConsumer.SetAuthHeader(_tokenManager.Token); var Servicios_Pericialess_Diligencia = _IServicios_PericialesApiConsumer.SelAll(true); if (Servicios_Pericialess_Diligencia != null && Servicios_Pericialess_Diligencia.Resource != null) { ViewBag.Servicios_Pericialess_Diligencia = Servicios_Pericialess_Diligencia.Resource.Where(m => m.Servicio != null).OrderBy(m => m.Servicio).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Servicios_Periciales", "Servicio") ?? m.Servicio.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _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_de_Indicios", varDetalle_de_Indicios)); }