Example #1
0
        public ActionResult Post(bool IsNew, Detalle_Condiciones_Proceso_PenalModel varDetalle_Condiciones_Proceso_Penal)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (!_tokenManager.GenerateToken())
                    {
                        return(Json(null, JsonRequestBehavior.AllowGet));
                    }
                    _IDetalle_Condiciones_Proceso_PenalApiConsumer.SetAuthHeader(_tokenManager.Token);



                    var result = "";
                    var Detalle_Condiciones_Proceso_PenalInfo = new Detalle_Condiciones_Proceso_Penal
                    {
                        Clave             = varDetalle_Condiciones_Proceso_Penal.Clave
                        , Medida_Cautelar = varDetalle_Condiciones_Proceso_Penal.Medida_Cautelar
                    };

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

                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Example #2
0
        public ActionResult AddDetalle_Condiciones_Proceso_Penal(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, 45564);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDetalle_Condiciones_Proceso_PenalApiConsumer.SetAuthHeader(_tokenManager.Token);
            Detalle_Condiciones_Proceso_PenalModel varDetalle_Condiciones_Proceso_Penal = new Detalle_Condiciones_Proceso_PenalModel();


            if (id.ToString() != "0")
            {
                var Detalle_Condiciones_Proceso_PenalsData = _IDetalle_Condiciones_Proceso_PenalApiConsumer.ListaSelAll(0, 1000, "Detalle_Condiciones_Proceso_Penal.Clave=" + id, "").Resource.Detalle_Condiciones_Proceso_Penals;

                if (Detalle_Condiciones_Proceso_PenalsData != null && Detalle_Condiciones_Proceso_PenalsData.Count > 0)
                {
                    var Detalle_Condiciones_Proceso_PenalData = Detalle_Condiciones_Proceso_PenalsData.First();
                    varDetalle_Condiciones_Proceso_Penal = new Detalle_Condiciones_Proceso_PenalModel
                    {
                        Clave                        = Detalle_Condiciones_Proceso_PenalData.Clave
                        , Medida_Cautelar            = Detalle_Condiciones_Proceso_PenalData.Medida_Cautelar
                        , Medida_CautelarDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Condiciones_Proceso_PenalData.Medida_Cautelar), "Condiciones_en_Suspension_Condicional") ?? (string)Detalle_Condiciones_Proceso_PenalData.Medida_Cautelar_Condiciones_en_Suspension_Condicional.Descripcion
                    };
                }
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ICondiciones_en_Suspension_CondicionalApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Condiciones_en_Suspension_Condicionals_Medida_Cautelar = _ICondiciones_en_Suspension_CondicionalApiConsumer.SelAll(true);

            if (Condiciones_en_Suspension_Condicionals_Medida_Cautelar != null && Condiciones_en_Suspension_Condicionals_Medida_Cautelar.Resource != null)
            {
                ViewBag.Condiciones_en_Suspension_Condicionals_Medida_Cautelar = Condiciones_en_Suspension_Condicionals_Medida_Cautelar.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Condiciones_en_Suspension_Condicional", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }


            return(PartialView("AddDetalle_Condiciones_Proceso_Penal", varDetalle_Condiciones_Proceso_Penal));
        }
Example #3
0
        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, 45564);

            ViewBag.Permission = permission;
            var varDetalle_Condiciones_Proceso_Penal = new Detalle_Condiciones_Proceso_PenalModel();

            ViewBag.ObjectId  = "45564";
            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_Condiciones_Proceso_PenalApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_Condiciones_Proceso_PenalData = _IDetalle_Condiciones_Proceso_PenalApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Condiciones_Proceso_Penals[0];
                if (Detalle_Condiciones_Proceso_PenalData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_Condiciones_Proceso_Penal = new Detalle_Condiciones_Proceso_PenalModel
                {
                    Clave                        = (int)Detalle_Condiciones_Proceso_PenalData.Clave
                    , Medida_Cautelar            = Detalle_Condiciones_Proceso_PenalData.Medida_Cautelar
                    , Medida_CautelarDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Condiciones_Proceso_PenalData.Medida_Cautelar), "Condiciones_en_Suspension_Condicional") ?? (string)Detalle_Condiciones_Proceso_PenalData.Medida_Cautelar_Condiciones_en_Suspension_Condicional.Descripcion
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ICondiciones_en_Suspension_CondicionalApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Condiciones_en_Suspension_Condicionals_Medida_Cautelar = _ICondiciones_en_Suspension_CondicionalApiConsumer.SelAll(true);

            if (Condiciones_en_Suspension_Condicionals_Medida_Cautelar != null && Condiciones_en_Suspension_Condicionals_Medida_Cautelar.Resource != null)
            {
                ViewBag.Condiciones_en_Suspension_Condicionals_Medida_Cautelar = Condiciones_en_Suspension_Condicionals_Medida_Cautelar.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Condiciones_en_Suspension_Condicional", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_Condiciones_Proceso_Penal));
        }