Exemplo n.º 1
0
        public ActionResult Post(bool IsNew, Otras_Identificaciones_InvolucradoModel varOtras_Identificaciones_Involucrado)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (!_tokenManager.GenerateToken())
                    {
                        return(Json(null, JsonRequestBehavior.AllowGet));
                    }
                    _IOtras_Identificaciones_InvolucradoApiConsumer.SetAuthHeader(_tokenManager.Token);



                    var result = "";
                    var Otras_Identificaciones_InvolucradoInfo = new Otras_Identificaciones_Involucrado
                    {
                        Clave = varOtras_Identificaciones_Involucrado.Clave
                        , Tipo_de_identificacion = varOtras_Identificaciones_Involucrado.Tipo_de_identificacion
                        , Descripcion            = varOtras_Identificaciones_Involucrado.Descripcion
                    };

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

                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 2
0
        public ActionResult AddOtras_Identificaciones_Involucrado(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, 45309);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IOtras_Identificaciones_InvolucradoApiConsumer.SetAuthHeader(_tokenManager.Token);
            Otras_Identificaciones_InvolucradoModel varOtras_Identificaciones_Involucrado = new Otras_Identificaciones_InvolucradoModel();


            if (id.ToString() != "0")
            {
                var Otras_Identificaciones_InvolucradosData = _IOtras_Identificaciones_InvolucradoApiConsumer.ListaSelAll(0, 1000, "Otras_Identificaciones_Involucrado.Clave=" + id, "").Resource.Otras_Identificaciones_Involucrados;

                if (Otras_Identificaciones_InvolucradosData != null && Otras_Identificaciones_InvolucradosData.Count > 0)
                {
                    var Otras_Identificaciones_InvolucradoData = Otras_Identificaciones_InvolucradosData.First();
                    varOtras_Identificaciones_Involucrado = new Otras_Identificaciones_InvolucradoModel
                    {
                        Clave = Otras_Identificaciones_InvolucradoData.Clave
                        , Tipo_de_identificacion       = Otras_Identificaciones_InvolucradoData.Tipo_de_identificacion
                        , Tipo_de_identificacionNombre = CultureHelper.GetTraduction(Convert.ToString(Otras_Identificaciones_InvolucradoData.Tipo_de_identificacion), "Tipo_de_Identificacion") ?? (string)Otras_Identificaciones_InvolucradoData.Tipo_de_identificacion_Tipo_de_Identificacion.Nombre
                        , Descripcion = Otras_Identificaciones_InvolucradoData.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_Involucrado", varOtras_Identificaciones_Involucrado));
        }
Exemplo n.º 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, 45309);

            ViewBag.Permission = permission;
            var varOtras_Identificaciones_Involucrado = new Otras_Identificaciones_InvolucradoModel();

            ViewBag.ObjectId  = "45309";
            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_InvolucradoApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Otras_Identificaciones_InvolucradoData = _IOtras_Identificaciones_InvolucradoApiConsumer.GetByKeyComplete(Id).Resource.Otras_Identificaciones_Involucrados[0];
                if (Otras_Identificaciones_InvolucradoData == null)
                {
                    return(HttpNotFound());
                }

                varOtras_Identificaciones_Involucrado = new Otras_Identificaciones_InvolucradoModel
                {
                    Clave = (int)Otras_Identificaciones_InvolucradoData.Clave
                    , Tipo_de_identificacion       = Otras_Identificaciones_InvolucradoData.Tipo_de_identificacion
                    , Tipo_de_identificacionNombre = CultureHelper.GetTraduction(Convert.ToString(Otras_Identificaciones_InvolucradoData.Tipo_de_identificacion), "Tipo_de_Identificacion") ?? (string)Otras_Identificaciones_InvolucradoData.Tipo_de_identificacion_Tipo_de_Identificacion.Nombre
                    , Descripcion = Otras_Identificaciones_InvolucradoData.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_Involucrado));
        }