public JsonResult GetDetalle_Pagos_Paciente_Forma_de_Pago_Formas_de_Pago(string query, string where) { try { if (String.IsNullOrEmpty(where)) { where = ""; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IFormas_de_PagoApiConsumer.SetAuthHeader(_tokenManager.Token); var elWhere = " (cast(Formas_de_Pago.Clave as nvarchar(max)) LIKE '%" + query.Trim() + "%' or cast(Formas_de_Pago.Nombre as nvarchar(max)) LIKE '%" + query.Trim() + "%') " + where; elWhere = HttpUtility.UrlEncode(elWhere); var result = _IFormas_de_PagoApiConsumer.ListaSelAll(1, 20, elWhere, " Formas_de_Pago.Nombre ASC ").Resource; foreach (var item in result.Formas_de_Pagos) { var trans = CultureHelper.GetTraduction(Convert.ToString(item.Clave), "Formas_de_Pago", "Nombre"); item.Nombre = trans ?? item.Nombre; } return(Json(result.Formas_de_Pagos.ToArray(), JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(null, JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(int Id = 0, int consult = 0, int ModuleId = 0) { if (ModuleId == 0) { ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0; } else { Session["CurrentModuleId"] = ModuleId; } var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 44402, ModuleId); if ((!permission.New && Id.ToString() == "0") || (!permission.Edit && Id.ToString() != "0" && (!permission.Consult && consult == 1))) { Response.Redirect("~/"); } ViewBag.Permission = permission; var varFormas_de_Pago = new Formas_de_PagoModel(); varFormas_de_Pago.Clave = Id; ViewBag.ObjectId = "44402"; 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"; _tokenManager.GenerateToken(); _ISpartane_FileApiConsumer.SetAuthHeader(_tokenManager.Token); _IFormas_de_PagoApiConsumer.SetAuthHeader(_tokenManager.Token); var Formas_de_PagosData = _IFormas_de_PagoApiConsumer.ListaSelAll(0, 1000, "Formas_de_Pago.Clave=" + Id, "").Resource.Formas_de_Pagos; if (Formas_de_PagosData != null && Formas_de_PagosData.Count > 0) { var Formas_de_PagoData = Formas_de_PagosData.First(); varFormas_de_Pago = new Formas_de_PagoModel { Clave = Formas_de_PagoData.Clave , Nombre = Formas_de_PagoData.Nombre }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } var isPartial = false; var isMR = false; var nameMR = string.Empty; var nameAttribute = string.Empty; if (Request.QueryString["isPartial"] != null) { isPartial = Convert.ToBoolean(Request.QueryString["isPartial"]); } if (Request.QueryString["isMR"] != null) { isMR = Convert.ToBoolean(Request.QueryString["isMR"]); } if (Request.QueryString["nameMR"] != null) { nameMR = Request.QueryString["nameMR"].ToString(); } if (Request.QueryString["nameAttribute"] != null) { nameAttribute = Request.QueryString["nameAttribute"].ToString(); } ViewBag.isPartial = isPartial; ViewBag.isMR = isMR; ViewBag.nameMR = nameMR; ViewBag.nameAttribute = nameAttribute; return(View(varFormas_de_Pago)); }