protected void Page_Load(object sender, EventArgs e)
 {
     //tieneOS = false;
     boolRequerido.Value       = Requerido.ToString().ToLower();
     cvValidar.ValidationGroup = ValidationGroup;
     cvValidar.Enabled         = (Requerido != true ? false : true);
 }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("idRequerido,nombreRequerido")] Requerido requerido)
        {
            if (!_context.Modulo.Any(x => x.nombreModulo == "Requerido" && x.idRol == Convert.ToInt32(User.FindFirstValue("idRol"))))
            {
                return(Redirect("../"));
                //return RedirectToAction("DetailResponder");
            }
            if (id != requerido.idRequerido)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(requerido);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RequeridoExists(requerido.idRequerido))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(requerido));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("idRequerido,nombreRequerido")] Requerido requerido)
        {
            if (!_context.Modulo.Any(x => x.nombreModulo == "Requerido" && x.idRol == Convert.ToInt32(User.FindFirstValue("idRol"))))
            {
                return(Redirect("../"));
                //return RedirectToAction("DetailResponder");
            }
            if (ModelState.IsValid)
            {
                _context.Add(requerido);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(requerido));
        }
Exemplo n.º 4
0
        public ActionResult Delete(int id)
        {
            try
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IRequeridoApiConsumer.SetAuthHeader(_tokenManager.Token);

                Requerido varRequerido = null;
                if (id.ToString() != "0")
                {
                    string where = "";
                }
                var result = _IRequeridoApiConsumer.Delete(id, null, null).Resource;
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 5
0
        public ActionResult Post(bool IsNew, RequeridoModel varRequerido)
        {
            try
            {
                //if (ModelState.IsValid)
                //{
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IRequeridoApiConsumer.SetAuthHeader(_tokenManager.Token);



                var result        = "";
                var RequeridoInfo = new Requerido
                {
                    Clave       = varRequerido.Clave
                    , Nombre    = varRequerido.Nombre
                    , Solicitud = varRequerido.Solicitud
                };

                result = !IsNew?
                         _IRequeridoApiConsumer.Update(RequeridoInfo, null, null).Resource.ToString() :
                             _IRequeridoApiConsumer.Insert(RequeridoInfo, null, null).Resource.ToString();

                Session["KeyValueInserted"] = result;
                return(Json(result, JsonRequestBehavior.AllowGet));
                //}
                //return Json(false, JsonRequestBehavior.AllowGet);
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }