public ActionResult ResourceStructureAttributesAll_Select(long id)
        {
            using (ResourceStructureManager rsManager = new ResourceStructureManager())
                using (ResourceStructureAttributeManager rsaManager = new ResourceStructureAttributeManager())
                {
                    IQueryable <ResourceStructureAttribute> rsaList = rsaManager.GetAllResourceStructureAttributes();
                    List <ResourceStructureAttributeModel>  list    = new List <ResourceStructureAttributeModel>();

                    foreach (ResourceStructureAttribute a in rsaList)
                    {
                        ResourceStructureAttributeModel rsaModel = new ResourceStructureAttributeModel(a);
                        rsaModel.rsID = id;
                        list.Add(rsaModel);
                    }
                    return(View("_chooseResourceStructureAttributes", new GridModel <ResourceStructureAttributeModel> {
                        Data = list
                    }));
                }
        }
        public ActionResult ResourceStructureAttribute()
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Manage Resource Structure Attributes", this.Session.GetTenant());
            List <ResourceStructureAttributeModel> model = new List <ResourceStructureAttributeModel>();

            using (var rsManager = new ResourceStructureManager())
                using (var rsaManager = new ResourceStructureAttributeManager())
                    using (var permissionManager = new EntityPermissionManager())
                        using (var entityTypeManager = new EntityManager())
                        {
                            IQueryable <ResourceStructureAttribute> rsaList = rsaManager.GetAllResourceStructureAttributes();

                            foreach (ResourceStructureAttribute a in rsaList)
                            {
                                ResourceStructureAttributeModel rsaModel = new ResourceStructureAttributeModel(a);
                                if (rsaManager.IsAttributeInUse(a.Id))
                                {
                                    rsaModel.InUse = true;
                                }

                                //get id from loged in user
                                long userId = UserHelper.GetUserId(HttpContext.User.Identity.Name);
                                //get entity type id
                                long entityTypeId = entityTypeManager.FindByName("ResourceStructureAttribute").Id;

                                //get permission from logged in user
                                rsaModel.EditAccess = permissionManager.HasEffectiveRight(userId, new List <long>()
                                {
                                    entityTypeId
                                }, a.Id, RightType.Write);
                                rsaModel.DeleteAccess = permissionManager.HasEffectiveRight(userId, new List <long>()
                                {
                                    entityTypeId
                                }, a.Id, RightType.Delete);
                                model.Add(rsaModel);
                            }
                        }

            return(View("ResourceStructureAttributeManager", model));
        }
        public ActionResult ResourceStructureAttributesAllManager_Select()
        {
            using (var rsManager = new ResourceStructureManager())
                using (var rsaManager = new ResourceStructureAttributeManager())
                    using (var permissionManager = new EntityPermissionManager())
                        using (var entityTypeManager = new EntityManager())
                        {
                            IQueryable <ResourceStructureAttribute> rsaList = rsaManager.GetAllResourceStructureAttributes();
                            List <ResourceStructureAttributeModel>  list    = new List <ResourceStructureAttributeModel>();

                            foreach (ResourceStructureAttribute a in rsaList)
                            {
                                ResourceStructureAttributeModel rsaModel = new ResourceStructureAttributeModel(a);
                                if (rsaManager.IsAttributeInUse(a.Id))
                                {
                                    rsaModel.InUse = true;
                                }

                                //get id from loged in user
                                long userId = UserHelper.GetUserId(HttpContext.User.Identity.Name);
                                //get entity type id
                                long entityTypeId = entityTypeManager.FindByName("ResourceStructureAttribute").Id;

                                //get permission from logged in user
                                rsaModel.EditAccess = permissionManager.HasEffectiveRight(userId, new List <long>()
                                {
                                    entityTypeId
                                }, a.Id, RightType.Write);
                                rsaModel.DeleteAccess = permissionManager.HasEffectiveRight(userId, new List <long>()
                                {
                                    entityTypeId
                                }, a.Id, RightType.Delete);
                                list.Add(rsaModel);
                            }
                            return(View("ResourceStructureAttributeManager", new GridModel <ResourceStructureAttributeModel> {
                                Data = list
                            }));
                        }
        }