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



                    var result = "";
                    var Detalle_de_Oficio_de_Servicio_PericialInfo = new Detalle_de_Oficio_de_Servicio_Pericial
                    {
                        Clave               = varDetalle_de_Oficio_de_Servicio_Pericial.Clave
                        , Oficio            = varDetalle_de_Oficio_de_Servicio_Pericial.Oficio
                        , Servicio_Pericial = varDetalle_de_Oficio_de_Servicio_Pericial.Servicio_Pericial
                    };

                    result = !IsNew?
                             _IDetalle_de_Oficio_de_Servicio_PericialApiConsumer.Update(Detalle_de_Oficio_de_Servicio_PericialInfo, null, null).Resource.ToString() :
                                 _IDetalle_de_Oficio_de_Servicio_PericialApiConsumer.Insert(Detalle_de_Oficio_de_Servicio_PericialInfo, 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 Create(int Id = 0, int consult = 0)
        {
            int ModuleId   = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 45160);

            ViewBag.Permission = permission;
            var varDetalle_de_Oficio_de_Servicio_Pericial = new Detalle_de_Oficio_de_Servicio_PericialModel();

            ViewBag.ObjectId  = "45160";
            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_Oficio_de_Servicio_PericialApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_de_Oficio_de_Servicio_PericialData = _IDetalle_de_Oficio_de_Servicio_PericialApiConsumer.GetByKeyComplete(Id).Resource.Detalle_de_Oficio_de_Servicio_Pericials[0];
                if (Detalle_de_Oficio_de_Servicio_PericialData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_de_Oficio_de_Servicio_Pericial = new Detalle_de_Oficio_de_Servicio_PericialModel
                {
                    Clave                       = (int)Detalle_de_Oficio_de_Servicio_PericialData.Clave
                    , Oficio                    = Detalle_de_Oficio_de_Servicio_PericialData.Oficio
                    , OficioDescripcion         = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Oficio_de_Servicio_PericialData.Oficio), "Tipo_de_Oficios") ?? (string)Detalle_de_Oficio_de_Servicio_PericialData.Oficio_Tipo_de_Oficios.Descripcion
                    , Servicio_Pericial         = Detalle_de_Oficio_de_Servicio_PericialData.Servicio_Pericial
                    , Servicio_PericialServicio = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Oficio_de_Servicio_PericialData.Servicio_Pericial), "Servicios_Periciales") ?? (string)Detalle_de_Oficio_de_Servicio_PericialData.Servicio_Pericial_Servicios_Periciales.Servicio
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ITipo_de_OficiosApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Tipo_de_Oficioss_Oficio = _ITipo_de_OficiosApiConsumer.SelAll(true);

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

            if (Servicios_Pericialess_Servicio_Pericial != null && Servicios_Pericialess_Servicio_Pericial.Resource != null)
            {
                ViewBag.Servicios_Pericialess_Servicio_Pericial = Servicios_Pericialess_Servicio_Pericial.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_Oficio_de_Servicio_Pericial));
        }
Exemplo n.º 3
0
        public ActionResult AddDetalle_de_Oficio_de_Servicio_Pericial(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, 45160);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDetalle_de_Oficio_de_Servicio_PericialApiConsumer.SetAuthHeader(_tokenManager.Token);
            Detalle_de_Oficio_de_Servicio_PericialModel varDetalle_de_Oficio_de_Servicio_Pericial = new Detalle_de_Oficio_de_Servicio_PericialModel();


            if (id.ToString() != "0")
            {
                var Detalle_de_Oficio_de_Servicio_PericialsData = _IDetalle_de_Oficio_de_Servicio_PericialApiConsumer.ListaSelAll(0, 1000, "Detalle_de_Oficio_de_Servicio_Pericial.Clave=" + id, "").Resource.Detalle_de_Oficio_de_Servicio_Pericials;

                if (Detalle_de_Oficio_de_Servicio_PericialsData != null && Detalle_de_Oficio_de_Servicio_PericialsData.Count > 0)
                {
                    var Detalle_de_Oficio_de_Servicio_PericialData = Detalle_de_Oficio_de_Servicio_PericialsData.First();
                    varDetalle_de_Oficio_de_Servicio_Pericial = new Detalle_de_Oficio_de_Servicio_PericialModel
                    {
                        Clave                       = Detalle_de_Oficio_de_Servicio_PericialData.Clave
                        , Oficio                    = Detalle_de_Oficio_de_Servicio_PericialData.Oficio
                        , OficioDescripcion         = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Oficio_de_Servicio_PericialData.Oficio), "Tipo_de_Oficios") ?? (string)Detalle_de_Oficio_de_Servicio_PericialData.Oficio_Tipo_de_Oficios.Descripcion
                        , Servicio_Pericial         = Detalle_de_Oficio_de_Servicio_PericialData.Servicio_Pericial
                        , Servicio_PericialServicio = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Oficio_de_Servicio_PericialData.Servicio_Pericial), "Servicios_Periciales") ?? (string)Detalle_de_Oficio_de_Servicio_PericialData.Servicio_Pericial_Servicios_Periciales.Servicio
                    };
                }
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ITipo_de_OficiosApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Tipo_de_Oficioss_Oficio = _ITipo_de_OficiosApiConsumer.SelAll(true);

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

            if (Servicios_Pericialess_Servicio_Pericial != null && Servicios_Pericialess_Servicio_Pericial.Resource != null)
            {
                ViewBag.Servicios_Pericialess_Servicio_Pericial = Servicios_Pericialess_Servicio_Pericial.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_Oficio_de_Servicio_Pericial", varDetalle_de_Oficio_de_Servicio_Pericial));
        }