/// <inheritdoc cref="ISectionManager.GetSameEntitySections"/> public IEnumerable <Section> GetSameEntitySections(Guid sectionId) { Section section = _sectionRepository.Get(sectionId); var allSections = _sectionRepository.GetAll(); return(allSections.Where(s => s.EntityUId.Equals(section.EntityUId))); }
public ActionResult List(PagerRequest request, SectionSearchOption search) { int totalCount; var linq = _sectionRepo.Get(s => (!search.SId.HasValue || search.SId.Value == s.Id) && (string.IsNullOrEmpty(search.Name) || s.Name.StartsWith(search.Name)) && (!search.BrandId.HasValue || search.BrandId.Value == s.BrandId) && (!search.StoreId.HasValue || search.StoreId.Value == s.StoreId) && s.Status != (int)DataStatus.Deleted , out totalCount , request.PageIndex , request.PageSize , e => e.OrderByDescending(o => o.CreateDate)); var data = linq.Join(_storeRepo.GetAll(), o => o.StoreId, i => i.Id, (o, i) => new { S = o, Store = i }) .Join(_brandRepo.GetAll(), o => o.S.BrandId, i => i.Id, (o, i) => new { S = o.S, Store = o.Store, B = i }) .ToList() .Select(l => new SectionViewModel().FromEntity <SectionViewModel>(l.S, p => { p.Store = new StoreViewModel().FromEntity <StoreViewModel>(l.Store); p.Brand = new BrandViewModel().FromEntity <BrandViewModel>(l.B); })); var v = new Pager <SectionViewModel>(request, totalCount) { Data = data.ToList() }; return(View("List", v)); }
public Section UpdateSection(long sectionId, SectionEntryModel model) { var tmpSection = _sectionsRepository.Get(sectionId); if (tmpSection == null) { throw new NotFoundException("No se encontro la seccion"); } PutMap(tmpSection, model); tmpSection.Id = sectionId; _sectionsRepository.Update(tmpSection); _sectionsRepository.Save(); return(tmpSection); }
/// <inheritdoc cref="IPageEntityManager.GetSectionPages"/> public IEnumerable <PageEntity> GetSectionPages(Guid sectionId) { var pages = _pageEntityRepository.GetAll(); Section pageSection = _sectionRepository.Get(sectionId); return(pages.Where(p => p.SysModuleEntityId.Equals(pageSection.SysModuleEntityId))); }
/// <inheritdoc /> public void AddSectionToWorkplace(Guid workplaceId, Guid sectionId) { var workplace = _workplaceRepository.Get(workplaceId); var section = _sectionRepository.Get(sectionId); workplace.AddSection(section.Id); _workplaceRepository.SaveWorkplace(workplace); _sectionRepository.ClearCache(); }
protected bool CheckUserPermission(int userId, int sectionId) { //todo rewrite //lecture can be created only by it's conference admin //find lecture's conf id //check if current user is conf admin if (_sectionRepository.Get(sectionId) is Section sect && _adminOfConferenceRepository.IsAdminOfConf(userId, sect.ConferenceId)) { return(true); } return(false); }
public ProjectFinalReportModel GenerateFinalReportModel(long projectId, long sectionId, long sectionprojectId, int fieldHours, int calification, int beneficiariesQuantity, string beneficiarieGroups) { var model = new ProjectFinalReportModel(); model.Project = _projectRepository.Get(projectId); model.Section = _sectionRepository.Get(sectionId); model.BeneficiarieGroups = beneficiarieGroups; model.BeneficiariesQuantity = beneficiariesQuantity; model.Calification = calification; model.FieldHours = fieldHours; model.StudentsInSections = _sectionRepository.GetSectionStudents(sectionId).ToList(); model.MajorsOfStudents = _studentRepository.GetStudentMajors(model.StudentsInSections); model.SectionProject = _sectionProjectRepository.Get(sectionprojectId); model.StudentsHours = _studentRepository.GetStudentsHoursByProject(sectionId, projectId); model.ProfessorName = model.Section.User != null ? model.Section.User.Name : "Maestro Pendiente"; return(model); }
public IList <SectionProject> AddOrUpdate(SectionProjectEntryModel sectionProjectEntryModel) { IList <SectionProject> sectionProjects = new List <SectionProject>(); foreach (var projectId in sectionProjectEntryModel.ProjectIds) { var sectionproject = _sectionProjectRepository.GetSectionProjectByIds(sectionProjectEntryModel.SectiontId, projectId); if (sectionproject == null) { var project = _projectRepository.Get(projectId); var section = _sectionRepository.Get(sectionProjectEntryModel.SectiontId); if (project == null || section == null) { throw new InvalidSectionOrProjectException("proyecto o seccion no valido"); } sectionproject = new SectionProject { Section = section, Project = project, Organization = sectionProjectEntryModel.Organization, Description = sectionProjectEntryModel.Description, Cost = sectionProjectEntryModel.Cost, IsApproved = false }; _sectionProjectRepository.Insert(sectionproject); _sectionProjectRepository.Save(); } sectionproject.Organization = sectionProjectEntryModel.Organization; sectionproject.Description = sectionProjectEntryModel.Description; sectionproject.Cost = sectionProjectEntryModel.Cost; _sectionProjectRepository.Update(sectionproject); sectionProjects.Add(sectionproject); _sectionProjectRepository.Save(); } _sectionProjectRepository.Save(); return(sectionProjects); }
public BanicoQuery( ISectionRepository sectionRepository, ISectionItemRepository sectionItemRepository, IContentItemRepository contentItemRepository) { Field <ListGraphType <SectionType> >( "sections", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "id" }, new QueryArgument <StringGraphType> { Name = "module" }, new QueryArgument <StringGraphType> { Name = "name" } ), resolve: context => sectionRepository.Get( context.GetArgument <string>("id"), context.GetArgument <string>("module"), context.GetArgument <string>("name") )); Field <ListGraphType <SectionItemType> >( "sectionItems", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "id" }, new QueryArgument <StringGraphType> { Name = "section" }, new QueryArgument <StringGraphType> { Name = "pathUrl" }, new QueryArgument <StringGraphType> { Name = "alias" }, new QueryArgument <StringGraphType> { Name = "name" }, new QueryArgument <StringGraphType> { Name = "parentId" }, new QueryArgument <BooleanGraphType> { Name = "isRoot" } ), resolve: context => sectionItemRepository.Get( context.GetArgument <string>("id"), context.GetArgument <string>("section"), context.GetArgument <string>("pathUrl"), context.GetArgument <string>("alias"), context.GetArgument <string>("name"), context.GetArgument <string>("parentId"), context.GetArgument <bool>("isRoot") ) ); Field <ListGraphType <ContentItemType> >( "contentItems", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "id" }, new QueryArgument <StringGraphType> { Name = "name" }, new QueryArgument <StringGraphType> { Name = "alias" }, new QueryArgument <StringGraphType> { Name = "module" }, new QueryArgument <StringGraphType> { Name = "parentId" }, new QueryArgument <StringGraphType> { Name = "createdBy" }, new QueryArgument <StringGraphType> { Name = "sectionItems" }, new QueryArgument <StringGraphType> { Name = "content" }, new QueryArgument <StringGraphType> { Name = "attribute01" }, new QueryArgument <StringGraphType> { Name = "attribute02" }, new QueryArgument <StringGraphType> { Name = "attribute03" }, new QueryArgument <StringGraphType> { Name = "attribute04" }, new QueryArgument <StringGraphType> { Name = "attribute05" }, new QueryArgument <StringGraphType> { Name = "attribute06" }, new QueryArgument <StringGraphType> { Name = "attribute07" }, new QueryArgument <StringGraphType> { Name = "attribute08" }, new QueryArgument <StringGraphType> { Name = "attribute09" }, new QueryArgument <StringGraphType> { Name = "attribute10" }, new QueryArgument <StringGraphType> { Name = "attribute11" }, new QueryArgument <StringGraphType> { Name = "attribute12" }, new QueryArgument <StringGraphType> { Name = "attribute13" }, new QueryArgument <StringGraphType> { Name = "attribute14" }, new QueryArgument <StringGraphType> { Name = "attribute15" }, new QueryArgument <StringGraphType> { Name = "attribute16" }, new QueryArgument <StringGraphType> { Name = "attribute17" }, new QueryArgument <StringGraphType> { Name = "attribute18" }, new QueryArgument <StringGraphType> { Name = "attribute19" }, new QueryArgument <StringGraphType> { Name = "attribute20" } ), resolve: context => contentItemRepository.Get( context.GetArgument <string>("id"), context.GetArgument <string>("name"), context.GetArgument <string>("alias"), context.GetArgument <string>("module"), context.GetArgument <string>("parentId"), context.GetArgument <string>("createdBy"), context.GetArgument <string>("sectionItems"), context.GetArgument <string>("content"), context.GetArgument <string>("attribute01"), context.GetArgument <string>("attribute02"), context.GetArgument <string>("attribute03"), context.GetArgument <string>("attribute04"), context.GetArgument <string>("attribute05"), context.GetArgument <string>("attribute06"), context.GetArgument <string>("attribute07"), context.GetArgument <string>("attribute08"), context.GetArgument <string>("attribute09"), context.GetArgument <string>("attribute10"), context.GetArgument <string>("attribute11"), context.GetArgument <string>("attribute12"), context.GetArgument <string>("attribute13"), context.GetArgument <string>("attribute14"), context.GetArgument <string>("attribute15"), context.GetArgument <string>("attribute16"), context.GetArgument <string>("attribute17"), context.GetArgument <string>("attribute18"), context.GetArgument <string>("attribute19"), context.GetArgument <string>("attribute20") ) ); }
public SectionDto Get(int id) { return(_mapper.Map <SectionDto>(_sectionRepository.Get(id))); }
public ActionResult <IEnumerable <SectionListView> > GetSections() { var sections = _repository.Get(); return(Ok(sections)); }
//private IConfiguration _configuration; public BanicoQuery( IAccessService accessService, ISectionRepository sectionRepository, ISectionItemRepository sectionItemRepository, IContentItemRepository contentItemRepository, IConfigRepository configRepository, IOEmbedService oEmbedService) { Name = "Query"; Field <ListGraphType <SectionType> >( "sections", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "id" }, new QueryArgument <StringGraphType> { Name = "module" }, new QueryArgument <StringGraphType> { Name = "name" } ), resolve: context => { string tenant = string.Empty; return(sectionRepository.Get( tenant, context.GetArgument <string>("id"), context.GetArgument <string>("module"), context.GetArgument <string>("name") )); }); Field <ListGraphType <SectionItemType> >( "sectionItems", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "id" }, new QueryArgument <StringGraphType> { Name = "section" }, new QueryArgument <StringGraphType> { Name = "pathUrl" }, new QueryArgument <StringGraphType> { Name = "alias" }, new QueryArgument <StringGraphType> { Name = "name" }, new QueryArgument <StringGraphType> { Name = "parentId" }, new QueryArgument <BooleanGraphType> { Name = "isRoot" } ), resolve: (context) => { string tenant = string.Empty; return(sectionItemRepository.Get( tenant, context.GetArgument <string>("id"), context.GetArgument <string>("section"), context.GetArgument <string>("pathUrl"), context.GetArgument <string>("alias"), context.GetArgument <string>("name"), context.GetArgument <string>("parentId"), context.GetArgument <bool>("isRoot") )); } ); Field <MaxPageSizeType>( "maxPageSize", resolve: context => contentItemRepository.GetMaxPageSize() ); Field <ContentItemsCountType>( "contentItemsCount", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "id" }, new QueryArgument <StringGraphType> { Name = "name" }, new QueryArgument <StringGraphType> { Name = "alias" }, new QueryArgument <StringGraphType> { Name = "module" }, new QueryArgument <StringGraphType> { Name = "type" }, new QueryArgument <StringGraphType> { Name = "parentId" }, new QueryArgument <StringGraphType> { Name = "createdBy" }, new QueryArgument <StringGraphType> { Name = "sectionItems" }, new QueryArgument <StringGraphType> { Name = "content" }, new QueryArgument <StringGraphType> { Name = "attribute01" }, new QueryArgument <StringGraphType> { Name = "attribute02" }, new QueryArgument <StringGraphType> { Name = "attribute03" }, new QueryArgument <StringGraphType> { Name = "attribute04" }, new QueryArgument <StringGraphType> { Name = "attribute05" }, new QueryArgument <StringGraphType> { Name = "attribute06" }, new QueryArgument <StringGraphType> { Name = "attribute07" }, new QueryArgument <StringGraphType> { Name = "attribute08" }, new QueryArgument <StringGraphType> { Name = "attribute09" }, new QueryArgument <StringGraphType> { Name = "attribute10" }, new QueryArgument <StringGraphType> { Name = "attribute11" }, new QueryArgument <StringGraphType> { Name = "attribute12" }, new QueryArgument <StringGraphType> { Name = "attribute13" }, new QueryArgument <StringGraphType> { Name = "attribute14" }, new QueryArgument <StringGraphType> { Name = "attribute15" }, new QueryArgument <StringGraphType> { Name = "attribute16" }, new QueryArgument <StringGraphType> { Name = "attribute17" }, new QueryArgument <StringGraphType> { Name = "attribute18" }, new QueryArgument <StringGraphType> { Name = "attribute19" }, new QueryArgument <StringGraphType> { Name = "attribute20" }, new QueryArgument <BooleanGraphType> { Name = "includeChildren" }, new QueryArgument <BooleanGraphType> { Name = "includeParents" }), resolve: context => { string tenant = accessService.DomainTenant(); return(contentItemRepository.GetCount( tenant, context.GetArgument <string>("id"), context.GetArgument <string>("name"), context.GetArgument <string>("alias"), context.GetArgument <string>("module"), context.GetArgument <string>("type"), context.GetArgument <string>("parentId"), context.GetArgument <string>("createdBy"), context.GetArgument <string>("sectionItems"), context.GetArgument <string>("content"), context.GetArgument <string>("attribute01"), context.GetArgument <string>("attribute02"), context.GetArgument <string>("attribute03"), context.GetArgument <string>("attribute04"), context.GetArgument <string>("attribute05"), context.GetArgument <string>("attribute06"), context.GetArgument <string>("attribute07"), context.GetArgument <string>("attribute08"), context.GetArgument <string>("attribute09"), context.GetArgument <string>("attribute10"), context.GetArgument <string>("attribute11"), context.GetArgument <string>("attribute12"), context.GetArgument <string>("attribute13"), context.GetArgument <string>("attribute14"), context.GetArgument <string>("attribute15"), context.GetArgument <string>("attribute16"), context.GetArgument <string>("attribute17"), context.GetArgument <string>("attribute18"), context.GetArgument <string>("attribute19"), context.GetArgument <string>("attribute20"), context.GetArgument <bool>("includeChildren"), context.GetArgument <bool>("includeParents") )); }); Field <ListGraphType <ContentItemType> >( "contentItems", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "id" }, new QueryArgument <StringGraphType> { Name = "name" }, new QueryArgument <StringGraphType> { Name = "alias" }, new QueryArgument <StringGraphType> { Name = "module" }, new QueryArgument <StringGraphType> { Name = "type" }, new QueryArgument <StringGraphType> { Name = "parentId" }, new QueryArgument <StringGraphType> { Name = "createdBy" }, new QueryArgument <StringGraphType> { Name = "sectionItems" }, new QueryArgument <StringGraphType> { Name = "content" }, new QueryArgument <StringGraphType> { Name = "attribute01" }, new QueryArgument <StringGraphType> { Name = "attribute02" }, new QueryArgument <StringGraphType> { Name = "attribute03" }, new QueryArgument <StringGraphType> { Name = "attribute04" }, new QueryArgument <StringGraphType> { Name = "attribute05" }, new QueryArgument <StringGraphType> { Name = "attribute06" }, new QueryArgument <StringGraphType> { Name = "attribute07" }, new QueryArgument <StringGraphType> { Name = "attribute08" }, new QueryArgument <StringGraphType> { Name = "attribute09" }, new QueryArgument <StringGraphType> { Name = "attribute10" }, new QueryArgument <StringGraphType> { Name = "attribute11" }, new QueryArgument <StringGraphType> { Name = "attribute12" }, new QueryArgument <StringGraphType> { Name = "attribute13" }, new QueryArgument <StringGraphType> { Name = "attribute14" }, new QueryArgument <StringGraphType> { Name = "attribute15" }, new QueryArgument <StringGraphType> { Name = "attribute16" }, new QueryArgument <StringGraphType> { Name = "attribute17" }, new QueryArgument <StringGraphType> { Name = "attribute18" }, new QueryArgument <StringGraphType> { Name = "attribute19" }, new QueryArgument <StringGraphType> { Name = "attribute20" }, new QueryArgument <BooleanGraphType> { Name = "includeChildren" }, new QueryArgument <BooleanGraphType> { Name = "includeParents" }, new QueryArgument <StringGraphType> { Name = "orderBy" }, new QueryArgument <StringGraphType> { Name = "thenBy" }, new QueryArgument <IntGraphType> { Name = "page" }, new QueryArgument <IntGraphType> { Name = "pageSize" }, new QueryArgument <IntGraphType> { Name = "offset" } ), resolve: context => { string tenant = accessService.DomainTenant(); return(contentItemRepository.Get( tenant, context.GetArgument <string>("id"), context.GetArgument <string>("name"), context.GetArgument <string>("alias"), context.GetArgument <string>("module"), context.GetArgument <string>("type"), context.GetArgument <string>("parentId"), context.GetArgument <string>("createdBy"), context.GetArgument <string>("sectionItems"), context.GetArgument <string>("content"), context.GetArgument <string>("attribute01"), context.GetArgument <string>("attribute02"), context.GetArgument <string>("attribute03"), context.GetArgument <string>("attribute04"), context.GetArgument <string>("attribute05"), context.GetArgument <string>("attribute06"), context.GetArgument <string>("attribute07"), context.GetArgument <string>("attribute08"), context.GetArgument <string>("attribute09"), context.GetArgument <string>("attribute10"), context.GetArgument <string>("attribute11"), context.GetArgument <string>("attribute12"), context.GetArgument <string>("attribute13"), context.GetArgument <string>("attribute14"), context.GetArgument <string>("attribute15"), context.GetArgument <string>("attribute16"), context.GetArgument <string>("attribute17"), context.GetArgument <string>("attribute18"), context.GetArgument <string>("attribute19"), context.GetArgument <string>("attribute20"), context.GetArgument <bool>("includeChildren"), context.GetArgument <bool>("includeParents"), context.GetArgument <string>("orderBy"), context.GetArgument <string>("thenBy"), context.GetArgument <int>("page"), context.GetArgument <int>("pageSize"), context.GetArgument <int>("offset") )); }); Field <ListGraphType <ConfigType> >( "configs", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "id" }, new QueryArgument <StringGraphType> { Name = "module" }, new QueryArgument <StringGraphType> { Name = "name" } ), resolve: context => configRepository.Get( context.GetArgument <string>("id"), context.GetArgument <string>("module"), context.GetArgument <string>("name") )); Field <OEmbedType>( "oEmbed", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "service" }, new QueryArgument <StringGraphType> { Name = "url" } ), resolve: context => { return(oEmbedService.GetOEmbed( context.GetArgument <string>("service"), context.GetArgument <string>("url") )); }); }