public ActionResult Post(bool IsNew, Otras_Identificaciones_Probable_ResponsableModel varOtras_Identificaciones_Probable_Responsable) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IOtras_Identificaciones_Probable_ResponsableApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Otras_Identificaciones_Probable_ResponsableInfo = new Otras_Identificaciones_Probable_Responsable { Clave = varOtras_Identificaciones_Probable_Responsable.Clave , Tipo_de_identificacion = varOtras_Identificaciones_Probable_Responsable.Tipo_de_identificacion , Descripcion = varOtras_Identificaciones_Probable_Responsable.Descripcion }; result = !IsNew? _IOtras_Identificaciones_Probable_ResponsableApiConsumer.Update(Otras_Identificaciones_Probable_ResponsableInfo, null, null).Resource.ToString() : _IOtras_Identificaciones_Probable_ResponsableApiConsumer.Insert(Otras_Identificaciones_Probable_ResponsableInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddOtras_Identificaciones_Probable_Responsable(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, 45306); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IOtras_Identificaciones_Probable_ResponsableApiConsumer.SetAuthHeader(_tokenManager.Token); Otras_Identificaciones_Probable_ResponsableModel varOtras_Identificaciones_Probable_Responsable = new Otras_Identificaciones_Probable_ResponsableModel(); if (id.ToString() != "0") { var Otras_Identificaciones_Probable_ResponsablesData = _IOtras_Identificaciones_Probable_ResponsableApiConsumer.ListaSelAll(0, 1000, "Otras_Identificaciones_Probable_Responsable.Clave=" + id, "").Resource.Otras_Identificaciones_Probable_Responsables; if (Otras_Identificaciones_Probable_ResponsablesData != null && Otras_Identificaciones_Probable_ResponsablesData.Count > 0) { var Otras_Identificaciones_Probable_ResponsableData = Otras_Identificaciones_Probable_ResponsablesData.First(); varOtras_Identificaciones_Probable_Responsable = new Otras_Identificaciones_Probable_ResponsableModel { Clave = Otras_Identificaciones_Probable_ResponsableData.Clave , Tipo_de_identificacion = Otras_Identificaciones_Probable_ResponsableData.Tipo_de_identificacion , Tipo_de_identificacionNombre = CultureHelper.GetTraduction(Convert.ToString(Otras_Identificaciones_Probable_ResponsableData.Tipo_de_identificacion), "Tipo_de_Identificacion") ?? (string)Otras_Identificaciones_Probable_ResponsableData.Tipo_de_identificacion_Tipo_de_Identificacion.Nombre , Descripcion = Otras_Identificaciones_Probable_ResponsableData.Descripcion }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ITipo_de_IdentificacionApiConsumer.SetAuthHeader(_tokenManager.Token); var Tipo_de_Identificacions_Tipo_de_identificacion = _ITipo_de_IdentificacionApiConsumer.SelAll(true); if (Tipo_de_Identificacions_Tipo_de_identificacion != null && Tipo_de_Identificacions_Tipo_de_identificacion.Resource != null) { ViewBag.Tipo_de_Identificacions_Tipo_de_identificacion = Tipo_de_Identificacions_Tipo_de_identificacion.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tipo_de_Identificacion", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } return(PartialView("AddOtras_Identificaciones_Probable_Responsable", varOtras_Identificaciones_Probable_Responsable)); }
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, 45306); ViewBag.Permission = permission; var varOtras_Identificaciones_Probable_Responsable = new Otras_Identificaciones_Probable_ResponsableModel(); ViewBag.ObjectId = "45306"; 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)); } _IOtras_Identificaciones_Probable_ResponsableApiConsumer.SetAuthHeader(_tokenManager.Token); var Otras_Identificaciones_Probable_ResponsableData = _IOtras_Identificaciones_Probable_ResponsableApiConsumer.GetByKeyComplete(Id).Resource.Otras_Identificaciones_Probable_Responsables[0]; if (Otras_Identificaciones_Probable_ResponsableData == null) { return(HttpNotFound()); } varOtras_Identificaciones_Probable_Responsable = new Otras_Identificaciones_Probable_ResponsableModel { Clave = (int)Otras_Identificaciones_Probable_ResponsableData.Clave , Tipo_de_identificacion = Otras_Identificaciones_Probable_ResponsableData.Tipo_de_identificacion , Tipo_de_identificacionNombre = CultureHelper.GetTraduction(Convert.ToString(Otras_Identificaciones_Probable_ResponsableData.Tipo_de_identificacion), "Tipo_de_Identificacion") ?? (string)Otras_Identificaciones_Probable_ResponsableData.Tipo_de_identificacion_Tipo_de_Identificacion.Nombre , Descripcion = Otras_Identificaciones_Probable_ResponsableData.Descripcion }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ITipo_de_IdentificacionApiConsumer.SetAuthHeader(_tokenManager.Token); var Tipo_de_Identificacions_Tipo_de_identificacion = _ITipo_de_IdentificacionApiConsumer.SelAll(true); if (Tipo_de_Identificacions_Tipo_de_identificacion != null && Tipo_de_Identificacions_Tipo_de_identificacion.Resource != null) { ViewBag.Tipo_de_Identificacions_Tipo_de_identificacion = Tipo_de_Identificacions_Tipo_de_identificacion.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tipo_de_Identificacion", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varOtras_Identificaciones_Probable_Responsable)); }