Exemple #1
0
        public ActionResult Post(bool IsNew, Detalle_de_Devolucion_de_IndiciosModel varDetalle_de_Devolucion_de_Indicios)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (!_tokenManager.GenerateToken())
                    {
                        return(Json(null, JsonRequestBehavior.AllowGet));
                    }
                    _IDetalle_de_Devolucion_de_IndiciosApiConsumer.SetAuthHeader(_tokenManager.Token);



                    var result = "";
                    var Detalle_de_Devolucion_de_IndiciosInfo = new Detalle_de_Devolucion_de_Indicios
                    {
                        Clave = varDetalle_de_Devolucion_de_Indicios.Clave
                        , Fecha_de_Devolucion                  = (!String.IsNullOrEmpty(varDetalle_de_Devolucion_de_Indicios.Fecha_de_Devolucion)) ? DateTime.ParseExact(varDetalle_de_Devolucion_de_Indicios.Fecha_de_Devolucion, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null
                        , Hora_de_Devolucion                   = varDetalle_de_Devolucion_de_Indicios.Hora_de_Devolucion
                        , Nombre_de_Persona_que_Entrega        = varDetalle_de_Devolucion_de_Indicios.Nombre_de_Persona_que_Entrega
                        , Numero_de_Indicio                    = varDetalle_de_Devolucion_de_Indicios.Numero_de_Indicio
                        , Nombre_de_Indicio                    = varDetalle_de_Devolucion_de_Indicios.Nombre_de_Indicio
                        , Descripcion_de_Devolucion_de_Indicio = varDetalle_de_Devolucion_de_Indicios.Descripcion_de_Devolucion_de_Indicio
                        , Diligencia_que_Devuelve              = varDetalle_de_Devolucion_de_Indicios.Diligencia_que_Devuelve
                    };

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

                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #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, 45187);

            ViewBag.Permission = permission;
            var varDetalle_de_Devolucion_de_Indicios = new Detalle_de_Devolucion_de_IndiciosModel();

            ViewBag.ObjectId  = "45187";
            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_de_Devolucion_de_IndiciosApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_de_Devolucion_de_IndiciosData = _IDetalle_de_Devolucion_de_IndiciosApiConsumer.GetByKeyComplete(Id).Resource.Detalle_de_Devolucion_de_Indicioss[0];
                if (Detalle_de_Devolucion_de_IndiciosData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_de_Devolucion_de_Indicios = new Detalle_de_Devolucion_de_IndiciosModel
                {
                    Clave = (int)Detalle_de_Devolucion_de_IndiciosData.Clave
                    , Fecha_de_Devolucion                  = (Detalle_de_Devolucion_de_IndiciosData.Fecha_de_Devolucion == null ? string.Empty : Convert.ToDateTime(Detalle_de_Devolucion_de_IndiciosData.Fecha_de_Devolucion).ToString(ConfigurationProperty.DateFormat))
                    , Hora_de_Devolucion                   = Detalle_de_Devolucion_de_IndiciosData.Hora_de_Devolucion
                    , Nombre_de_Persona_que_Entrega        = Detalle_de_Devolucion_de_IndiciosData.Nombre_de_Persona_que_Entrega
                    , Numero_de_Indicio                    = Detalle_de_Devolucion_de_IndiciosData.Numero_de_Indicio
                    , Numero_de_IndicioDescripcion         = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Devolucion_de_IndiciosData.Numero_de_Indicio), "Indicios_para_MPI") ?? (string)Detalle_de_Devolucion_de_IndiciosData.Numero_de_Indicio_Indicios_para_MPI.Descripcion
                    , Nombre_de_Indicio                    = Detalle_de_Devolucion_de_IndiciosData.Nombre_de_Indicio
                    , Descripcion_de_Devolucion_de_Indicio = Detalle_de_Devolucion_de_IndiciosData.Descripcion_de_Devolucion_de_Indicio
                    , Diligencia_que_Devuelve              = Detalle_de_Devolucion_de_IndiciosData.Diligencia_que_Devuelve
                    , Diligencia_que_DevuelveServicio      = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Devolucion_de_IndiciosData.Diligencia_que_Devuelve), "Servicios_Periciales") ?? (string)Detalle_de_Devolucion_de_IndiciosData.Diligencia_que_Devuelve_Servicios_Periciales.Servicio
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IIndicios_para_MPIApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Indicios_para_MPIs_Numero_de_Indicio = _IIndicios_para_MPIApiConsumer.SelAll(true);

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

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_de_Devolucion_de_Indicios));
        }
Exemple #3
0
        public ActionResult AddDetalle_de_Devolucion_de_Indicios(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, 45187);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDetalle_de_Devolucion_de_IndiciosApiConsumer.SetAuthHeader(_tokenManager.Token);
            Detalle_de_Devolucion_de_IndiciosModel varDetalle_de_Devolucion_de_Indicios = new Detalle_de_Devolucion_de_IndiciosModel();


            if (id.ToString() != "0")
            {
                var Detalle_de_Devolucion_de_IndiciossData = _IDetalle_de_Devolucion_de_IndiciosApiConsumer.ListaSelAll(0, 1000, "Detalle_de_Devolucion_de_Indicios.Clave=" + id, "").Resource.Detalle_de_Devolucion_de_Indicioss;

                if (Detalle_de_Devolucion_de_IndiciossData != null && Detalle_de_Devolucion_de_IndiciossData.Count > 0)
                {
                    var Detalle_de_Devolucion_de_IndiciosData = Detalle_de_Devolucion_de_IndiciossData.First();
                    varDetalle_de_Devolucion_de_Indicios = new Detalle_de_Devolucion_de_IndiciosModel
                    {
                        Clave = Detalle_de_Devolucion_de_IndiciosData.Clave
                        , Fecha_de_Devolucion                  = (Detalle_de_Devolucion_de_IndiciosData.Fecha_de_Devolucion == null ? string.Empty : Convert.ToDateTime(Detalle_de_Devolucion_de_IndiciosData.Fecha_de_Devolucion).ToString(ConfigurationProperty.DateFormat))
                        , Hora_de_Devolucion                   = Detalle_de_Devolucion_de_IndiciosData.Hora_de_Devolucion
                        , Nombre_de_Persona_que_Entrega        = Detalle_de_Devolucion_de_IndiciosData.Nombre_de_Persona_que_Entrega
                        , Numero_de_Indicio                    = Detalle_de_Devolucion_de_IndiciosData.Numero_de_Indicio
                        , Numero_de_IndicioDescripcion         = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Devolucion_de_IndiciosData.Numero_de_Indicio), "Indicios_para_MPI") ?? (string)Detalle_de_Devolucion_de_IndiciosData.Numero_de_Indicio_Indicios_para_MPI.Descripcion
                        , Nombre_de_Indicio                    = Detalle_de_Devolucion_de_IndiciosData.Nombre_de_Indicio
                        , Descripcion_de_Devolucion_de_Indicio = Detalle_de_Devolucion_de_IndiciosData.Descripcion_de_Devolucion_de_Indicio
                        , Diligencia_que_Devuelve              = Detalle_de_Devolucion_de_IndiciosData.Diligencia_que_Devuelve
                        , Diligencia_que_DevuelveServicio      = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Devolucion_de_IndiciosData.Diligencia_que_Devuelve), "Servicios_Periciales") ?? (string)Detalle_de_Devolucion_de_IndiciosData.Diligencia_que_Devuelve_Servicios_Periciales.Servicio
                    };
                }
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IIndicios_para_MPIApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Indicios_para_MPIs_Numero_de_Indicio = _IIndicios_para_MPIApiConsumer.SelAll(true);

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

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


            return(PartialView("AddDetalle_de_Devolucion_de_Indicios", varDetalle_de_Devolucion_de_Indicios));
        }