Ejemplo n.º 1
0
        public ActionResult Post(bool IsNew, Detalle_Notificaciones_PacienteModel varDetalle_Notificaciones_Paciente)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (!_tokenManager.GenerateToken())
                    {
                        return(Json(null, JsonRequestBehavior.AllowGet));
                    }
                    _IDetalle_Notificaciones_PacienteApiConsumer.SetAuthHeader(_tokenManager.Token);



                    var result = "";
                    var Detalle_Notificaciones_PacienteInfo = new Detalle_Notificaciones_Paciente
                    {
                        Folio           = varDetalle_Notificaciones_Paciente.Folio
                        , Funcionalidad = varDetalle_Notificaciones_Paciente.Funcionalidad
                    };

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

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

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDetalle_Notificaciones_PacienteApiConsumer.SetAuthHeader(_tokenManager.Token);
            Detalle_Notificaciones_PacienteModel varDetalle_Notificaciones_Paciente = new Detalle_Notificaciones_PacienteModel();


            if (id.ToString() != "0")
            {
                var Detalle_Notificaciones_PacientesData = _IDetalle_Notificaciones_PacienteApiConsumer.ListaSelAll(0, 1000, "Detalle_Notificaciones_Paciente.Folio=" + id, "").Resource.Detalle_Notificaciones_Pacientes;

                if (Detalle_Notificaciones_PacientesData != null && Detalle_Notificaciones_PacientesData.Count > 0)
                {
                    var Detalle_Notificaciones_PacienteData = Detalle_Notificaciones_PacientesData.First();
                    varDetalle_Notificaciones_Paciente = new Detalle_Notificaciones_PacienteModel
                    {
                        Folio           = Detalle_Notificaciones_PacienteData.Folio
                        , Funcionalidad = Detalle_Notificaciones_PacienteData.Funcionalidad
                        , FuncionalidadFuncionalidad = CultureHelper.GetTraduction(Convert.ToString(Detalle_Notificaciones_PacienteData.Funcionalidad), "Funcionalidades_para_Notificacion") ?? (string)Detalle_Notificaciones_PacienteData.Funcionalidad_Funcionalidades_para_Notificacion.Funcionalidad
                    };
                }
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IFuncionalidades_para_NotificacionApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Funcionalidades_para_Notificacions_Funcionalidad = _IFuncionalidades_para_NotificacionApiConsumer.SelAll(true);

            if (Funcionalidades_para_Notificacions_Funcionalidad != null && Funcionalidades_para_Notificacions_Funcionalidad.Resource != null)
            {
                ViewBag.Funcionalidades_para_Notificacions_Funcionalidad = Funcionalidades_para_Notificacions_Funcionalidad.Resource.Where(m => m.Funcionalidad != null).OrderBy(m => m.Funcionalidad).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Funcionalidades_para_Notificacion", "Funcionalidad") ?? m.Funcionalidad.ToString(), Value = Convert.ToString(m.Folio)
                }).ToList();
            }


            return(PartialView("AddDetalle_Notificaciones_Paciente", varDetalle_Notificaciones_Paciente));
        }
Ejemplo 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, 44695);

            ViewBag.Permission = permission;
            var varDetalle_Notificaciones_Paciente = new Detalle_Notificaciones_PacienteModel();

            ViewBag.ObjectId  = "44695";
            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_Notificaciones_PacienteApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_Notificaciones_PacienteData = _IDetalle_Notificaciones_PacienteApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Notificaciones_Pacientes[0];
                if (Detalle_Notificaciones_PacienteData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_Notificaciones_Paciente = new Detalle_Notificaciones_PacienteModel
                {
                    Folio           = (int)Detalle_Notificaciones_PacienteData.Folio
                    , Funcionalidad = Detalle_Notificaciones_PacienteData.Funcionalidad
                    , FuncionalidadFuncionalidad = CultureHelper.GetTraduction(Convert.ToString(Detalle_Notificaciones_PacienteData.Funcionalidad), "Funcionalidades_para_Notificacion") ?? (string)Detalle_Notificaciones_PacienteData.Funcionalidad_Funcionalidades_para_Notificacion.Funcionalidad
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IFuncionalidades_para_NotificacionApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Funcionalidades_para_Notificacions_Funcionalidad = _IFuncionalidades_para_NotificacionApiConsumer.SelAll(true);

            if (Funcionalidades_para_Notificacions_Funcionalidad != null && Funcionalidades_para_Notificacions_Funcionalidad.Resource != null)
            {
                ViewBag.Funcionalidades_para_Notificacions_Funcionalidad = Funcionalidades_para_Notificacions_Funcionalidad.Resource.Where(m => m.Funcionalidad != null).OrderBy(m => m.Funcionalidad).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Funcionalidades_para_Notificacion", "Funcionalidad") ?? m.Funcionalidad.ToString(), Value = Convert.ToString(m.Folio)
                }).ToList();
            }


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