public ActionResult Post(bool IsNew, Detalle_de_Servicio_de_Apoyo_MPIModel varDetalle_de_Servicio_de_Apoyo_MPI) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDetalle_de_Servicio_de_Apoyo_MPIApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Detalle_de_Servicio_de_Apoyo_MPIInfo = new Detalle_de_Servicio_de_Apoyo_MPI { Clave = varDetalle_de_Servicio_de_Apoyo_MPI.Clave , Tipo_de_Servicio = varDetalle_de_Servicio_de_Apoyo_MPI.Tipo_de_Servicio , Dictamen = varDetalle_de_Servicio_de_Apoyo_MPI.Dictamen , Responsable = varDetalle_de_Servicio_de_Apoyo_MPI.Responsable , Victima = varDetalle_de_Servicio_de_Apoyo_MPI.Victima }; result = !IsNew? _IDetalle_de_Servicio_de_Apoyo_MPIApiConsumer.Update(Detalle_de_Servicio_de_Apoyo_MPIInfo, null, null).Resource.ToString() : _IDetalle_de_Servicio_de_Apoyo_MPIApiConsumer.Insert(Detalle_de_Servicio_de_Apoyo_MPIInfo, 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, 45122); ViewBag.Permission = permission; var varDetalle_de_Servicio_de_Apoyo_MPI = new Detalle_de_Servicio_de_Apoyo_MPIModel(); ViewBag.ObjectId = "45122"; 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_Servicio_de_Apoyo_MPIApiConsumer.SetAuthHeader(_tokenManager.Token); var Detalle_de_Servicio_de_Apoyo_MPIData = _IDetalle_de_Servicio_de_Apoyo_MPIApiConsumer.GetByKeyComplete(Id).Resource.Detalle_de_Servicio_de_Apoyo_MPIs[0]; if (Detalle_de_Servicio_de_Apoyo_MPIData == null) { return(HttpNotFound()); } varDetalle_de_Servicio_de_Apoyo_MPI = new Detalle_de_Servicio_de_Apoyo_MPIModel { Clave = (int)Detalle_de_Servicio_de_Apoyo_MPIData.Clave , Tipo_de_Servicio = Detalle_de_Servicio_de_Apoyo_MPIData.Tipo_de_Servicio , Tipo_de_ServicioServicio = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Servicio_de_Apoyo_MPIData.Tipo_de_Servicio), "Tipo_de_Servicio_de_Apoyo") ?? (string)Detalle_de_Servicio_de_Apoyo_MPIData.Tipo_de_Servicio_Tipo_de_Servicio_de_Apoyo.Servicio , Dictamen = Detalle_de_Servicio_de_Apoyo_MPIData.Dictamen , Responsable = Detalle_de_Servicio_de_Apoyo_MPIData.Responsable , Victima = Detalle_de_Servicio_de_Apoyo_MPIData.Victima , VictimaNombre = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Servicio_de_Apoyo_MPIData.Victima), "Solicitante_MPI") ?? (string)Detalle_de_Servicio_de_Apoyo_MPIData.Victima_Solicitante_MPI.Nombre }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ITipo_de_Servicio_de_ApoyoApiConsumer.SetAuthHeader(_tokenManager.Token); var Tipo_de_Servicio_de_Apoyos_Tipo_de_Servicio = _ITipo_de_Servicio_de_ApoyoApiConsumer.SelAll(true); if (Tipo_de_Servicio_de_Apoyos_Tipo_de_Servicio != null && Tipo_de_Servicio_de_Apoyos_Tipo_de_Servicio.Resource != null) { ViewBag.Tipo_de_Servicio_de_Apoyos_Tipo_de_Servicio = Tipo_de_Servicio_de_Apoyos_Tipo_de_Servicio.Resource.Where(m => m.Servicio != null).OrderBy(m => m.Servicio).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tipo_de_Servicio_de_Apoyo", "Servicio") ?? m.Servicio.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _ISolicitante_MPIApiConsumer.SetAuthHeader(_tokenManager.Token); var Solicitante_MPIs_Victima = _ISolicitante_MPIApiConsumer.SelAll(true); if (Solicitante_MPIs_Victima != null && Solicitante_MPIs_Victima.Resource != null) { ViewBag.Solicitante_MPIs_Victima = Solicitante_MPIs_Victima.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Solicitante_MPI", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDetalle_de_Servicio_de_Apoyo_MPI)); }
public ActionResult AddDetalle_de_Servicio_de_Apoyo_MPI(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, 45122); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDetalle_de_Servicio_de_Apoyo_MPIApiConsumer.SetAuthHeader(_tokenManager.Token); Detalle_de_Servicio_de_Apoyo_MPIModel varDetalle_de_Servicio_de_Apoyo_MPI = new Detalle_de_Servicio_de_Apoyo_MPIModel(); if (id.ToString() != "0") { var Detalle_de_Servicio_de_Apoyo_MPIsData = _IDetalle_de_Servicio_de_Apoyo_MPIApiConsumer.ListaSelAll(0, 1000, "Detalle_de_Servicio_de_Apoyo_MPI.Clave=" + id, "").Resource.Detalle_de_Servicio_de_Apoyo_MPIs; if (Detalle_de_Servicio_de_Apoyo_MPIsData != null && Detalle_de_Servicio_de_Apoyo_MPIsData.Count > 0) { var Detalle_de_Servicio_de_Apoyo_MPIData = Detalle_de_Servicio_de_Apoyo_MPIsData.First(); varDetalle_de_Servicio_de_Apoyo_MPI = new Detalle_de_Servicio_de_Apoyo_MPIModel { Clave = Detalle_de_Servicio_de_Apoyo_MPIData.Clave , Tipo_de_Servicio = Detalle_de_Servicio_de_Apoyo_MPIData.Tipo_de_Servicio , Tipo_de_ServicioServicio = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Servicio_de_Apoyo_MPIData.Tipo_de_Servicio), "Tipo_de_Servicio_de_Apoyo") ?? (string)Detalle_de_Servicio_de_Apoyo_MPIData.Tipo_de_Servicio_Tipo_de_Servicio_de_Apoyo.Servicio , Dictamen = Detalle_de_Servicio_de_Apoyo_MPIData.Dictamen , Responsable = Detalle_de_Servicio_de_Apoyo_MPIData.Responsable , Victima = Detalle_de_Servicio_de_Apoyo_MPIData.Victima , VictimaNombre = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Servicio_de_Apoyo_MPIData.Victima), "Solicitante_MPI") ?? (string)Detalle_de_Servicio_de_Apoyo_MPIData.Victima_Solicitante_MPI.Nombre }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ITipo_de_Servicio_de_ApoyoApiConsumer.SetAuthHeader(_tokenManager.Token); var Tipo_de_Servicio_de_Apoyos_Tipo_de_Servicio = _ITipo_de_Servicio_de_ApoyoApiConsumer.SelAll(true); if (Tipo_de_Servicio_de_Apoyos_Tipo_de_Servicio != null && Tipo_de_Servicio_de_Apoyos_Tipo_de_Servicio.Resource != null) { ViewBag.Tipo_de_Servicio_de_Apoyos_Tipo_de_Servicio = Tipo_de_Servicio_de_Apoyos_Tipo_de_Servicio.Resource.Where(m => m.Servicio != null).OrderBy(m => m.Servicio).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tipo_de_Servicio_de_Apoyo", "Servicio") ?? m.Servicio.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } _ISolicitante_MPIApiConsumer.SetAuthHeader(_tokenManager.Token); var Solicitante_MPIs_Victima = _ISolicitante_MPIApiConsumer.SelAll(true); if (Solicitante_MPIs_Victima != null && Solicitante_MPIs_Victima.Resource != null) { ViewBag.Solicitante_MPIs_Victima = Solicitante_MPIs_Victima.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Solicitante_MPI", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } return(PartialView("AddDetalle_de_Servicio_de_Apoyo_MPI", varDetalle_de_Servicio_de_Apoyo_MPI)); }