public void HasPermission_AuthorAccessingControllerPermissionExplicitlyDenied_False()
        {
            // ARRANGE
            List<RolePermission> rolePermissions = new List<RolePermission>
            {
                new RolePermission
                {
                    Controller = "LookupTypes",
                    Action = string.Empty,
                    Role = "Author",
                    IsAllowed = false
                },
                new RolePermission
                {
                    Controller = "Assets",
                    Action = "Delete",
                    Role = "Viewer",
                    IsAllowed = true
                },
            };
            PermissionHelper permissionHelper = new PermissionHelper(rolePermissions.AsQueryable());

            // ACT
            bool hasPermission = permissionHelper.HasPermission(EnumHelper.Roles.Author, "LookupTypes", "Delete");

            // ASSERT
            Assert.IsFalse(hasPermission);
        }
        public void HasPermission_Admin_True()
        {
            // ARRANGE
            List<RolePermission> rolePermissions = new List<RolePermission>
            {
                new RolePermission
                {
                    Controller = "LookupTypes",
                    Action = "Index",
                    Role = "Admin"
                },
                new RolePermission
                {
                    Controller = "LookupTypes",
                    Action = "Detail",
                    Role = "Admin"
                }
            };
            PermissionHelper permissionHelper = new PermissionHelper(rolePermissions.AsQueryable());

            // ACT
            bool hasPermission = permissionHelper.HasPermission(EnumHelper.Roles.Admin, "LookupTypes", "Index");

            // ASSERT
            Assert.IsTrue(hasPermission);
        }
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            base.OnAuthorization(filterContext);

            EnumHelper.Roles role = EnumHelper.Roles.Viewer;
            if(HttpContext.Current.User.IsInRole(EnumHelper.Roles.Author.ToString()))
            {
                role = EnumHelper.Roles.Author;
            } else if(HttpContext.Current.User.IsInRole(EnumHelper.Roles.Admin.ToString()))
            {
                role = EnumHelper.Roles.Admin;
            }

            string action = filterContext.Controller.ControllerContext.RouteData.Values["action"].ToString();
            string controller = filterContext.Controller.ControllerContext.RouteData.Values["controller"].ToString();

            CustomApplicationDbContext context = new CustomApplicationDbContext();
            IQueryable<RolePermission> rolePermissions = context.RolePermissions;
            PermissionHelper permissionHelper = new PermissionHelper(rolePermissions);

            if (!permissionHelper.HasPermission(role, controller, action))
            {
                HandleUnauthorizedRequest(filterContext);
            }
        }
        /// <summary>
        /// Returns the table row Edit | Details | Delete links which the user in scope has permission to.
        /// </summary>
        /// <param name="html"></param>
        /// <param name="linkId"></param>
        /// <returns></returns>
        public static MvcHtmlString IndexLinks(this HtmlHelper html, object linkId)
        {
            // Get the users role
            EnumHelper.Roles role = EnumHelper.Roles.Viewer;
            if (HttpContext.Current.User.IsInRole(EnumHelper.Roles.Author.ToString()))
            {
                role = EnumHelper.Roles.Author;
            }
            else if (HttpContext.Current.User.IsInRole(EnumHelper.Roles.Admin.ToString()))
            {
                role = EnumHelper.Roles.Admin;
            }

            // Get the current route Controller name
            var currentRouteData = html.ViewContext.RouteData;
            string controller = currentRouteData.GetRequiredString("controller");

            // Check user permissions
            CustomApplicationDbContext context = new CustomApplicationDbContext();
            IQueryable<RolePermission> rolePermissions = context.RolePermissions;
            PermissionHelper permissionHelper = new PermissionHelper(rolePermissions);

            // Build the MvcHtmlString
            StringBuilder linkStringBuilder = new StringBuilder();
            if (permissionHelper.HasPermission(role, controller, "Edit"))
            {
                linkStringBuilder.Append(string.Format("{0} |",
                    LinkExtensions.ActionLink(html, "Edit", "Edit", linkId)));
            }
            linkStringBuilder.Append(LinkExtensions.ActionLink(html, "Details", "Details", linkId));
            if (permissionHelper.HasPermission(role, controller, "Delete"))
            {
                linkStringBuilder.Append(string.Format("| {0}",
                    LinkExtensions.ActionLink(html, "Delete", "Delete", linkId)));
            }
            return new MvcHtmlString(linkStringBuilder.ToString());
        }
Example #5
0
        public ActionResult Create(int Id = 0, int consult = 0, int ModuleId = 0)
        {
            if (ModuleId == 0)
            {
                ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;
            }
            else
            {
                Session["CurrentModuleId"] = ModuleId;
            }
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 44989, ModuleId);

            if ((!permission.New && Id.ToString() == "0") || (!permission.Edit && Id.ToString() != "0" && (!permission.Consult && consult == 1)))
            {
                Response.Redirect("~/");
            }
            ViewBag.Permission = permission;
            var varAutoridad = new AutoridadModel();

            varAutoridad.Clave = Id;

            ViewBag.ObjectId  = "44989";
            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";

                _tokenManager.GenerateToken();
                _ISpartane_FileApiConsumer.SetAuthHeader(_tokenManager.Token);
                _IAutoridadApiConsumer.SetAuthHeader(_tokenManager.Token);
                var AutoridadsData = _IAutoridadApiConsumer.ListaSelAll(0, 1000, "Autoridad.Clave=" + Id, "").Resource.Autoridads;

                if (AutoridadsData != null && AutoridadsData.Count > 0)
                {
                    var AutoridadData = AutoridadsData.First();
                    varAutoridad = new AutoridadModel
                    {
                        Clave         = AutoridadData.Clave
                        , Descripcion = AutoridadData.Descripcion
                    };
                }
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }



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

            var viewInEframe  = false;
            var isPartial     = false;
            var isMR          = false;
            var nameMR        = string.Empty;
            var nameAttribute = string.Empty;

            if (Request.QueryString["isPartial"] != null)
            {
                isPartial = Convert.ToBoolean(Request.QueryString["isPartial"]);
            }

            if (Request.QueryString["isMR"] != null)
            {
                isMR = Convert.ToBoolean(Request.QueryString["isMR"]);
            }

            if (Request.QueryString["nameMR"] != null)
            {
                nameMR = Request.QueryString["nameMR"].ToString();
            }

            if (Request.QueryString["nameAttribute"] != null)
            {
                nameAttribute = Request.QueryString["nameAttribute"].ToString();
            }

            if (Request.QueryString["viewInEframe"] != null)
            {
                viewInEframe = Convert.ToBoolean(Request.QueryString["viewInEframe"]);
            }

            ViewBag.isPartial     = isPartial;
            ViewBag.isMR          = isMR;
            ViewBag.nameMR        = nameMR;
            ViewBag.nameAttribute = nameAttribute;
            ViewBag.viewInEframe  = viewInEframe;


            return(View(varAutoridad));
        }
Example #6
0
 public SystemController(ISystemService systemService, IOptionsMonitor <AdminOptions> optionsMonitor, FileUploadHelper fileUploadHelper, PermissionHelper permissionHelper, MvcHelper mvcHelper)
 {
     _systemService    = systemService;
     _fileUploadHelper = fileUploadHelper;
     _permissionHelper = permissionHelper;
     _mvcHelper        = mvcHelper;
     _options          = optionsMonitor.CurrentValue;
 }
Example #7
0
        public ActionResult AddDetalle_Bitacora_de_Canalizacion_MPI(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, 45177);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDetalle_Bitacora_de_Canalizacion_MPIApiConsumer.SetAuthHeader(_tokenManager.Token);
            Detalle_Bitacora_de_Canalizacion_MPIModel varDetalle_Bitacora_de_Canalizacion_MPI = new Detalle_Bitacora_de_Canalizacion_MPIModel();


            if (id.ToString() != "0")
            {
                var Detalle_Bitacora_de_Canalizacion_MPIsData = _IDetalle_Bitacora_de_Canalizacion_MPIApiConsumer.ListaSelAll(0, 1000, "Detalle_Bitacora_de_Canalizacion_MPI.Clave=" + id, "").Resource.Detalle_Bitacora_de_Canalizacion_MPIs;

                if (Detalle_Bitacora_de_Canalizacion_MPIsData != null && Detalle_Bitacora_de_Canalizacion_MPIsData.Count > 0)
                {
                    var Detalle_Bitacora_de_Canalizacion_MPIData = Detalle_Bitacora_de_Canalizacion_MPIsData.First();
                    varDetalle_Bitacora_de_Canalizacion_MPI = new Detalle_Bitacora_de_Canalizacion_MPIModel
                    {
                        Clave = Detalle_Bitacora_de_Canalizacion_MPIData.Clave
                        , Fecha_de_Cambio_de_Estatus         = (Detalle_Bitacora_de_Canalizacion_MPIData.Fecha_de_Cambio_de_Estatus == null ? string.Empty : Convert.ToDateTime(Detalle_Bitacora_de_Canalizacion_MPIData.Fecha_de_Cambio_de_Estatus).ToString(ConfigurationProperty.DateFormat))
                        , Hora_de_Cambio_de_Estatus          = Detalle_Bitacora_de_Canalizacion_MPIData.Hora_de_Cambio_de_Estatus
                        , Estatus_Interno                    = Detalle_Bitacora_de_Canalizacion_MPIData.Estatus_Interno
                        , Estatus_InternoDescripcion         = CultureHelper.GetTraduction(Convert.ToString(Detalle_Bitacora_de_Canalizacion_MPIData.Estatus_Interno), "Estatus_de_Expediente_Inicial") ?? (string)Detalle_Bitacora_de_Canalizacion_MPIData.Estatus_Interno_Estatus_de_Expediente_Inicial.Descripcion
                        , Estatus_de_Canalizacion            = Detalle_Bitacora_de_Canalizacion_MPIData.Estatus_de_Canalizacion
                        , Estatus_de_CanalizacionDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Bitacora_de_Canalizacion_MPIData.Estatus_de_Canalizacion), "Estatus_Orientador") ?? (string)Detalle_Bitacora_de_Canalizacion_MPIData.Estatus_de_Canalizacion_Estatus_Orientador.Descripcion
                    };
                }
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IEstatus_de_Expediente_InicialApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Estatus_de_Expediente_Inicials_Estatus_Interno = _IEstatus_de_Expediente_InicialApiConsumer.SelAll(true);

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

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


            return(PartialView("AddDetalle_Bitacora_de_Canalizacion_MPI", varDetalle_Bitacora_de_Canalizacion_MPI));
        }
Example #8
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, 44587);

            ViewBag.Permission = permission;
            var varDetalle_Codigos_de_Referencia_Vendedores = new Detalle_Codigos_de_Referencia_VendedoresModel();

            ViewBag.ObjectId  = "44587";
            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_Codigos_de_Referencia_VendedoresApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_Codigos_de_Referencia_VendedoresData = _IDetalle_Codigos_de_Referencia_VendedoresApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Codigos_de_Referencia_Vendedoress[0];
                if (Detalle_Codigos_de_Referencia_VendedoresData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_Codigos_de_Referencia_Vendedores = new Detalle_Codigos_de_Referencia_VendedoresModel
                {
                    Folio = (int)Detalle_Codigos_de_Referencia_VendedoresData.Folio
                    , Porcentaje_de_descuento          = Detalle_Codigos_de_Referencia_VendedoresData.Porcentaje_de_descuento
                    , Fecha_inicio_vigencia            = (Detalle_Codigos_de_Referencia_VendedoresData.Fecha_inicio_vigencia == null ? string.Empty : Convert.ToDateTime(Detalle_Codigos_de_Referencia_VendedoresData.Fecha_inicio_vigencia).ToString(ConfigurationProperty.DateFormat))
                    , Fecha_fin_vigencia               = (Detalle_Codigos_de_Referencia_VendedoresData.Fecha_fin_vigencia == null ? string.Empty : Convert.ToDateTime(Detalle_Codigos_de_Referencia_VendedoresData.Fecha_fin_vigencia).ToString(ConfigurationProperty.DateFormat))
                    , Cantidad_maxima_de_referenciados = Detalle_Codigos_de_Referencia_VendedoresData.Cantidad_maxima_de_referenciados
                    , Codigo_para_referenciados        = Detalle_Codigos_de_Referencia_VendedoresData.Codigo_para_referenciados
                    , Autorizado               = Detalle_Codigos_de_Referencia_VendedoresData.Autorizado.GetValueOrDefault()
                    , Usuario_que_autoriza     = Detalle_Codigos_de_Referencia_VendedoresData.Usuario_que_autoriza
                    , Usuario_que_autorizaName = CultureHelper.GetTraduction(Convert.ToString(Detalle_Codigos_de_Referencia_VendedoresData.Usuario_que_autoriza), "Spartan_User") ?? (string)Detalle_Codigos_de_Referencia_VendedoresData.Usuario_que_autoriza_Spartan_User.Name
                    , Fecha_de_autorizacion    = (Detalle_Codigos_de_Referencia_VendedoresData.Fecha_de_autorizacion == null ? string.Empty : Convert.ToDateTime(Detalle_Codigos_de_Referencia_VendedoresData.Fecha_de_autorizacion).ToString(ConfigurationProperty.DateFormat))
                    , Hora_de_autorizacion     = Detalle_Codigos_de_Referencia_VendedoresData.Hora_de_autorizacion
                    , Estatus            = Detalle_Codigos_de_Referencia_VendedoresData.Estatus
                    , EstatusDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Codigos_de_Referencia_VendedoresData.Estatus), "Estatus") ?? (string)Detalle_Codigos_de_Referencia_VendedoresData.Estatus_Estatus.Descripcion
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ISpartan_UserApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Spartan_Users_Usuario_que_autoriza = _ISpartan_UserApiConsumer.SelAll(true);

            if (Spartan_Users_Usuario_que_autoriza != null && Spartan_Users_Usuario_que_autoriza.Resource != null)
            {
                ViewBag.Spartan_Users_Usuario_que_autoriza = Spartan_Users_Usuario_que_autoriza.Resource.Where(m => m.Name != null).OrderBy(m => m.Name).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Id_User), "Spartan_User", "Name") ?? m.Name.ToString(), Value = Convert.ToString(m.Id_User)
                }).ToList();
            }
            _IEstatusApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Estatuss_Estatus = _IEstatusApiConsumer.SelAll(true);

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_Codigos_de_Referencia_Vendedores));
        }
Example #9
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, 44410);

            ViewBag.Permission = permission;
            var varDetalle_Suscripciones_Empresa = new Detalle_Suscripciones_EmpresaModel();

            ViewBag.ObjectId  = "44410";
            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_Suscripciones_EmpresaApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_Suscripciones_EmpresaData = _IDetalle_Suscripciones_EmpresaApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Suscripciones_Empresas[0];
                if (Detalle_Suscripciones_EmpresaData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_Suscripciones_Empresa = new Detalle_Suscripciones_EmpresaModel
                {
                    Folio = (int)Detalle_Suscripciones_EmpresaData.Folio
                    , Cantidad_de_Beneficiarios = Detalle_Suscripciones_EmpresaData.Cantidad_de_Beneficiarios
                    , Suscripcion = Detalle_Suscripciones_EmpresaData.Suscripcion
                    , SuscripcionNombre_del_Plan = CultureHelper.GetTraduction(Convert.ToString(Detalle_Suscripciones_EmpresaData.Suscripcion), "Planes_de_Suscripcion") ?? (string)Detalle_Suscripciones_EmpresaData.Suscripcion_Planes_de_Suscripcion.Nombre_del_Plan
                    , Fecha_de_inicio            = (Detalle_Suscripciones_EmpresaData.Fecha_de_inicio == null ? string.Empty : Convert.ToDateTime(Detalle_Suscripciones_EmpresaData.Fecha_de_inicio).ToString(ConfigurationProperty.DateFormat))
                    , Fecha_Fin = (Detalle_Suscripciones_EmpresaData.Fecha_Fin == null ? string.Empty : Convert.ToDateTime(Detalle_Suscripciones_EmpresaData.Fecha_Fin).ToString(ConfigurationProperty.DateFormat))
                    , Nombre_de_la_Suscripcion = Detalle_Suscripciones_EmpresaData.Nombre_de_la_Suscripcion
                    , Frecuencia_de_Pago       = Detalle_Suscripciones_EmpresaData.Frecuencia_de_Pago
                    , Frecuencia_de_PagoNombre = CultureHelper.GetTraduction(Convert.ToString(Detalle_Suscripciones_EmpresaData.Frecuencia_de_Pago), "Frecuencia_de_pago_Empresas") ?? (string)Detalle_Suscripciones_EmpresaData.Frecuencia_de_Pago_Frecuencia_de_pago_Empresas.Nombre
                    , Costo              = Detalle_Suscripciones_EmpresaData.Costo
                    , Estatus            = Detalle_Suscripciones_EmpresaData.Estatus
                    , EstatusDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Suscripciones_EmpresaData.Estatus), "Estatus_de_Suscripcion") ?? (string)Detalle_Suscripciones_EmpresaData.Estatus_Estatus_de_Suscripcion.Descripcion
                    , Beneficiarios_extra_por_titular = Detalle_Suscripciones_EmpresaData.Beneficiarios_extra_por_titular
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IPlanes_de_SuscripcionApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Planes_de_Suscripcions_Suscripcion = _IPlanes_de_SuscripcionApiConsumer.SelAll(true);

            if (Planes_de_Suscripcions_Suscripcion != null && Planes_de_Suscripcions_Suscripcion.Resource != null)
            {
                ViewBag.Planes_de_Suscripcions_Suscripcion = Planes_de_Suscripcions_Suscripcion.Resource.Where(m => m.Nombre_del_Plan != null).OrderBy(m => m.Nombre_del_Plan).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Planes_de_Suscripcion", "Nombre_del_Plan") ?? m.Nombre_del_Plan.ToString(), Value = Convert.ToString(m.Folio)
                }).ToList();
            }
            _IFrecuencia_de_pago_EmpresasApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Frecuencia_de_pago_Empresass_Frecuencia_de_Pago = _IFrecuencia_de_pago_EmpresasApiConsumer.SelAll(true);

            if (Frecuencia_de_pago_Empresass_Frecuencia_de_Pago != null && Frecuencia_de_pago_Empresass_Frecuencia_de_Pago.Resource != null)
            {
                ViewBag.Frecuencia_de_pago_Empresass_Frecuencia_de_Pago = Frecuencia_de_pago_Empresass_Frecuencia_de_Pago.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Frecuencia_de_pago_Empresas", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IEstatus_de_SuscripcionApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Estatus_de_Suscripcions_Estatus = _IEstatus_de_SuscripcionApiConsumer.SelAll(true);

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_Suscripciones_Empresa));
        }
Example #10
0
        public ActionResult AddDetalle_de_Persona_Moral_MPI(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, 45121);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDetalle_de_Persona_Moral_MPIApiConsumer.SetAuthHeader(_tokenManager.Token);
            Detalle_de_Persona_Moral_MPIModel varDetalle_de_Persona_Moral_MPI = new Detalle_de_Persona_Moral_MPIModel();


            if (id.ToString() != "0")
            {
                var Detalle_de_Persona_Moral_MPIsData = _IDetalle_de_Persona_Moral_MPIApiConsumer.ListaSelAll(0, 1000, "Detalle_de_Persona_Moral_MPI.Clave=" + id, "").Resource.Detalle_de_Persona_Moral_MPIs;

                if (Detalle_de_Persona_Moral_MPIsData != null && Detalle_de_Persona_Moral_MPIsData.Count > 0)
                {
                    var Detalle_de_Persona_Moral_MPIData = Detalle_de_Persona_Moral_MPIsData.First();
                    varDetalle_de_Persona_Moral_MPI = new Detalle_de_Persona_Moral_MPIModel
                    {
                        Clave                  = Detalle_de_Persona_Moral_MPIData.Clave
                        , Nombre               = Detalle_de_Persona_Moral_MPIData.Nombre
                        , Apellido_Paterno     = Detalle_de_Persona_Moral_MPIData.Apellido_Paterno
                        , Apellido_Materno     = Detalle_de_Persona_Moral_MPIData.Apellido_Materno
                        , Nombre_Completo      = Detalle_de_Persona_Moral_MPIData.Nombre_Completo
                        , Calidad_Juridica     = Detalle_de_Persona_Moral_MPIData.Calidad_Juridica
                        , Razon_Social         = Detalle_de_Persona_Moral_MPIData.Razon_Social
                        , Pais                 = Detalle_de_Persona_Moral_MPIData.Pais
                        , PaisNombre           = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Persona_Moral_MPIData.Pais), "Pais") ?? (string)Detalle_de_Persona_Moral_MPIData.Pais_Pais.Nombre
                        , Estado               = Detalle_de_Persona_Moral_MPIData.Estado
                        , EstadoNombre         = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Persona_Moral_MPIData.Estado), "Estado") ?? (string)Detalle_de_Persona_Moral_MPIData.Estado_Estado.Nombre
                        , Municipio            = Detalle_de_Persona_Moral_MPIData.Municipio
                        , MunicipioNombre      = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Persona_Moral_MPIData.Municipio), "Municipio") ?? (string)Detalle_de_Persona_Moral_MPIData.Municipio_Municipio.Nombre
                        , Localidad            = Detalle_de_Persona_Moral_MPIData.Localidad
                        , LocalidadDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Persona_Moral_MPIData.Localidad), "Localidad") ?? (string)Detalle_de_Persona_Moral_MPIData.Localidad_Localidad.Descripcion
                        , Colonia              = Detalle_de_Persona_Moral_MPIData.Colonia
                        , ColoniaNombre        = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Persona_Moral_MPIData.Colonia), "Colonia") ?? (string)Detalle_de_Persona_Moral_MPIData.Colonia_Colonia.Nombre
                        , Calle                = Detalle_de_Persona_Moral_MPIData.Calle
                        , Numero_Exterior      = Detalle_de_Persona_Moral_MPIData.Numero_Exterior
                        , Numero_Interior      = Detalle_de_Persona_Moral_MPIData.Numero_Interior
                        , Telefono             = Detalle_de_Persona_Moral_MPIData.Telefono
                        , Extension            = Detalle_de_Persona_Moral_MPIData.Extension
                        , Celular              = Detalle_de_Persona_Moral_MPIData.Celular
                        , Correo_Electronico   = Detalle_de_Persona_Moral_MPIData.Correo_Electronico
                    };
                }
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IPaisApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Paiss_Pais = _IPaisApiConsumer.SelAll(true);

            if (Paiss_Pais != null && Paiss_Pais.Resource != null)
            {
                ViewBag.Paiss_Pais = Paiss_Pais.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Pais", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IEstadoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Estados_Estado = _IEstadoApiConsumer.SelAll(true);

            if (Estados_Estado != null && Estados_Estado.Resource != null)
            {
                ViewBag.Estados_Estado = Estados_Estado.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Estado", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IMunicipioApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Municipios_Municipio = _IMunicipioApiConsumer.SelAll(true);

            if (Municipios_Municipio != null && Municipios_Municipio.Resource != null)
            {
                ViewBag.Municipios_Municipio = Municipios_Municipio.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Municipio", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _ILocalidadApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Localidads_Localidad = _ILocalidadApiConsumer.SelAll(true);

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

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


            return(PartialView("AddDetalle_de_Persona_Moral_MPI", varDetalle_de_Persona_Moral_MPI));
        }
Example #11
0
        public ActionResult AddDetalle_Aseguramiento_Objetos_Asegurados(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, 45530);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDetalle_Aseguramiento_Objetos_AseguradosApiConsumer.SetAuthHeader(_tokenManager.Token);
            Detalle_Aseguramiento_Objetos_AseguradosModel varDetalle_Aseguramiento_Objetos_Asegurados = new Detalle_Aseguramiento_Objetos_AseguradosModel();


            if (id.ToString() != "0")
            {
                var Detalle_Aseguramiento_Objetos_AseguradossData = _IDetalle_Aseguramiento_Objetos_AseguradosApiConsumer.ListaSelAll(0, 1000, "Detalle_Aseguramiento_Objetos_Asegurados.Clave=" + id, "").Resource.Detalle_Aseguramiento_Objetos_Aseguradoss;

                if (Detalle_Aseguramiento_Objetos_AseguradossData != null && Detalle_Aseguramiento_Objetos_AseguradossData.Count > 0)
                {
                    var Detalle_Aseguramiento_Objetos_AseguradosData = Detalle_Aseguramiento_Objetos_AseguradossData.First();
                    varDetalle_Aseguramiento_Objetos_Asegurados = new Detalle_Aseguramiento_Objetos_AseguradosModel
                    {
                        Clave = Detalle_Aseguramiento_Objetos_AseguradosData.Clave
                        , Motivo_de_Registro            = Detalle_Aseguramiento_Objetos_AseguradosData.Motivo_de_Registro
                        , Motivo_de_RegistroDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_Objetos_AseguradosData.Motivo_de_Registro), "Motivo_de_Registro") ?? (string)Detalle_Aseguramiento_Objetos_AseguradosData.Motivo_de_Registro_Motivo_de_Registro.Descripcion
                        , Numero           = Detalle_Aseguramiento_Objetos_AseguradosData.Numero
                        , Tipo             = Detalle_Aseguramiento_Objetos_AseguradosData.Tipo
                        , TipoDescripcion  = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_Objetos_AseguradosData.Tipo), "Tipo_de_Equipo_de_Comunicacion") ?? (string)Detalle_Aseguramiento_Objetos_AseguradosData.Tipo_Tipo_de_Equipo_de_Comunicacion.Descripcion
                        , Marca            = Detalle_Aseguramiento_Objetos_AseguradosData.Marca
                        , MarcaDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_Objetos_AseguradosData.Marca), "Marca_de_Equipo_de_Comunicacion") ?? (string)Detalle_Aseguramiento_Objetos_AseguradosData.Marca_Marca_de_Equipo_de_Comunicacion.Descripcion
                        , Serie            = Detalle_Aseguramiento_Objetos_AseguradosData.Serie
                        , IMEI             = Detalle_Aseguramiento_Objetos_AseguradosData.IMEI
                    };
                }
            }
            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();
            }
            _ITipo_de_Equipo_de_ComunicacionApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Tipo_de_Equipo_de_Comunicacions_Tipo = _ITipo_de_Equipo_de_ComunicacionApiConsumer.SelAll(true);

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

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


            return(PartialView("AddDetalle_Aseguramiento_Objetos_Asegurados", varDetalle_Aseguramiento_Objetos_Asegurados));
        }
Example #12
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, 45197);

            ViewBag.Permission = permission;
            var varDetalle_de_Solicitante_Procedimiento = new Detalle_de_Solicitante_ProcedimientoModel();

            ViewBag.ObjectId  = "45197";
            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_Solicitante_ProcedimientoApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_de_Solicitante_ProcedimientoData = _IDetalle_de_Solicitante_ProcedimientoApiConsumer.GetByKeyComplete(Id).Resource.Detalle_de_Solicitante_Procedimientos[0];
                if (Detalle_de_Solicitante_ProcedimientoData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_de_Solicitante_Procedimiento = new Detalle_de_Solicitante_ProcedimientoModel
                {
                    Clave                    = (int)Detalle_de_Solicitante_ProcedimientoData.Clave
                    , Descripcion            = Detalle_de_Solicitante_ProcedimientoData.Descripcion
                    , DescripcionDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Solicitante_ProcedimientoData.Descripcion), "Audiencia_de_Control_Procedimiento") ?? (string)Detalle_de_Solicitante_ProcedimientoData.Descripcion_Audiencia_de_Control_Procedimiento.Descripcion
                    , Si = Detalle_de_Solicitante_ProcedimientoData.Si.GetValueOrDefault()
                    , Archivo_Adjunto = Detalle_de_Solicitante_ProcedimientoData.Archivo_Adjunto
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IAudiencia_de_Control_ProcedimientoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Audiencia_de_Control_Procedimientos_Descripcion = _IAudiencia_de_Control_ProcedimientoApiConsumer.SelAll(true);

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_de_Solicitante_Procedimiento));
        }
Example #13
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, 45534);

            ViewBag.Permission = permission;
            var varDetalle_Aseguramiento_de_Cargador_Cartuchos = new Detalle_Aseguramiento_de_Cargador_CartuchosModel();

            ViewBag.ObjectId  = "45534";
            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_de_Cargador_CartuchosApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_Aseguramiento_de_Cargador_CartuchosData = _IDetalle_Aseguramiento_de_Cargador_CartuchosApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Aseguramiento_de_Cargador_Cartuchoss[0];
                if (Detalle_Aseguramiento_de_Cargador_CartuchosData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_Aseguramiento_de_Cargador_Cartuchos = new Detalle_Aseguramiento_de_Cargador_CartuchosModel
                {
                    Clave                           = (int)Detalle_Aseguramiento_de_Cargador_CartuchosData.Clave
                    , Calibre                       = Detalle_Aseguramiento_de_Cargador_CartuchosData.Calibre
                    , CalibreDescripcion            = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_de_Cargador_CartuchosData.Calibre), "Calibre_de_Arma") ?? (string)Detalle_Aseguramiento_de_Cargador_CartuchosData.Calibre_Calibre_de_Arma.Descripcion
                    , Motivo_de_Registro            = Detalle_Aseguramiento_de_Cargador_CartuchosData.Motivo_de_Registro
                    , Motivo_de_RegistroDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_de_Cargador_CartuchosData.Motivo_de_Registro), "Motivo_de_Registro") ?? (string)Detalle_Aseguramiento_de_Cargador_CartuchosData.Motivo_de_Registro_Motivo_de_Registro.Descripcion
                    , cartuchos_municiones          = Detalle_Aseguramiento_de_Cargador_CartuchosData.cartuchos_municiones
                    , Cartuchos_Habiles             = Detalle_Aseguramiento_de_Cargador_CartuchosData.Cartuchos_Habiles
                    , Cartuchos_Percutidos          = Detalle_Aseguramiento_de_Cargador_CartuchosData.Cartuchos_Percutidos
                    , cargadores                    = Detalle_Aseguramiento_de_Cargador_CartuchosData.cargadores
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ICalibre_de_ArmaApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Calibre_de_Armas_Calibre = _ICalibre_de_ArmaApiConsumer.SelAll(true);

            if (Calibre_de_Armas_Calibre != null && Calibre_de_Armas_Calibre.Resource != null)
            {
                ViewBag.Calibre_de_Armas_Calibre = Calibre_de_Armas_Calibre.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Calibre_de_Arma", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _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();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_Aseguramiento_de_Cargador_Cartuchos));
        }
Example #14
0
        public ActionResult AddDetalle_Aseguramiento_de_Cargador_Cartuchos(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, 45534);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDetalle_Aseguramiento_de_Cargador_CartuchosApiConsumer.SetAuthHeader(_tokenManager.Token);
            Detalle_Aseguramiento_de_Cargador_CartuchosModel varDetalle_Aseguramiento_de_Cargador_Cartuchos = new Detalle_Aseguramiento_de_Cargador_CartuchosModel();


            if (id.ToString() != "0")
            {
                var Detalle_Aseguramiento_de_Cargador_CartuchossData = _IDetalle_Aseguramiento_de_Cargador_CartuchosApiConsumer.ListaSelAll(0, 1000, "Detalle_Aseguramiento_de_Cargador_Cartuchos.Clave=" + id, "").Resource.Detalle_Aseguramiento_de_Cargador_Cartuchoss;

                if (Detalle_Aseguramiento_de_Cargador_CartuchossData != null && Detalle_Aseguramiento_de_Cargador_CartuchossData.Count > 0)
                {
                    var Detalle_Aseguramiento_de_Cargador_CartuchosData = Detalle_Aseguramiento_de_Cargador_CartuchossData.First();
                    varDetalle_Aseguramiento_de_Cargador_Cartuchos = new Detalle_Aseguramiento_de_Cargador_CartuchosModel
                    {
                        Clave                           = Detalle_Aseguramiento_de_Cargador_CartuchosData.Clave
                        , Calibre                       = Detalle_Aseguramiento_de_Cargador_CartuchosData.Calibre
                        , CalibreDescripcion            = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_de_Cargador_CartuchosData.Calibre), "Calibre_de_Arma") ?? (string)Detalle_Aseguramiento_de_Cargador_CartuchosData.Calibre_Calibre_de_Arma.Descripcion
                        , Motivo_de_Registro            = Detalle_Aseguramiento_de_Cargador_CartuchosData.Motivo_de_Registro
                        , Motivo_de_RegistroDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_de_Cargador_CartuchosData.Motivo_de_Registro), "Motivo_de_Registro") ?? (string)Detalle_Aseguramiento_de_Cargador_CartuchosData.Motivo_de_Registro_Motivo_de_Registro.Descripcion
                        , cartuchos_municiones          = Detalle_Aseguramiento_de_Cargador_CartuchosData.cartuchos_municiones
                        , Cartuchos_Habiles             = Detalle_Aseguramiento_de_Cargador_CartuchosData.Cartuchos_Habiles
                        , Cartuchos_Percutidos          = Detalle_Aseguramiento_de_Cargador_CartuchosData.Cartuchos_Percutidos
                        , cargadores                    = Detalle_Aseguramiento_de_Cargador_CartuchosData.cargadores
                    };
                }
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ICalibre_de_ArmaApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Calibre_de_Armas_Calibre = _ICalibre_de_ArmaApiConsumer.SelAll(true);

            if (Calibre_de_Armas_Calibre != null && Calibre_de_Armas_Calibre.Resource != null)
            {
                ViewBag.Calibre_de_Armas_Calibre = Calibre_de_Armas_Calibre.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Calibre_de_Arma", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _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();
            }


            return(PartialView("AddDetalle_Aseguramiento_de_Cargador_Cartuchos", varDetalle_Aseguramiento_de_Cargador_Cartuchos));
        }
Example #15
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, 45334);

            ViewBag.Permission = permission;
            var varDatos_Personales_Adicionales_Requerido_MASC = new Datos_Personales_Adicionales_Requerido_MASCModel();

            ViewBag.ObjectId  = "45334";
            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));
                }
                _IDatos_Personales_Adicionales_Requerido_MASCApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Datos_Personales_Adicionales_Requerido_MASCData = _IDatos_Personales_Adicionales_Requerido_MASCApiConsumer.GetByKeyComplete(Id).Resource.Datos_Personales_Adicionales_Requerido_MASCs[0];
                if (Datos_Personales_Adicionales_Requerido_MASCData == null)
                {
                    return(HttpNotFound());
                }

                varDatos_Personales_Adicionales_Requerido_MASC = new Datos_Personales_Adicionales_Requerido_MASCModel
                {
                    Clave = (int)Datos_Personales_Adicionales_Requerido_MASCData.Clave
                    , Correo_Electronico        = Datos_Personales_Adicionales_Requerido_MASCData.Correo_Electronico
                    , Numero_Telefonico         = Datos_Personales_Adicionales_Requerido_MASCData.Numero_Telefonico
                    , Redes_Sociales            = Datos_Personales_Adicionales_Requerido_MASCData.Redes_Sociales
                    , Redes_SocialesDescripcion = CultureHelper.GetTraduction(Convert.ToString(Datos_Personales_Adicionales_Requerido_MASCData.Redes_Sociales), "Redes_Sociales") ?? (string)Datos_Personales_Adicionales_Requerido_MASCData.Redes_Sociales_Redes_Sociales.Descripcion
                    , Observaciones             = Datos_Personales_Adicionales_Requerido_MASCData.Observaciones
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IRedes_SocialesApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Redes_Socialess_Redes_Sociales = _IRedes_SocialesApiConsumer.SelAll(true);

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDatos_Personales_Adicionales_Requerido_MASC));
        }
        /// <summary>
        /// Gets the MIME content type for a given path extension.
        /// </summary>
        /// <param name="extension">The input path extension.</param>
        /// <param name="def">The default content type to return if any error occurs.</param>
        /// <returns>The path extension's MIME content type.</returns>
        public static string GetContentTypeForExtension(string extension, string def)
		{
		    var helper = new PermissionHelper();
			if (string.IsNullOrEmpty(extension))
			{
				return def;
			}
			string contentType = "";
			if (!helper.GetIsRegistryAvailable())
			{
				if (MimeTypes.ContainsKey(extension))
					contentType = MimeTypes[extension];
				else
					contentType = def;
			}

			if (!helper.GetIsDnsAvailable())
			{
				//do something.... not at full trust
				try
				{
					RegistryKey reg = Registry.ClassesRoot;
					reg = reg.OpenSubKey(extension, false);
					if (reg != null) contentType = (string)reg.GetValue("", def);
				}
				catch (Exception)
				{
					contentType = def;
				}
			}
			return contentType;
		}
 void Update()
 {
     PermissionHelper.RequestMicrophontPermission();
     StartCoroutine(shareScreen());
 }
Example #18
0
 public static bool IsValid(int flag) =>
 PermissionHelper.HasAnyPermission(flag, GetRoles().Select(x => x.Value).ToArray());
        public void HasPermission_AuthorAccessingDeleteNoPermissionDefined_True()
        {
            // ARRANGE
            List<RolePermission> rolePermissions = new List<RolePermission>
            {
                new RolePermission
                {
                    Controller = "LookupTypes",
                    Action = "Index",
                    Role = "Author"
                },
                new RolePermission
                {
                    Controller = "LookupTypes",
                    Action = "Detail",
                    Role = "Viewer"
                },
            };
            PermissionHelper permissionHelper = new PermissionHelper(rolePermissions.AsQueryable());

            // ACT
            bool hasPermission = permissionHelper.HasPermission(EnumHelper.Roles.Author, "Assets", "Delete");

            // ASSERT
            Assert.IsTrue(hasPermission);
        }
Example #20
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, 45530);

            ViewBag.Permission = permission;
            var varDetalle_Aseguramiento_Objetos_Asegurados = new Detalle_Aseguramiento_Objetos_AseguradosModel();

            ViewBag.ObjectId  = "45530";
            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_Objetos_AseguradosApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_Aseguramiento_Objetos_AseguradosData = _IDetalle_Aseguramiento_Objetos_AseguradosApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Aseguramiento_Objetos_Aseguradoss[0];
                if (Detalle_Aseguramiento_Objetos_AseguradosData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_Aseguramiento_Objetos_Asegurados = new Detalle_Aseguramiento_Objetos_AseguradosModel
                {
                    Clave = (int)Detalle_Aseguramiento_Objetos_AseguradosData.Clave
                    , Motivo_de_Registro            = Detalle_Aseguramiento_Objetos_AseguradosData.Motivo_de_Registro
                    , Motivo_de_RegistroDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_Objetos_AseguradosData.Motivo_de_Registro), "Motivo_de_Registro") ?? (string)Detalle_Aseguramiento_Objetos_AseguradosData.Motivo_de_Registro_Motivo_de_Registro.Descripcion
                    , Numero           = Detalle_Aseguramiento_Objetos_AseguradosData.Numero
                    , Tipo             = Detalle_Aseguramiento_Objetos_AseguradosData.Tipo
                    , TipoDescripcion  = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_Objetos_AseguradosData.Tipo), "Tipo_de_Equipo_de_Comunicacion") ?? (string)Detalle_Aseguramiento_Objetos_AseguradosData.Tipo_Tipo_de_Equipo_de_Comunicacion.Descripcion
                    , Marca            = Detalle_Aseguramiento_Objetos_AseguradosData.Marca
                    , MarcaDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Aseguramiento_Objetos_AseguradosData.Marca), "Marca_de_Equipo_de_Comunicacion") ?? (string)Detalle_Aseguramiento_Objetos_AseguradosData.Marca_Marca_de_Equipo_de_Comunicacion.Descripcion
                    , Serie            = Detalle_Aseguramiento_Objetos_AseguradosData.Serie
                    , IMEI             = Detalle_Aseguramiento_Objetos_AseguradosData.IMEI
                };
            }
            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();
            }
            _ITipo_de_Equipo_de_ComunicacionApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Tipo_de_Equipo_de_Comunicacions_Tipo = _ITipo_de_Equipo_de_ComunicacionApiConsumer.SelAll(true);

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

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_Aseguramiento_Objetos_Asegurados));
        }
Example #21
0
        public static List <string> ParseRoleNames(int flag, Dictionary <string, int> all_roles = null)
        {
            all_roles = all_roles ?? GetRoles();

            return(all_roles.Where(x => PermissionHelper.HasPermission(flag, x.Value)).Select(x => x.Key).ToList());
        }
Example #22
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, 45121);

            ViewBag.Permission = permission;
            var varDetalle_de_Persona_Moral_MPI = new Detalle_de_Persona_Moral_MPIModel();

            ViewBag.ObjectId  = "45121";
            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_Persona_Moral_MPIApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_de_Persona_Moral_MPIData = _IDetalle_de_Persona_Moral_MPIApiConsumer.GetByKeyComplete(Id).Resource.Detalle_de_Persona_Moral_MPIs[0];
                if (Detalle_de_Persona_Moral_MPIData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_de_Persona_Moral_MPI = new Detalle_de_Persona_Moral_MPIModel
                {
                    Clave                  = (int)Detalle_de_Persona_Moral_MPIData.Clave
                    , Nombre               = Detalle_de_Persona_Moral_MPIData.Nombre
                    , Apellido_Paterno     = Detalle_de_Persona_Moral_MPIData.Apellido_Paterno
                    , Apellido_Materno     = Detalle_de_Persona_Moral_MPIData.Apellido_Materno
                    , Nombre_Completo      = Detalle_de_Persona_Moral_MPIData.Nombre_Completo
                    , Calidad_Juridica     = Detalle_de_Persona_Moral_MPIData.Calidad_Juridica
                    , Razon_Social         = Detalle_de_Persona_Moral_MPIData.Razon_Social
                    , Pais                 = Detalle_de_Persona_Moral_MPIData.Pais
                    , PaisNombre           = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Persona_Moral_MPIData.Pais), "Pais") ?? (string)Detalle_de_Persona_Moral_MPIData.Pais_Pais.Nombre
                    , Estado               = Detalle_de_Persona_Moral_MPIData.Estado
                    , EstadoNombre         = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Persona_Moral_MPIData.Estado), "Estado") ?? (string)Detalle_de_Persona_Moral_MPIData.Estado_Estado.Nombre
                    , Municipio            = Detalle_de_Persona_Moral_MPIData.Municipio
                    , MunicipioNombre      = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Persona_Moral_MPIData.Municipio), "Municipio") ?? (string)Detalle_de_Persona_Moral_MPIData.Municipio_Municipio.Nombre
                    , Localidad            = Detalle_de_Persona_Moral_MPIData.Localidad
                    , LocalidadDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Persona_Moral_MPIData.Localidad), "Localidad") ?? (string)Detalle_de_Persona_Moral_MPIData.Localidad_Localidad.Descripcion
                    , Colonia              = Detalle_de_Persona_Moral_MPIData.Colonia
                    , ColoniaNombre        = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Persona_Moral_MPIData.Colonia), "Colonia") ?? (string)Detalle_de_Persona_Moral_MPIData.Colonia_Colonia.Nombre
                    , Calle                = Detalle_de_Persona_Moral_MPIData.Calle
                    , Numero_Exterior      = Detalle_de_Persona_Moral_MPIData.Numero_Exterior
                    , Numero_Interior      = Detalle_de_Persona_Moral_MPIData.Numero_Interior
                    , Telefono             = Detalle_de_Persona_Moral_MPIData.Telefono
                    , Extension            = Detalle_de_Persona_Moral_MPIData.Extension
                    , Celular              = Detalle_de_Persona_Moral_MPIData.Celular
                    , Correo_Electronico   = Detalle_de_Persona_Moral_MPIData.Correo_Electronico
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IPaisApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Paiss_Pais = _IPaisApiConsumer.SelAll(true);

            if (Paiss_Pais != null && Paiss_Pais.Resource != null)
            {
                ViewBag.Paiss_Pais = Paiss_Pais.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Pais", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IEstadoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Estados_Estado = _IEstadoApiConsumer.SelAll(true);

            if (Estados_Estado != null && Estados_Estado.Resource != null)
            {
                ViewBag.Estados_Estado = Estados_Estado.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Estado", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IMunicipioApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Municipios_Municipio = _IMunicipioApiConsumer.SelAll(true);

            if (Municipios_Municipio != null && Municipios_Municipio.Resource != null)
            {
                ViewBag.Municipios_Municipio = Municipios_Municipio.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Municipio", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _ILocalidadApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Localidads_Localidad = _ILocalidadApiConsumer.SelAll(true);

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

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_de_Persona_Moral_MPI));
        }
Example #23
0
 public TestInfo[] GetTestList(TestInfo filter)
 {
     Check(PermissionHelper.SelectPermission(EIDSSPermissionObject.Test));
     return(TestInfo.GetAll(filter));
 }
Example #24
0
        public ActionResult AddDetalle_Suscripciones_Empresa(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, 44410);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDetalle_Suscripciones_EmpresaApiConsumer.SetAuthHeader(_tokenManager.Token);
            Detalle_Suscripciones_EmpresaModel varDetalle_Suscripciones_Empresa = new Detalle_Suscripciones_EmpresaModel();


            if (id.ToString() != "0")
            {
                var Detalle_Suscripciones_EmpresasData = _IDetalle_Suscripciones_EmpresaApiConsumer.ListaSelAll(0, 1000, "Detalle_Suscripciones_Empresa.Folio=" + id, "").Resource.Detalle_Suscripciones_Empresas;

                if (Detalle_Suscripciones_EmpresasData != null && Detalle_Suscripciones_EmpresasData.Count > 0)
                {
                    var Detalle_Suscripciones_EmpresaData = Detalle_Suscripciones_EmpresasData.First();
                    varDetalle_Suscripciones_Empresa = new Detalle_Suscripciones_EmpresaModel
                    {
                        Folio = Detalle_Suscripciones_EmpresaData.Folio
                        , Cantidad_de_Beneficiarios = Detalle_Suscripciones_EmpresaData.Cantidad_de_Beneficiarios
                        , Suscripcion = Detalle_Suscripciones_EmpresaData.Suscripcion
                        , SuscripcionNombre_del_Plan = CultureHelper.GetTraduction(Convert.ToString(Detalle_Suscripciones_EmpresaData.Suscripcion), "Planes_de_Suscripcion") ?? (string)Detalle_Suscripciones_EmpresaData.Suscripcion_Planes_de_Suscripcion.Nombre_del_Plan
                        , Fecha_de_inicio            = (Detalle_Suscripciones_EmpresaData.Fecha_de_inicio == null ? string.Empty : Convert.ToDateTime(Detalle_Suscripciones_EmpresaData.Fecha_de_inicio).ToString(ConfigurationProperty.DateFormat))
                        , Fecha_Fin = (Detalle_Suscripciones_EmpresaData.Fecha_Fin == null ? string.Empty : Convert.ToDateTime(Detalle_Suscripciones_EmpresaData.Fecha_Fin).ToString(ConfigurationProperty.DateFormat))
                        , Nombre_de_la_Suscripcion = Detalle_Suscripciones_EmpresaData.Nombre_de_la_Suscripcion
                        , Frecuencia_de_Pago       = Detalle_Suscripciones_EmpresaData.Frecuencia_de_Pago
                        , Frecuencia_de_PagoNombre = CultureHelper.GetTraduction(Convert.ToString(Detalle_Suscripciones_EmpresaData.Frecuencia_de_Pago), "Frecuencia_de_pago_Empresas") ?? (string)Detalle_Suscripciones_EmpresaData.Frecuencia_de_Pago_Frecuencia_de_pago_Empresas.Nombre
                        , Costo              = Detalle_Suscripciones_EmpresaData.Costo
                        , Estatus            = Detalle_Suscripciones_EmpresaData.Estatus
                        , EstatusDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Suscripciones_EmpresaData.Estatus), "Estatus_de_Suscripcion") ?? (string)Detalle_Suscripciones_EmpresaData.Estatus_Estatus_de_Suscripcion.Descripcion
                        , Beneficiarios_extra_por_titular = Detalle_Suscripciones_EmpresaData.Beneficiarios_extra_por_titular
                    };
                }
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IPlanes_de_SuscripcionApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Planes_de_Suscripcions_Suscripcion = _IPlanes_de_SuscripcionApiConsumer.SelAll(true);

            if (Planes_de_Suscripcions_Suscripcion != null && Planes_de_Suscripcions_Suscripcion.Resource != null)
            {
                ViewBag.Planes_de_Suscripcions_Suscripcion = Planes_de_Suscripcions_Suscripcion.Resource.Where(m => m.Nombre_del_Plan != null).OrderBy(m => m.Nombre_del_Plan).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Planes_de_Suscripcion", "Nombre_del_Plan") ?? m.Nombre_del_Plan.ToString(), Value = Convert.ToString(m.Folio)
                }).ToList();
            }
            _IFrecuencia_de_pago_EmpresasApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Frecuencia_de_pago_Empresass_Frecuencia_de_Pago = _IFrecuencia_de_pago_EmpresasApiConsumer.SelAll(true);

            if (Frecuencia_de_pago_Empresass_Frecuencia_de_Pago != null && Frecuencia_de_pago_Empresass_Frecuencia_de_Pago.Resource != null)
            {
                ViewBag.Frecuencia_de_pago_Empresass_Frecuencia_de_Pago = Frecuencia_de_pago_Empresass_Frecuencia_de_Pago.Resource.Where(m => m.Nombre != null).OrderBy(m => m.Nombre).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Frecuencia_de_pago_Empresas", "Nombre") ?? m.Nombre.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IEstatus_de_SuscripcionApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Estatus_de_Suscripcions_Estatus = _IEstatus_de_SuscripcionApiConsumer.SelAll(true);

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


            return(PartialView("AddDetalle_Suscripciones_Empresa", varDetalle_Suscripciones_Empresa));
        }
Example #25
0
 public HumanCaseListInfo[] GetHumanCaseList(HumanCaseListInfo filter)
 {
     Check(PermissionHelper.SelectPermission(EIDSSPermissionObject.HumanCase));
     return(HumanCaseListInfo.GetAll(filter));
 }
Example #26
0
        public ActionResult AddDetalle_Codigos_de_Referencia_Vendedores(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, 44587);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDetalle_Codigos_de_Referencia_VendedoresApiConsumer.SetAuthHeader(_tokenManager.Token);
            Detalle_Codigos_de_Referencia_VendedoresModel varDetalle_Codigos_de_Referencia_Vendedores = new Detalle_Codigos_de_Referencia_VendedoresModel();


            if (id.ToString() != "0")
            {
                var Detalle_Codigos_de_Referencia_VendedoressData = _IDetalle_Codigos_de_Referencia_VendedoresApiConsumer.ListaSelAll(0, 1000, "Detalle_Codigos_de_Referencia_Vendedores.Folio=" + id, "").Resource.Detalle_Codigos_de_Referencia_Vendedoress;

                if (Detalle_Codigos_de_Referencia_VendedoressData != null && Detalle_Codigos_de_Referencia_VendedoressData.Count > 0)
                {
                    var Detalle_Codigos_de_Referencia_VendedoresData = Detalle_Codigos_de_Referencia_VendedoressData.First();
                    varDetalle_Codigos_de_Referencia_Vendedores = new Detalle_Codigos_de_Referencia_VendedoresModel
                    {
                        Folio = Detalle_Codigos_de_Referencia_VendedoresData.Folio
                        , Porcentaje_de_descuento          = Detalle_Codigos_de_Referencia_VendedoresData.Porcentaje_de_descuento
                        , Fecha_inicio_vigencia            = (Detalle_Codigos_de_Referencia_VendedoresData.Fecha_inicio_vigencia == null ? string.Empty : Convert.ToDateTime(Detalle_Codigos_de_Referencia_VendedoresData.Fecha_inicio_vigencia).ToString(ConfigurationProperty.DateFormat))
                        , Fecha_fin_vigencia               = (Detalle_Codigos_de_Referencia_VendedoresData.Fecha_fin_vigencia == null ? string.Empty : Convert.ToDateTime(Detalle_Codigos_de_Referencia_VendedoresData.Fecha_fin_vigencia).ToString(ConfigurationProperty.DateFormat))
                        , Cantidad_maxima_de_referenciados = Detalle_Codigos_de_Referencia_VendedoresData.Cantidad_maxima_de_referenciados
                        , Codigo_para_referenciados        = Detalle_Codigos_de_Referencia_VendedoresData.Codigo_para_referenciados
                        , Autorizado               = Detalle_Codigos_de_Referencia_VendedoresData.Autorizado.GetValueOrDefault()
                        , Usuario_que_autoriza     = Detalle_Codigos_de_Referencia_VendedoresData.Usuario_que_autoriza
                        , Usuario_que_autorizaName = CultureHelper.GetTraduction(Convert.ToString(Detalle_Codigos_de_Referencia_VendedoresData.Usuario_que_autoriza), "Spartan_User") ?? (string)Detalle_Codigos_de_Referencia_VendedoresData.Usuario_que_autoriza_Spartan_User.Name
                        , Fecha_de_autorizacion    = (Detalle_Codigos_de_Referencia_VendedoresData.Fecha_de_autorizacion == null ? string.Empty : Convert.ToDateTime(Detalle_Codigos_de_Referencia_VendedoresData.Fecha_de_autorizacion).ToString(ConfigurationProperty.DateFormat))
                        , Hora_de_autorizacion     = Detalle_Codigos_de_Referencia_VendedoresData.Hora_de_autorizacion
                        , Estatus            = Detalle_Codigos_de_Referencia_VendedoresData.Estatus
                        , EstatusDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Codigos_de_Referencia_VendedoresData.Estatus), "Estatus") ?? (string)Detalle_Codigos_de_Referencia_VendedoresData.Estatus_Estatus.Descripcion
                    };
                }
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ISpartan_UserApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Spartan_Users_Usuario_que_autoriza = _ISpartan_UserApiConsumer.SelAll(true);

            if (Spartan_Users_Usuario_que_autoriza != null && Spartan_Users_Usuario_que_autoriza.Resource != null)
            {
                ViewBag.Spartan_Users_Usuario_que_autoriza = Spartan_Users_Usuario_que_autoriza.Resource.Where(m => m.Name != null).OrderBy(m => m.Name).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Id_User), "Spartan_User", "Name") ?? m.Name.ToString(), Value = Convert.ToString(m.Id_User)
                }).ToList();
            }
            _IEstatusApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Estatuss_Estatus = _IEstatusApiConsumer.SelAll(true);

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


            return(PartialView("AddDetalle_Codigos_de_Referencia_Vendedores", varDetalle_Codigos_de_Referencia_Vendedores));
        }
Example #27
0
 public VetCaseListInfo[] GetVetCaseList(VetCaseListInfo filter)
 {
     Check(PermissionHelper.SelectPermission(EIDSSPermissionObject.VetCase));
     return(VetCaseListInfo.GetAll(filter));
 }
Example #28
0
        public ActionResult Create(int Id = 0, int consult = 0)
        {
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 31867);

            ViewBag.Permission = permission;
            var varSpartan_Format_Field = new Spartan_Format_FieldModel();

            ViewBag.ObjectId  = "31867";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || (Id.GetType() == typeof(int) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _ISpartan_Format_FieldApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Spartan_Format_FieldData = _ISpartan_Format_FieldApiConsumer.GetByKeyComplete(Id).Resource.Spartan_Format_Fields[0];
                if (Spartan_Format_FieldData == null)
                {
                    return(HttpNotFound());
                }

                varSpartan_Format_Field = new Spartan_Format_FieldModel
                {
                    FormatFieldId         = (int)Spartan_Format_FieldData.FormatFieldId
                    , Format              = Spartan_Format_FieldData.Format
                    , FormatFormat_Name   = (string)Spartan_Format_FieldData.Format_Spartan_Format.Format_Name
                    , Field_Path          = Spartan_Format_FieldData.Field_Path
                    , Physical_Field_Name = Spartan_Format_FieldData.Physical_Field_Name
                    , Logical_Field_Name  = Spartan_Format_FieldData.Logical_Field_Name
                    , Creation_Date       = (Spartan_Format_FieldData.Creation_Date == null ? string.Empty : Convert.ToDateTime(Spartan_Format_FieldData.Creation_Date).ToString(ConfigurationProperty.DateFormat))
                    , Creation_Hour       = Spartan_Format_FieldData.Creation_Hour
                    , Creation_User       = Spartan_Format_FieldData.Creation_User
                    , Properties          = Spartan_Format_FieldData.Properties
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ISpartan_FormatApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Spartan_Formats = _ISpartan_FormatApiConsumer.SelAll(true);

            if (Spartan_Formats != null && Spartan_Formats.Resource != null)
            {
                ViewBag.Spartan_Formats = Spartan_Formats.Resource.Select(m => new SelectListItem
                {
                    Text = m.Format_Name.ToString(), Value = Convert.ToString(m.FormatId)
                }).ToList();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varSpartan_Format_Field));
        }
Example #29
0
 public HumanCaseInfo GetHumanCase(string id)
 {
     Check(PermissionHelper.SelectPermission(EIDSSPermissionObject.HumanCase));
     return(HumanCaseInfo.GetById(id));
 }
Example #30
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, 45177);

            ViewBag.Permission = permission;
            var varDetalle_Bitacora_de_Canalizacion_MPI = new Detalle_Bitacora_de_Canalizacion_MPIModel();

            ViewBag.ObjectId  = "45177";
            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_Bitacora_de_Canalizacion_MPIApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_Bitacora_de_Canalizacion_MPIData = _IDetalle_Bitacora_de_Canalizacion_MPIApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Bitacora_de_Canalizacion_MPIs[0];
                if (Detalle_Bitacora_de_Canalizacion_MPIData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_Bitacora_de_Canalizacion_MPI = new Detalle_Bitacora_de_Canalizacion_MPIModel
                {
                    Clave = (int)Detalle_Bitacora_de_Canalizacion_MPIData.Clave
                    , Fecha_de_Cambio_de_Estatus         = (Detalle_Bitacora_de_Canalizacion_MPIData.Fecha_de_Cambio_de_Estatus == null ? string.Empty : Convert.ToDateTime(Detalle_Bitacora_de_Canalizacion_MPIData.Fecha_de_Cambio_de_Estatus).ToString(ConfigurationProperty.DateFormat))
                    , Hora_de_Cambio_de_Estatus          = Detalle_Bitacora_de_Canalizacion_MPIData.Hora_de_Cambio_de_Estatus
                    , Estatus_Interno                    = Detalle_Bitacora_de_Canalizacion_MPIData.Estatus_Interno
                    , Estatus_InternoDescripcion         = CultureHelper.GetTraduction(Convert.ToString(Detalle_Bitacora_de_Canalizacion_MPIData.Estatus_Interno), "Estatus_de_Expediente_Inicial") ?? (string)Detalle_Bitacora_de_Canalizacion_MPIData.Estatus_Interno_Estatus_de_Expediente_Inicial.Descripcion
                    , Estatus_de_Canalizacion            = Detalle_Bitacora_de_Canalizacion_MPIData.Estatus_de_Canalizacion
                    , Estatus_de_CanalizacionDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Bitacora_de_Canalizacion_MPIData.Estatus_de_Canalizacion), "Estatus_Orientador") ?? (string)Detalle_Bitacora_de_Canalizacion_MPIData.Estatus_de_Canalizacion_Estatus_Orientador.Descripcion
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IEstatus_de_Expediente_InicialApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Estatus_de_Expediente_Inicials_Estatus_Interno = _IEstatus_de_Expediente_InicialApiConsumer.SelAll(true);

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

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_Bitacora_de_Canalizacion_MPI));
        }
Example #31
0
 public VetCaseInfo GetVetCase(string id)
 {
     Check(PermissionHelper.SelectPermission(EIDSSPermissionObject.VetCase));
     return(VetCaseInfo.GetById(id));
 }
        public ActionResult Create(string Id = "", int consult = 0, int ModuleId = 0)
        {
            if (ModuleId == 0)
            {
                ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;
            }
            else
            {
                Session["CurrentModuleId"] = ModuleId;
            }
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 136, ModuleId);

            if ((!permission.New && Id.ToString() == "0") || (!permission.Edit && Id.ToString() != "0" && (!permission.Consult && consult == 1)))
            {
                Response.Redirect("~/");
            }
            ViewBag.Permission = permission;
            var varSpartan_Settings = new Spartan_SettingsModel();

            ViewBag.ObjectId  = "136";
            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));
                }
                _ISpartan_SettingsApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Spartan_SettingsData = _ISpartan_SettingsApiConsumer.GetByKeyComplete(Id).Resource.Spartan_Settingss[0];
                if (Spartan_SettingsData == null)
                {
                    return(HttpNotFound());
                }

                varSpartan_Settings = new Spartan_SettingsModel
                {
                    Clave   = (string)Spartan_SettingsData.Clave
                    , Valor = Spartan_SettingsData.Valor
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }



            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varSpartan_Settings));
        }
Example #33
0
 public string CreateHumanCase(HumanCaseInfo hc)
 {
     Check(PermissionHelper.InsertPermission(EIDSSPermissionObject.HumanCase));
     hc.Save(true);
     return(hc.Id.ToString());
 }
Example #34
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, 45341);

            ViewBag.Permission = permission;
            var varAdicciones_de_Solicitante_MASC = new Adicciones_de_Solicitante_MASCModel();

            ViewBag.ObjectId  = "45341";
            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));
                }
                _IAdicciones_de_Solicitante_MASCApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Adicciones_de_Solicitante_MASCData = _IAdicciones_de_Solicitante_MASCApiConsumer.GetByKeyComplete(Id).Resource.Adicciones_de_Solicitante_MASCs[0];
                if (Adicciones_de_Solicitante_MASCData == null)
                {
                    return(HttpNotFound());
                }

                varAdicciones_de_Solicitante_MASC = new Adicciones_de_Solicitante_MASCModel
                {
                    Clave                    = (int)Adicciones_de_Solicitante_MASCData.Clave
                    , Descripcion            = Adicciones_de_Solicitante_MASCData.Descripcion
                    , DescripcionDescripcion = CultureHelper.GetTraduction(Convert.ToString(Adicciones_de_Solicitante_MASCData.Descripcion), "Adicciones") ?? (string)Adicciones_de_Solicitante_MASCData.Descripcion_Adicciones.Descripcion
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IAdiccionesApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Adiccioness_Descripcion = _IAdiccionesApiConsumer.SelAll(true);

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varAdicciones_de_Solicitante_MASC));
        }
Example #35
0
 public void EditHumanCase(HumanCaseInfo hc)
 {
     Check(PermissionHelper.UpdatePermission(EIDSSPermissionObject.HumanCase));
     hc.Save(true);
 }
		/// <summary>
		/// Gets the path extension for a given MIME content type.
		/// </summary>
		/// <param name="contentType">The input MIME content type.</param>
		/// <param name="def">The default path extension to return if any error occurs.</param>
		/// <returns>The MIME content type's path extension.</returns>
		public static string GetExtensionForContentType(string contentType, string def)
		{
            var helper = new PermissionHelper();

			if (string.IsNullOrEmpty(contentType))
			{
				return def;
			}
			string ext = "";
			if (!helper.GetIsRegistryAvailable())
			{
				if (MimeTypes.ContainsValue(contentType))
				{
					foreach (KeyValuePair<string, string> pair in MimeTypes)
						if (pair.Value == contentType)
							return pair.Value;
				}
				return def;
			}

			if (helper.GetIsRegistryAvailable())
			{
				try
				{
					RegistryKey reg = Registry.ClassesRoot;
					reg = reg.OpenSubKey(@"MIME\Database\Content Type\" + contentType, false);
					if (reg != null) ext = (string)reg.GetValue("Extension", def);
				}
				catch (Exception)
				{
					ext = def;
				}
			}
			return ext;
		}
Example #37
0
 public SampleInfo[] GetSampleList(SampleInfo filter)
 {
     Check(PermissionHelper.SelectPermission(EIDSSPermissionObject.Sample));
     return(SampleInfo.GetAll(filter));
 }