public PartialViewResult Get(FilterViewModel filter, string resName, int packgeId) { InitData(); ResourceFilterModel fillter = new ResourceFilterModel() { Name = resName, PackageId = packgeId, pageNumber = filter.PageIndex, pageSize = filter.PageSize }; ReturnPageResultIList <Resource> data = new cncbk_resource_application.Controller.ResourceController().GetAllWhere(fillter); IList <ResourceViewModel> gmList = new List <ResourceViewModel>(); if (data != null && data.DataT != null) { gmList = data.DataT.Select(g => new ResourceViewModel() { Id = g.Id, Title = g.Title, PackageName = g.ResourcePackage.Name, MemberTypes = GetMemberTypes(g.ResourceResourcePermissions) }).ToList(); } PageListViewModel <ResourceViewModel> mpage = new PageListViewModel <ResourceViewModel>(gmList, filter.PageIndex, filter.PageSize, data.totalRecords); return(PartialView(mpage)); }
public ActionResult TreeFilterSchedules() { ResourceFilterModel model = new ResourceFilterModel(); using (ResourceStructureManager rsManager = new ResourceStructureManager()) // using(ResourceManager rManager = new ResourceManager()) { // List<SingleResource> singleResources = rManager.GetAllReesources().ToList(); // List<ResourceModel> resources = new List<ResourceModel>(); // singleResources.ForEach(r => resources.Add(new ResourceModel(r))); List <ResourceStructure> resourceStructures = rsManager.GetAllResourceStructures().ToList(); foreach (ResourceStructure rs in resourceStructures) { foreach (ResourceAttributeUsage usage in rs.ResourceAttributeUsages) { ResourceStructureAttribute attr = usage.ResourceStructureAttribute; AttributeDomainItemsModel item = new AttributeDomainItemsModel(attr); if (item.DomainItems.Count != 0) { if (!model.TreeItems.Any(a => a.AttrId == item.AttrId)) { model.TreeItems.Add(item); } } } } /*foreach (ResourceModel r in resources) * { * foreach (ResourceAttributeUsage usage in r.ResourceStructure.ResourceAttributeUsages) * { * ResourceStructureAttribute attr = usage.ResourceStructureAttribute; * AttributeDomainItemsModel item = new AttributeDomainItemsModel(attr); * if (item.DomainItems.Count != 0) * { * if (!model.TreeItems.Any(a => a.AttrId == item.AttrId)) * model.TreeItems.Add(item); * } * } * }*/ } return(PartialView("_treeFilterSchedules", model)); }