Пример #1
0
        public ActionResult Post(bool IsNew, Detalle_Aseguramiento_Artefactos_y_ExplosivosModel varDetalle_Aseguramiento_Artefactos_y_Explosivos)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (!_tokenManager.GenerateToken())
                    {
                        return(Json(null, JsonRequestBehavior.AllowGet));
                    }
                    _IDetalle_Aseguramiento_Artefactos_y_ExplosivosApiConsumer.SetAuthHeader(_tokenManager.Token);



                    var result = "";
                    var Detalle_Aseguramiento_Artefactos_y_ExplosivosInfo = new Detalle_Aseguramiento_Artefactos_y_Explosivos
                    {
                        Clave = varDetalle_Aseguramiento_Artefactos_y_Explosivos.Clave
                        , Motivo_de_Registro = varDetalle_Aseguramiento_Artefactos_y_Explosivos.Motivo_de_Registro
                        , Clasificacion      = varDetalle_Aseguramiento_Artefactos_y_Explosivos.Clasificacion
                        , Cantidad           = varDetalle_Aseguramiento_Artefactos_y_Explosivos.Cantidad
                        , Lugar_de_Hallazgo  = varDetalle_Aseguramiento_Artefactos_y_Explosivos.Lugar_de_Hallazgo
                        , Observaciones      = varDetalle_Aseguramiento_Artefactos_y_Explosivos.Observaciones
                    };

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

                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Пример #2
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, 45527);

            ViewBag.Permission = permission;
            var varDetalle_Aseguramiento_Artefactos_y_Explosivos = new Detalle_Aseguramiento_Artefactos_y_ExplosivosModel();

            ViewBag.ObjectId  = "45527";
            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_Aseguramiento_Artefactos_y_ExplosivosApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_Aseguramiento_Artefactos_y_ExplosivosData = _IDetalle_Aseguramiento_Artefactos_y_ExplosivosApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Aseguramiento_Artefactos_y_Explosivoss[0];
                if (Detalle_Aseguramiento_Artefactos_y_ExplosivosData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_Aseguramiento_Artefactos_y_Explosivos = new Detalle_Aseguramiento_Artefactos_y_ExplosivosModel
                {
                    Clave = (int)Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Clave
                    , Motivo_de_Registro            = Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Motivo_de_Registro
                    , Motivo_de_RegistroDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Motivo_de_Registro), "Motivo_de_Registro") ?? (string)Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Motivo_de_Registro_Motivo_de_Registro.Descripcion
                    , Clasificacion            = Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Clasificacion
                    , ClasificacionDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Clasificacion), "Clasificacion_de_Artefacto_y_Explosivo") ?? (string)Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Clasificacion_Clasificacion_de_Artefacto_y_Explosivo.Descripcion
                    , Cantidad          = Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Cantidad
                    , Lugar_de_Hallazgo = Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Lugar_de_Hallazgo
                    , Observaciones     = Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Observaciones
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IMotivo_de_RegistroApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Motivo_de_Registros_Motivo_de_Registro = _IMotivo_de_RegistroApiConsumer.SelAll(true);

            if (Motivo_de_Registros_Motivo_de_Registro != null && Motivo_de_Registros_Motivo_de_Registro.Resource != null)
            {
                ViewBag.Motivo_de_Registros_Motivo_de_Registro = Motivo_de_Registros_Motivo_de_Registro.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Motivo_de_Registro", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IClasificacion_de_Artefacto_y_ExplosivoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Clasificacion_de_Artefacto_y_Explosivos_Clasificacion = _IClasificacion_de_Artefacto_y_ExplosivoApiConsumer.SelAll(true);

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_Aseguramiento_Artefactos_y_Explosivos));
        }
Пример #3
0
        public ActionResult AddDetalle_Aseguramiento_Artefactos_y_Explosivos(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, 45527);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDetalle_Aseguramiento_Artefactos_y_ExplosivosApiConsumer.SetAuthHeader(_tokenManager.Token);
            Detalle_Aseguramiento_Artefactos_y_ExplosivosModel varDetalle_Aseguramiento_Artefactos_y_Explosivos = new Detalle_Aseguramiento_Artefactos_y_ExplosivosModel();


            if (id.ToString() != "0")
            {
                var Detalle_Aseguramiento_Artefactos_y_ExplosivossData = _IDetalle_Aseguramiento_Artefactos_y_ExplosivosApiConsumer.ListaSelAll(0, 1000, "Detalle_Aseguramiento_Artefactos_y_Explosivos.Clave=" + id, "").Resource.Detalle_Aseguramiento_Artefactos_y_Explosivoss;

                if (Detalle_Aseguramiento_Artefactos_y_ExplosivossData != null && Detalle_Aseguramiento_Artefactos_y_ExplosivossData.Count > 0)
                {
                    var Detalle_Aseguramiento_Artefactos_y_ExplosivosData = Detalle_Aseguramiento_Artefactos_y_ExplosivossData.First();
                    varDetalle_Aseguramiento_Artefactos_y_Explosivos = new Detalle_Aseguramiento_Artefactos_y_ExplosivosModel
                    {
                        Clave = Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Clave
                        , Motivo_de_Registro            = Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Motivo_de_Registro
                        , Motivo_de_RegistroDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Motivo_de_Registro), "Motivo_de_Registro") ?? (string)Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Motivo_de_Registro_Motivo_de_Registro.Descripcion
                        , Clasificacion            = Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Clasificacion
                        , ClasificacionDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Clasificacion), "Clasificacion_de_Artefacto_y_Explosivo") ?? (string)Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Clasificacion_Clasificacion_de_Artefacto_y_Explosivo.Descripcion
                        , Cantidad          = Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Cantidad
                        , Lugar_de_Hallazgo = Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Lugar_de_Hallazgo
                        , Observaciones     = Detalle_Aseguramiento_Artefactos_y_ExplosivosData.Observaciones
                    };
                }
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IMotivo_de_RegistroApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Motivo_de_Registros_Motivo_de_Registro = _IMotivo_de_RegistroApiConsumer.SelAll(true);

            if (Motivo_de_Registros_Motivo_de_Registro != null && Motivo_de_Registros_Motivo_de_Registro.Resource != null)
            {
                ViewBag.Motivo_de_Registros_Motivo_de_Registro = Motivo_de_Registros_Motivo_de_Registro.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Motivo_de_Registro", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IClasificacion_de_Artefacto_y_ExplosivoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Clasificacion_de_Artefacto_y_Explosivos_Clasificacion = _IClasificacion_de_Artefacto_y_ExplosivoApiConsumer.SelAll(true);

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


            return(PartialView("AddDetalle_Aseguramiento_Artefactos_y_Explosivos", varDetalle_Aseguramiento_Artefactos_y_Explosivos));
        }